Refactors Dataset update so it cannot be edited if DMP is finalized.

This commit is contained in:
gkolokythas 2019-06-27 11:48:39 +03:00
parent ad6371ed1e
commit 349dffb137
1 changed files with 2 additions and 2 deletions

View File

@ -317,8 +317,8 @@ 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 (dmp.isPublic())
throw new Exception("DMP is public, therefore Dataset cannot be edited.");
if (dmp.getStatus().equals(DMP.DMPStatus.FINALISED.getValue()))
throw new Exception("DMP is finalized, therefore Dataset cannot be edited.");
eu.eudat.data.entities.Dataset dataset = datasetWizardModel.toDataModel();
dataset.setDmp(dmp);
propertiesModelToString(datasetWizardModel, dataset);