When creating or updating a DMP with datasets, check the datasets template validity from the datasets of the request and not from the ones in DB

This commit is contained in:
George Kalampokis 2020-09-08 10:53:10 +03:00
parent eb7a5571c4
commit db0cee542c
1 changed files with 1 additions and 2 deletions

View File

@ -473,8 +473,7 @@ public class DataManagementPlanManager {
if (dmp1.getModified().getTime() != dataManagementPlan.getModified().getTime()) {
throw new Exception("Another user have already edit that DMP.");
}
List<Dataset> datasetList = new ArrayList<>(dmp1.getDataset());
for (Dataset dataset : datasetList) {
for (DatasetWizardModel dataset : dataManagementPlan.getDatasets()) {
if (dataManagementPlan.getProfiles().stream().filter(associatedProfile -> dataset.getProfile().getId().equals(associatedProfile.getId())).findAny().orElse(null) == null)
throw new Exception("Dataset Template for Dataset Description is missing from the DMP.");
}