return Response.status(Status.FORBIDDEN)
.entity("Project '" + projectSlug + "' is read-only.")
.build();
}
HProjectIteration hProjectIteration =
projectIterationDAO.getBySlug(getProjectSlug(),
getIterationSlug());
if (hProjectIteration == null) { // must be a create operation
response = request.evaluatePreconditions();
if (response != null) {
return response.build();
}
hProjectIteration = new HProjectIteration();
hProjectIteration.setSlug(iterationSlug);
copyProjectConfiguration(projectIteration, hProjectIteration,
hProject);
hProject.addIteration(hProjectIteration);
// pre-emptive entity permission check
// identity.checkWorkspaceAction(hProject, "add-iteration");
identity.checkPermission(hProjectIteration, "insert");
response = Response.created(uri.getAbsolutePath());
changed = true;
}
// Iteration is Obsolete
else if (Objects.equal(hProjectIteration.getStatus(), OBSOLETE)) {
return Response
.status(Status.FORBIDDEN)
.entity("Project Iiteration '" + projectSlug + ":"
+ iterationSlug + "' is obsolete.").build();
}
// Iteration is ReadOnly
else if (Objects.equal(hProjectIteration.getStatus(), READONLY)) {
return Response
.status(Status.FORBIDDEN)
.entity("Project Iteration '" + projectSlug + ":"
+ iterationSlug + "' is read-only.").build();
} else { // must be an update operation