From 6b2ec54a31e79d2ec00a534c3bca0ef8e14356a3 Mon Sep 17 00:00:00 2001 From: Keith Woodlock Date: Wed, 5 Sep 2012 14:08:50 +0100 Subject: [PATCH] MIFOSX-32: start with modifing loan account data returned from get for use in the submit loan application and modify loan application flows. --- .../platform/api/LoansApiResource.java | 4 +- .../platform/api/data/LoanAccountData.java | 475 +++++++----------- .../api/data/LoanBasicDetailsData.java | 407 ++++++--------- .../GoogleGsonApiJsonSerializerService.java | 5 +- .../service/LoanReadPlatformServiceImpl.java | 21 +- 5 files changed, 365 insertions(+), 547 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/LoansApiResource.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/LoansApiResource.java index d3c123267..59828fccb 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/LoansApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/LoansApiResource.java @@ -103,7 +103,9 @@ public class LoansApiResource { @Context final UriInfo uriInfo) { Set typicalResponseParameters = new HashSet( - Arrays.asList("id", "externalId", "fundId", "fundName", "loanProductId", "loanProductName", "principal", "inArrearsTolerance", "numberOfRepayments", + Arrays.asList("id", "externalId", "clientId", "clientName", "fundId", "fundName", "loanProductId", "loanProductName", "loanProductDescription", + "currency", + "principal", "inArrearsTolerance", "numberOfRepayments", "repaymentEvery", "interestRatePerPeriod", "annualInterestRate", "repaymentFrequencyType", "interestRateFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType", "submittedOnDate", "approvedOnDate", "expectedDisbursementDate", "actualDisbursementDate", diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/data/LoanAccountData.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/data/LoanAccountData.java index 1aa92c244..759194839 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/data/LoanAccountData.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/data/LoanAccountData.java @@ -5,61 +5,65 @@ import java.util.Collection; import org.joda.time.LocalDate; +/** + * Immutable data object representing loan account data. + */ public class LoanAccountData { - private Long id; - private String externalId; - private Long fundId; - private String fundName; - private Long loanProductId; - private String loanProductName; + private final Long id; + private final String externalId; + private final Long clientId; + private final String clientName; + private final Long loanProductId; + private final String loanProductName; + private final String loanProductDescription; + private final Integer lifeCycleStatusId; + private final String lifeCycleStatusText; + private final LocalDate lifeCycleStatusDate; + + private final Long fundId; + private final String fundName; - private LocalDate submittedOnDate; - private LocalDate approvedOnDate; - private LocalDate expectedDisbursementDate; - private LocalDate actualDisbursementDate; - private LocalDate expectedFirstRepaymentOnDate; - private LocalDate interestChargedFromDate; - private LocalDate closedOnDate; - private LocalDate expectedMaturityDate; + private final LocalDate submittedOnDate; + private final LocalDate approvedOnDate; + private final LocalDate expectedDisbursementDate; + private final LocalDate actualDisbursementDate; + private final LocalDate expectedFirstRepaymentOnDate; + private final LocalDate interestChargedFromDate; + private final LocalDate closedOnDate; + private final LocalDate expectedMaturityDate; - private MoneyData principal; - private MoneyData inArrearsTolerance; + private final CurrencyData currency; + private final MoneyData principal; + private final MoneyData inArrearsTolerance; - private Integer numberOfRepayments; - private Integer repaymentEvery; - private BigDecimal interestRatePerPeriod; - private BigDecimal annualInterestRate; + private final Integer numberOfRepayments; + private final Integer repaymentEvery; + private final BigDecimal interestRatePerPeriod; + private final BigDecimal annualInterestRate; - private EnumOptionData repaymentFrequencyType; - private EnumOptionData interestRateFrequencyType; - private EnumOptionData amortizationType; - private EnumOptionData interestType; - private EnumOptionData interestCalculationPeriodType; + private final EnumOptionData repaymentFrequencyType; + private final EnumOptionData interestRateFrequencyType; + private final EnumOptionData amortizationType; + private final EnumOptionData interestType; + private final EnumOptionData interestCalculationPeriodType; - private Integer lifeCycleStatusId; - private String lifeCycleStatusText; - private LocalDate lifeCycleStatusDate; + private final LoanAccountSummaryData summary; + private final Collection repaymentSchedule; + private final Collection loanRepayments; - private LoanAccountSummaryData summary; - private Collection repaymentSchedule; - private Collection loanRepayments; + private final LoanPermissionData permissions; - private LoanPermissionData permissions; + private final LoanConvenienceData convenienceData; + private Collection charges; - private LoanConvenienceData convenienceData; - - private Collection charges; - - protected LoanAccountData() { - // - } - - public LoanAccountData(LoanBasicDetailsData basicDetails, - LoanAccountSummaryData summary, - Collection repaymentSchedule, - Collection loanRepayments, - LoanPermissionData permissions, Collection charges) { + public LoanAccountData( + final LoanBasicDetailsData basicDetails, + final LoanAccountSummaryData summary, + final Collection repaymentSchedule, + final Collection loanRepayments, + final LoanPermissionData permissions, + final Collection charges) { this.summary = summary; this.repaymentSchedule = repaymentSchedule; this.loanRepayments = loanRepayments; @@ -85,10 +89,14 @@ public class LoanAccountData { this.id = basicDetails.getId(); this.externalId = basicDetails.getExternalId(); - this.fundId = basicDetails.getFundId(); - this.fundName = basicDetails.getFundName(); + this.clientId = basicDetails.getClientId(); + this.clientName = basicDetails.getClientName(); this.loanProductId = basicDetails.getLoanProductId(); this.loanProductName = basicDetails.getLoanProductName(); + this.loanProductDescription = basicDetails.getLoanProductDescription(); + this.fundId = basicDetails.getFundId(); + this.fundName = basicDetails.getFundName(); + this.submittedOnDate = basicDetails.getSubmittedOnDate(); this.approvedOnDate = basicDetails.getApprovedOnDate(); this.expectedDisbursementDate = basicDetails @@ -100,6 +108,8 @@ public class LoanAccountData { .getExpectedFirstRepaymentOnDate(); this.interestChargedFromDate = basicDetails .getInterestChargedFromDate(); + + this.currency = basicDetails.getCurrency(); this.principal = basicDetails.getPrincipal(); this.inArrearsTolerance = basicDetails.getInArrearsTolerance(); this.numberOfRepayments = basicDetails.getNumberOfRepayments(); @@ -118,277 +128,156 @@ public class LoanAccountData { this.lifeCycleStatusDate = basicDetails.getLifeCycleStatusDate(); } - public LoanConvenienceData getConvenienceData() { - return convenienceData; - } - - public void setConvenienceData(LoanConvenienceData convenienceData) { - this.convenienceData = convenienceData; - } - - public LoanPermissionData getPermissions() { - return permissions; - } - - public void setPermissions(LoanPermissionData permissions) { - this.permissions = permissions; - } - - public LoanAccountSummaryData getSummary() { - return summary; - } - - public void setSummary(LoanAccountSummaryData summary) { - this.summary = summary; - } - - public Collection getRepaymentSchedule() { - return repaymentSchedule; - } - - public void setRepaymentSchedule( - Collection repaymentSchedule) { - this.repaymentSchedule = repaymentSchedule; - } - - public Collection getLoanRepayments() { - return loanRepayments; - } - - public void setLoanRepayments( - Collection loanRepayments) { - this.loanRepayments = loanRepayments; - } - public Long getId() { return id; } - public void setId(Long id) { - this.id = id; - } - public String getExternalId() { return externalId; } - public void setExternalId(String externalId) { - this.externalId = externalId; + public Long getClientId() { + return clientId; } - public String getLoanProductName() { - return loanProductName; - } - - public void setLoanProductName(String loanProductName) { - this.loanProductName = loanProductName; - } - - public LocalDate getSubmittedOnDate() { - return submittedOnDate; - } - - public void setSubmittedOnDate(LocalDate submittedOnDate) { - this.submittedOnDate = submittedOnDate; - } - - public LocalDate getApprovedOnDate() { - return approvedOnDate; - } - - public void setApprovedOnDate(LocalDate approvedOnDate) { - this.approvedOnDate = approvedOnDate; - } - - public LocalDate getExpectedDisbursementDate() { - return expectedDisbursementDate; - } - - public void setExpectedDisbursementDate(LocalDate expectedDisbursementDate) { - this.expectedDisbursementDate = expectedDisbursementDate; - } - - public LocalDate getActualDisbursementDate() { - return actualDisbursementDate; - } - - public void setActualDisbursementDate(LocalDate actualDisbursementDate) { - this.actualDisbursementDate = actualDisbursementDate; - } - - public LocalDate getExpectedFirstRepaymentOnDate() { - return expectedFirstRepaymentOnDate; - } - - public void setExpectedFirstRepaymentOnDate( - LocalDate expectedFirstRepaymentOnDate) { - this.expectedFirstRepaymentOnDate = expectedFirstRepaymentOnDate; - } - - public LocalDate getInterestChargedFromDate() { - return interestChargedFromDate; - } - - public void setInterestChargedFromDate(LocalDate interestChargedFromDate) { - this.interestChargedFromDate = interestChargedFromDate; - } - - public LocalDate getClosedOnDate() { - return closedOnDate; - } - - public void setClosedOnDate(LocalDate closedOnDate) { - this.closedOnDate = closedOnDate; - } - - public LocalDate getExpectedMaturityDate() { - return expectedMaturityDate; - } - - public void setExpectedMaturityDate(LocalDate expectedMaturityDate) { - this.expectedMaturityDate = expectedMaturityDate; - } - - public MoneyData getPrincipal() { - return principal; - } - - public void setPrincipal(MoneyData principal) { - this.principal = principal; - } - - public MoneyData getInArrearsTolerance() { - return inArrearsTolerance; - } - - public void setInArrearsTolerance(MoneyData inArrearsTolerance) { - this.inArrearsTolerance = inArrearsTolerance; - } - - public Integer getNumberOfRepayments() { - return numberOfRepayments; - } - - public void setNumberOfRepayments(Integer numberOfRepayments) { - this.numberOfRepayments = numberOfRepayments; - } - - public Integer getRepaymentEvery() { - return repaymentEvery; - } - - public void setRepaymentEvery(Integer repaymentEvery) { - this.repaymentEvery = repaymentEvery; - } - - public BigDecimal getInterestRatePerPeriod() { - return interestRatePerPeriod; - } - - public void setInterestRatePerPeriod(BigDecimal interestRatePerPeriod) { - this.interestRatePerPeriod = interestRatePerPeriod; - } - - public BigDecimal getAnnualInterestRate() { - return annualInterestRate; - } - - public void setAnnualInterestRate(BigDecimal annualInterestRate) { - this.annualInterestRate = annualInterestRate; - } - - public EnumOptionData getRepaymentFrequencyType() { - return repaymentFrequencyType; - } - - public void setRepaymentFrequencyType(EnumOptionData repaymentFrequencyType) { - this.repaymentFrequencyType = repaymentFrequencyType; - } - - public EnumOptionData getInterestRateFrequencyType() { - return interestRateFrequencyType; - } - - public void setInterestRateFrequencyType( - EnumOptionData interestRateFrequencyType) { - this.interestRateFrequencyType = interestRateFrequencyType; - } - - public EnumOptionData getAmortizationType() { - return amortizationType; - } - - public void setAmortizationType(EnumOptionData amortizationType) { - this.amortizationType = amortizationType; - } - - public EnumOptionData getInterestType() { - return interestType; - } - - public void setInterestType(EnumOptionData interestType) { - this.interestType = interestType; - } - - public EnumOptionData getInterestCalculationPeriodType() { - return interestCalculationPeriodType; - } - - public void setInterestCalculationPeriodType( - EnumOptionData interestCalculationPeriodType) { - this.interestCalculationPeriodType = interestCalculationPeriodType; - } - - public String getLifeCycleStatusText() { - return lifeCycleStatusText; - } - - public void setLifeCycleStatusText(String lifeCycleStatusText) { - this.lifeCycleStatusText = lifeCycleStatusText; - } - - public LocalDate getLifeCycleStatusDate() { - return lifeCycleStatusDate; - } - - public void setLifeCycleStatusDate(LocalDate lifeCycleStatusDate) { - this.lifeCycleStatusDate = lifeCycleStatusDate; - } - - public Long getFundId() { - return fundId; - } - - public void setFundId(Long fundId) { - this.fundId = fundId; - } - - public String getFundName() { - return fundName; - } - - public void setFundName(String fundName) { - this.fundName = fundName; + public String getClientName() { + return clientName; } public Long getLoanProductId() { return loanProductId; } - public void setLoanProductId(Long loanProductId) { - this.loanProductId = loanProductId; + public String getLoanProductName() { + return loanProductName; + } + + public String getLoanProductDescription() { + return loanProductDescription; + } + + public Long getFundId() { + return fundId; + } + + public String getFundName() { + return fundName; + } + + public LocalDate getSubmittedOnDate() { + return submittedOnDate; + } + + public LocalDate getApprovedOnDate() { + return approvedOnDate; + } + + public LocalDate getExpectedDisbursementDate() { + return expectedDisbursementDate; + } + + public LocalDate getActualDisbursementDate() { + return actualDisbursementDate; + } + + public LocalDate getExpectedFirstRepaymentOnDate() { + return expectedFirstRepaymentOnDate; + } + + public LocalDate getInterestChargedFromDate() { + return interestChargedFromDate; + } + + public LocalDate getClosedOnDate() { + return closedOnDate; + } + + public LocalDate getExpectedMaturityDate() { + return expectedMaturityDate; + } + + public CurrencyData getCurrency() { + return currency; + } + + public MoneyData getPrincipal() { + return principal; + } + + public MoneyData getInArrearsTolerance() { + return inArrearsTolerance; + } + + public Integer getNumberOfRepayments() { + return numberOfRepayments; + } + + public Integer getRepaymentEvery() { + return repaymentEvery; + } + + public BigDecimal getInterestRatePerPeriod() { + return interestRatePerPeriod; + } + + public BigDecimal getAnnualInterestRate() { + return annualInterestRate; + } + + public EnumOptionData getRepaymentFrequencyType() { + return repaymentFrequencyType; + } + + public EnumOptionData getInterestRateFrequencyType() { + return interestRateFrequencyType; + } + + public EnumOptionData getAmortizationType() { + return amortizationType; + } + + public EnumOptionData getInterestType() { + return interestType; + } + + public EnumOptionData getInterestCalculationPeriodType() { + return interestCalculationPeriodType; } public Integer getLifeCycleStatusId() { return lifeCycleStatusId; } - public void setLifeCycleStatusId(Integer lifeCycleStatusId) { - this.lifeCycleStatusId = lifeCycleStatusId; + public String getLifeCycleStatusText() { + return lifeCycleStatusText; + } + + public LocalDate getLifeCycleStatusDate() { + return lifeCycleStatusDate; + } + + public LoanAccountSummaryData getSummary() { + return summary; + } + + public Collection getRepaymentSchedule() { + return repaymentSchedule; + } + + public Collection getLoanRepayments() { + return loanRepayments; + } + + public LoanPermissionData getPermissions() { + return permissions; + } + + public LoanConvenienceData getConvenienceData() { + return convenienceData; } public Collection getCharges() { - return charges; + return this.charges; } public void setCharges(Collection charges) { diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/data/LoanBasicDetailsData.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/data/LoanBasicDetailsData.java index 0f94da3b5..7389999d9 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/data/LoanBasicDetailsData.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/data/LoanBasicDetailsData.java @@ -9,64 +9,82 @@ import org.joda.time.Months; public class LoanBasicDetailsData { - private Long id; - private String externalId; - private Long fundId; - private String fundName; - private Long loanProductId; - private String loanProductName; + private final Long id; + private final String externalId; + private final Long clientId; + private final String clientName; + private final Long loanProductId; + private final String loanProductName; + private final String loanProductDescription; + private final Long fundId; + private final String fundName; + + private final LocalDate submittedOnDate; + private final LocalDate approvedOnDate; + private final LocalDate expectedDisbursementDate; + private final LocalDate actualDisbursementDate; + private final LocalDate expectedFirstRepaymentOnDate; + private final LocalDate interestChargedFromDate; + private final LocalDate closedOnDate; + private final LocalDate expectedMaturityDate; - private LocalDate submittedOnDate; - private LocalDate approvedOnDate; - private LocalDate expectedDisbursementDate; - private LocalDate actualDisbursementDate; - private LocalDate expectedFirstRepaymentOnDate; - private LocalDate interestChargedFromDate; - private LocalDate closedOnDate; - private LocalDate expectedMaturityDate; + private final CurrencyData currency; + private final MoneyData principal; + private final MoneyData inArrearsTolerance; - private MoneyData principal; - private MoneyData inArrearsTolerance; + private final Integer numberOfRepayments; + private final Integer repaymentEvery; + private final BigDecimal interestRatePerPeriod; + private final BigDecimal annualInterestRate; - private Integer numberOfRepayments; - private Integer repaymentEvery; - private BigDecimal interestRatePerPeriod; - private BigDecimal annualInterestRate; + private final EnumOptionData repaymentFrequencyType; + private final EnumOptionData interestRateFrequencyType; + private final EnumOptionData amortizationType; + private final EnumOptionData interestType; + private final EnumOptionData interestCalculationPeriodType; - private EnumOptionData repaymentFrequencyType; - private EnumOptionData interestRateFrequencyType; - private EnumOptionData amortizationType; - private EnumOptionData interestType; - private EnumOptionData interestCalculationPeriodType; + private final Integer lifeCycleStatusId; + private final String lifeCycleStatusText; + private final LocalDate lifeCycleStatusDate; - private Integer lifeCycleStatusId; - private String lifeCycleStatusText; - private LocalDate lifeCycleStatusDate; - - protected LoanBasicDetailsData() { - // - } - - public LoanBasicDetailsData(Long id, String externalId, Long loanProductId, - String loanProductName, Long fundId, String fundName, - LocalDate closedOnDate, LocalDate submittedOnDate, - LocalDate approvedOnDate, LocalDate expectedDisbursementDate, - LocalDate actualDisbursementDate, LocalDate expectedMaturityDate, - LocalDate expectedFirstRepaymentOnDate, - LocalDate interestChargedFromDate, MoneyData principal, - MoneyData inArrearsTolerance, Integer numberOfRepayments, - Integer repaymentEvery, BigDecimal interestRatePerPeriod, - BigDecimal annualInterestRate, - EnumOptionData repaymentFrequencyType, - EnumOptionData interestRateFrequencyType, - EnumOptionData amortizationType, EnumOptionData interestType, - EnumOptionData interestCalculationPeriodType, - Integer lifeCycleStatusId, String lifeCycleStatusText, - LocalDate lifeCycleStatusDate) { + public LoanBasicDetailsData( + final Long id, + final String externalId, + final Long clientId, final String clientName, + final Long loanProductId, + final String loanProductName, + final String loanProductDescription, + final Long fundId, String fundName, + final LocalDate closedOnDate, + final LocalDate submittedOnDate, + final LocalDate approvedOnDate, + final LocalDate expectedDisbursementDate, + final LocalDate actualDisbursementDate, + final LocalDate expectedMaturityDate, + final LocalDate expectedFirstRepaymentOnDate, + final LocalDate interestChargedFromDate, + final CurrencyData currency, + final MoneyData principal, + final MoneyData inArrearsTolerance, + final Integer numberOfRepayments, + final Integer repaymentEvery, + final BigDecimal interestRatePerPeriod, + final BigDecimal annualInterestRate, + final EnumOptionData repaymentFrequencyType, + final EnumOptionData interestRateFrequencyType, + final EnumOptionData amortizationType, + final EnumOptionData interestType, + final EnumOptionData interestCalculationPeriodType, + final Integer lifeCycleStatusId, + final String lifeCycleStatusText, + final LocalDate lifeCycleStatusDate) { this.id = id; this.externalId = externalId; + this.clientId = clientId; + this.clientName = clientName; this.loanProductId = loanProductId; this.loanProductName = loanProductName; + this.loanProductDescription = loanProductDescription; this.fundId = fundId; this.fundName = fundName; this.closedOnDate = closedOnDate; @@ -77,6 +95,7 @@ public class LoanBasicDetailsData { this.expectedMaturityDate = expectedMaturityDate; this.expectedFirstRepaymentOnDate = expectedFirstRepaymentOnDate; this.interestChargedFromDate = interestChargedFromDate; + this.currency = currency; this.principal = principal; this.inArrearsTolerance = inArrearsTolerance; this.numberOfRepayments = numberOfRepayments; @@ -186,227 +205,127 @@ public class LoanBasicDetailsData { return id; } - public void setId(Long id) { - this.id = id; - } - public String getExternalId() { return externalId; } - public void setExternalId(String externalId) { - this.externalId = externalId; + public Long getClientId() { + return clientId; } - public String getLoanProductName() { - return loanProductName; - } - - public void setLoanProductName(String loanProductName) { - this.loanProductName = loanProductName; - } - - public LocalDate getSubmittedOnDate() { - return submittedOnDate; - } - - public void setSubmittedOnDate(LocalDate submittedOnDate) { - this.submittedOnDate = submittedOnDate; - } - - public LocalDate getApprovedOnDate() { - return approvedOnDate; - } - - public void setApprovedOnDate(LocalDate approvedOnDate) { - this.approvedOnDate = approvedOnDate; - } - - public LocalDate getExpectedDisbursementDate() { - return expectedDisbursementDate; - } - - public void setExpectedDisbursementDate(LocalDate expectedDisbursementDate) { - this.expectedDisbursementDate = expectedDisbursementDate; - } - - public LocalDate getActualDisbursementDate() { - return actualDisbursementDate; - } - - public void setActualDisbursementDate(LocalDate actualDisbursementDate) { - this.actualDisbursementDate = actualDisbursementDate; - } - - public LocalDate getExpectedFirstRepaymentOnDate() { - return expectedFirstRepaymentOnDate; - } - - public void setExpectedFirstRepaymentOnDate( - LocalDate expectedFirstRepaymentOnDate) { - this.expectedFirstRepaymentOnDate = expectedFirstRepaymentOnDate; - } - - public LocalDate getInterestChargedFromDate() { - return interestChargedFromDate; - } - - public void setInterestChargedFromDate(LocalDate interestChargedFromDate) { - this.interestChargedFromDate = interestChargedFromDate; - } - - public LocalDate getClosedOnDate() { - return closedOnDate; - } - - public void setClosedOnDate(LocalDate closedOnDate) { - this.closedOnDate = closedOnDate; - } - - public LocalDate getExpectedMaturityDate() { - return expectedMaturityDate; - } - - public void setExpectedMaturityDate(LocalDate expectedMaturityDate) { - this.expectedMaturityDate = expectedMaturityDate; - } - - public MoneyData getPrincipal() { - return principal; - } - - public void setPrincipal(MoneyData principal) { - this.principal = principal; - } - - public MoneyData getInArrearsTolerance() { - return inArrearsTolerance; - } - - public void setInArrearsTolerance(MoneyData inArrearsTolerance) { - this.inArrearsTolerance = inArrearsTolerance; - } - - public Integer getNumberOfRepayments() { - return numberOfRepayments; - } - - public void setNumberOfRepayments(Integer numberOfRepayments) { - this.numberOfRepayments = numberOfRepayments; - } - - public Integer getRepaymentEvery() { - return repaymentEvery; - } - - public void setRepaymentEvery(Integer repaymentEvery) { - this.repaymentEvery = repaymentEvery; - } - - public BigDecimal getInterestRatePerPeriod() { - return interestRatePerPeriod; - } - - public void setInterestRatePerPeriod(BigDecimal interestRatePerPeriod) { - this.interestRatePerPeriod = interestRatePerPeriod; - } - - public BigDecimal getAnnualInterestRate() { - return annualInterestRate; - } - - public void setAnnualInterestRate(BigDecimal annualInterestRate) { - this.annualInterestRate = annualInterestRate; - } - - public EnumOptionData getRepaymentFrequencyType() { - return repaymentFrequencyType; - } - - public void setRepaymentFrequencyType(EnumOptionData repaymentFrequencyType) { - this.repaymentFrequencyType = repaymentFrequencyType; - } - - public EnumOptionData getInterestRateFrequencyType() { - return interestRateFrequencyType; - } - - public void setInterestRateFrequencyType( - EnumOptionData interestRateFrequencyType) { - this.interestRateFrequencyType = interestRateFrequencyType; - } - - public EnumOptionData getAmortizationType() { - return amortizationType; - } - - public void setAmortizationType(EnumOptionData amortizationType) { - this.amortizationType = amortizationType; - } - - public EnumOptionData getInterestType() { - return interestType; - } - - public void setInterestType(EnumOptionData interestType) { - this.interestType = interestType; - } - - public EnumOptionData getInterestCalculationPeriodType() { - return interestCalculationPeriodType; - } - - public void setInterestCalculationPeriodType( - EnumOptionData interestCalculationPeriodType) { - this.interestCalculationPeriodType = interestCalculationPeriodType; - } - - public String getLifeCycleStatusText() { - return lifeCycleStatusText; - } - - public void setLifeCycleStatusText(String lifeCycleStatusText) { - this.lifeCycleStatusText = lifeCycleStatusText; - } - - public LocalDate getLifeCycleStatusDate() { - return lifeCycleStatusDate; - } - - public void setLifeCycleStatusDate(LocalDate lifeCycleStatusDate) { - this.lifeCycleStatusDate = lifeCycleStatusDate; + public String getClientName() { + return clientName; } public Long getFundId() { return fundId; } - public void setFundId(Long fundId) { - this.fundId = fundId; - } - public String getFundName() { return fundName; } - public void setFundName(String fundName) { - this.fundName = fundName; - } - public Long getLoanProductId() { return loanProductId; } - public void setLoanProductId(Long loanProductId) { - this.loanProductId = loanProductId; + public String getLoanProductName() { + return loanProductName; + } + + public String getLoanProductDescription() { + return loanProductDescription; + } + + public LocalDate getSubmittedOnDate() { + return submittedOnDate; + } + + public LocalDate getApprovedOnDate() { + return approvedOnDate; + } + + public LocalDate getExpectedDisbursementDate() { + return expectedDisbursementDate; + } + + public LocalDate getActualDisbursementDate() { + return actualDisbursementDate; + } + + public LocalDate getExpectedFirstRepaymentOnDate() { + return expectedFirstRepaymentOnDate; + } + + public LocalDate getInterestChargedFromDate() { + return interestChargedFromDate; + } + + public LocalDate getClosedOnDate() { + return closedOnDate; + } + + public LocalDate getExpectedMaturityDate() { + return expectedMaturityDate; + } + + public CurrencyData getCurrency() { + return currency; + } + + public MoneyData getPrincipal() { + return principal; + } + + public MoneyData getInArrearsTolerance() { + return inArrearsTolerance; + } + + public Integer getNumberOfRepayments() { + return numberOfRepayments; + } + + public Integer getRepaymentEvery() { + return repaymentEvery; + } + + public BigDecimal getInterestRatePerPeriod() { + return interestRatePerPeriod; + } + + public BigDecimal getAnnualInterestRate() { + return annualInterestRate; + } + + public EnumOptionData getRepaymentFrequencyType() { + return repaymentFrequencyType; + } + + public EnumOptionData getInterestRateFrequencyType() { + return interestRateFrequencyType; + } + + public EnumOptionData getAmortizationType() { + return amortizationType; + } + + public EnumOptionData getInterestType() { + return interestType; + } + + public EnumOptionData getInterestCalculationPeriodType() { + return interestCalculationPeriodType; } public Integer getLifeCycleStatusId() { return lifeCycleStatusId; } - public void setLifeCycleStatusId(Integer lifeCycleStatusId) { - this.lifeCycleStatusId = lifeCycleStatusId; + public String getLifeCycleStatusText() { + return lifeCycleStatusText; } + public LocalDate getLifeCycleStatusDate() { + return lifeCycleStatusDate; + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/GoogleGsonApiJsonSerializerService.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/GoogleGsonApiJsonSerializerService.java index 399847fc5..bb66e0406 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/GoogleGsonApiJsonSerializerService.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/GoogleGsonApiJsonSerializerService.java @@ -139,8 +139,9 @@ public class GoogleGsonApiJsonSerializerService implements "allowedProducts")); private static final Set LOAN_DATA_PARAMETERS = new HashSet( - Arrays.asList("id", "externalId", "fundId", "fundName", - "loanProductId", "loanProductName", "principal", + Arrays.asList("id", "externalId", "clientId", "clientName", "fundId", "fundName", + "loanProductId", "loanProductName", "loanProductDescription", + "currency", "principal", "inArrearsTolerance", "numberOfRepayments", "repaymentEvery", "interestRatePerPeriod", "annualInterestRate", "repaymentFrequencyType", diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanReadPlatformServiceImpl.java index 3816e46c6..a62b0c880 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanReadPlatformServiceImpl.java @@ -413,7 +413,9 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { RowMapper { public String loanSchema() { - return "l.id as id, l.external_id as externalId, l.fund_id as fundId, f.name as fundName, lp.id as loanProductId, lp.name as loanProductName, l.submittedon_date as submittedOnDate," + return "l.id as id, l.external_id as externalId, l.fund_id as fundId, f.name as fundName, " + + " lp.id as loanProductId, lp.name as loanProductName, lp.description as loanProductDescription, c.id as clientId, c.display_name as clientName, " + + " l.submittedon_date as submittedOnDate," + " l.approvedon_date as approvedOnDate, l.expected_disbursedon_date as expectedDisbursementDate, l.disbursedon_date as actualDisbursementDate, l.expected_firstrepaymenton_date as expectedFirstRepaymentOnDate," + " l.interest_calculated_from_date as interestChargedFromDate, l.closedon_date as closedOnDate, l.expected_maturedon_date as expectedMaturityDate, " + " l.principal_amount as principal, l.arrearstolerance_amount as inArrearsTolerance, l.number_of_repayments as numberOfRepayments, l.repay_every as repaymentEvery," @@ -423,6 +425,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { + " l.loan_status_id as lifeCycleStatusId, " + " l.currency_code as currencyCode, l.currency_digits as currencyDigits, rc.`name` as currencyName, rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode" + " from m_loan l" + + " join m_client c on c.id = l.client_id" + " join m_product_loan lp on lp.id = l.product_id" + " join m_currency rc on rc.`code` = l.currency_code" + " left join m_fund f on f.id = l.fund_id"; @@ -435,20 +438,22 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { String currencyCode = rs.getString("currencyCode"); String currencyName = rs.getString("currencyName"); String currencyNameCode = rs.getString("currencyNameCode"); - String currencyDisplaySymbol = rs - .getString("currencyDisplaySymbol"); - Integer currencyDigits = JdbcSupport.getInteger(rs, - "currencyDigits"); + String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol"); + Integer currencyDigits = JdbcSupport.getInteger(rs,"currencyDigits"); CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol, currencyNameCode); Long id = rs.getLong("id"); String externalId = rs.getString("externalId"); + Long clientId = JdbcSupport.getLong(rs, "clientId"); + String clientName = rs.getString("clientName"); Long fundId = JdbcSupport.getLong(rs, "fundId"); String fundName = rs.getString("fundName"); Long loanProductId = JdbcSupport.getLong(rs, "loanProductId"); String loanProductName = rs.getString("loanProductName"); + String loanProductDescription = rs.getString("loanProductDescription"); + LocalDate submittedOnDate = JdbcSupport.getLocalDate(rs, "submittedOnDate"); LocalDate approvedOnDate = JdbcSupport.getLocalDate(rs, @@ -516,11 +521,13 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { lifeCycleStatusDate = closedOnDate; } - return new LoanBasicDetailsData(id, externalId, loanProductId, - loanProductName, fundId, fundName, closedOnDate, + return new LoanBasicDetailsData(id, externalId, clientId, clientName, + loanProductId, loanProductName, loanProductDescription, + fundId, fundName, closedOnDate, submittedOnDate, approvedOnDate, expectedDisbursementDate, actualDisbursementDate, expectedMaturityDate, expectedFirstRepaymentOnDate, interestChargedFromDate, + currencyData, principal, inArrearsTolerance, numberOfRepayments, repaymentEvery, interestRatePerPeriod, annualInterestRate, repaymentFrequencyType, interestRateFrequencyType,