Fixes Collaborators' autocomplete search query not working properly.

This commit is contained in:
gkolokythas 2019-05-21 10:52:32 +03:00
parent 199d011f98
commit 7de3e34a6d
2 changed files with 3 additions and 3 deletions

View File

@ -32,6 +32,8 @@ public class UserInfoDaoImpl extends DatabaseAccess<UserInfo> 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() + "%"))); 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) if (criteria.getEmail() != null)
users.where((builder, root) -> builder.equal(root.get("email"), criteria.getEmail())); 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; return users;
} }
@ -42,7 +44,6 @@ public class UserInfoDaoImpl extends DatabaseAccess<UserInfo> implements UserInf
users.subQuery((builder1, root1) -> builder1.equal(root1.get("id"), principalId), users.subQuery((builder1, root1) -> builder1.equal(root1.get("id"), principalId),
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmps:id")))), Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmps:id")))),
builder.notEqual(root.get("id"), principalId))); builder.notEqual(root.get("id"), principalId)));
return users; return users;
} }

View File

@ -98,8 +98,7 @@ public class UserManager {
public DataTableData<UserListingModel> getCollaboratorsPaged(UserInfoTableRequestItem userInfoTableRequestItem, Principal principal) throws Exception { public DataTableData<UserListingModel> getCollaboratorsPaged(UserInfoTableRequestItem userInfoTableRequestItem, Principal principal) throws Exception {
UserInfoDao userInfoDao = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao(); UserInfoDao userInfoDao = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao();
QueryableList<UserInfo> users = userInfoDao.getWithCriteria(userInfoTableRequestItem.getCriteria());
QueryableList<UserInfo> users = userInfoDao.asQueryable();
List<UserListingModel> colaborators = userInfoDao.getAuthenticated(users, principal.getId()) List<UserListingModel> colaborators = userInfoDao.getAuthenticated(users, principal.getId())
.withHint(HintedModelFactory.getHint(UserListingModel.class)) .withHint(HintedModelFactory.getHint(UserListingModel.class))