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