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));
}
Aggregations