Search in sources :

Example 1 with ListAccountsOption

use of com.google.gerrit.extensions.client.ListAccountsOption in project gerrit by GerritCodeReview.

the class AccountsImpl method query.

private List<AccountInfo> query(QueryRequest r) throws RestApiException {
    try {
        QueryAccounts myQueryAccounts = queryAccountsProvider.get();
        myQueryAccounts.setQuery(r.getQuery());
        myQueryAccounts.setLimit(r.getLimit());
        myQueryAccounts.setStart(r.getStart());
        for (ListAccountsOption option : r.getOptions()) {
            myQueryAccounts.addOption(option);
        }
        return myQueryAccounts.apply(TopLevelResource.INSTANCE);
    } catch (Exception e) {
        throw asRestApiException("Cannot retrieve suggested accounts", e);
    }
}
Also used : QueryAccounts(com.google.gerrit.server.account.QueryAccounts) ListAccountsOption(com.google.gerrit.extensions.client.ListAccountsOption) ApiUtil.asRestApiException(com.google.gerrit.server.api.ApiUtil.asRestApiException) BadRequestException(com.google.gerrit.extensions.restapi.BadRequestException) AuthException(com.google.gerrit.extensions.restapi.AuthException) RestApiException(com.google.gerrit.extensions.restapi.RestApiException)

Aggregations

ListAccountsOption (com.google.gerrit.extensions.client.ListAccountsOption)1 AuthException (com.google.gerrit.extensions.restapi.AuthException)1 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)1 RestApiException (com.google.gerrit.extensions.restapi.RestApiException)1 QueryAccounts (com.google.gerrit.server.account.QueryAccounts)1 ApiUtil.asRestApiException (com.google.gerrit.server.api.ApiUtil.asRestApiException)1