Search in sources :

Example 1 with ProjectUnpublishedEvent

use of org.obiba.mica.project.event.ProjectUnpublishedEvent in project mica2 by obiba.

the class ProjectService method publish.

/**
 * Set the publication flag on a {@link Project}.
 *
 * @param id
 * @throws NoSuchProjectException
 */
@Caching(evict = { @CacheEvict(value = "aggregations-metadata", key = "'project'") })
public void publish(@NotNull String id, boolean publish, PublishCascadingScope cascadingScope) throws NoSuchEntityException {
    Project project = projectRepository.findOne(id);
    if (project == null)
        return;
    if (publish) {
        publishState(id);
        eventBus.post(new ProjectPublishedEvent(project, getCurrentUsername(), cascadingScope));
    } else {
        unPublishState(id);
        eventBus.post(new ProjectUnpublishedEvent(project));
    }
}
Also used : Project(org.obiba.mica.project.domain.Project) ProjectPublishedEvent(org.obiba.mica.project.event.ProjectPublishedEvent) ProjectUnpublishedEvent(org.obiba.mica.project.event.ProjectUnpublishedEvent) Caching(org.springframework.cache.annotation.Caching)

Aggregations

Project (org.obiba.mica.project.domain.Project)1 ProjectPublishedEvent (org.obiba.mica.project.event.ProjectPublishedEvent)1 ProjectUnpublishedEvent (org.obiba.mica.project.event.ProjectUnpublishedEvent)1 Caching (org.springframework.cache.annotation.Caching)1