Commit 1b7d1188 authored by Georgios Kolokythas's avatar Georgios Kolokythas

Fixes bug on exposing private Datasets on published DMP listing due to some...

Fixes bug on exposing private Datasets on published DMP listing due to some old Datasets not being "Canceled".
parent 3aa7dc04
......@@ -28,7 +28,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
private String description;
private List<DatasetListingModel> datasets;
private List<AssociatedProfile> profiles;
private eu.eudat.models.data.grant.Grant grant;
private Grant grant;
private List<Organisation> organisations;
private List<Researcher> researchers;
private List<UserListingModel> associatedUsers;
......@@ -218,7 +218,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
this.organisations = entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList());
this.researchers = entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList());
this.version = entity.getVersion();
this.groupId = this.groupId == null ? null : this.groupId;
this.groupId = this.groupId == null ? null : entity.getGroupId();
this.label = entity.getLabel();
this.grant = new Grant();
this.properties = entity.getProperties() != null ? new org.json.JSONObject(entity.getProperties()).toMap() : null;
......@@ -243,9 +243,15 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
this.profiles.add(associatedProfile);
}
}
this.datasets = entity.getDataset().stream()
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue()))
.map(x-> new DatasetListingModel().fromDataModel(x)).collect(Collectors.toList());
if (entity.isPublic()) {
this.datasets = entity.getDataset().stream()
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue()) && !dataset.getStatus().equals(Dataset.Status.SAVED.getValue()))
.map(x-> new DatasetListingModel().fromDataModel(x)).collect(Collectors.toList());
} else {
this.datasets = entity.getDataset().stream()
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue()))
.map(x-> new DatasetListingModel().fromDataModel(x)).collect(Collectors.toList());
}
this.modified = entity.getModified();
this.created = entity.getCreated();
this.description = entity.getDescription();
......
......@@ -218,11 +218,12 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
this.organisations = entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList());
this.researchers = entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList());
this.version = entity.getVersion();
this.groupId = this.groupId == null ? null : this.groupId;
this.groupId = this.groupId == null ? null : entity.getGroupId();
this.label = entity.getLabel();
this.grant = new GrantDMPEditorModel();
this.properties = entity.getProperties() != null ? new org.json.JSONObject(entity.getProperties()).toMap() : null;
this.grant.getExistGrant().fromDataModel(entity.getGrant());
this.grant.getExistGrant().setSource("");
this.creator = new eu.eudat.models.data.userinfo.UserInfo();
this.groupId = entity.getGroupId();
this.lockable = entity.getDataset().stream().findAny().isPresent();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment