Search in sources :

Example 1 with AliasType

use of io.nem.symbol.sdk.model.namespace.AliasType in project nem2-sdk-java by nemtech.

the class NamespaceRepositoryOkHttpImpl 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());
    Callable<NamespacePage> callback = () -> getClient().searchNamespaces(ownerAddress, registrationType, level0, aliasType, pageSize, pageNumber, offset, order);
    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.okhttp_gson.model.Order) NamespacePage(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespacePage) NamespaceInfo(io.nem.symbol.sdk.model.namespace.NamespaceInfo) MosaicsNamesDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicsNamesDTO) NamespaceRepository(io.nem.symbol.sdk.api.NamespaceRepository) Callable(java.util.concurrent.Callable) MosaicIds(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicIds) NamespaceNameDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceNameDTO) ArrayList(java.util.ArrayList) AccountsNamesDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountsNamesDTO) MapperUtils.toNamespaceId(io.nem.symbol.core.utils.MapperUtils.toNamespaceId) NamespaceSearchCriteria(io.nem.symbol.sdk.api.NamespaceSearchCriteria) MosaicNamesDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicNamesDTO) NamespaceDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceDTO) NamespaceRegistrationTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceRegistrationTypeEnum) ObjectUtils(org.apache.commons.lang3.ObjectUtils) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) NamespaceInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceInfoDTO) MosaicAlias(io.nem.symbol.sdk.model.namespace.MosaicAlias) Observable(io.reactivex.Observable) NamespaceId(io.nem.symbol.sdk.model.namespace.NamespaceId) AliasTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.AliasTypeEnum) MapperUtils(io.nem.symbol.core.utils.MapperUtils) Alias(io.nem.symbol.sdk.model.namespace.Alias) Addresses(io.nem.symbol.sdk.openapi.okhttp_gson.model.Addresses) NamespaceName(io.nem.symbol.sdk.model.namespace.NamespaceName) ApiClient(io.nem.symbol.sdk.openapi.okhttp_gson.invoker.ApiClient) MosaicNames(io.nem.symbol.sdk.model.mosaic.MosaicNames) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) EmptyAlias(io.nem.symbol.sdk.model.namespace.EmptyAlias) Collectors(java.util.stream.Collectors) Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) AccountNames(io.nem.symbol.sdk.model.account.AccountNames) NamespaceRegistrationType(io.nem.symbol.sdk.model.namespace.NamespaceRegistrationType) AccountNamesDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountNamesDTO) List(java.util.List) NamespaceRoutesApi(io.nem.symbol.sdk.openapi.okhttp_gson.api.NamespaceRoutesApi) AliasType(io.nem.symbol.sdk.model.namespace.AliasType) Optional(java.util.Optional) Address(io.nem.symbol.sdk.model.account.Address) NamespaceIds(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceIds) Page(io.nem.symbol.sdk.api.Page) AddressAlias(io.nem.symbol.sdk.model.namespace.AddressAlias) AliasTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.AliasTypeEnum) NamespacePage(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespacePage) NamespaceRegistrationTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.NamespaceRegistrationTypeEnum)

Example 2 with AliasType

use of io.nem.symbol.sdk.model.namespace.AliasType 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)

Aggregations

MapperUtils (io.nem.symbol.core.utils.MapperUtils)2 MapperUtils.toNamespaceId (io.nem.symbol.core.utils.MapperUtils.toNamespaceId)2 NamespaceRepository (io.nem.symbol.sdk.api.NamespaceRepository)2 NamespaceSearchCriteria (io.nem.symbol.sdk.api.NamespaceSearchCriteria)2 Page (io.nem.symbol.sdk.api.Page)2 AccountNames (io.nem.symbol.sdk.model.account.AccountNames)2 Address (io.nem.symbol.sdk.model.account.Address)2 MerkleStateInfo (io.nem.symbol.sdk.model.blockchain.MerkleStateInfo)2 MosaicId (io.nem.symbol.sdk.model.mosaic.MosaicId)2 MosaicNames (io.nem.symbol.sdk.model.mosaic.MosaicNames)2 AddressAlias (io.nem.symbol.sdk.model.namespace.AddressAlias)2 Alias (io.nem.symbol.sdk.model.namespace.Alias)2 AliasType (io.nem.symbol.sdk.model.namespace.AliasType)2 EmptyAlias (io.nem.symbol.sdk.model.namespace.EmptyAlias)2 MosaicAlias (io.nem.symbol.sdk.model.namespace.MosaicAlias)2 NamespaceId (io.nem.symbol.sdk.model.namespace.NamespaceId)2 NamespaceInfo (io.nem.symbol.sdk.model.namespace.NamespaceInfo)2 NamespaceName (io.nem.symbol.sdk.model.namespace.NamespaceName)2 NamespaceRegistrationType (io.nem.symbol.sdk.model.namespace.NamespaceRegistrationType)2 Observable (io.reactivex.Observable)2