@Test public void test_to_contract() { final BudgetContract expectedContract = budgetMapper.toContract(domain()); assertEquals(expectedContract.getId(), contract().getId()); assertEquals(expectedContract.getName(), contract().getName()); assertEquals(expectedContract.getFinancialYear().getId(), contract().getFinancialYear().getId()); assertEquals(expectedContract.getEstimationType(), contract().getEstimationType()); assertEquals(expectedContract.getParent().getId(), contract().getParent().getId()); assertEquals(expectedContract.getReferenceBudget().getId(), contract().getReferenceBudget().getId()); assertEquals(expectedContract.getDescription(), contract().getDescription()); assertEquals(expectedContract.getActive(), contract().getActive()); assertEquals(expectedContract.getPrimaryBudget(), contract().getPrimaryBudget()); assertEquals(expectedContract.getMaterializedPath(), contract().getMaterializedPath()); assertEquals(expectedContract.getDocumentNumber(), contract().getDocumentNumber()); assertEquals(expectedContract.getStatus().getId(), contract().getStatus().getId()); assertEquals(expectedContract.getCreatedBy().getId(), contract().getCreatedBy().getId()); assertEquals(expectedContract.getLastModifiedBy().getId(), contract().getLastModifiedBy().getId()); assertEquals(expectedContract.getTenantId(), contract().getTenantId()); }
public BudgetContract toContract(final Budget budget) { final BudgetContract contract = new BudgetContract(); contract.setId(budget.getId()); contract.setName(budget.getName()); if (budget.getFinancialYear() != null) contract.setFinancialYear(budget.getFinancialYear()); contract.setEstimationType( budget.getEstimationType() != null ? EstimationTypeContract.valueOf(budget.getEstimationType().name()) : null); if (budget.getParent() != null) contract.setParent(toContract(budget.getParent())); contract.setDescription(budget.getDescription()); contract.setActive(budget.getActive()); contract.setPrimaryBudget(budget.getPrimaryBudget()); contract.setMaterializedPath(budget.getMaterializedPath()); if (budget.getReferenceBudget() != null) contract.setReferenceBudget(toContract(budget.getReferenceBudget())); contract.setDocumentNumber(budget.getDocumentNumber()); if (budget.getStatus() != null) contract.setStatus(FinancialStatusContract.builder().id(budget.getStatus().getId()) .code(budget.getStatus().getCode()).description(budget.getStatus().getDescription()) .moduleType(budget.getStatus().getModuleType()).build()); contract.setCreatedBy(budget.getCreatedBy()); contract.setCreatedDate(budget.getCreatedDate()); contract.setLastModifiedBy(budget.getLastModifiedBy()); contract.setLastModifiedDate(budget.getLastModifiedDate()); contract.setTenantId(budget.getTenantId()); return contract; }
BudgetMapper { public BudgetContract toContract(final Budget budget) { final BudgetContract contract = new BudgetContract(); contract.setId(budget.getId()); contract.setName(budget.getName()); if (budget.getFinancialYear() != null) contract.setFinancialYear(budget.getFinancialYear()); contract.setEstimationType( budget.getEstimationType() != null ? EstimationTypeContract.valueOf(budget.getEstimationType().name()) : null); if (budget.getParent() != null) contract.setParent(toContract(budget.getParent())); contract.setDescription(budget.getDescription()); contract.setActive(budget.getActive()); contract.setPrimaryBudget(budget.getPrimaryBudget()); contract.setMaterializedPath(budget.getMaterializedPath()); if (budget.getReferenceBudget() != null) contract.setReferenceBudget(toContract(budget.getReferenceBudget())); contract.setDocumentNumber(budget.getDocumentNumber()); if (budget.getStatus() != null) contract.setStatus(FinancialStatusContract.builder().id(budget.getStatus().getId()) .code(budget.getStatus().getCode()).description(budget.getStatus().getDescription()) .moduleType(budget.getStatus().getModuleType()).build()); contract.setCreatedBy(budget.getCreatedBy()); contract.setCreatedDate(budget.getCreatedDate()); contract.setLastModifiedBy(budget.getLastModifiedBy()); contract.setLastModifiedDate(budget.getLastModifiedDate()); contract.setTenantId(budget.getTenantId()); return contract; } }
BudgetMapper { public BudgetContract toContract(final Budget budget) { final BudgetContract contract = new BudgetContract(); contract.setId(budget.getId()); contract.setName(budget.getName()); if (budget.getFinancialYear() != null) contract.setFinancialYear(budget.getFinancialYear()); contract.setEstimationType( budget.getEstimationType() != null ? EstimationTypeContract.valueOf(budget.getEstimationType().name()) : null); if (budget.getParent() != null) contract.setParent(toContract(budget.getParent())); contract.setDescription(budget.getDescription()); contract.setActive(budget.getActive()); contract.setPrimaryBudget(budget.getPrimaryBudget()); contract.setMaterializedPath(budget.getMaterializedPath()); if (budget.getReferenceBudget() != null) contract.setReferenceBudget(toContract(budget.getReferenceBudget())); contract.setDocumentNumber(budget.getDocumentNumber()); if (budget.getStatus() != null) contract.setStatus(FinancialStatusContract.builder().id(budget.getStatus().getId()) .code(budget.getStatus().getCode()).description(budget.getStatus().getDescription()) .moduleType(budget.getStatus().getModuleType()).build()); contract.setCreatedBy(budget.getCreatedBy()); contract.setCreatedDate(budget.getCreatedDate()); contract.setLastModifiedBy(budget.getLastModifiedBy()); contract.setLastModifiedDate(budget.getLastModifiedDate()); contract.setTenantId(budget.getTenantId()); return contract; }  }
BudgetMapper { public BudgetContract toContract(final Budget budget) { final BudgetContract contract = new BudgetContract(); contract.setId(budget.getId()); contract.setName(budget.getName()); if (budget.getFinancialYear() != null) contract.setFinancialYear(budget.getFinancialYear()); contract.setEstimationType( budget.getEstimationType() != null ? EstimationTypeContract.valueOf(budget.getEstimationType().name()) : null); if (budget.getParent() != null) contract.setParent(toContract(budget.getParent())); contract.setDescription(budget.getDescription()); contract.setActive(budget.getActive()); contract.setPrimaryBudget(budget.getPrimaryBudget()); contract.setMaterializedPath(budget.getMaterializedPath()); if (budget.getReferenceBudget() != null) contract.setReferenceBudget(toContract(budget.getReferenceBudget())); contract.setDocumentNumber(budget.getDocumentNumber()); if (budget.getStatus() != null) contract.setStatus(FinancialStatusContract.builder().id(budget.getStatus().getId()) .code(budget.getStatus().getCode()).description(budget.getStatus().getDescription()) .moduleType(budget.getStatus().getModuleType()).build()); contract.setCreatedBy(budget.getCreatedBy()); contract.setCreatedDate(budget.getCreatedDate()); contract.setLastModifiedBy(budget.getLastModifiedBy()); contract.setLastModifiedDate(budget.getLastModifiedDate()); contract.setTenantId(budget.getTenantId()); return contract; }  Budget toDomain(final BudgetContract contract); BudgetContract toContract(final Budget budget); BudgetSearch toSearchDomain(final BudgetSearchContract contract); BudgetSearchContract toSearchContract(final BudgetSearch budgetSearch); }
BudgetMapper { public BudgetContract toContract(final Budget budget) { final BudgetContract contract = new BudgetContract(); contract.setId(budget.getId()); contract.setName(budget.getName()); if (budget.getFinancialYear() != null) contract.setFinancialYear(budget.getFinancialYear()); contract.setEstimationType( budget.getEstimationType() != null ? EstimationTypeContract.valueOf(budget.getEstimationType().name()) : null); if (budget.getParent() != null) contract.setParent(toContract(budget.getParent())); contract.setDescription(budget.getDescription()); contract.setActive(budget.getActive()); contract.setPrimaryBudget(budget.getPrimaryBudget()); contract.setMaterializedPath(budget.getMaterializedPath()); if (budget.getReferenceBudget() != null) contract.setReferenceBudget(toContract(budget.getReferenceBudget())); contract.setDocumentNumber(budget.getDocumentNumber()); if (budget.getStatus() != null) contract.setStatus(FinancialStatusContract.builder().id(budget.getStatus().getId()) .code(budget.getStatus().getCode()).description(budget.getStatus().getDescription()) .moduleType(budget.getStatus().getModuleType()).build()); contract.setCreatedBy(budget.getCreatedBy()); contract.setCreatedDate(budget.getCreatedDate()); contract.setLastModifiedBy(budget.getLastModifiedBy()); contract.setLastModifiedDate(budget.getLastModifiedDate()); contract.setTenantId(budget.getTenantId()); return contract; }  Budget toDomain(final BudgetContract contract); BudgetContract toContract(final Budget budget); BudgetSearch toSearchDomain(final BudgetSearchContract contract); BudgetSearchContract toSearchContract(final BudgetSearch budgetSearch);  }