Search in sources :

Example 6 with AccountSearchCriteria

use of io.nem.symbol.sdk.api.AccountSearchCriteria in project nem2-sdk-java by nemtech.

the class MerkleLoaderIntegrationTest method accounts.

public List<Arguments> accounts() {
    RepositoryFactory repositoryFactory = getRepositoryFactory(DEFAULT_REPOSITORY_TYPE);
    AccountRepository repository = repositoryFactory.createAccountRepository();
    return getArguments(repository, new AccountSearchCriteria().order(ORDER_BY));
}
Also used : AccountSearchCriteria(io.nem.symbol.sdk.api.AccountSearchCriteria) AccountRepository(io.nem.symbol.sdk.api.AccountRepository) RestrictionAccountRepository(io.nem.symbol.sdk.api.RestrictionAccountRepository) RepositoryFactory(io.nem.symbol.sdk.api.RepositoryFactory)

Example 7 with AccountSearchCriteria

use of io.nem.symbol.sdk.api.AccountSearchCriteria in project nem2-sdk-java by nemtech.

the class AccountRepositoryOkHttpImpl 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();
    Callable<AccountPage> callback = () -> getClient().searchAccounts(pageSize, pageNumber, offset, order, orderBy, mosaicId);
    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.okhttp_gson.model.Order) AccountOrderByEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountOrderByEnum) AccountInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountInfoDTO) MapperUtils.toMosaicId(io.nem.symbol.core.utils.MapperUtils.toMosaicId) AccountLinkPublicKeyDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountLinkPublicKeyDTO) AccountRepository(io.nem.symbol.sdk.api.AccountRepository) Callable(java.util.concurrent.Callable) AccountDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountDTO) AccountType(io.nem.symbol.sdk.model.account.AccountType) AccountPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountPage) MapperUtils.toAddress(io.nem.symbol.core.utils.MapperUtils.toAddress) ObjectUtils(org.apache.commons.lang3.ObjectUtils) AccountInfo(io.nem.symbol.sdk.model.account.AccountInfo) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) ActivityBucket(io.nem.symbol.sdk.model.account.ActivityBucket) AccountRoutesApi(io.nem.symbol.sdk.openapi.okhttp_gson.api.AccountRoutesApi) Observable(io.reactivex.Observable) ResolvedMosaic(io.nem.symbol.sdk.model.mosaic.ResolvedMosaic) SupplementalPublicKeysDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.SupplementalPublicKeysDTO) ApiClient(io.nem.symbol.sdk.openapi.okhttp_gson.invoker.ApiClient) AccountIds(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountIds) AccountOrderByEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountOrderByEnum) AccountSearchCriteria(io.nem.symbol.sdk.api.AccountSearchCriteria) Collectors(java.util.stream.Collectors) Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) List(java.util.List) SupplementalAccountKeys(io.nem.symbol.sdk.model.account.SupplementalAccountKeys) PublicKey(io.nem.symbol.core.crypto.PublicKey) AccountLinkVotingKey(io.nem.symbol.sdk.model.account.AccountLinkVotingKey) Address(io.nem.symbol.sdk.model.account.Address) Collections(java.util.Collections) Page(io.nem.symbol.sdk.api.Page) AccountPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountPage)

Aggregations

AccountSearchCriteria (io.nem.symbol.sdk.api.AccountSearchCriteria)7 AccountInfo (io.nem.symbol.sdk.model.account.AccountInfo)5 Address (io.nem.symbol.sdk.model.account.Address)4 AccountRepository (io.nem.symbol.sdk.api.AccountRepository)3 PublicKey (io.nem.symbol.core.crypto.PublicKey)2 MapperUtils.toAddress (io.nem.symbol.core.utils.MapperUtils.toAddress)2 MapperUtils.toMosaicId (io.nem.symbol.core.utils.MapperUtils.toMosaicId)2 Page (io.nem.symbol.sdk.api.Page)2 RepositoryFactory (io.nem.symbol.sdk.api.RepositoryFactory)2 Account (io.nem.symbol.sdk.model.account.Account)2 AccountLinkVotingKey (io.nem.symbol.sdk.model.account.AccountLinkVotingKey)2 AccountType (io.nem.symbol.sdk.model.account.AccountType)2 ActivityBucket (io.nem.symbol.sdk.model.account.ActivityBucket)2 SupplementalAccountKeys (io.nem.symbol.sdk.model.account.SupplementalAccountKeys)2 MerkleStateInfo (io.nem.symbol.sdk.model.blockchain.MerkleStateInfo)2 ResolvedMosaic (io.nem.symbol.sdk.model.mosaic.ResolvedMosaic)2 AccountDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountDTO)2 AccountInfoDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountInfoDTO)2 AccountLinkPublicKeyDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountLinkPublicKeyDTO)2 SupplementalPublicKeysDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.SupplementalPublicKeysDTO)2