use of org.obiba.mica.network.event.NetworkUnpublishedEvent in project mica2 by obiba.
the class NetworkService method index.
/**
* Index a specific {@link Network} without updating it.
*
* @param id
* @throws NoSuchNetworkException
*/
public void index(@NotNull String id) throws NoSuchNetworkException {
NetworkState networkState = getEntityState(id);
Network network = findById(id);
eventBus.post(new NetworkUpdatedEvent(network));
processNetworkForPublishedNumberOfStudies(network);
if (networkState.isPublished())
eventBus.post(new NetworkPublishedEvent(network, getCurrentUsername()));
else
eventBus.post(new NetworkUnpublishedEvent(network));
}
use of org.obiba.mica.network.event.NetworkUnpublishedEvent in project mica2 by obiba.
the class NetworkService method publish.
/**
* Set the publication flag on a {@link Network}.
*
* @param id
* @throws NoSuchNetworkException
*/
@Caching(evict = { @CacheEvict(value = "aggregations-metadata", key = "'network'") })
public void publish(@NotNull String id, boolean publish, PublishCascadingScope cascadingScope) throws NoSuchEntityException {
Network network = networkRepository.findOne(id);
if (network == null)
return;
if (publish) {
processNetworkForPublishedNumberOfStudies(network);
publishState(id);
eventBus.post(new NetworkPublishedEvent(network, getCurrentUsername(), cascadingScope));
} else {
unPublishState(id);
eventBus.post(new NetworkUnpublishedEvent(network));
}
}
Aggregations