Search in sources :

Example 1 with ResourceDeletedEvent

use of org.obiba.mica.security.event.ResourceDeletedEvent in project mica2 by obiba.

the class DataAccessRequestResource method delete.

@DELETE
public Response delete(@PathParam("id") String id) {
    subjectAclService.checkPermission("/data-access-request", "DELETE", id);
    try {
        dataAccessRequestService.delete(id);
        // remove associated comments
        commentsService.delete(DataAccessRequest.class.getSimpleName(), id);
        eventBus.post(new ResourceDeletedEvent("/data-access-request", id));
        eventBus.post(new ResourceDeletedEvent("/data-access-request/" + id, "_status"));
    } catch (NoSuchDataAccessRequestException e) {
    // ignore
    }
    return Response.noContent().build();
}
Also used : DataAccessRequest(org.obiba.mica.access.domain.DataAccessRequest) NoSuchDataAccessRequestException(org.obiba.mica.access.NoSuchDataAccessRequestException) ResourceDeletedEvent(org.obiba.mica.security.event.ResourceDeletedEvent) DELETE(javax.ws.rs.DELETE)

Example 2 with ResourceDeletedEvent

use of org.obiba.mica.security.event.ResourceDeletedEvent in project mica2 by obiba.

the class CommentResource method deleteComment.

@DELETE
public Response deleteComment(@PathParam("id") String id, @PathParam("commentId") String commentId) {
    subjectAclService.checkPermission(String.format("/draft/%s/%s/comment", service.getTypeName(), id), "DELETE", commentId);
    service.findDraft(id);
    commentsService.delete(commentId);
    eventBus.post(new ResourceDeletedEvent(String.format("/draft/%s/%s/comment", service.getTypeName(), id), commentId));
    return Response.noContent().build();
}
Also used : ResourceDeletedEvent(org.obiba.mica.security.event.ResourceDeletedEvent) DELETE(javax.ws.rs.DELETE)

Example 3 with ResourceDeletedEvent

use of org.obiba.mica.security.event.ResourceDeletedEvent in project mica2 by obiba.

the class DataAccessRequestResource method deleteComment.

@DELETE
@Path("/comment/{commentId}")
public Response deleteComment(@PathParam("id") String id, @PathParam("commentId") String commentId) {
    subjectAclService.checkPermission("/data-access-request/" + id + "/comment", "DELETE", commentId);
    dataAccessRequestService.findById(id);
    commentsService.delete(commentId);
    eventBus.post(new ResourceDeletedEvent("/data-access-request/" + id + "/comment", commentId));
    return Response.noContent().build();
}
Also used : ResourceDeletedEvent(org.obiba.mica.security.event.ResourceDeletedEvent) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Aggregations

DELETE (javax.ws.rs.DELETE)3 ResourceDeletedEvent (org.obiba.mica.security.event.ResourceDeletedEvent)3 Path (javax.ws.rs.Path)1 NoSuchDataAccessRequestException (org.obiba.mica.access.NoSuchDataAccessRequestException)1 DataAccessRequest (org.obiba.mica.access.domain.DataAccessRequest)1