Fixes bug on exposing private Datasets on published DMP listing due to some old Datasets not being "Canceled".
This commit is contained in:
parent
3aa7dc0481
commit
1b7d118861
|
@ -28,7 +28,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
|
||||||
private String description;
|
private String description;
|
||||||
private List<DatasetListingModel> datasets;
|
private List<DatasetListingModel> datasets;
|
||||||
private List<AssociatedProfile> profiles;
|
private List<AssociatedProfile> profiles;
|
||||||
private eu.eudat.models.data.grant.Grant grant;
|
private Grant grant;
|
||||||
private List<Organisation> organisations;
|
private List<Organisation> organisations;
|
||||||
private List<Researcher> researchers;
|
private List<Researcher> researchers;
|
||||||
private List<UserListingModel> associatedUsers;
|
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.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.researchers = entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList());
|
||||||
this.version = entity.getVersion();
|
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.label = entity.getLabel();
|
||||||
this.grant = new Grant();
|
this.grant = new Grant();
|
||||||
this.properties = entity.getProperties() != null ? new org.json.JSONObject(entity.getProperties()).toMap() : null;
|
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.profiles.add(associatedProfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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()
|
this.datasets = entity.getDataset().stream()
|
||||||
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue()))
|
.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());
|
.map(x-> new DatasetListingModel().fromDataModel(x)).collect(Collectors.toList());
|
||||||
|
}
|
||||||
this.modified = entity.getModified();
|
this.modified = entity.getModified();
|
||||||
this.created = entity.getCreated();
|
this.created = entity.getCreated();
|
||||||
this.description = entity.getDescription();
|
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.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.researchers = entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList());
|
||||||
this.version = entity.getVersion();
|
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.label = entity.getLabel();
|
||||||
this.grant = new GrantDMPEditorModel();
|
this.grant = new GrantDMPEditorModel();
|
||||||
this.properties = entity.getProperties() != null ? new org.json.JSONObject(entity.getProperties()).toMap() : null;
|
this.properties = entity.getProperties() != null ? new org.json.JSONObject(entity.getProperties()).toMap() : null;
|
||||||
this.grant.getExistGrant().fromDataModel(entity.getGrant());
|
this.grant.getExistGrant().fromDataModel(entity.getGrant());
|
||||||
|
this.grant.getExistGrant().setSource("");
|
||||||
this.creator = new eu.eudat.models.data.userinfo.UserInfo();
|
this.creator = new eu.eudat.models.data.userinfo.UserInfo();
|
||||||
this.groupId = entity.getGroupId();
|
this.groupId = entity.getGroupId();
|
||||||
this.lockable = entity.getDataset().stream().findAny().isPresent();
|
this.lockable = entity.getDataset().stream().findAny().isPresent();
|
||||||
|
|
Loading…
Reference in New Issue