use of org.obiba.mica.project.event.ProjectPublishedEvent 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));
}
}
use of org.obiba.mica.project.event.ProjectPublishedEvent in project mica2 by obiba.
the class ProjectService method index.
/**
* Index a specific {@link Project} without updating it.
*
* @param id
* @throws NoSuchProjectException
*/
public void index(@NotNull String id) throws NoSuchProjectException {
ProjectState projectState = getEntityState(id);
Project project = findById(id);
eventBus.post(new ProjectUpdatedEvent(project));
if (projectState.isPublished())
eventBus.post(new ProjectPublishedEvent(project, getCurrentUsername()));
else
eventBus.post(new ProjectUpdatedEvent(project));
}
Aggregations