Sort Datasets by Modified date on DMP Overview and DMP Editor

This commit is contained in:
George Kalampokis 2022-04-01 13:49:04 +03:00
parent 7cfedf24a2
commit ef6e3b8d7c
1 changed files with 7 additions and 3 deletions

View File

@ -42,6 +42,7 @@ import eu.eudat.logic.utilities.documents.types.ParagraphStyle;
import eu.eudat.logic.utilities.documents.word.WordBuilder;
import eu.eudat.logic.utilities.documents.xml.ExportXmlBuilder;
import eu.eudat.models.HintedModelFactory;
import eu.eudat.models.data.dataset.DatasetOverviewModel;
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
import eu.eudat.models.data.datasetwizard.DatasetsToBeFinalized;
@ -289,7 +290,9 @@ public class DataManagementPlanManager {
}
if (includeDatasets) {
dataManagementPlan.fromDataModel(dataManagementPlanEntity);
List<Dataset> datasetEnities = new ArrayList<>(dataManagementPlanEntity.getDataset());
dataManagementPlan.getDatasets().forEach(datasetWizardModel -> datasetWizardModel.setDescription(null));
dataManagementPlan.setDatasets(dataManagementPlan.getDatasets().stream().sorted(Comparator.comparing(DatasetWizardModel::getModified).reversed()).collect(Collectors.toList()));
//List<Dataset> datasetEnities = new ArrayList<>(dataManagementPlanEntity.getDataset());
/*for (int i = 0; i < datasetEnities.size(); i++) {
for (int j = i; j < dataManagementPlan.getDatasets().size(); j++) {
if (dataManagementPlan.getDatasets().get(j).getId().equals(datasetEnities.get(i).getId())) {
@ -298,7 +301,7 @@ public class DataManagementPlanManager {
}
}
}*/
datasetEnities.stream()
/*datasetEnities.stream()
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED) && !dataset.getStatus().equals(Dataset.Status.CANCELED))
.forEach(dataset -> {
dataManagementPlan.getDatasets().stream().filter(datasetWizardModel -> datasetWizardModel.getId().equals(dataset.getId())).forEach(datasetWizardModel -> {
@ -306,7 +309,7 @@ public class DataManagementPlanManager {
datasetWizardModel.setDatasetProfileDefinition(wizardModel.getDatasetProfileDefinition());
datasetWizardModel.setTags(wizardModel.getTags());
});
});
});*/
if (isPublic) {
dataManagementPlan.setDatasets(dataManagementPlan.getDatasets().stream().filter(dataset -> dataset.getStatus() == Dataset.Status.FINALISED.getValue()).collect(Collectors.toList()));
}
@ -340,6 +343,7 @@ public class DataManagementPlanManager {
}
DataManagementPlanOverviewModel datamanagementPlan = new DataManagementPlanOverviewModel();
datamanagementPlan.fromDataModelDatasets(dataManagementPlanEntity);
datamanagementPlan.setDatasets(datamanagementPlan.getDatasets().stream().sorted(Comparator.comparing(DatasetOverviewModel::getModified).reversed()).collect(Collectors.toList()));
if (isPublic) {
datamanagementPlan.setDatasets(datamanagementPlan.getDatasets().stream().filter(dataset -> dataset.getStatus() == Dataset.Status.FINALISED.getValue()).collect(Collectors.toList()));
}