use of org.apache.openmeetings.db.dto.basic.SearchResult in project openmeetings by apache.
the class GroupWebService method getUsers.
/**
* Search users and return them
*
* @param sid
* The SID from getSession
* @param id
* the group id
* @param start
* first record
* @param max
* max records
* @param orderby
* orderby clause
* @param asc
* asc or desc
* @return - users found
*/
@GET
@Path("/users/{id}")
public UserSearchResult getUsers(@QueryParam("sid") @WebParam(name = "sid") String sid, @PathParam("id") @WebParam(name = "id") long id, @QueryParam("start") @WebParam(name = "start") int start, @QueryParam("max") @WebParam(name = "max") int max, @QueryParam("orderby") @WebParam(name = "orderby") String orderby, @QueryParam("asc") @WebParam(name = "asc") boolean asc) {
return performCall(sid, User.Right.Soap, sd -> {
SearchResult<User> result = new SearchResult<>();
result.setObjectName(User.class.getName());
result.setRecords(groupUserDao.count(id));
result.setResult(new ArrayList<User>());
String order = isAlphanumeric(orderby) ? orderby : "id";
for (GroupUser ou : groupUserDao.get(id, null, start, max, order + " " + (asc ? "ASC" : "DESC"))) {
result.getResult().add(ou.getUser());
}
return new UserSearchResult(result);
});
}
Aggregations