use of io.nem.symbol.sdk.openapi.okhttp_gson.model.EmbeddedTransactionInfoDTO in project nem2-sdk-java by nemtech.
the class AbstractTransactionMapper method mapToFactoryFromDto.
@Override
public TransactionFactory<T> mapToFactoryFromDto(Object object) {
if (object instanceof EmbeddedTransactionInfoDTO) {
EmbeddedTransactionInfoDTO transactionInfoDTO = (EmbeddedTransactionInfoDTO) object;
TransactionInfo transactionInfo = createTransactionInfo(transactionInfoDTO.getMeta(), transactionInfoDTO.getId());
return createFactory(transactionInfo, transactionInfoDTO.getTransaction());
}
TransactionInfoDTO transactionInfoDTO = this.jsonHelper.convert(object, TransactionInfoDTO.class);
TransactionInfo transactionInfo = createTransactionInfo(transactionInfoDTO.getMeta(), transactionInfoDTO.getId());
return createFactory(transactionInfo, transactionInfoDTO.getTransaction());
}
use of io.nem.symbol.sdk.openapi.okhttp_gson.model.EmbeddedTransactionInfoDTO in project nem2-sdk-java by nemtech.
the class AbstractTransactionMapper method mapToDto.
@Override
public Object mapToDto(Transaction transaction, Boolean embedded) {
if (transaction.getTransactionInfo().flatMap(TransactionInfo::getAggregateHash).isPresent() || Boolean.TRUE.equals(embedded)) {
EmbeddedTransactionInfoDTO dto = new EmbeddedTransactionInfoDTO();
dto.setMeta(createTransactionInfoEmbedded(transaction));
dto.setId(transaction.getRecordId().orElse(null));
dto.setTransaction(mapTransaction(transaction, true));
return dto;
} else {
TransactionInfoDTO dto = new TransactionInfoDTO();
dto.setMeta(createTransactionInfo(transaction));
dto.setId(transaction.getRecordId().orElse(null));
dto.setTransaction(mapTransaction(transaction, false));
return dto;
}
}
Aggregations