use of io.apiman.manager.api.beans.search.searchResults.UserSearchResult in project apiman by apiman.
the class SearchResourceImpl method searchUsers.
/**
* @see io.apiman.manager.api.rest.ISearchResource#searchUsers(io.apiman.manager.api.beans.search.SearchCriteriaBean)
*/
@Override
public SearchResultsBean<UserSearchResult> searchUsers(SearchCriteriaBean criteria) throws InvalidSearchCriteriaException {
List<UserSearchResult> users = new ArrayList<>();
try {
// Maybe this should be a new query in the future?
List<UserBean> userBeans = query.findUsers(criteria).getBeans();
for (UserBean user : userBeans) {
users.add(new UserSearchResult(user.getUsername(), user.getFullName()));
}
SearchResultsBean<UserSearchResult> searchResultsBean = new SearchResultsBean<>();
searchResultsBean.setBeans(users);
searchResultsBean.setTotalSize(users.size());
return searchResultsBean;
} catch (StorageException e) {
throw new SystemErrorException(e);
}
}
Aggregations