use of io.nem.symbol.sdk.model.metadata.MetadataType in project nem2-sdk-java by nemtech.
the class MosaicMetadataIntegrationTest method searchIntegration.
//
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchIntegration(RepositoryType type) {
BigInteger key = MapperUtils.fromHexToBigInteger("000000000000000A");
Address sourceAddress = Address.createFromEncoded("9852D5EAA9AB038151EEBDD34308B3B2B7D82B92955F298E");
Address targetAddress = Address.createFromEncoded("9852D5EAA9AB038151EEBDD34308B3B2B7D82B92955F298E");
MosaicId mosaicId = new MosaicId("213CED6E6BBA6689");
MetadataType metadataType = MetadataType.MOSAIC;
Page<Metadata> metadataPage = get(getRepositoryFactory(type).createMetadataRepository().search(new MetadataSearchCriteria().scopedMetadataKey(key).targetId(mosaicId).sourceAddress(sourceAddress).targetAddress(targetAddress).metadataType(metadataType)));
System.out.println(type + "\n" + toJson(metadataPage));
}
use of io.nem.symbol.sdk.model.metadata.MetadataType 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()))));
}
Aggregations