use of org.obiba.mica.dataset.event.DatasetPublishedEvent in project mica2 by obiba.
the class HarmonizedDatasetService method publish.
/**
* Apply dataset publication flag.
*
* @param id
* @param published
*/
@Caching(evict = { @CacheEvict(value = "aggregations-metadata", key = "'dataset'") })
public void publish(@NotNull String id, boolean published, PublishCascadingScope cascadingScope) {
HarmonizationDataset dataset = findById(id);
helper.evictCache(dataset);
if (published) {
checkIsPublishable(dataset);
publishState(id);
eventBus.post(new DatasetPublishedEvent(dataset, wrappedGetDatasetVariables(dataset), null, getCurrentUsername(), cascadingScope));
indexHarmonizedVariables(dataset);
} else {
unPublishState(id);
eventBus.post(new DatasetUnpublishedEvent(dataset));
}
}
use of org.obiba.mica.dataset.event.DatasetPublishedEvent in project mica2 by obiba.
the class DatasetStateUpgrade method migrateDataset.
private <T extends AbstractGitPersistableService, T1 extends EntityStateRepository> void migrateDataset(Dataset dataset, T datasetService, T1 stateRepository, Supplier<EntityState> supplier) {
EntityState state = datasetService.findEntityState(dataset, supplier);
state.incrementRevisionsAhead();
stateRepository.save(state);
eventBus.post(new DatasetUpdatedEvent(dataset));
gitService.save(dataset, "System upgrade");
if (state.isPublished()) {
datasetService.publishState(dataset.getId());
eventBus.post(new DatasetPublishedEvent(dataset, null, null));
}
}
Aggregations