this.isShowSearchUser = isShowSearchUser;
}
public void search(String keyword, String filter, String groupId) throws Exception {
OrganizationService service = getApplicationComponent(OrganizationService.class);
Query q = new Query();
if (keyword != null && (keyword = keyword.trim()).length() != 0) {
if (keyword.indexOf("*") < 0) {
if (keyword.charAt(0) != '*')
keyword = "*" + keyword;
if (keyword.charAt(keyword.length() - 1) != '*')
keyword += "*";
}
keyword = keyword.replace('?', '_');
if (USER_NAME.equals(filter)) {
q.setUserName(keyword);
}
if (LAST_NAME.equals(filter)) {
q.setLastName(keyword);
}
if (FIRST_NAME.equals(filter)) {
q.setFirstName(keyword);
}
if (EMAIL.equals(filter)) {
q.setEmail(keyword);
}
}
List results = new CopyOnWriteArrayList();
results.addAll(service.getUserHandler().findUsers(q).getAll());
// remove if user doesn't exist in selected group