diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/UserInfoDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/UserInfoDaoImpl.java index 960cca165..60526bd6a 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/UserInfoDaoImpl.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/UserInfoDaoImpl.java @@ -32,6 +32,8 @@ public class UserInfoDaoImpl extends DatabaseAccess implements UserInf users.where((builder, root) -> builder.or(builder.like(builder.upper(root.get("name")), "%" + criteria.getLike().toUpperCase() + "%"), builder.like(root.get("email"), "%" + criteria.getLike() + "%"))); if (criteria.getEmail() != null) users.where((builder, root) -> builder.equal(root.get("email"), criteria.getEmail())); + if (criteria.getCollaboratorLike() != null) + users.where((builder, root) -> builder.or(builder.like(builder.upper(root.get("name")), "%" + criteria.getCollaboratorLike().toUpperCase() + "%"), builder.like(root.get("email"), "%" + criteria.getCollaboratorLike() + "%"))); return users; } @@ -42,7 +44,6 @@ public class UserInfoDaoImpl extends DatabaseAccess implements UserInf users.subQuery((builder1, root1) -> builder1.equal(root1.get("id"), principalId), Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmps:id")))), builder.notEqual(root.get("id"), principalId))); - return users; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/UserManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/UserManager.java index 352af13a0..d625b551a 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/UserManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/UserManager.java @@ -98,8 +98,7 @@ public class UserManager { public DataTableData getCollaboratorsPaged(UserInfoTableRequestItem userInfoTableRequestItem, Principal principal) throws Exception { UserInfoDao userInfoDao = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao(); - - QueryableList users = userInfoDao.asQueryable(); + QueryableList users = userInfoDao.getWithCriteria(userInfoTableRequestItem.getCriteria()); List colaborators = userInfoDao.getAuthenticated(users, principal.getId()) .withHint(HintedModelFactory.getHint(UserListingModel.class))