use of org.eclipse.kapua.service.user.UserQuery in project kapua by eclipse.
the class GwtUserServiceImpl method findAll.
public ListLoadResult<GwtUser> findAll(String scopeIdString) throws GwtKapuaException {
KapuaId scopeId = KapuaEid.parseShortId(scopeIdString);
List<GwtUser> gwtUserList = new ArrayList<GwtUser>();
try {
KapuaLocator locator = KapuaLocator.getInstance();
UserService userService = locator.getService(UserService.class);
UserFactory userFactory = locator.getFactory(UserFactory.class);
UserQuery query = userFactory.newQuery(scopeId);
UserListResult list = userService.query(query);
for (User user : list.getItems()) {
gwtUserList.add(KapuaGwtConverter.convert(user));
}
} catch (Throwable t) {
KapuaExceptionHandler.handle(t);
}
return new BaseListLoadResult<GwtUser>(gwtUserList);
}
use of org.eclipse.kapua.service.user.UserQuery in project kapua by eclipse.
the class Users method getUsers.
/**
* Returns the list of all the users associated to the account of the
* currently connected user.
*
* @return The list of requested User objects.
*/
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public UserListResult getUsers() {
UserListResult userResult = userFactory.newUserListResult();
try {
UserQuery query = userFactory.newQuery(KapuaSecurityUtils.getSession().getScopeId());
userResult = (UserListResult) userService.query(query);
} catch (Throwable t) {
handleException(t);
}
return userResult;
}
Aggregations