From 100e096f643955ae1f91ca14e543e9a96bed1697 Mon Sep 17 00:00:00 2001 From: Keith Woodlock Date: Mon, 25 Nov 2013 14:37:42 +0000 Subject: [PATCH] remove eclipse warnings. --- ...LoanProductBorrowerCycleVariationData.java | 16 ++--- .../LoanProductBorrowerCycleVariations.java | 26 +++----- .../LoanProductReadPlatformServiceImpl.java | 65 ++++++++++--------- 3 files changed, 53 insertions(+), 54 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductBorrowerCycleVariationData.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductBorrowerCycleVariationData.java index 5d416e870..8cfb44891 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductBorrowerCycleVariationData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductBorrowerCycleVariationData.java @@ -8,7 +8,7 @@ import org.mifosplatform.portfolio.loanproduct.domain.LoanProductValueConditionT public class LoanProductBorrowerCycleVariationData { - + @SuppressWarnings("unused") private final Long id; private final Integer borrowerCycleNumber; @@ -19,34 +19,34 @@ public class LoanProductBorrowerCycleVariationData { @SuppressWarnings("unused") private final BigDecimal maxValue; private final BigDecimal defaultValue; - - + + public LoanProductBorrowerCycleVariationData(final Long id,final Integer borrowerCycleNumber,final EnumOptionData paramType,final EnumOptionData valueConditionType,final BigDecimal defaultValue,final BigDecimal minValue, final BigDecimal maxValue) { this.id = id; this.borrowerCycleNumber = borrowerCycleNumber; this.paramType = paramType; - this.valueConditionType = valueConditionType;; + this.valueConditionType = valueConditionType; this.minValue = minValue; this.maxValue = maxValue; this.defaultValue = defaultValue; } - + public LoanProductParamType getParamType(){ return LoanProductParamType.fromInt(this.paramType.getId().intValue()); } - + public Integer getBorrowerCycleNumber() { return this.borrowerCycleNumber; } - + public LoanProductValueConditionType getValueConditionType() { return LoanProductValueConditionType.fromInt(this.valueConditionType.getId().intValue()); } - + public BigDecimal getDefaultValue() { return this.defaultValue; } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductBorrowerCycleVariations.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductBorrowerCycleVariations.java index f78c6b268..fdd68f465 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductBorrowerCycleVariations.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductBorrowerCycleVariations.java @@ -19,7 +19,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable; @Table(name = "m_product_loan_variations_borrower_cycle") public class LoanProductBorrowerCycleVariations extends AbstractPersistable { - @SuppressWarnings("unused") @ManyToOne @JoinColumn(name = "loan_product_id", nullable = false) private LoanProduct loanProduct; @@ -69,30 +68,29 @@ public class LoanProductBorrowerCycleVariations extends AbstractPersistable charges = this.chargeReadPlatformService.retrieveLoanProductCharges(loanProductId); - final Collection borrowerCycleVariationDatas = this.retrieveLoanProductBorrowerCycleVariations(loanProductId); - final LoanProductMapper rm = new LoanProductMapper(charges,borrowerCycleVariationDatas); + final Collection borrowerCycleVariationDatas = retrieveLoanProductBorrowerCycleVariations(loanProductId); + final LoanProductMapper rm = new LoanProductMapper(charges, borrowerCycleVariationDatas); final String sql = "select " + rm.loanProductSchema() + " where lp.id = ?"; return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId }); @@ -61,11 +61,11 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo throw new LoanProductNotFoundException(loanProductId); } } - + @Override public Collection retrieveLoanProductBorrowerCycleVariations(final Long loanProductId) { - LoanProductBorrowerCycleMapper rm = new LoanProductBorrowerCycleMapper(); - String sql = "select " + rm.schema() +" where bc.loan_product_id=? order by bc.borrower_cycle_number,bc.value_condition"; + final LoanProductBorrowerCycleMapper rm = new LoanProductBorrowerCycleMapper(); + final String sql = "select " + rm.schema() + " where bc.loan_product_id=? order by bc.borrower_cycle_number,bc.value_condition"; return this.jdbcTemplate.query(sql, rm, new Object[] { loanProductId }); } @@ -74,7 +74,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo this.context.authenticatedUser(); - final LoanProductMapper rm = new LoanProductMapper(null,null); + final LoanProductMapper rm = new LoanProductMapper(null, null); final String sql = "select " + rm.loanProductSchema(); @@ -101,10 +101,11 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo private static final class LoanProductMapper implements RowMapper { private final Collection charges; - + private final Collection borrowerCycleVariationDatas; - public LoanProductMapper(final Collection charges,final Collection borrowerCycleVariationDatas) { + public LoanProductMapper(final Collection charges, + final Collection borrowerCycleVariationDatas) { this.charges = charges; this.borrowerCycleVariationDatas = borrowerCycleVariationDatas; } @@ -196,29 +197,30 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo status = "loanProduct.active"; } final String externalId = rs.getString("externalId"); - Collection principalVariationsForBorrowerCycle = new ArrayList();; - Collection interestRateVariationsForBorrowerCycle = new ArrayList();; - Collection numberOfRepaymentVariationsForBorrowerCycle = new ArrayList();; - if(this.borrowerCycleVariationDatas!=null){ - for(LoanProductBorrowerCycleVariationData borrowerCycleVariationData:this.borrowerCycleVariationDatas){ - LoanProductParamType loanProductParamType =borrowerCycleVariationData.getParamType(); - if(loanProductParamType.isParamTypePrincipal()){ + final Collection principalVariationsForBorrowerCycle = new ArrayList(); + final Collection interestRateVariationsForBorrowerCycle = new ArrayList(); + final Collection numberOfRepaymentVariationsForBorrowerCycle = new ArrayList(); + if (this.borrowerCycleVariationDatas != null) { + for (final LoanProductBorrowerCycleVariationData borrowerCycleVariationData : this.borrowerCycleVariationDatas) { + final LoanProductParamType loanProductParamType = borrowerCycleVariationData.getParamType(); + if (loanProductParamType.isParamTypePrincipal()) { principalVariationsForBorrowerCycle.add(borrowerCycleVariationData); - }else if(loanProductParamType.isParamTypeInterestTate()){ + } else if (loanProductParamType.isParamTypeInterestTate()) { interestRateVariationsForBorrowerCycle.add(borrowerCycleVariationData); - }else if(loanProductParamType.isParamTypeRepayment()){ + } else if (loanProductParamType.isParamTypeRepayment()) { numberOfRepaymentVariationsForBorrowerCycle.add(borrowerCycleVariationData); } } } - + return new LoanProductData(id, name, description, currency, principal, minPrincipal, maxPrincipal, tolerance, numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod, minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId, fundName, transactionStrategyId, transactionStrategyName, graceOnPrincipalPayment, graceOnInterestPayment, - graceOnInterestCharged, this.charges, accountingRuleType, includeInBorrowerCycle, useBorrowerCycle, startDate, closeDate, - status, externalId, principalVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle, numberOfRepaymentVariationsForBorrowerCycle); + graceOnInterestCharged, this.charges, accountingRuleType, includeInBorrowerCycle, useBorrowerCycle, startDate, + closeDate, status, externalId, principalVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle, + numberOfRepaymentVariationsForBorrowerCycle); } } @@ -251,16 +253,18 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo return LoanProductData.lookup(id, name); } } - + private static final class LoanProductBorrowerCycleMapper implements RowMapper { - public String schema(){ - return "bc.id as id,bc.borrower_cycle_number as cycleNumber,bc.value_condition as conditionType,bc.param_type as paramType," + - "bc.default_value as defaultValue,bc.max_value as maxVal,bc.min_value as minVal "+ - "from m_product_loan_variations_borrower_cycle bc"; + + public String schema() { + return "bc.id as id,bc.borrower_cycle_number as cycleNumber,bc.value_condition as conditionType,bc.param_type as paramType," + + "bc.default_value as defaultValue,bc.max_value as maxVal,bc.min_value as minVal " + + "from m_product_loan_variations_borrower_cycle bc"; } - + @Override - public LoanProductBorrowerCycleVariationData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException { + public LoanProductBorrowerCycleVariationData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) + throws SQLException { final Long id = rs.getLong("id"); final Integer cycleNumber = JdbcSupport.getInteger(rs, "cycleNumber"); final Integer conditionType = JdbcSupport.getInteger(rs, "conditionType"); @@ -270,11 +274,12 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo final BigDecimal defaultValue = rs.getBigDecimal("defaultValue"); final BigDecimal maxValue = rs.getBigDecimal("maxVal"); final BigDecimal minValue = rs.getBigDecimal("minVal"); - - LoanProductBorrowerCycleVariationData borrowerCycleVariationData = new LoanProductBorrowerCycleVariationData(id,cycleNumber, paramTypeData, conditionTypeData, defaultValue, minValue, maxValue); + + final LoanProductBorrowerCycleVariationData borrowerCycleVariationData = new LoanProductBorrowerCycleVariationData(id, + cycleNumber, paramTypeData, conditionTypeData, defaultValue, minValue, maxValue); return borrowerCycleVariationData; } - + } @Override