Fix issue that prevented the creation of DMPs and Datasets

This commit is contained in:
George Kalampokis 2020-02-11 18:29:40 +02:00
parent b62c0f7ff5
commit 8098b8bafd
3 changed files with 8 additions and 6 deletions

View File

@ -401,10 +401,12 @@ public class DatasetManager {
public eu.eudat.data.entities.Dataset createOrUpdate(DatasetWizardModel datasetWizardModel, Principal principal) throws Exception { public eu.eudat.data.entities.Dataset createOrUpdate(DatasetWizardModel datasetWizardModel, Principal principal) throws Exception {
DMP dmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(datasetWizardModel.getDmp().getId()); DMP dmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(datasetWizardModel.getDmp().getId());
Dataset tempDataset = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().find(datasetWizardModel.getId()); if (datasetWizardModel.getId() != null) {
if (tempDataset != null) { Dataset tempDataset = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().find(datasetWizardModel.getId());
if (datasetWizardModel.getModified().getTime() != tempDataset.getModified().getTime()) { if (tempDataset != null) {
throw new Exception("Dataset has been modified already by another user."); if (datasetWizardModel.getModified().getTime() != tempDataset.getModified().getTime()) {
throw new Exception("Dataset has been modified already by another user.");
}
} }
} }
if (dmp.getStatus().equals(DMP.DMPStatus.FINALISED.getValue()) && datasetWizardModel.getId() != null) if (dmp.getStatus().equals(DMP.DMPStatus.FINALISED.getValue()) && datasetWizardModel.getId() != null)

View File

@ -145,7 +145,7 @@ export class DatasetWizardEditorModel {
baseContext.validation.push({ key: 'dmp', validators: [BackendErrorValidator(this.validationErrorModel, 'dmp')] }); baseContext.validation.push({ key: 'dmp', validators: [BackendErrorValidator(this.validationErrorModel, 'dmp')] });
baseContext.validation.push({ key: 'datasetProfileDefinition', validators: [BackendErrorValidator(this.validationErrorModel, 'datasetProfileDefinition')] }); baseContext.validation.push({ key: 'datasetProfileDefinition', validators: [BackendErrorValidator(this.validationErrorModel, 'datasetProfileDefinition')] });
baseContext.validation.push({ key: 'tags', validators: [BackendErrorValidator(this.validationErrorModel, 'datasetProfileDefinition')] }); baseContext.validation.push({ key: 'tags', validators: [BackendErrorValidator(this.validationErrorModel, 'datasetProfileDefinition')] });
baseContext.validation.push({ key: 'modified', validators: [Validators.required]}); baseContext.validation.push({ key: 'modified', validators: []});
return baseContext; return baseContext;
} }
} }

View File

@ -131,7 +131,7 @@ export class DmpEditorModel {
baseContext.validation.push({ key: 'datasetsToBeFinalized', validators: [BackendErrorValidator(this.validationErrorModel, 'datasetsToBeFinalized')] }); baseContext.validation.push({ key: 'datasetsToBeFinalized', validators: [BackendErrorValidator(this.validationErrorModel, 'datasetsToBeFinalized')] });
baseContext.validation.push({ key: 'associatedUsers', validators: [BackendErrorValidator(this.validationErrorModel, 'associatedUsers')] }); baseContext.validation.push({ key: 'associatedUsers', validators: [BackendErrorValidator(this.validationErrorModel, 'associatedUsers')] });
baseContext.validation.push({ key: 'users', validators: [BackendErrorValidator(this.validationErrorModel, 'users')] }); baseContext.validation.push({ key: 'users', validators: [BackendErrorValidator(this.validationErrorModel, 'users')] });
baseContext.validation.push({ key: 'modified', validators: [Validators.required] }); baseContext.validation.push({ key: 'modified', validators: [] });
return baseContext; return baseContext;
} }
} }