Search in sources :

Example 1 with Order

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

the class MetadataRepositoryVertxImpl method search.

@Override
public Observable<Page<Metadata>> search(MetadataSearchCriteria criteria) {
    String sourceAddress = toDto(criteria.getSourceAddress());
    String targetAddress = toDto(criteria.getTargetAddress());
    String scopedMetadataKey = toDto(criteria.getScopedMetadataKey());
    String targetId = criteria.getTargetId();
    MetadataTypeEnum metadataType = criteria.getMetadataType() == null ? null : MetadataTypeEnum.fromValue(criteria.getMetadataType().getValue());
    String offset = criteria.getOffset();
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    Order order = toDto(criteria.getOrder());
    Consumer<Handler<AsyncResult<MetadataPage>>> callback = handler -> getClient().searchMetadataEntries(sourceAddress, targetAddress, scopedMetadataKey, targetId, metadataType, pageSize, pageNumber, offset, order, handler);
    return exceptionHandling(call(callback).map(page -> this.toPage(page.getPagination(), page.getData().stream().map(this::toMetadata).collect(Collectors.toList()))));
}
Also used : MetadataTypeEnum(io.nem.symbol.sdk.openapi.vertx.model.MetadataTypeEnum) BigInteger(java.math.BigInteger) Order(io.nem.symbol.sdk.openapi.vertx.model.Order) MapperUtils(io.nem.symbol.core.utils.MapperUtils) ApiClient(io.nem.symbol.sdk.openapi.vertx.invoker.ApiClient) ConvertUtils(io.nem.symbol.core.utils.ConvertUtils) MetadataType(io.nem.symbol.sdk.model.metadata.MetadataType) MetadataTypeEnum(io.nem.symbol.sdk.openapi.vertx.model.MetadataTypeEnum) Collectors(java.util.stream.Collectors) MetadataRepository(io.nem.symbol.sdk.api.MetadataRepository) MetadataEntryDTO(io.nem.symbol.sdk.openapi.vertx.model.MetadataEntryDTO) MetadataInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.MetadataInfoDTO) Consumer(java.util.function.Consumer) Order(io.nem.symbol.sdk.openapi.vertx.model.Order) ObjectUtils(org.apache.commons.lang3.ObjectUtils) MetadataSearchCriteria(io.nem.symbol.sdk.api.MetadataSearchCriteria) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) MetadataPage(io.nem.symbol.sdk.openapi.vertx.model.MetadataPage) Observable(io.reactivex.Observable) BigInteger(java.math.BigInteger) MetadataRoutesApiImpl(io.nem.symbol.sdk.openapi.vertx.api.MetadataRoutesApiImpl) AsyncResult(io.vertx.core.AsyncResult) Handler(io.vertx.core.Handler) Metadata(io.nem.symbol.sdk.model.metadata.Metadata) MetadataRoutesApi(io.nem.symbol.sdk.openapi.vertx.api.MetadataRoutesApi) Page(io.nem.symbol.sdk.api.Page) MetadataPage(io.nem.symbol.sdk.openapi.vertx.model.MetadataPage) Handler(io.vertx.core.Handler)

Example 2 with Order

use of io.nem.symbol.sdk.openapi.vertx.model.Order 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)

Example 3 with Order

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

the class NamespaceRepositoryVertxImpl method search.

@Override
public Observable<Page<NamespaceInfo>> search(NamespaceSearchCriteria criteria) {
    String ownerAddress = toDto(criteria.getOwnerAddress());
    NamespaceRegistrationTypeEnum registrationType = criteria.getRegistrationType() == null ? null : NamespaceRegistrationTypeEnum.fromValue(criteria.getRegistrationType().getValue());
    String level0 = criteria.getLevel0();
    AliasTypeEnum aliasType = criteria.getAliasType() == null ? null : AliasTypeEnum.fromValue(criteria.getAliasType().getValue());
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    Consumer<Handler<AsyncResult<NamespacePage>>> callback = handler -> getClient().searchNamespaces(ownerAddress, registrationType, level0, aliasType, pageSize, pageNumber, offset, order, handler);
    return exceptionHandling(call(callback).map(page -> this.toPage(page.getPagination(), page.getData().stream().map(this::toNamespaceInfo).collect(Collectors.toList()))));
}
Also used : Order(io.nem.symbol.sdk.openapi.vertx.model.Order) AliasTypeEnum(io.nem.symbol.sdk.openapi.vertx.model.AliasTypeEnum) NamespaceInfo(io.nem.symbol.sdk.model.namespace.NamespaceInfo) NamespaceDTO(io.nem.symbol.sdk.openapi.vertx.model.NamespaceDTO) Addresses(io.nem.symbol.sdk.openapi.vertx.model.Addresses) NamespaceRepository(io.nem.symbol.sdk.api.NamespaceRepository) NamespaceRoutesApi(io.nem.symbol.sdk.openapi.vertx.api.NamespaceRoutesApi) ArrayList(java.util.ArrayList) Order(io.nem.symbol.sdk.openapi.vertx.model.Order) MapperUtils.toNamespaceId(io.nem.symbol.core.utils.MapperUtils.toNamespaceId) NamespaceSearchCriteria(io.nem.symbol.sdk.api.NamespaceSearchCriteria) ObjectUtils(org.apache.commons.lang3.ObjectUtils) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) MosaicAlias(io.nem.symbol.sdk.model.namespace.MosaicAlias) Observable(io.reactivex.Observable) AsyncResult(io.vertx.core.AsyncResult) NamespaceId(io.nem.symbol.sdk.model.namespace.NamespaceId) MosaicNamesDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicNamesDTO) MapperUtils(io.nem.symbol.core.utils.MapperUtils) Alias(io.nem.symbol.sdk.model.namespace.Alias) ApiClient(io.nem.symbol.sdk.openapi.vertx.invoker.ApiClient) MosaicsNamesDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicsNamesDTO) NamespaceName(io.nem.symbol.sdk.model.namespace.NamespaceName) NamespacePage(io.nem.symbol.sdk.openapi.vertx.model.NamespacePage) MosaicNames(io.nem.symbol.sdk.model.mosaic.MosaicNames) NamespaceNameDTO(io.nem.symbol.sdk.openapi.vertx.model.NamespaceNameDTO) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) NamespaceRegistrationTypeEnum(io.nem.symbol.sdk.openapi.vertx.model.NamespaceRegistrationTypeEnum) EmptyAlias(io.nem.symbol.sdk.model.namespace.EmptyAlias) Collectors(java.util.stream.Collectors) NamespaceRoutesApiImpl(io.nem.symbol.sdk.openapi.vertx.api.NamespaceRoutesApiImpl) MosaicIds(io.nem.symbol.sdk.openapi.vertx.model.MosaicIds) NamespaceIds(io.nem.symbol.sdk.openapi.vertx.model.NamespaceIds) AccountNames(io.nem.symbol.sdk.model.account.AccountNames) NamespaceRegistrationType(io.nem.symbol.sdk.model.namespace.NamespaceRegistrationType) Consumer(java.util.function.Consumer) NamespaceInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.NamespaceInfoDTO) List(java.util.List) AccountNamesDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountNamesDTO) AliasType(io.nem.symbol.sdk.model.namespace.AliasType) AccountsNamesDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountsNamesDTO) Optional(java.util.Optional) Address(io.nem.symbol.sdk.model.account.Address) Handler(io.vertx.core.Handler) Page(io.nem.symbol.sdk.api.Page) AddressAlias(io.nem.symbol.sdk.model.namespace.AddressAlias) AliasTypeEnum(io.nem.symbol.sdk.openapi.vertx.model.AliasTypeEnum) NamespacePage(io.nem.symbol.sdk.openapi.vertx.model.NamespacePage) Handler(io.vertx.core.Handler) NamespaceRegistrationTypeEnum(io.nem.symbol.sdk.openapi.vertx.model.NamespaceRegistrationTypeEnum)

Example 4 with Order

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

the class RestrictionAccountRepositoryVertxImpl method search.

@Override
public Observable<Page<AccountRestrictions>> search(AccountRestrictionSearchCriteria criteria) {
    String address = toDto(criteria.getAddress());
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    Consumer<Handler<AsyncResult<AccountRestrictionsPage>>> handlerConsumer = (h) -> getClient().searchAccountRestrictions(address, pageSize, pageNumber, offset, order, h);
    return this.call(handlerConsumer, this::toPage);
}
Also used : Order(io.nem.symbol.sdk.openapi.vertx.model.Order) AccountRestrictionsPage(io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionsPage) RestrictionAccountRepository(io.nem.symbol.sdk.api.RestrictionAccountRepository) MapperUtils(io.nem.symbol.core.utils.MapperUtils) ApiClient(io.nem.symbol.sdk.openapi.vertx.invoker.ApiClient) RestrictionAccountRoutesApi(io.nem.symbol.sdk.openapi.vertx.api.RestrictionAccountRoutesApi) AccountRestrictionFlags(io.nem.symbol.sdk.model.transaction.AccountRestrictionFlags) AccountRestrictionDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionDTO) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) Consumer(java.util.function.Consumer) AccountRestrictionSearchCriteria(io.nem.symbol.sdk.api.AccountRestrictionSearchCriteria) AccountRestrictionsPage(io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionsPage) Order(io.nem.symbol.sdk.openapi.vertx.model.Order) AccountRestrictions(io.nem.symbol.sdk.model.account.AccountRestrictions) ObjectUtils(org.apache.commons.lang3.ObjectUtils) AccountRestriction(io.nem.symbol.sdk.model.account.AccountRestriction) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) Observable(io.reactivex.Observable) AccountRestrictionsInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionsInfoDTO) AsyncResult(io.vertx.core.AsyncResult) Address(io.nem.symbol.sdk.model.account.Address) RestrictionAccountRoutesApiImpl(io.nem.symbol.sdk.openapi.vertx.api.RestrictionAccountRoutesApiImpl) Handler(io.vertx.core.Handler) Page(io.nem.symbol.sdk.api.Page) Handler(io.vertx.core.Handler)

Example 5 with Order

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

the class ReceiptRepositoryVertxImpl method searchReceipts.

@Override
public Observable<Page<TransactionStatement>> searchReceipts(TransactionStatementSearchCriteria criteria) {
    BigInteger height = criteria.getHeight();
    BigInteger fromHeight = criteria.getFromHeight();
    BigInteger toHeight = criteria.getToHeight();
    List<ReceiptTypeEnum> receiptTypes = toDto(criteria.getReceiptTypes());
    String recipientAddress = toDto(criteria.getRecipientAddress());
    String senderAddress = toDto(criteria.getSenderAddress());
    String targetAddress = toDto(criteria.getTargetAddress());
    String artifactId = criteria.getArtifactId();
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    Consumer<Handler<AsyncResult<TransactionStatementPage>>> callback = (handler) -> getClient().searchReceipts(height, fromHeight, toHeight, receiptTypes, recipientAddress, senderAddress, targetAddress, artifactId, pageSize, pageNumber, offset, order, handler);
    return exceptionHandling(call(callback).map(page -> this.toPage(page.getPagination(), page.getData().stream().map(mapper::createTransactionStatement).collect(Collectors.toList()))));
}
Also used : BigInteger(java.math.BigInteger) Order(io.nem.symbol.sdk.openapi.vertx.model.Order) ApiClient(io.nem.symbol.sdk.openapi.vertx.invoker.ApiClient) Collectors(java.util.stream.Collectors) TransactionStatementSearchCriteria(io.nem.symbol.sdk.api.TransactionStatementSearchCriteria) ReceiptType(io.nem.symbol.sdk.model.receipt.ReceiptType) TransactionStatementPage(io.nem.symbol.sdk.openapi.vertx.model.TransactionStatementPage) ReceiptRepository(io.nem.symbol.sdk.api.ReceiptRepository) Consumer(java.util.function.Consumer) List(java.util.List) Order(io.nem.symbol.sdk.openapi.vertx.model.Order) ReceiptRoutesApi(io.nem.symbol.sdk.openapi.vertx.api.ReceiptRoutesApi) TransactionStatement(io.nem.symbol.sdk.model.receipt.TransactionStatement) ResolutionStatementSearchCriteria(io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria) AddressResolutionStatement(io.nem.symbol.sdk.model.receipt.AddressResolutionStatement) MosaicResolutionStatement(io.nem.symbol.sdk.model.receipt.MosaicResolutionStatement) ReceiptRoutesApiImpl(io.nem.symbol.sdk.openapi.vertx.api.ReceiptRoutesApiImpl) ResolutionStatementPage(io.nem.symbol.sdk.openapi.vertx.model.ResolutionStatementPage) ReceiptTypeEnum(io.nem.symbol.sdk.openapi.vertx.model.ReceiptTypeEnum) Observable(io.reactivex.Observable) BigInteger(java.math.BigInteger) AsyncResult(io.vertx.core.AsyncResult) Handler(io.vertx.core.Handler) Page(io.nem.symbol.sdk.api.Page) TransactionStatementPage(io.nem.symbol.sdk.openapi.vertx.model.TransactionStatementPage) BigInteger(java.math.BigInteger) Handler(io.vertx.core.Handler) ReceiptTypeEnum(io.nem.symbol.sdk.openapi.vertx.model.ReceiptTypeEnum)

Aggregations

Page (io.nem.symbol.sdk.api.Page)10 ApiClient (io.nem.symbol.sdk.openapi.vertx.invoker.ApiClient)10 Order (io.nem.symbol.sdk.openapi.vertx.model.Order)10 Observable (io.reactivex.Observable)10 AsyncResult (io.vertx.core.AsyncResult)10 Handler (io.vertx.core.Handler)10 Consumer (java.util.function.Consumer)10 Collectors (java.util.stream.Collectors)10 MerkleStateInfo (io.nem.symbol.sdk.model.blockchain.MerkleStateInfo)7 ObjectUtils (org.apache.commons.lang3.ObjectUtils)7 MapperUtils (io.nem.symbol.core.utils.MapperUtils)6 List (java.util.List)5 BigInteger (java.math.BigInteger)4 ReceiptRepository (io.nem.symbol.sdk.api.ReceiptRepository)3 ResolutionStatementSearchCriteria (io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria)3 TransactionStatementSearchCriteria (io.nem.symbol.sdk.api.TransactionStatementSearchCriteria)3 Address (io.nem.symbol.sdk.model.account.Address)3 AddressResolutionStatement (io.nem.symbol.sdk.model.receipt.AddressResolutionStatement)3 MosaicResolutionStatement (io.nem.symbol.sdk.model.receipt.MosaicResolutionStatement)3 ReceiptType (io.nem.symbol.sdk.model.receipt.ReceiptType)3