Fix issue that prevented the creation of DMPs and Datasets
This commit is contained in:
parent
b62c0f7ff5
commit
8098b8bafd
|
@ -401,12 +401,14 @@ public class DatasetManager {
|
|||
|
||||
public eu.eudat.data.entities.Dataset createOrUpdate(DatasetWizardModel datasetWizardModel, Principal principal) throws Exception {
|
||||
DMP dmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(datasetWizardModel.getDmp().getId());
|
||||
if (datasetWizardModel.getId() != null) {
|
||||
Dataset tempDataset = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().find(datasetWizardModel.getId());
|
||||
if (tempDataset != null) {
|
||||
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)
|
||||
throw new Exception("DMP is finalized, therefore Dataset cannot be edited.");
|
||||
eu.eudat.data.entities.Dataset dataset = datasetWizardModel.toDataModel();
|
||||
|
|
|
@ -145,7 +145,7 @@ export class DatasetWizardEditorModel {
|
|||
baseContext.validation.push({ key: 'dmp', validators: [BackendErrorValidator(this.validationErrorModel, 'dmp')] });
|
||||
baseContext.validation.push({ key: 'datasetProfileDefinition', 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ export class DmpEditorModel {
|
|||
baseContext.validation.push({ key: 'datasetsToBeFinalized', validators: [BackendErrorValidator(this.validationErrorModel, 'datasetsToBeFinalized')] });
|
||||
baseContext.validation.push({ key: 'associatedUsers', validators: [BackendErrorValidator(this.validationErrorModel, 'associatedUsers')] });
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue