When exporting DMP to xml or json get only the active/finalized datasets and not the deleted ones

This commit is contained in:
George Kalampokis 2021-11-24 18:14:24 +02:00
parent 8524bce2e0
commit aed23a655b
2 changed files with 2 additions and 2 deletions

View File

@ -1344,7 +1344,7 @@ public class DataManagementPlanManager {
eu.eudat.data.entities.DMP dmp = databaseRepository.getDmpDao().find(UUID.fromString(id));
if (!dmp.isPublic() && dmp.getUsers().stream().filter(userInfo -> userInfo.getUser().getId() == principal.getId()).collect(Collectors.toList()).size() == 0)
throw new UnauthorisedException();
List<Dataset> datasets = dmp.getDataset().stream().collect(Collectors.toList());
List<Dataset> datasets = dmp.getDataset().stream().filter(dataset -> dataset.getStatus() != Dmp.DMPStatus.DELETED.getValue()).collect(Collectors.toList());
/*String fileName = dmp.getLabel();
fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "");*/
String uuid = UUID.randomUUID().toString();

View File

@ -95,7 +95,7 @@ public class DmpRDAMapper {
rda.getContributor().addAll(dmp.getResearchers().stream().map(ContributorRDAMapper::toRDA).collect(Collectors.toList()));
}
// rda.getContributor().addAll(dmp.getUsers().stream().map(ContributorRDAMapper::toRDA).collect(Collectors.toList()));
rda.setDataset(dmp.getDataset().stream().map(dataset -> datasetRDAMapper.toRDA(dataset, rda.getContributor())).collect(Collectors.toList()));
rda.setDataset(dmp.getDataset().stream().filter(dataset -> dataset.getStatus() != eu.eudat.elastic.entities.Dmp.DMPStatus.DELETED.getValue()).map(dataset -> datasetRDAMapper.toRDA(dataset, rda.getContributor())).collect(Collectors.toList()));
rda.setProject(Collections.singletonList(ProjectRDAMapper.toRDA(dmp.getProject(), dmp.getGrant())));
rda.setAdditionalProperty("templates", dmp.getAssociatedDmps().stream().map(datasetProfile -> datasetProfile.getId().toString()).toArray());
return rda;