Search in sources :

Example 1 with MosaicRestrictionEntryTypeEnum

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

the class RestrictionMosaicRepositoryOkHttpImpl method search.

@Override
public Observable<Page<MosaicRestriction<?>>> search(MosaicRestrictionSearchCriteria criteria) {
    String mosaicId = criteria.getMosaicId() == null ? null : criteria.getMosaicId().getIdAsHex();
    MosaicRestrictionEntryTypeEnum entryType = criteria.getEntryType() == null ? null : MosaicRestrictionEntryTypeEnum.fromValue(criteria.getEntryType().getValue());
    String targetAddress = toDto(criteria.getTargetAddress());
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());
    Callable<MosaicRestrictionsPage> callback = () -> getClient().searchMosaicRestrictions(mosaicId, entryType, targetAddress, pageSize, pageNumber, offset, order);
    return call(callback, page -> toPage(page.getPagination(), page.getData().stream().map(this::toMosaicRestriction).collect(Collectors.toList())));
}
Also used : BigInteger(java.math.BigInteger) Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) MosaicRestrictionEntryTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicRestrictionEntryTypeEnum) MosaicRestrictionsPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicRestrictionsPage)

Aggregations

MosaicRestrictionEntryTypeEnum (io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicRestrictionEntryTypeEnum)1 MosaicRestrictionsPage (io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicRestrictionsPage)1 Order (io.nem.symbol.sdk.openapi.okhttp_gson.model.Order)1 BigInteger (java.math.BigInteger)1