Search in sources :

Example 1 with AccountQuery

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);
}
Also used : BaseListLoadResult(com.extjs.gxt.ui.client.data.BaseListLoadResult) KapuaLocator(org.eclipse.kapua.locator.KapuaLocator) AccountFactory(org.eclipse.kapua.service.account.AccountFactory) Account(org.eclipse.kapua.service.account.Account) GwtAccount(org.eclipse.kapua.app.console.shared.model.GwtAccount) ArrayList(java.util.ArrayList) KapuaId(org.eclipse.kapua.model.id.KapuaId) GwtAccount(org.eclipse.kapua.app.console.shared.model.GwtAccount) AccountService(org.eclipse.kapua.service.account.AccountService) GwtAccountService(org.eclipse.kapua.app.console.shared.service.GwtAccountService) AccountQuery(org.eclipse.kapua.service.account.AccountQuery)

Example 2 with AccountQuery

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);
}
Also used : BaseListLoadResult(com.extjs.gxt.ui.client.data.BaseListLoadResult) KapuaLocator(org.eclipse.kapua.locator.KapuaLocator) AccountFactory(org.eclipse.kapua.service.account.AccountFactory) Account(org.eclipse.kapua.service.account.Account) GwtAccount(org.eclipse.kapua.app.console.shared.model.GwtAccount) ArrayList(java.util.ArrayList) GwtAccount(org.eclipse.kapua.app.console.shared.model.GwtAccount) KapuaId(org.eclipse.kapua.model.id.KapuaId) AccountService(org.eclipse.kapua.service.account.AccountService) GwtAccountService(org.eclipse.kapua.app.console.shared.service.GwtAccountService) AccountQuery(org.eclipse.kapua.service.account.AccountQuery)

Aggregations

BaseListLoadResult (com.extjs.gxt.ui.client.data.BaseListLoadResult)2 ArrayList (java.util.ArrayList)2 GwtAccount (org.eclipse.kapua.app.console.shared.model.GwtAccount)2 GwtAccountService (org.eclipse.kapua.app.console.shared.service.GwtAccountService)2 KapuaLocator (org.eclipse.kapua.locator.KapuaLocator)2 KapuaId (org.eclipse.kapua.model.id.KapuaId)2 Account (org.eclipse.kapua.service.account.Account)2 AccountFactory (org.eclipse.kapua.service.account.AccountFactory)2 AccountQuery (org.eclipse.kapua.service.account.AccountQuery)2 AccountService (org.eclipse.kapua.service.account.AccountService)2