use of org.obiba.mica.dataset.event.DatasetUpdatedEvent in project mica2 by obiba.
the class CollectedDatasetService method index.
/**
* Index the dataset
*
* @param id
*/
public void index(@NotNull String id) {
StudyDataset dataset = findById(id);
prepareForIndex(dataset);
eventBus.post(new DatasetUpdatedEvent(dataset));
}
use of org.obiba.mica.dataset.event.DatasetUpdatedEvent in project mica2 by obiba.
the class CollectedDatasetService method indexDatasets.
private void indexDatasets(Set<StudyDataset> publishedDatasets, List<StudyDataset> datasets, boolean mustIndexVariables) {
datasets.forEach(dataset -> {
try {
eventBus.post(new DatasetUpdatedEvent(dataset));
if (publishedDatasets.contains(dataset)) {
prepareForIndex(dataset);
Iterable<DatasetVariable> variables = mustIndexVariables && publishedDatasets.contains(dataset) ? wrappedGetDatasetVariables(dataset) : null;
eventBus.post(new DatasetPublishedEvent(dataset, variables, getCurrentUsername()));
}
} catch (Exception e) {
log.error(String.format("Error indexing dataset %s", dataset), e);
}
});
}
use of org.obiba.mica.dataset.event.DatasetUpdatedEvent in project mica2 by obiba.
the class HarmonizedDatasetService method index.
/**
* Index the dataset and associated variables.
*
* @param id
*/
public void index(@NotNull String id) {
HarmonizationDataset dataset = findById(id);
eventBus.post(new DatasetUpdatedEvent(dataset));
}
use of org.obiba.mica.dataset.event.DatasetUpdatedEvent in project mica2 by obiba.
the class HarmonizedDatasetService method indexAll.
public void indexAll(boolean mustIndexVariables) {
Set<HarmonizationDataset> publishedDatasets = Sets.newHashSet(findAllPublishedDatasets());
findAllDatasets().forEach(dataset -> {
try {
eventBus.post(new DatasetUpdatedEvent(dataset));
if (publishedDatasets.contains(dataset)) {
Map<String, List<DatasetVariable>> harmonizationVariables = mustIndexVariables && publishedDatasets.contains(dataset) ? populateHarmonizedVariablesMap(dataset) : null;
Iterable<DatasetVariable> datasetVariables = mustIndexVariables && publishedDatasets.contains(dataset) ? wrappedGetDatasetVariables(dataset) : null;
eventBus.post(new DatasetPublishedEvent(dataset, datasetVariables, harmonizationVariables, getCurrentUsername()));
}
} catch (Exception e) {
log.error(String.format("Error indexing dataset %s", dataset), e);
}
});
eventBus.post(new HarmonizationDatasetIndexedEvent());
}
use of org.obiba.mica.dataset.event.DatasetUpdatedEvent 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