Fixes DMP models to not expose Datasets with "Canceled" status.

This commit is contained in:
gkolokythas 2019-06-21 13:58:20 +03:00
parent c5d00b9ba1
commit 590d85b355
2 changed files with 2 additions and 16 deletions

View File

@ -221,7 +221,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
this.profiles.add(associatedProfile); this.profiles.add(associatedProfile);
} }
} }
this.datasets = entity.getDataset().stream().filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue())).map(x-> new DatasetListingModel().fromDataModel(x)).collect(Collectors.toList()); 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.modified = entity.getModified();
this.created = entity.getCreated(); this.created = entity.getCreated();
this.description = entity.getDescription(); this.description = entity.getDescription();

View File

@ -162,7 +162,7 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
this.creationTime = entity.getCreated(); this.creationTime = entity.getCreated();
this.modifiedTime = entity.getModified(); this.modifiedTime = entity.getModified();
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.datasets = entity.getDataset().stream().filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue())).map(x-> new DatasetOverviewModel().fromDataModel(x)).collect(Collectors.toList()); this.datasets = entity.getDataset().stream().filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue())).map(x-> new DatasetOverviewModel().fromDataModel(x)).collect(Collectors.toList());
this.users = entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList()); this.users = entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList());
this.description = entity.getDescription(); this.description = entity.getDescription();
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());
@ -174,20 +174,6 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
this.associatedProfiles.add(associatedProfile); this.associatedProfiles.add(associatedProfile);
} }
} }
/*if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
Document viewStyleDoc = XmlBuilder.fromXml(entity.getAssociatedDmps());
Element item = (Element) viewStyleDoc.getElementsByTagName("profiles").item(0);
this.associatedProfiles = new LinkedList<>();
if (item != null) {
NodeList associatedProfilesElement = item.getChildNodes();
for (int temp = 0; temp < associatedProfilesElement.getLength(); temp++) {
Node associatedProfileElement = associatedProfilesElement.item(temp);
if (associatedProfileElement.getNodeType() == Node.ELEMENT_NODE) {
this.associatedProfiles.add(new AssociatedProfile().fromXml((Element) associatedProfileElement));
}
}
}
}*/
return this; return this;
} }