Refactors Dataset update so it cannot be edited if DMP is finalized.
This commit is contained in:
parent
ad6371ed1e
commit
349dffb137
|
@ -317,8 +317,8 @@ 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());
|
||||||
if (dmp.isPublic())
|
if (dmp.getStatus().equals(DMP.DMPStatus.FINALISED.getValue()))
|
||||||
throw new Exception("DMP is public, therefore Dataset cannot be edited.");
|
throw new Exception("DMP is finalized, therefore Dataset cannot be edited.");
|
||||||
eu.eudat.data.entities.Dataset dataset = datasetWizardModel.toDataModel();
|
eu.eudat.data.entities.Dataset dataset = datasetWizardModel.toDataModel();
|
||||||
dataset.setDmp(dmp);
|
dataset.setDmp(dmp);
|
||||||
propertiesModelToString(datasetWizardModel, dataset);
|
propertiesModelToString(datasetWizardModel, dataset);
|
||||||
|
|
Loading…
Reference in New Issue