Search in sources :

Example 1 with StudyUnpublishedEvent

use of org.obiba.mica.study.event.StudyUnpublishedEvent in project mica2 by obiba.

the class AbstractStudyService method publish.

@Caching(evict = { @CacheEvict(value = "aggregations-metadata", allEntries = true), @CacheEvict(value = { "studies-draft", "studies-published" }, key = "#id") })
public void publish(@NotNull String id, boolean publish, PublishCascadingScope cascadingScope) throws NoSuchEntityException {
    log.info("Publish study: {}", id);
    T study = getRepository().findOne(id);
    if (publish) {
        publishState(id);
        eventBus.post(new StudyPublishedEvent(study, getCurrentUsername(), cascadingScope));
    } else {
        unPublishState(id);
        eventBus.post(new StudyUnpublishedEvent(study));
    }
}
Also used : StudyPublishedEvent(org.obiba.mica.study.event.StudyPublishedEvent) StudyUnpublishedEvent(org.obiba.mica.study.event.StudyUnpublishedEvent) Caching(org.springframework.cache.annotation.Caching)

Aggregations

StudyPublishedEvent (org.obiba.mica.study.event.StudyPublishedEvent)1 StudyUnpublishedEvent (org.obiba.mica.study.event.StudyUnpublishedEvent)1 Caching (org.springframework.cache.annotation.Caching)1