Search in sources :

Example 1 with DataAccessRequestDeletedEvent

use of org.obiba.mica.access.event.DataAccessRequestDeletedEvent in project mica2 by obiba.

the class DataAccessRequestService method delete.

/**
 * Delete the {@link DataAccessRequest} matching the identifier.
 *
 * @param id
 * @throws NoSuchDataAccessRequestException
 */
public void delete(@NotNull String id) throws NoSuchDataAccessRequestException {
    DataAccessRequest dataAccessRequest = findById(id);
    List<Attachment> attachments = dataAccessRequest.getAttachments();
    dataAccessRequestRepository.deleteWithReferences(dataAccessRequest);
    schemaFormContentFileService.deleteFiles(dataAccessRequest);
    attachments.forEach(a -> fileStoreService.delete(a.getId()));
    eventBus.post(new DataAccessRequestDeletedEvent(dataAccessRequest));
}
Also used : DataAccessRequest(org.obiba.mica.access.domain.DataAccessRequest) Attachment(org.obiba.mica.file.Attachment) DataAccessRequestDeletedEvent(org.obiba.mica.access.event.DataAccessRequestDeletedEvent)

Aggregations

DataAccessRequest (org.obiba.mica.access.domain.DataAccessRequest)1 DataAccessRequestDeletedEvent (org.obiba.mica.access.event.DataAccessRequestDeletedEvent)1 Attachment (org.obiba.mica.file.Attachment)1