From 8067a288d0b7661d891a7e8b91a6b63473728bac Mon Sep 17 00:00:00 2001 From: Vishwas Babu A J Date: Thu, 23 Oct 2014 19:02:01 -0700 Subject: [PATCH] cleaning up method signatures in Charge read platform service --- .../service/ChargeReadPlatformService.java | 48 ++++++++++++++++++- .../ChargeReadPlatformServiceImpl.java | 5 +- .../loanaccount/api/LoansApiResource.java | 2 +- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformService.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformService.java index af2322bde..343196412 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformService.java @@ -8,6 +8,7 @@ package org.mifosplatform.portfolio.charge.service; import java.util.Collection; import org.mifosplatform.portfolio.charge.data.ChargeData; +import org.mifosplatform.portfolio.charge.domain.ChargeTimeType; public interface ChargeReadPlatformService { @@ -19,17 +20,62 @@ public interface ChargeReadPlatformService { ChargeData retrieveNewChargeDetails(); + /** + * Returns all charges applicable for loans + * + * @param feeChargesOnly + * If set to "true", only fees are returned + * @param excludeChargeTimes + * @return + */ Collection retrieveLoanApplicableCharges(boolean feeChargesOnly, Integer[] excludeChargeTimes); + /** + * Returns all Penalties applicable for loans + * + * @return + */ Collection retrieveLoanApplicablePenalties(); + /** + * Returns all Charges associated with a given Loan Product + * + * @param loanProductId + * @return + */ Collection retrieveLoanProductCharges(Long loanProductId); + /** + * Returns all charges applicable for a given loan product + * + * @param loanProductId + * @param chargeTime + * Filters based on the type of the charge to be returned + * @return + */ + Collection retrieveLoanProductCharges(Long loanProductId, ChargeTimeType chargeTime); + + /** + * Returns all charges applicable for savings + * + * @param feeChargesOnly + * @return + */ Collection retrieveSavingsAccountApplicableCharges(boolean feeChargesOnly); + /** + * Returns all penalties applicable for savings + * + * @return + */ Collection retrieveSavingsAccountApplicablePenalties(); + /** + * Returns all charges applicable for a given savings product + * + * @param savingsProductId + * @return + */ Collection retrieveSavingsProductCharges(Long savingsProductId); - Collection retrieveLoanProductCharges(Long loanProductId, Integer chargeTime); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformServiceImpl.java index 0804a032b..cfa058727 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformServiceImpl.java @@ -19,6 +19,7 @@ import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.organisation.monetary.service.CurrencyReadPlatformService; import org.mifosplatform.portfolio.charge.data.ChargeData; import org.mifosplatform.portfolio.charge.domain.ChargeAppliesTo; +import org.mifosplatform.portfolio.charge.domain.ChargeTimeType; import org.mifosplatform.portfolio.charge.exception.ChargeNotFoundException; import org.mifosplatform.portfolio.common.service.CommonEnumerations; import org.mifosplatform.portfolio.common.service.DropdownReadPlatformService; @@ -112,14 +113,14 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService } @Override - public Collection retrieveLoanProductCharges(final Long loanProductId, final Integer chargeTime) { + public Collection retrieveLoanProductCharges(final Long loanProductId, final ChargeTimeType chargeTime) { final ChargeMapper rm = new ChargeMapper(); final String sql = "select " + rm.loanProductChargeSchema() + " where c.is_deleted=0 and c.is_active=1 and plc.product_loan_id=? and c.charge_time_enum=?"; - return this.jdbcTemplate.query(sql, rm, new Object[] { loanProductId, chargeTime }); + return this.jdbcTemplate.query(sql, rm, new Object[] { loanProductId, chargeTime.getValue() }); } @Override diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java index ab6cb5951..05bc16993 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java @@ -470,7 +470,7 @@ public class LoansApiResource { } Collection overdueCharges = this.chargeReadPlatformService.retrieveLoanProductCharges(loanBasicDetails.loanProductId(), - ChargeTimeType.OVERDUE_INSTALLMENT.getValue()); + ChargeTimeType.OVERDUE_INSTALLMENT); final LoanAccountData loanAccount = LoanAccountData.associationsAndTemplate(loanBasicDetails, repaymentSchedule, loanRepayments, charges, collateral, guarantors, meeting, productOptions, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,