@Test public void test_to_search_contract() { InstrumentSearchContract expectedSearchContract = instrumentMapper.toSearchContract(searchDomain()); assertEquals(expectedSearchContract.getId(), searchContract().getId()); assertEquals(expectedSearchContract.getAmount(), searchContract().getAmount()); assertEquals(expectedSearchContract.getBank().getId(), searchContract().getBank().getId()); assertEquals(expectedSearchContract.getBankAccount().getId(), searchContract().getBankAccount().getId()); assertEquals(expectedSearchContract.getBranchName(), searchContract().getBranchName()); assertEquals(expectedSearchContract.getDrawer(), searchContract().getDrawer()); assertEquals(expectedSearchContract.getFinancialStatus().getCode(), searchContract().getFinancialStatus().getCode()); assertEquals(expectedSearchContract.getInstrumentType().getId(), searchContract().getInstrumentType().getId()); assertEquals(expectedSearchContract.getSurrenderReason().getId(), searchContract().getSurrenderReason().getId()); assertEquals(expectedSearchContract.getInstrumentVouchers().iterator().next().getInstrument(), searchContract().getInstrumentVouchers().iterator().next().getInstrument()); assertEquals(expectedSearchContract.getInstrumentVouchers().iterator().next().getVoucherHeaderId(), searchContract().getInstrumentVouchers().iterator().next().getVoucherHeaderId()); assertEquals(expectedSearchContract.getPayee(), searchContract().getPayee()); assertEquals(expectedSearchContract.getSerialNo(), searchContract().getSerialNo()); assertEquals(expectedSearchContract.getTransactionNumber(), searchContract().getTransactionNumber()); assertEquals(expectedSearchContract.getTransactionType(), searchContract().getTransactionType()); assertEquals(expectedSearchContract.getCreatedBy().getId(), searchContract().getCreatedBy().getId()); assertEquals(expectedSearchContract.getLastModifiedBy().getId(), searchContract().getLastModifiedBy().getId()); assertEquals(expectedSearchContract.getTenantId(), searchContract().getTenantId()); assertEquals(expectedSearchContract.getPageSize(), searchContract().getPageSize()); assertEquals(expectedSearchContract.getOffset(), searchContract().getOffset()); }
public InstrumentSearchContract toSearchContract(InstrumentSearch instrumentSearch) { InstrumentSearchContract contract = new InstrumentSearchContract(); contract.setId(instrumentSearch.getId()); contract.setAmount(instrumentSearch.getAmount()); contract.setBank(instrumentSearch.getBank()); contract.setBankAccount(instrumentSearch.getBankAccount()); contract.setBranchName(instrumentSearch.getBranchName()); contract.setDrawer(instrumentSearch.getDrawer()); contract.setFinancialStatus(instrumentSearch.getFinancialStatus()); contract.setRemittanceVoucherId(instrumentSearch.getRemittanceVoucherId()); if (instrumentSearch.getInstrumentType() != null) contract.setInstrumentType(typeMapper.toContract(instrumentSearch.getInstrumentType())); if (instrumentSearch.getSurrenderReason() != null) contract.setSurrenderReason(srMapper.toContract(instrumentSearch.getSurrenderReason())); if (instrumentSearch.getInstrumentVouchers() != null) { List<InstrumentVoucherContract> instrumentVouchers = new ArrayList<>(); if (instrumentSearch.getInstrumentVouchers() != null) for (InstrumentVoucher iv : instrumentSearch.getInstrumentVouchers()) instrumentVouchers .add(InstrumentVoucherContract.builder().instrument(contract.getId()) .voucherHeaderId(iv.getVoucherHeaderId()).receiptHeaderId(iv.getReceiptHeaderId()).build()); contract.setInstrumentVouchers(instrumentVouchers); } contract.setPayee(instrumentSearch.getPayee()); contract.setSerialNo(instrumentSearch.getSerialNo()); contract.setTransactionDate(instrumentSearch.getTransactionDate()); contract.setTransactionNumber(instrumentSearch.getTransactionNumber()); contract.setTransactionType(instrumentSearch.getTransactionType() != null ? TransactionTypeContract.valueOf(instrumentSearch.getTransactionType().name()) : null); contract.setPayinSlipId(instrumentSearch.getPayinSlipId()); contract.setReconciledAmount(instrumentSearch.getReconciledAmount()); contract.setReconciledOn(instrumentSearch.getReconciledOn()); contract.setCreatedBy(instrumentSearch.getCreatedBy()); contract.setCreatedDate(instrumentSearch.getCreatedDate()); contract.setLastModifiedBy(instrumentSearch.getLastModifiedBy()); contract.setLastModifiedDate(instrumentSearch.getLastModifiedDate()); contract.setTenantId(instrumentSearch.getTenantId()); contract.setPageSize(instrumentSearch.getPageSize()); contract.setOffset(instrumentSearch.getOffset()); contract.setSortBy(instrumentSearch.getSortBy()); contract.setIds(instrumentSearch.getIds()); contract.setFinancialStatuses(instrumentSearch.getFinancialStatuses()); contract.setInstrumentTypes(instrumentSearch.getInstrumentTypes()); contract.setTransactionFromDate(instrumentSearch.getTransactionFromDate()); contract.setTransactionToDate(instrumentSearch.getTransactionToDate()); contract.setDeleteReason(instrumentSearch.getDeleteReason()); return contract; }
InstrumentMapper { public InstrumentSearchContract toSearchContract(InstrumentSearch instrumentSearch) { InstrumentSearchContract contract = new InstrumentSearchContract(); contract.setId(instrumentSearch.getId()); contract.setAmount(instrumentSearch.getAmount()); contract.setBank(instrumentSearch.getBank()); contract.setBankAccount(instrumentSearch.getBankAccount()); contract.setBranchName(instrumentSearch.getBranchName()); contract.setDrawer(instrumentSearch.getDrawer()); contract.setFinancialStatus(instrumentSearch.getFinancialStatus()); contract.setRemittanceVoucherId(instrumentSearch.getRemittanceVoucherId()); if (instrumentSearch.getInstrumentType() != null) contract.setInstrumentType(typeMapper.toContract(instrumentSearch.getInstrumentType())); if (instrumentSearch.getSurrenderReason() != null) contract.setSurrenderReason(srMapper.toContract(instrumentSearch.getSurrenderReason())); if (instrumentSearch.getInstrumentVouchers() != null) { List<InstrumentVoucherContract> instrumentVouchers = new ArrayList<>(); if (instrumentSearch.getInstrumentVouchers() != null) for (InstrumentVoucher iv : instrumentSearch.getInstrumentVouchers()) instrumentVouchers .add(InstrumentVoucherContract.builder().instrument(contract.getId()) .voucherHeaderId(iv.getVoucherHeaderId()).receiptHeaderId(iv.getReceiptHeaderId()).build()); contract.setInstrumentVouchers(instrumentVouchers); } contract.setPayee(instrumentSearch.getPayee()); contract.setSerialNo(instrumentSearch.getSerialNo()); contract.setTransactionDate(instrumentSearch.getTransactionDate()); contract.setTransactionNumber(instrumentSearch.getTransactionNumber()); contract.setTransactionType(instrumentSearch.getTransactionType() != null ? TransactionTypeContract.valueOf(instrumentSearch.getTransactionType().name()) : null); contract.setPayinSlipId(instrumentSearch.getPayinSlipId()); contract.setReconciledAmount(instrumentSearch.getReconciledAmount()); contract.setReconciledOn(instrumentSearch.getReconciledOn()); contract.setCreatedBy(instrumentSearch.getCreatedBy()); contract.setCreatedDate(instrumentSearch.getCreatedDate()); contract.setLastModifiedBy(instrumentSearch.getLastModifiedBy()); contract.setLastModifiedDate(instrumentSearch.getLastModifiedDate()); contract.setTenantId(instrumentSearch.getTenantId()); contract.setPageSize(instrumentSearch.getPageSize()); contract.setOffset(instrumentSearch.getOffset()); contract.setSortBy(instrumentSearch.getSortBy()); contract.setIds(instrumentSearch.getIds()); contract.setFinancialStatuses(instrumentSearch.getFinancialStatuses()); contract.setInstrumentTypes(instrumentSearch.getInstrumentTypes()); contract.setTransactionFromDate(instrumentSearch.getTransactionFromDate()); contract.setTransactionToDate(instrumentSearch.getTransactionToDate()); contract.setDeleteReason(instrumentSearch.getDeleteReason()); return contract; } }
InstrumentMapper { public InstrumentSearchContract toSearchContract(InstrumentSearch instrumentSearch) { InstrumentSearchContract contract = new InstrumentSearchContract(); contract.setId(instrumentSearch.getId()); contract.setAmount(instrumentSearch.getAmount()); contract.setBank(instrumentSearch.getBank()); contract.setBankAccount(instrumentSearch.getBankAccount()); contract.setBranchName(instrumentSearch.getBranchName()); contract.setDrawer(instrumentSearch.getDrawer()); contract.setFinancialStatus(instrumentSearch.getFinancialStatus()); contract.setRemittanceVoucherId(instrumentSearch.getRemittanceVoucherId()); if (instrumentSearch.getInstrumentType() != null) contract.setInstrumentType(typeMapper.toContract(instrumentSearch.getInstrumentType())); if (instrumentSearch.getSurrenderReason() != null) contract.setSurrenderReason(srMapper.toContract(instrumentSearch.getSurrenderReason())); if (instrumentSearch.getInstrumentVouchers() != null) { List<InstrumentVoucherContract> instrumentVouchers = new ArrayList<>(); if (instrumentSearch.getInstrumentVouchers() != null) for (InstrumentVoucher iv : instrumentSearch.getInstrumentVouchers()) instrumentVouchers .add(InstrumentVoucherContract.builder().instrument(contract.getId()) .voucherHeaderId(iv.getVoucherHeaderId()).receiptHeaderId(iv.getReceiptHeaderId()).build()); contract.setInstrumentVouchers(instrumentVouchers); } contract.setPayee(instrumentSearch.getPayee()); contract.setSerialNo(instrumentSearch.getSerialNo()); contract.setTransactionDate(instrumentSearch.getTransactionDate()); contract.setTransactionNumber(instrumentSearch.getTransactionNumber()); contract.setTransactionType(instrumentSearch.getTransactionType() != null ? TransactionTypeContract.valueOf(instrumentSearch.getTransactionType().name()) : null); contract.setPayinSlipId(instrumentSearch.getPayinSlipId()); contract.setReconciledAmount(instrumentSearch.getReconciledAmount()); contract.setReconciledOn(instrumentSearch.getReconciledOn()); contract.setCreatedBy(instrumentSearch.getCreatedBy()); contract.setCreatedDate(instrumentSearch.getCreatedDate()); contract.setLastModifiedBy(instrumentSearch.getLastModifiedBy()); contract.setLastModifiedDate(instrumentSearch.getLastModifiedDate()); contract.setTenantId(instrumentSearch.getTenantId()); contract.setPageSize(instrumentSearch.getPageSize()); contract.setOffset(instrumentSearch.getOffset()); contract.setSortBy(instrumentSearch.getSortBy()); contract.setIds(instrumentSearch.getIds()); contract.setFinancialStatuses(instrumentSearch.getFinancialStatuses()); contract.setInstrumentTypes(instrumentSearch.getInstrumentTypes()); contract.setTransactionFromDate(instrumentSearch.getTransactionFromDate()); contract.setTransactionToDate(instrumentSearch.getTransactionToDate()); contract.setDeleteReason(instrumentSearch.getDeleteReason()); return contract; }  }
InstrumentMapper { public InstrumentSearchContract toSearchContract(InstrumentSearch instrumentSearch) { InstrumentSearchContract contract = new InstrumentSearchContract(); contract.setId(instrumentSearch.getId()); contract.setAmount(instrumentSearch.getAmount()); contract.setBank(instrumentSearch.getBank()); contract.setBankAccount(instrumentSearch.getBankAccount()); contract.setBranchName(instrumentSearch.getBranchName()); contract.setDrawer(instrumentSearch.getDrawer()); contract.setFinancialStatus(instrumentSearch.getFinancialStatus()); contract.setRemittanceVoucherId(instrumentSearch.getRemittanceVoucherId()); if (instrumentSearch.getInstrumentType() != null) contract.setInstrumentType(typeMapper.toContract(instrumentSearch.getInstrumentType())); if (instrumentSearch.getSurrenderReason() != null) contract.setSurrenderReason(srMapper.toContract(instrumentSearch.getSurrenderReason())); if (instrumentSearch.getInstrumentVouchers() != null) { List<InstrumentVoucherContract> instrumentVouchers = new ArrayList<>(); if (instrumentSearch.getInstrumentVouchers() != null) for (InstrumentVoucher iv : instrumentSearch.getInstrumentVouchers()) instrumentVouchers .add(InstrumentVoucherContract.builder().instrument(contract.getId()) .voucherHeaderId(iv.getVoucherHeaderId()).receiptHeaderId(iv.getReceiptHeaderId()).build()); contract.setInstrumentVouchers(instrumentVouchers); } contract.setPayee(instrumentSearch.getPayee()); contract.setSerialNo(instrumentSearch.getSerialNo()); contract.setTransactionDate(instrumentSearch.getTransactionDate()); contract.setTransactionNumber(instrumentSearch.getTransactionNumber()); contract.setTransactionType(instrumentSearch.getTransactionType() != null ? TransactionTypeContract.valueOf(instrumentSearch.getTransactionType().name()) : null); contract.setPayinSlipId(instrumentSearch.getPayinSlipId()); contract.setReconciledAmount(instrumentSearch.getReconciledAmount()); contract.setReconciledOn(instrumentSearch.getReconciledOn()); contract.setCreatedBy(instrumentSearch.getCreatedBy()); contract.setCreatedDate(instrumentSearch.getCreatedDate()); contract.setLastModifiedBy(instrumentSearch.getLastModifiedBy()); contract.setLastModifiedDate(instrumentSearch.getLastModifiedDate()); contract.setTenantId(instrumentSearch.getTenantId()); contract.setPageSize(instrumentSearch.getPageSize()); contract.setOffset(instrumentSearch.getOffset()); contract.setSortBy(instrumentSearch.getSortBy()); contract.setIds(instrumentSearch.getIds()); contract.setFinancialStatuses(instrumentSearch.getFinancialStatuses()); contract.setInstrumentTypes(instrumentSearch.getInstrumentTypes()); contract.setTransactionFromDate(instrumentSearch.getTransactionFromDate()); contract.setTransactionToDate(instrumentSearch.getTransactionToDate()); contract.setDeleteReason(instrumentSearch.getDeleteReason()); return contract; }  Instrument toDomain(InstrumentContract contract); InstrumentContract toContract(Instrument instrument); InstrumentSearch toSearchDomain(InstrumentSearchContract contract); InstrumentSearchContract toSearchContract(InstrumentSearch instrumentSearch); }
InstrumentMapper { public InstrumentSearchContract toSearchContract(InstrumentSearch instrumentSearch) { InstrumentSearchContract contract = new InstrumentSearchContract(); contract.setId(instrumentSearch.getId()); contract.setAmount(instrumentSearch.getAmount()); contract.setBank(instrumentSearch.getBank()); contract.setBankAccount(instrumentSearch.getBankAccount()); contract.setBranchName(instrumentSearch.getBranchName()); contract.setDrawer(instrumentSearch.getDrawer()); contract.setFinancialStatus(instrumentSearch.getFinancialStatus()); contract.setRemittanceVoucherId(instrumentSearch.getRemittanceVoucherId()); if (instrumentSearch.getInstrumentType() != null) contract.setInstrumentType(typeMapper.toContract(instrumentSearch.getInstrumentType())); if (instrumentSearch.getSurrenderReason() != null) contract.setSurrenderReason(srMapper.toContract(instrumentSearch.getSurrenderReason())); if (instrumentSearch.getInstrumentVouchers() != null) { List<InstrumentVoucherContract> instrumentVouchers = new ArrayList<>(); if (instrumentSearch.getInstrumentVouchers() != null) for (InstrumentVoucher iv : instrumentSearch.getInstrumentVouchers()) instrumentVouchers .add(InstrumentVoucherContract.builder().instrument(contract.getId()) .voucherHeaderId(iv.getVoucherHeaderId()).receiptHeaderId(iv.getReceiptHeaderId()).build()); contract.setInstrumentVouchers(instrumentVouchers); } contract.setPayee(instrumentSearch.getPayee()); contract.setSerialNo(instrumentSearch.getSerialNo()); contract.setTransactionDate(instrumentSearch.getTransactionDate()); contract.setTransactionNumber(instrumentSearch.getTransactionNumber()); contract.setTransactionType(instrumentSearch.getTransactionType() != null ? TransactionTypeContract.valueOf(instrumentSearch.getTransactionType().name()) : null); contract.setPayinSlipId(instrumentSearch.getPayinSlipId()); contract.setReconciledAmount(instrumentSearch.getReconciledAmount()); contract.setReconciledOn(instrumentSearch.getReconciledOn()); contract.setCreatedBy(instrumentSearch.getCreatedBy()); contract.setCreatedDate(instrumentSearch.getCreatedDate()); contract.setLastModifiedBy(instrumentSearch.getLastModifiedBy()); contract.setLastModifiedDate(instrumentSearch.getLastModifiedDate()); contract.setTenantId(instrumentSearch.getTenantId()); contract.setPageSize(instrumentSearch.getPageSize()); contract.setOffset(instrumentSearch.getOffset()); contract.setSortBy(instrumentSearch.getSortBy()); contract.setIds(instrumentSearch.getIds()); contract.setFinancialStatuses(instrumentSearch.getFinancialStatuses()); contract.setInstrumentTypes(instrumentSearch.getInstrumentTypes()); contract.setTransactionFromDate(instrumentSearch.getTransactionFromDate()); contract.setTransactionToDate(instrumentSearch.getTransactionToDate()); contract.setDeleteReason(instrumentSearch.getDeleteReason()); return contract; }  Instrument toDomain(InstrumentContract contract); InstrumentContract toContract(Instrument instrument); InstrumentSearch toSearchDomain(InstrumentSearchContract contract); InstrumentSearchContract toSearchContract(InstrumentSearch instrumentSearch);  }