cleaning up method signatures in Charge read platform service

This commit is contained in:
Vishwas Babu A J
2014-10-23 19:02:01 -07:00
parent a09da301c1
commit 8067a288d0
3 changed files with 51 additions and 4 deletions
@@ -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<ChargeData> retrieveLoanApplicableCharges(boolean feeChargesOnly, Integer[] excludeChargeTimes);
/**
* Returns all Penalties applicable for loans
*
* @return
*/
Collection<ChargeData> retrieveLoanApplicablePenalties();
/**
* Returns all Charges associated with a given Loan Product
*
* @param loanProductId
* @return
*/
Collection<ChargeData> 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<ChargeData> retrieveLoanProductCharges(Long loanProductId, ChargeTimeType chargeTime);
/**
* Returns all charges applicable for savings
*
* @param feeChargesOnly
* @return
*/
Collection<ChargeData> retrieveSavingsAccountApplicableCharges(boolean feeChargesOnly);
/**
* Returns all penalties applicable for savings
*
* @return
*/
Collection<ChargeData> retrieveSavingsAccountApplicablePenalties();
/**
* Returns all charges applicable for a given savings product
*
* @param savingsProductId
* @return
*/
Collection<ChargeData> retrieveSavingsProductCharges(Long savingsProductId);
Collection<ChargeData> retrieveLoanProductCharges(Long loanProductId, Integer chargeTime);
}
@@ -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<ChargeData> retrieveLoanProductCharges(final Long loanProductId, final Integer chargeTime) {
public Collection<ChargeData> 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
@@ -470,7 +470,7 @@ public class LoansApiResource {
}
Collection<ChargeData> 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,