use of org.obiba.mica.access.domain.DataAccessAmendment in project mica2 by obiba.
the class DataAccessAmendmentResource method update.
@PUT
@Timed
public Response update(Mica.DataAccessRequestDto dto) {
subjectAclService.checkPermission(getResourcePath(), "EDIT", id);
if (!id.equals(dto.getId()))
throw new BadRequestException();
DataAccessAmendment amendment = dtos.fromAmendmentDto(dto);
DataAccessRequest request = dataAccessRequestService.findById(parentId);
if (request.isArchived())
throw new BadRequestException("Data access request is archived");
dataAccessAmendmentService.save(amendment);
return Response.noContent().build();
}
use of org.obiba.mica.access.domain.DataAccessAmendment in project mica2 by obiba.
the class DataAccessAmendmentResource method setModel.
@PUT
@Path("/model")
@Consumes("application/json")
public Response setModel(String content) {
subjectAclService.checkPermission(getResourcePath(), "EDIT", id);
DataAccessRequest request = dataAccessRequestService.findById(parentId);
if (request.isArchived())
throw new BadRequestException("Data access request is archived");
DataAccessAmendment amendment = dataAccessAmendmentService.findById(id);
amendment.setContent(content);
dataAccessAmendmentService.save(amendment);
return Response.ok().build();
}
use of org.obiba.mica.access.domain.DataAccessAmendment in project mica2 by obiba.
the class DataAccessAmendmentsResource method create.
@POST
@Path("/_empty")
public Response create(@Context UriInfo uriInfo) {
DataAccessAmendment amendment = new DataAccessAmendment();
amendment.setContent("{}");
return saveNew(amendment, uriInfo);
}
use of org.obiba.mica.access.domain.DataAccessAmendment in project mica2 by obiba.
the class SubjectAclService method dataAccessAmendmentDeleted.
@Async
@Subscribe
public void dataAccessAmendmentDeleted(DataAccessAmendmentDeletedEvent event) {
DataAccessAmendment amendment = event.getPersistable();
String resource = String.format("/data-access-request/%s/amendment", amendment.getParentId());
String id = amendment.getId();
removeResourcePermissions(resource, id);
removeResourcePermissions(resource + "/" + id, "_status");
}
use of org.obiba.mica.access.domain.DataAccessAmendment in project mica2 by obiba.
the class DataAccessAmendmentResource method deleteVariablesSet.
@DELETE
@Path("/variables")
public Response deleteVariablesSet() {
subjectAclService.checkPermission(getResourcePath(), "EDIT", id);
DataAccessAmendment amendment = getService().findById(id);
if (amendment.hasVariablesSet())
variableSetService.delete(amendment.getVariablesSet());
return Response.noContent().build();
}
Aggregations