Search in sources :

Example 6 with Caching

use of org.springframework.cache.annotation.Caching 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

Caching (org.springframework.cache.annotation.Caching)6 DatasetPublishedEvent (org.obiba.mica.dataset.event.DatasetPublishedEvent)2 DatasetUnpublishedEvent (org.obiba.mica.dataset.event.DatasetUnpublishedEvent)2 List (java.util.List)1 Collectors.toList (java.util.stream.Collectors.toList)1 DBRefAwareRepository (org.obiba.mica.core.repository.DBRefAwareRepository)1 DatasetVariable (org.obiba.mica.dataset.domain.DatasetVariable)1 HarmonizationDataset (org.obiba.mica.dataset.domain.HarmonizationDataset)1 StudyDataset (org.obiba.mica.dataset.domain.StudyDataset)1 Network (org.obiba.mica.network.domain.Network)1 NetworkPublishedEvent (org.obiba.mica.network.event.NetworkPublishedEvent)1 NetworkUnpublishedEvent (org.obiba.mica.network.event.NetworkUnpublishedEvent)1 Project (org.obiba.mica.project.domain.Project)1 ProjectPublishedEvent (org.obiba.mica.project.event.ProjectPublishedEvent)1 ProjectUnpublishedEvent (org.obiba.mica.project.event.ProjectUnpublishedEvent)1 StudyDeletedEvent (org.obiba.mica.study.event.StudyDeletedEvent)1 StudyPublishedEvent (org.obiba.mica.study.event.StudyPublishedEvent)1 StudyUnpublishedEvent (org.obiba.mica.study.event.StudyUnpublishedEvent)1