Fix issue with not showing datasets on all version listing

This commit is contained in:
George Kalampokis 2022-02-22 11:30:22 +02:00
parent 4bdb27fcef
commit d1eab0d019
2 changed files with 6 additions and 3 deletions

View File

@ -35,9 +35,9 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
if (criteria.getIsPublic() != null && criteria.getIsPublic()) {
query.where((builder, root) -> builder.equal(root.get("dmp").get("isPublic"), true));
query.where((builder, root) -> builder.equal(root.get("status"), Dataset.Status.FINALISED.getValue()));
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"),
/*query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"),
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")),
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));*/
}
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.or(

View File

@ -182,8 +182,9 @@ public class DataManagementPlanManager {
dataTable.setData(dmps1.stream().map(dmp -> {
DatasetCriteria datasetCriteria = new DatasetCriteria();
datasetCriteria.setDmpIds(Collections.singletonList(dmp.getId()));
datasetCriteria.setAllVersions(false);
datasetCriteria.setAllVersions(dataManagementPlanTableRequest.getCriteria().getAllVersions());
datasetCriteria.setIsPublic(dataManagementPlanTableRequest.getCriteria().getIsPublic());
datasetCriteria.setGroupIds(Collections.singletonList(dmp.getGroupId()));
dmp.setDataset(retrieveRelevantDatasets(datasetCriteria, principalID));
@ -207,6 +208,8 @@ public class DataManagementPlanManager {
DatasetCriteria datasetCriteria = new DatasetCriteria();
datasetCriteria.setDmpIds(Collections.singletonList(dmp.getId()));
datasetCriteria.setIsPublic(true);
datasetCriteria.setAllVersions(dataManagementPlanTableRequest.getCriteria().getAllVersions());
datasetCriteria.setGroupIds(Collections.singletonList(dmp.getGroupId()));
dmp.setDataset(retrieveRelevantDatasets(datasetCriteria));