Search in sources :

Example 1 with AccountOrderByEnum

use of io.nem.symbol.sdk.openapi.vertx.model.AccountOrderByEnum in project nem2-sdk-java by nemtech.

the class AccountRepositoryVertxImpl method search.

@Override
public Observable<Page<AccountInfo>> search(AccountSearchCriteria criteria) {
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    AccountOrderByEnum orderBy = criteria.getOrderBy() == null ? null : AccountOrderByEnum.fromValue(criteria.getOrderBy().getValue());
    String mosaicId = criteria.getMosaicId() == null ? null : criteria.getMosaicId().getIdAsHex();
    Consumer<Handler<AsyncResult<AccountPage>>> callback = (handler) -> getClient().searchAccounts(pageSize, pageNumber, offset, order, orderBy, mosaicId, handler);
    return exceptionHandling(call(callback).map(page -> this.toPage(page.getPagination(), page.getData().stream().map(this::toAccountInfo).collect(Collectors.toList()))));
}
Also used : Order(io.nem.symbol.sdk.openapi.vertx.model.Order) AccountOrderByEnum(io.nem.symbol.sdk.openapi.vertx.model.AccountOrderByEnum) AccountDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountDTO) AccountOrderByEnum(io.nem.symbol.sdk.openapi.vertx.model.AccountOrderByEnum) MapperUtils.toMosaicId(io.nem.symbol.core.utils.MapperUtils.toMosaicId) AccountRepository(io.nem.symbol.sdk.api.AccountRepository) AccountType(io.nem.symbol.sdk.model.account.AccountType) SupplementalPublicKeysDTO(io.nem.symbol.sdk.openapi.vertx.model.SupplementalPublicKeysDTO) MapperUtils.toAddress(io.nem.symbol.core.utils.MapperUtils.toAddress) Order(io.nem.symbol.sdk.openapi.vertx.model.Order) AccountInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountInfoDTO) ObjectUtils(org.apache.commons.lang3.ObjectUtils) AccountRoutesApi(io.nem.symbol.sdk.openapi.vertx.api.AccountRoutesApi) AccountInfo(io.nem.symbol.sdk.model.account.AccountInfo) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) ActivityBucket(io.nem.symbol.sdk.model.account.ActivityBucket) Observable(io.reactivex.Observable) AsyncResult(io.vertx.core.AsyncResult) AccountPage(io.nem.symbol.sdk.openapi.vertx.model.AccountPage) AccountIds(io.nem.symbol.sdk.openapi.vertx.model.AccountIds) ResolvedMosaic(io.nem.symbol.sdk.model.mosaic.ResolvedMosaic) ApiClient(io.nem.symbol.sdk.openapi.vertx.invoker.ApiClient) AccountSearchCriteria(io.nem.symbol.sdk.api.AccountSearchCriteria) Collectors(java.util.stream.Collectors) Consumer(java.util.function.Consumer) List(java.util.List) SupplementalAccountKeys(io.nem.symbol.sdk.model.account.SupplementalAccountKeys) PublicKey(io.nem.symbol.core.crypto.PublicKey) AccountLinkPublicKeyDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountLinkPublicKeyDTO) AccountLinkVotingKey(io.nem.symbol.sdk.model.account.AccountLinkVotingKey) Address(io.nem.symbol.sdk.model.account.Address) AccountRoutesApiImpl(io.nem.symbol.sdk.openapi.vertx.api.AccountRoutesApiImpl) Handler(io.vertx.core.Handler) Collections(java.util.Collections) Page(io.nem.symbol.sdk.api.Page) AccountPage(io.nem.symbol.sdk.openapi.vertx.model.AccountPage) Handler(io.vertx.core.Handler)

Aggregations

PublicKey (io.nem.symbol.core.crypto.PublicKey)1 MapperUtils.toAddress (io.nem.symbol.core.utils.MapperUtils.toAddress)1 MapperUtils.toMosaicId (io.nem.symbol.core.utils.MapperUtils.toMosaicId)1 AccountRepository (io.nem.symbol.sdk.api.AccountRepository)1 AccountSearchCriteria (io.nem.symbol.sdk.api.AccountSearchCriteria)1 Page (io.nem.symbol.sdk.api.Page)1 AccountInfo (io.nem.symbol.sdk.model.account.AccountInfo)1 AccountLinkVotingKey (io.nem.symbol.sdk.model.account.AccountLinkVotingKey)1 AccountType (io.nem.symbol.sdk.model.account.AccountType)1 ActivityBucket (io.nem.symbol.sdk.model.account.ActivityBucket)1 Address (io.nem.symbol.sdk.model.account.Address)1 SupplementalAccountKeys (io.nem.symbol.sdk.model.account.SupplementalAccountKeys)1 MerkleStateInfo (io.nem.symbol.sdk.model.blockchain.MerkleStateInfo)1 ResolvedMosaic (io.nem.symbol.sdk.model.mosaic.ResolvedMosaic)1 AccountRoutesApi (io.nem.symbol.sdk.openapi.vertx.api.AccountRoutesApi)1 AccountRoutesApiImpl (io.nem.symbol.sdk.openapi.vertx.api.AccountRoutesApiImpl)1 ApiClient (io.nem.symbol.sdk.openapi.vertx.invoker.ApiClient)1 AccountDTO (io.nem.symbol.sdk.openapi.vertx.model.AccountDTO)1 AccountIds (io.nem.symbol.sdk.openapi.vertx.model.AccountIds)1 AccountInfoDTO (io.nem.symbol.sdk.openapi.vertx.model.AccountInfoDTO)1