use of org.uberfire.ext.widgets.common.client.dropdown.LiveSearchCallback in project kie-wb-common by kiegroup.
the class AssigneeLiveSearchService method search.
@Override
public void search(final String pattern, final int maxResults, final LiveSearchCallback<String> callback) {
final List<String> filteredCustomEntries;
if (pattern == null || pattern.isEmpty()) {
filteredCustomEntries = customEntries;
} else {
filteredCustomEntries = customEntries.stream().filter(entry -> entry.contains(pattern)).collect(Collectors.toList());
}
RemoteCallback<AbstractEntityManager.SearchResponse<?>> searchResponseRemoteCallback = response -> processFilterResponse(response, filteredCustomEntries, maxResults, callback);
ErrorCallback<Message> searchErrorCallback = (message, throwable) -> processError(callback);
SearchRequestImpl request = new SearchRequestImpl(pattern, 1, maxResults);
if (AssigneeType.USER.equals(type)) {
userSystemManager.users(searchResponseRemoteCallback, searchErrorCallback).search(request);
} else {
userSystemManager.groups(searchResponseRemoteCallback, searchErrorCallback).search(request);
}
}
use of org.uberfire.ext.widgets.common.client.dropdown.LiveSearchCallback in project kie-wb-common by kiegroup.
the class AssigneeLiveSearchService method searchEntry.
@Override
public void searchEntry(String key, LiveSearchCallback<String> callback) {
SearchRequestImpl request = new SearchRequestImpl(key, 1, 1);
ErrorCallback<Message> searchErrorCallback = (message, throwable) -> processError(callback);
RemoteCallback<AbstractEntityManager.SearchResponse<?>> searchResponseRemoteCallback = response -> searchEntry(key, response, callback);
if (AssigneeType.USER.equals(type)) {
userSystemManager.users(searchResponseRemoteCallback, searchErrorCallback).search(request);
} else {
userSystemManager.groups(searchResponseRemoteCallback, searchErrorCallback).search(request);
}
}
Aggregations