Fixes bug of duplicating "role"criteria on Dataset listing query.
This commit is contained in:
parent
3a58234282
commit
655f2a4456
|
@ -45,11 +45,11 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
|
||||||
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)));
|
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)));
|
||||||
if (criteria.getDmpIds() != null && !criteria.getDmpIds().isEmpty())
|
if (criteria.getDmpIds() != null && !criteria.getDmpIds().isEmpty())
|
||||||
query.where((builder, root) -> root.get("dmp").get("id").in(criteria.getDmpIds()));
|
query.where((builder, root) -> root.get("dmp").get("id").in(criteria.getDmpIds()));
|
||||||
if (criteria.getRole() != null) {
|
/*if (criteria.getRole() != null) {
|
||||||
query.where((builder, root) -> builder.equal(root.join("dmp").join("users").get("role"), criteria.getRole()));
|
query.where((builder, root) -> builder.equal(root.join("dmp").join("users").get("role"), criteria.getRole()));
|
||||||
} else {
|
} else {
|
||||||
query.where((builder, root) -> root.join("dmp").join("users").get("role").in(UserDMP.UserDMPRoles.getAllValues()));
|
query.where((builder, root) -> root.join("dmp").join("users").get("role").in(UserDMP.UserDMPRoles.getAllValues()));
|
||||||
}
|
}*/
|
||||||
if (criteria.getOrganisations() != null && !criteria.getOrganisations().isEmpty())
|
if (criteria.getOrganisations() != null && !criteria.getOrganisations().isEmpty())
|
||||||
query.where((builder, root) -> root.join("dmp").join("organisations").get("reference").in(criteria.getOrganisations()));
|
query.where((builder, root) -> root.join("dmp").join("organisations").get("reference").in(criteria.getOrganisations()));
|
||||||
if (criteria.getGrants() != null && !criteria.getGrants().isEmpty())
|
if (criteria.getGrants() != null && !criteria.getGrants().isEmpty())
|
||||||
|
|
Loading…
Reference in New Issue