use of org.eclipse.kapua.service.account.AccountQuery in project kapua by eclipse.
the class GwtAccountServiceImpl method findChildren.
public ListLoadResult<GwtAccount> findChildren(String parentAccountId, boolean recoursive) throws GwtKapuaException {
KapuaId scopeId = KapuaEid.parseShortId(parentAccountId);
KapuaLocator locator = KapuaLocator.getInstance();
AccountService accountService = locator.getService(AccountService.class);
AccountFactory accountFactory = locator.getFactory(AccountFactory.class);
List<GwtAccount> gwtAccountList = new ArrayList<GwtAccount>();
try {
AccountQuery query = accountFactory.newQuery(scopeId);
KapuaListResult<Account> list = accountService.query(query);
for (Account account : list.getItems()) {
gwtAccountList.add(KapuaGwtConverter.convert(account));
}
} catch (Throwable t) {
KapuaExceptionHandler.handle(t);
}
return new BaseListLoadResult<GwtAccount>(gwtAccountList);
}
use of org.eclipse.kapua.service.account.AccountQuery in project kapua by eclipse.
the class GwtAccountServiceImpl method findAll.
public ListLoadResult<GwtAccount> findAll(String scopeIdString) throws GwtKapuaException {
List<GwtAccount> gwtAccountList = new ArrayList<GwtAccount>();
KapuaId scopeId = KapuaEid.parseShortId(scopeIdString);
try {
KapuaLocator locator = KapuaLocator.getInstance();
AccountService accountService = locator.getService(AccountService.class);
AccountFactory accountFactory = locator.getFactory(AccountFactory.class);
AccountQuery query = accountFactory.newQuery(scopeId);
KapuaListResult<Account> list = accountService.query(query);
for (Account account : list.getItems()) {
gwtAccountList.add(KapuaGwtConverter.convert(account));
}
} catch (Throwable t) {
KapuaExceptionHandler.handle(t);
}
return new BaseListLoadResult<GwtAccount>(gwtAccountList);
}
Aggregations