When deleting a DMP that has more than one versions then show the previous version of that DMP on the list (no ghost Datasets)
This commit is contained in:
parent
ebb9617aa6
commit
4da5f54362
dmp-backend/data/src/main/java/eu/eudat/data/dao/entities
|
@ -43,8 +43,9 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
|
|||
query.where(((builder, root) -> root.get("grant").in(criteria.getGrants())));
|
||||
if (!criteria.getAllVersions())
|
||||
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"),
|
||||
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("groupId"),
|
||||
nestedRoot.get("groupId")), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
|
||||
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(
|
||||
builder1.equal(externalRoot.get("groupId"), nestedRoot.get("groupId")),
|
||||
builder1.notEqual(nestedRoot.get("status"), DMP.DMPStatus.DELETED.getValue())), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
|
||||
if (criteria.getGroupIds() != null && !criteria.getGroupIds().isEmpty())
|
||||
query.where((builder, root) -> root.get("groupId").in(criteria.getGroupIds()));
|
||||
if (criteria.getStatus() != null) {
|
||||
|
|
Loading…
Reference in New Issue