Prevent storing Tags if the elastic service is unavailable

This commit is contained in:
George Kalampokis 2020-06-16 11:17:07 +03:00
parent 4a9c589636
commit a8015064a8
2 changed files with 7 additions and 5 deletions

View File

@ -1427,11 +1427,11 @@ public class DataManagementPlanManager {
eu.eudat.elastic.entities.Dataset elastic = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
if (elastic != null) {
tags = elastic.getTags();
DatasetWizardModel datasetWizardModel = new DatasetWizardModel().fromDataModel(dataset);
datasetWizardModel.setTags(tags);
datasetManager.getTagsFromProfile(datasetWizardModel, dataset);
datasetManager.updateTags(dataset, datasetWizardModel.getTags());
}
DatasetWizardModel datasetWizardModel = new DatasetWizardModel().fromDataModel(dataset);
datasetWizardModel.setTags(tags);
datasetManager.getTagsFromProfile(datasetWizardModel, dataset);
datasetManager.updateTags(dataset, datasetWizardModel.getTags());
} catch (Exception e) {
logger.error(e.getMessage(), e);
}

View File

@ -567,7 +567,9 @@ public class DatasetManager {
eu.eudat.data.entities.Dataset dataset = datasetWizardModel.toDataModel();
dataset.setDmp(dmp);
dataset.setProperties(propertiesModelToString(datasetWizardModel.getDatasetProfileDefinition()));
this.getTagsFromProfile(datasetWizardModel, dataset);
if (this.apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().getClient() != null) {
this.getTagsFromProfile(datasetWizardModel, dataset);
}
if (datasetWizardModel.getStatus() == (int) Dataset.Status.FINALISED.getValue())
checkDatasetValidation(dataset);
UserInfo userInfo = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(principal.getId()).build();