Fixes bug on Public DMP editing exposing not "Finalized" Datasets.

This commit is contained in:
gkolokythas 2019-06-07 16:35:49 +03:00
parent 1e5b01a875
commit 3d7e31e145
1 changed files with 2 additions and 1 deletions

View File

@ -135,7 +135,7 @@ public class DataManagementPlanManager {
.selectAsync(item -> {
item.setDataset(
item.getDataset().stream()
.filter(dataset -> dataset.isPublic()).collect(Collectors.toSet()));
.filter(dataset -> dataset.getStatus().equals(Dataset.Status.FINALISED.getValue())).collect(Collectors.toSet()));
return new DataManagementPlanListingModel().fromDataModelDatasets(item);
})
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
@ -326,6 +326,7 @@ public class DataManagementPlanManager {
if (dataManagementPlanEntity != null && dataManagementPlanEntity.getStatus() == 1){
eu.eudat.models.data.dmp.DataManagementPlan datamanagementPlan = new eu.eudat.models.data.dmp.DataManagementPlan();
datamanagementPlan.fromDataModel(dataManagementPlanEntity);
datamanagementPlan.setDatasets(datamanagementPlan.getDatasets().stream().filter(dataset -> dataset.getStatus() == Dataset.Status.FINALISED.getValue()).collect(Collectors.toList()));
Map dmpProperties = dataManagementPlanEntity.getDmpProperties() != null ? new org.json.JSONObject(dataManagementPlanEntity.getDmpProperties()).toMap() : null;
datamanagementPlan.setDynamicFields(dynamicProjectConfiguration.getFields().stream().map(item -> {
DynamicFieldWithValue fieldWithValue = new DynamicFieldWithValue();