@Test public void test_to_domain() { Instrument expectedDomain = instrumentMapper.toDomain(contract()); assertEquals(expectedDomain.getId(), domain().getId()); assertEquals(expectedDomain.getAmount(), domain().getAmount()); assertEquals(expectedDomain.getBank().getId(), domain().getBank().getId()); assertEquals(expectedDomain.getBankAccount().getId(), domain().getBankAccount().getId()); assertEquals(expectedDomain.getBranchName(), domain().getBranchName()); assertEquals(expectedDomain.getDrawer(), domain().getDrawer()); assertEquals(expectedDomain.getFinancialStatus().getCode(), domain().getFinancialStatus().getCode()); assertEquals(expectedDomain.getInstrumentType().getId(), domain().getInstrumentType().getId()); assertEquals(expectedDomain.getSurrenderReason().getId(), domain().getSurrenderReason().getId()); assertEquals(expectedDomain.getInstrumentVouchers().iterator().next().getInstrument().getId(), domain().getInstrumentVouchers().iterator().next().getInstrument().getId()); assertEquals(expectedDomain.getInstrumentVouchers().iterator().next().getVoucherHeaderId(), domain().getInstrumentVouchers().iterator().next().getVoucherHeaderId()); assertEquals(expectedDomain.getPayee(), domain().getPayee()); assertEquals(expectedDomain.getSerialNo(), domain().getSerialNo()); assertEquals(expectedDomain.getTransactionNumber(), domain().getTransactionNumber()); assertEquals(expectedDomain.getTransactionType(), domain().getTransactionType()); assertEquals(expectedDomain.getCreatedBy().getId(), domain().getCreatedBy().getId()); assertEquals(expectedDomain.getLastModifiedBy().getId(), domain().getLastModifiedBy().getId()); assertEquals(expectedDomain.getTenantId(), domain().getTenantId()); }
public Instrument toDomain(InstrumentContract contract) { Instrument instrument = new Instrument(); instrument.setId(contract.getId()); instrument.setAmount(contract.getAmount()); instrument.setBank(contract.getBank()); instrument.setBankAccount(contract.getBankAccount()); instrument.setBranchName(contract.getBranchName()); instrument.setDrawer(contract.getDrawer()); instrument.setFinancialStatus(contract.getFinancialStatus()); instrument.setRemittanceVoucherId(contract.getRemittanceVoucherId()); if (contract.getInstrumentType() != null) instrument.setInstrumentType(typeMapper.toDomain(contract.getInstrumentType())); if (contract.getSurrenderReason() != null) instrument.setSurrenderReason(srMapper.toDomain(contract.getSurrenderReason())); if (contract.getInstrumentVouchers() != null) { List<InstrumentVoucher> instrumentVouchers = new ArrayList<>(); if (contract.getInstrumentVouchers() != null) for (InstrumentVoucherContract ivc : contract.getInstrumentVouchers()) instrumentVouchers.add(InstrumentVoucher.builder().voucherHeaderId(ivc.getVoucherHeaderId()) .receiptHeaderId(ivc.getReceiptHeaderId()).build()); instrument.setInstrumentVouchers(instrumentVouchers); } instrument.setPayee(contract.getPayee()); instrument.setSerialNo(contract.getSerialNo()); instrument.setTransactionDate(contract.getTransactionDate()); instrument.setTransactionNumber(contract.getTransactionNumber()); instrument.setTransactionType(contract.getTransactionType() != null ? TransactionType.valueOf(contract.getTransactionType().name()) : null); instrument.setPayinSlipId(contract.getPayinSlipId()); instrument.setReconciledAmount(contract.getReconciledAmount()); instrument.setReconciledOn(contract.getReconciledOn()); instrument.setCreatedBy(contract.getCreatedBy()); instrument.setCreatedDate(contract.getCreatedDate()); instrument.setLastModifiedBy(contract.getLastModifiedBy()); instrument.setLastModifiedDate(contract.getLastModifiedDate()); instrument.setTenantId(contract.getTenantId()); instrument.setDeleteReason(contract.getDeleteReason()); for (InstrumentVoucher iv : instrument.getInstrumentVouchers()) { iv.setInstrument(instrument); iv.setTenantId(instrument.getTenantId()); } return instrument; }
InstrumentMapper { public Instrument toDomain(InstrumentContract contract) { Instrument instrument = new Instrument(); instrument.setId(contract.getId()); instrument.setAmount(contract.getAmount()); instrument.setBank(contract.getBank()); instrument.setBankAccount(contract.getBankAccount()); instrument.setBranchName(contract.getBranchName()); instrument.setDrawer(contract.getDrawer()); instrument.setFinancialStatus(contract.getFinancialStatus()); instrument.setRemittanceVoucherId(contract.getRemittanceVoucherId()); if (contract.getInstrumentType() != null) instrument.setInstrumentType(typeMapper.toDomain(contract.getInstrumentType())); if (contract.getSurrenderReason() != null) instrument.setSurrenderReason(srMapper.toDomain(contract.getSurrenderReason())); if (contract.getInstrumentVouchers() != null) { List<InstrumentVoucher> instrumentVouchers = new ArrayList<>(); if (contract.getInstrumentVouchers() != null) for (InstrumentVoucherContract ivc : contract.getInstrumentVouchers()) instrumentVouchers.add(InstrumentVoucher.builder().voucherHeaderId(ivc.getVoucherHeaderId()) .receiptHeaderId(ivc.getReceiptHeaderId()).build()); instrument.setInstrumentVouchers(instrumentVouchers); } instrument.setPayee(contract.getPayee()); instrument.setSerialNo(contract.getSerialNo()); instrument.setTransactionDate(contract.getTransactionDate()); instrument.setTransactionNumber(contract.getTransactionNumber()); instrument.setTransactionType(contract.getTransactionType() != null ? TransactionType.valueOf(contract.getTransactionType().name()) : null); instrument.setPayinSlipId(contract.getPayinSlipId()); instrument.setReconciledAmount(contract.getReconciledAmount()); instrument.setReconciledOn(contract.getReconciledOn()); instrument.setCreatedBy(contract.getCreatedBy()); instrument.setCreatedDate(contract.getCreatedDate()); instrument.setLastModifiedBy(contract.getLastModifiedBy()); instrument.setLastModifiedDate(contract.getLastModifiedDate()); instrument.setTenantId(contract.getTenantId()); instrument.setDeleteReason(contract.getDeleteReason()); for (InstrumentVoucher iv : instrument.getInstrumentVouchers()) { iv.setInstrument(instrument); iv.setTenantId(instrument.getTenantId()); } return instrument; } }
InstrumentMapper { public Instrument toDomain(InstrumentContract contract) { Instrument instrument = new Instrument(); instrument.setId(contract.getId()); instrument.setAmount(contract.getAmount()); instrument.setBank(contract.getBank()); instrument.setBankAccount(contract.getBankAccount()); instrument.setBranchName(contract.getBranchName()); instrument.setDrawer(contract.getDrawer()); instrument.setFinancialStatus(contract.getFinancialStatus()); instrument.setRemittanceVoucherId(contract.getRemittanceVoucherId()); if (contract.getInstrumentType() != null) instrument.setInstrumentType(typeMapper.toDomain(contract.getInstrumentType())); if (contract.getSurrenderReason() != null) instrument.setSurrenderReason(srMapper.toDomain(contract.getSurrenderReason())); if (contract.getInstrumentVouchers() != null) { List<InstrumentVoucher> instrumentVouchers = new ArrayList<>(); if (contract.getInstrumentVouchers() != null) for (InstrumentVoucherContract ivc : contract.getInstrumentVouchers()) instrumentVouchers.add(InstrumentVoucher.builder().voucherHeaderId(ivc.getVoucherHeaderId()) .receiptHeaderId(ivc.getReceiptHeaderId()).build()); instrument.setInstrumentVouchers(instrumentVouchers); } instrument.setPayee(contract.getPayee()); instrument.setSerialNo(contract.getSerialNo()); instrument.setTransactionDate(contract.getTransactionDate()); instrument.setTransactionNumber(contract.getTransactionNumber()); instrument.setTransactionType(contract.getTransactionType() != null ? TransactionType.valueOf(contract.getTransactionType().name()) : null); instrument.setPayinSlipId(contract.getPayinSlipId()); instrument.setReconciledAmount(contract.getReconciledAmount()); instrument.setReconciledOn(contract.getReconciledOn()); instrument.setCreatedBy(contract.getCreatedBy()); instrument.setCreatedDate(contract.getCreatedDate()); instrument.setLastModifiedBy(contract.getLastModifiedBy()); instrument.setLastModifiedDate(contract.getLastModifiedDate()); instrument.setTenantId(contract.getTenantId()); instrument.setDeleteReason(contract.getDeleteReason()); for (InstrumentVoucher iv : instrument.getInstrumentVouchers()) { iv.setInstrument(instrument); iv.setTenantId(instrument.getTenantId()); } return instrument; }  }
InstrumentMapper { public Instrument toDomain(InstrumentContract contract) { Instrument instrument = new Instrument(); instrument.setId(contract.getId()); instrument.setAmount(contract.getAmount()); instrument.setBank(contract.getBank()); instrument.setBankAccount(contract.getBankAccount()); instrument.setBranchName(contract.getBranchName()); instrument.setDrawer(contract.getDrawer()); instrument.setFinancialStatus(contract.getFinancialStatus()); instrument.setRemittanceVoucherId(contract.getRemittanceVoucherId()); if (contract.getInstrumentType() != null) instrument.setInstrumentType(typeMapper.toDomain(contract.getInstrumentType())); if (contract.getSurrenderReason() != null) instrument.setSurrenderReason(srMapper.toDomain(contract.getSurrenderReason())); if (contract.getInstrumentVouchers() != null) { List<InstrumentVoucher> instrumentVouchers = new ArrayList<>(); if (contract.getInstrumentVouchers() != null) for (InstrumentVoucherContract ivc : contract.getInstrumentVouchers()) instrumentVouchers.add(InstrumentVoucher.builder().voucherHeaderId(ivc.getVoucherHeaderId()) .receiptHeaderId(ivc.getReceiptHeaderId()).build()); instrument.setInstrumentVouchers(instrumentVouchers); } instrument.setPayee(contract.getPayee()); instrument.setSerialNo(contract.getSerialNo()); instrument.setTransactionDate(contract.getTransactionDate()); instrument.setTransactionNumber(contract.getTransactionNumber()); instrument.setTransactionType(contract.getTransactionType() != null ? TransactionType.valueOf(contract.getTransactionType().name()) : null); instrument.setPayinSlipId(contract.getPayinSlipId()); instrument.setReconciledAmount(contract.getReconciledAmount()); instrument.setReconciledOn(contract.getReconciledOn()); instrument.setCreatedBy(contract.getCreatedBy()); instrument.setCreatedDate(contract.getCreatedDate()); instrument.setLastModifiedBy(contract.getLastModifiedBy()); instrument.setLastModifiedDate(contract.getLastModifiedDate()); instrument.setTenantId(contract.getTenantId()); instrument.setDeleteReason(contract.getDeleteReason()); for (InstrumentVoucher iv : instrument.getInstrumentVouchers()) { iv.setInstrument(instrument); iv.setTenantId(instrument.getTenantId()); } return instrument; }  Instrument toDomain(InstrumentContract contract); InstrumentContract toContract(Instrument instrument); InstrumentSearch toSearchDomain(InstrumentSearchContract contract); InstrumentSearchContract toSearchContract(InstrumentSearch instrumentSearch); }
InstrumentMapper { public Instrument toDomain(InstrumentContract contract) { Instrument instrument = new Instrument(); instrument.setId(contract.getId()); instrument.setAmount(contract.getAmount()); instrument.setBank(contract.getBank()); instrument.setBankAccount(contract.getBankAccount()); instrument.setBranchName(contract.getBranchName()); instrument.setDrawer(contract.getDrawer()); instrument.setFinancialStatus(contract.getFinancialStatus()); instrument.setRemittanceVoucherId(contract.getRemittanceVoucherId()); if (contract.getInstrumentType() != null) instrument.setInstrumentType(typeMapper.toDomain(contract.getInstrumentType())); if (contract.getSurrenderReason() != null) instrument.setSurrenderReason(srMapper.toDomain(contract.getSurrenderReason())); if (contract.getInstrumentVouchers() != null) { List<InstrumentVoucher> instrumentVouchers = new ArrayList<>(); if (contract.getInstrumentVouchers() != null) for (InstrumentVoucherContract ivc : contract.getInstrumentVouchers()) instrumentVouchers.add(InstrumentVoucher.builder().voucherHeaderId(ivc.getVoucherHeaderId()) .receiptHeaderId(ivc.getReceiptHeaderId()).build()); instrument.setInstrumentVouchers(instrumentVouchers); } instrument.setPayee(contract.getPayee()); instrument.setSerialNo(contract.getSerialNo()); instrument.setTransactionDate(contract.getTransactionDate()); instrument.setTransactionNumber(contract.getTransactionNumber()); instrument.setTransactionType(contract.getTransactionType() != null ? TransactionType.valueOf(contract.getTransactionType().name()) : null); instrument.setPayinSlipId(contract.getPayinSlipId()); instrument.setReconciledAmount(contract.getReconciledAmount()); instrument.setReconciledOn(contract.getReconciledOn()); instrument.setCreatedBy(contract.getCreatedBy()); instrument.setCreatedDate(contract.getCreatedDate()); instrument.setLastModifiedBy(contract.getLastModifiedBy()); instrument.setLastModifiedDate(contract.getLastModifiedDate()); instrument.setTenantId(contract.getTenantId()); instrument.setDeleteReason(contract.getDeleteReason()); for (InstrumentVoucher iv : instrument.getInstrumentVouchers()) { iv.setInstrument(instrument); iv.setTenantId(instrument.getTenantId()); } return instrument; }  Instrument toDomain(InstrumentContract contract); InstrumentContract toContract(Instrument instrument); InstrumentSearch toSearchDomain(InstrumentSearchContract contract); InstrumentSearchContract toSearchContract(InstrumentSearch instrumentSearch);  }