use of org.obiba.mica.study.event.StudyDeletedEvent in project mica2 by obiba.
the class AbstractStudyService method delete.
@Caching(evict = { @CacheEvict(value = "aggregations-metadata", allEntries = true), @CacheEvict(value = { "studies-draft", "studies-published" }, key = "#id") })
public void delete(@NotNull String id) {
T study = getRepository().findOne(id);
if (study == null) {
throw NoSuchEntityException.withId(getType(), id);
}
checkStudyConstraints(study);
fileSystemService.delete(FileUtils.getEntityPath(study));
getEntityStateRepository().delete(id);
((DBRefAwareRepository<T>) getRepository()).deleteWithReferences(study);
gitService.deleteGitRepository(study);
eventBus.post(new StudyDeletedEvent(study));
}
Aggregations