Cleaning up a few more method signatures on Charge Read Service

This commit is contained in:
Vishwas Babu A J
2014-10-23 19:19:57 -07:00
parent ba4154d8df
commit 5c76d3d377
5 changed files with 13 additions and 11 deletions
@@ -26,9 +26,10 @@ public interface ChargeReadPlatformService {
* @param feeChargesOnly
* If set to "true", only fees are returned
* @param excludeChargeTimes
* Excludes Given List of Charge Types from the response
* @return
*/
Collection<ChargeData> retrieveLoanApplicableCharges(boolean feeChargesOnly, Integer[] excludeChargeTimes);
Collection<ChargeData> retrieveLoanApplicableCharges(boolean feeChargesOnly, ChargeTimeType[] excludeChargeTimes);
/**
* Returns all Penalties applicable for loans
@@ -124,7 +124,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
}
@Override
public Collection<ChargeData> retrieveLoanApplicableCharges(final boolean feeChargesOnly, Integer[] excludeChargeTimes) {
public Collection<ChargeData> retrieveLoanApplicableCharges(final boolean feeChargesOnly, ChargeTimeType[] excludeChargeTimes) {
final ChargeMapper rm = new ChargeMapper();
String excludeClause = "";
Object[] params = new Object[] { ChargeAppliesTo.LOAN.getValue() };
@@ -135,7 +135,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
if (i != 0) {
sb.append(",");
}
sb.append(excludeChargeTimes[i]);
sb.append(excludeChargeTimes[i].getValue());
}
params = new Object[] { ChargeAppliesTo.LOAN.getValue(), sb.toString() };
}
@@ -48,10 +48,10 @@ import org.springframework.stereotype.Component;
@Scope("singleton")
public class LoanChargesApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "chargeId", "name", "penalty",
"chargeTimeType", "dueAsOfDate", "chargeCalculationType", "percentage", "amountPercentageAppliedTo", "currency",
"amountWaived", "amountWrittenOff", "amountOutstanding", "amountOrPercentage", "amount", "amountPaid", "chargeOptions",
"installmentChargeData"));
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList("id", "chargeId", "name", "penalty", "chargeTimeType", "dueAsOfDate", "chargeCalculationType", "percentage",
"amountPercentageAppliedTo", "currency", "amountWaived", "amountWrittenOff", "amountOutstanding", "amountOrPercentage",
"amount", "amountPaid", "chargeOptions", "installmentChargeData"));
private final String resourceNameForPermissions = "LOAN";
@@ -102,7 +102,8 @@ public class LoanChargesApiResource {
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
final boolean feeChargesOnly = false;
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly, new Integer[]{ChargeTimeType.OVERDUE_INSTALLMENT.getValue()});
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly,
new ChargeTimeType[] { ChargeTimeType.OVERDUE_INSTALLMENT });
final LoanChargeData loanChargeTemplate = LoanChargeData.template(chargeOptions);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
@@ -442,7 +442,7 @@ public class LoansApiResource {
repaymentStrategyOptions = this.dropdownReadPlatformService.retreiveTransactionProcessingStrategies();
final boolean feeChargesOnly = false;
chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly,
new Integer[] { ChargeTimeType.OVERDUE_INSTALLMENT.getValue() });
new ChargeTimeType[] { ChargeTimeType.OVERDUE_INSTALLMENT });
chargeTemplate = this.loanChargeReadPlatformService.retrieveLoanChargeTemplate();
allowedLoanOfficers = this.loanReadPlatformService.retrieveAllowedLoanOfficers(loanBasicDetails.officeId(),
@@ -1243,7 +1243,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
.retrieveCodeValuesByCode("LoanCollateral");
final boolean feeChargesOnly = false;
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly,
new Integer[] { ChargeTimeType.OVERDUE_INSTALLMENT.getValue() });
new ChargeTimeType[] { ChargeTimeType.OVERDUE_INSTALLMENT });
Integer loanCycleCounter = null;
if (loanProduct.useBorrowerCycle()) {
if (clientId == null) {
@@ -1673,7 +1673,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
final String sql = "select " + rm.getSchema()
+ " where lrs.loan_id = ? and lrs.interest_waived_derived is not null order by lrs.installment ASC ";
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId});
return this.jdbcTemplate.query(sql, rm, new Object[] { loanId });
} catch (final EmptyResultDataAccessException e) {
return null;
}