public List<User> findUserByQueryCriteria(Object query, Page page) {
List<User> userList = new ArrayList<User>();
// Query is a UserQueryImpl instance
UserQueryImpl userQuery = (UserQueryImpl) query;
StringBuilder searchQuery = new StringBuilder();
if(StringUtils.isNotEmpty(userQuery.getId())) {
searchQuery.append("(uid=").append(userQuery.getId()).append(")");
} else if(StringUtils.isNotEmpty(userQuery.getLastName())) {
searchQuery.append("(sn=").append(userQuery.getLastName()).append(")");
} else {
searchQuery.append("(uid=*)");
}
LdapConnection connection = LDAPConnectionUtil.openConnection(connectionParams);