Make DMP export to be more consistent with the DMP shown on the front end UI
This commit is contained in:
parent
c41c89774b
commit
afb0be5b18
|
@ -1220,9 +1220,12 @@ public class DataManagementPlanManager {
|
||||||
wordBuilder.addParagraphContent("Datasets", document, ParagraphStyle.HEADER1, BigInteger.ZERO);
|
wordBuilder.addParagraphContent("Datasets", document, ParagraphStyle.HEADER1, BigInteger.ZERO);
|
||||||
// Space below Datasets.
|
// Space below Datasets.
|
||||||
XWPFParagraph parBreakDatasets = document.createParagraph();
|
XWPFParagraph parBreakDatasets = document.createParagraph();
|
||||||
|
final Boolean isFinalized = dmpEntity.getStatus() == DMP.DMPStatus.FINALISED.getValue();
|
||||||
|
final Boolean isPublic = dmpEntity.isPublic();
|
||||||
dmpEntity.getDataset().stream()
|
dmpEntity.getDataset().stream()
|
||||||
.filter(item -> item.getStatus() != Dataset.Status.CANCELED.getValue())
|
.filter(item -> item.getStatus() != Dataset.Status.CANCELED.getValue())
|
||||||
.filter(item -> item.getStatus() != Dataset.Status.DELETED.getValue())
|
.filter(item -> item.getStatus() != Dataset.Status.DELETED.getValue())
|
||||||
|
.filter(item -> !isPublic && !isFinalized || item.getStatus() == Dataset.Status.FINALISED.getValue())
|
||||||
.forEach(datasetEntity -> {
|
.forEach(datasetEntity -> {
|
||||||
Map<String, Object> properties = new HashMap<>();
|
Map<String, Object> properties = new HashMap<>();
|
||||||
if (datasetEntity.getProperties() != null) {
|
if (datasetEntity.getProperties() != null) {
|
||||||
|
@ -1348,7 +1351,13 @@ public class DataManagementPlanManager {
|
||||||
eu.eudat.data.entities.DMP dmp = databaseRepository.getDmpDao().find(UUID.fromString(id));
|
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)
|
if (!dmp.isPublic() && dmp.getUsers().stream().filter(userInfo -> userInfo.getUser().getId() == principal.getId()).collect(Collectors.toList()).size() == 0)
|
||||||
throw new UnauthorisedException();
|
throw new UnauthorisedException();
|
||||||
List<Dataset> datasets = dmp.getDataset().stream().filter(dataset -> dataset.getStatus() != Dmp.DMPStatus.DELETED.getValue()).collect(Collectors.toList());
|
final Boolean isFinalized = dmp.getStatus() == DMP.DMPStatus.FINALISED.getValue();
|
||||||
|
final Boolean isPublic = dmp.isPublic();
|
||||||
|
List<Dataset> datasets = dmp.getDataset().stream()
|
||||||
|
.filter(dataset -> dataset.getStatus() != Dataset.Status.DELETED.getValue() &&
|
||||||
|
dataset.getStatus() != Dataset.Status.CANCELED.getValue())
|
||||||
|
.filter(dataset -> !isPublic && !isFinalized || dataset.getStatus() == Dataset.Status.FINALISED.getValue())
|
||||||
|
.collect(Collectors.toList());
|
||||||
/*String fileName = dmp.getLabel();
|
/*String fileName = dmp.getLabel();
|
||||||
fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "");*/
|
fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "");*/
|
||||||
String uuid = UUID.randomUUID().toString();
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
@ -1499,6 +1508,13 @@ public class DataManagementPlanManager {
|
||||||
if (!dmp.isPublic() && dmp.getUsers().stream().noneMatch(userInfo -> userInfo.getUser().getId() == principal.getId()))
|
if (!dmp.isPublic() && dmp.getUsers().stream().noneMatch(userInfo -> userInfo.getUser().getId() == principal.getId()))
|
||||||
throw new UnauthorisedException();
|
throw new UnauthorisedException();
|
||||||
// RDAExportModel rdaExportModel = new RDAExportModel().fromDataModel(dmp, datasetManager, principal);
|
// RDAExportModel rdaExportModel = new RDAExportModel().fromDataModel(dmp, datasetManager, principal);
|
||||||
|
final Boolean isFinalized = dmp.getStatus() == DMP.DMPStatus.FINALISED.getValue();
|
||||||
|
final Boolean isPublic = dmp.isPublic();
|
||||||
|
dmp.setDataset(dmp.getDataset().stream()
|
||||||
|
.filter(dataset -> dataset.getStatus() != Dataset.Status.DELETED.getValue() &&
|
||||||
|
dataset.getStatus() != Dataset.Status.CANCELED.getValue())
|
||||||
|
.filter(dataset -> !isPublic && !isFinalized || dataset.getStatus() == Dataset.Status.FINALISED.getValue())
|
||||||
|
.collect(Collectors.toSet()));
|
||||||
String result = rdaManager.convertToRDA(dmp);
|
String result = rdaManager.convertToRDA(dmp);
|
||||||
|
|
||||||
/*ObjectMapper mapper = new ObjectMapper();
|
/*ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
Loading…
Reference in New Issue