Clarifies DMP's finalize filter to not include published ones.
This commit is contained in:
parent
ff270185bd
commit
868e6886b3
|
@ -13,7 +13,6 @@ import eu.eudat.queryable.types.SelectionField;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import schemasMicrosoftComOfficeOffice.LeftDocument;
|
||||
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import java.util.Arrays;
|
||||
|
@ -50,7 +49,7 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
|
|||
query.where((builder, root) -> root.get("groupId").in(criteria.getGroupIds()));
|
||||
if (criteria.getStatus() != null) {
|
||||
if (criteria.getStatus() == DMP.DMPStatus.FINALISED.getValue()) {
|
||||
query.where((builder, root) -> builder.equal(root.get("status"), DMP.DMPStatus.FINALISED.getValue()));
|
||||
query.where((builder, root) -> builder.and(builder.equal(root.get("status"), DMP.DMPStatus.FINALISED.getValue()), builder.notEqual(root.get("isPublic"), true)));
|
||||
} else if (criteria.getStatus() == DMP.DMPStatus.ACTIVE.getValue()) {
|
||||
query.where((builder, root) -> builder.equal(root.get("status"), DMP.DMPStatus.ACTIVE.getValue()));
|
||||
}
|
||||
|
@ -58,9 +57,9 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
|
|||
if (criteria.getIsPublic())
|
||||
query.where(((builder, root) -> builder.equal(root.get("isPublic"), true)));
|
||||
if (criteria.getRole() != null) {
|
||||
if (criteria.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())){
|
||||
if (criteria.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())) {
|
||||
query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).get("role"), UserDMP.UserDMPRoles.OWNER.getValue()));
|
||||
} else if (criteria.getRole().equals(UserDMP.UserDMPRoles.USER.getValue())){
|
||||
} else if (criteria.getRole().equals(UserDMP.UserDMPRoles.USER.getValue())) {
|
||||
query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).get("role"), UserDMP.UserDMPRoles.USER.getValue()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue