return Response.ok(entity).build();
}
private HProjectIteration retrieveAndCheckIteration(String projectSlug,
String versionSlug, boolean writeOperation) {
HProjectIteration hProjectIteration =
projectIterationDAO.getBySlug(projectSlug, versionSlug);
HProject hProject =
hProjectIteration == null ? null : hProjectIteration
.getProject();
if (hProjectIteration == null) {
throw new NoSuchEntityException("Project version '" + projectSlug
+ ":" + versionSlug + "' not found.");
} else if (hProjectIteration.getStatus().equals(EntityStatus.OBSOLETE)
|| hProject.getStatus().equals(EntityStatus.OBSOLETE)) {
throw new NoSuchEntityException("Project version '" + projectSlug
+ ":" + versionSlug + "' not found.");
} else if (writeOperation) {
if (hProjectIteration.getStatus().equals(EntityStatus.READONLY)
|| hProject.getStatus().equals(EntityStatus.READONLY)) {
throw new ReadOnlyEntityException("Project version '"
+ projectSlug + ":" + versionSlug + "' is read-only.");
} else {
return hProjectIteration;