Search in sources :

Example 1 with StudyDeletedEvent

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));
}
Also used : StudyDeletedEvent(org.obiba.mica.study.event.StudyDeletedEvent) DBRefAwareRepository(org.obiba.mica.core.repository.DBRefAwareRepository) Caching(org.springframework.cache.annotation.Caching)

Aggregations

DBRefAwareRepository (org.obiba.mica.core.repository.DBRefAwareRepository)1 StudyDeletedEvent (org.obiba.mica.study.event.StudyDeletedEvent)1 Caching (org.springframework.cache.annotation.Caching)1