remove eclipse warnings.

This commit is contained in:
Keith Woodlock
2013-11-25 14:37:42 +00:00
parent 37c04828dd
commit 100e096f64
3 changed files with 53 additions and 54 deletions
@@ -8,7 +8,7 @@ import org.mifosplatform.portfolio.loanproduct.domain.LoanProductValueConditionT
public class LoanProductBorrowerCycleVariationData { public class LoanProductBorrowerCycleVariationData {
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final Long id; private final Long id;
private final Integer borrowerCycleNumber; private final Integer borrowerCycleNumber;
@@ -19,34 +19,34 @@ public class LoanProductBorrowerCycleVariationData {
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final BigDecimal maxValue; private final BigDecimal maxValue;
private final BigDecimal defaultValue; private final BigDecimal defaultValue;
public LoanProductBorrowerCycleVariationData(final Long id,final Integer borrowerCycleNumber,final EnumOptionData paramType,final EnumOptionData valueConditionType,final BigDecimal defaultValue,final BigDecimal minValue, public LoanProductBorrowerCycleVariationData(final Long id,final Integer borrowerCycleNumber,final EnumOptionData paramType,final EnumOptionData valueConditionType,final BigDecimal defaultValue,final BigDecimal minValue,
final BigDecimal maxValue) { final BigDecimal maxValue) {
this.id = id; this.id = id;
this.borrowerCycleNumber = borrowerCycleNumber; this.borrowerCycleNumber = borrowerCycleNumber;
this.paramType = paramType; this.paramType = paramType;
this.valueConditionType = valueConditionType;; this.valueConditionType = valueConditionType;
this.minValue = minValue; this.minValue = minValue;
this.maxValue = maxValue; this.maxValue = maxValue;
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
} }
public LoanProductParamType getParamType(){ public LoanProductParamType getParamType(){
return LoanProductParamType.fromInt(this.paramType.getId().intValue()); return LoanProductParamType.fromInt(this.paramType.getId().intValue());
} }
public Integer getBorrowerCycleNumber() { public Integer getBorrowerCycleNumber() {
return this.borrowerCycleNumber; return this.borrowerCycleNumber;
} }
public LoanProductValueConditionType getValueConditionType() { public LoanProductValueConditionType getValueConditionType() {
return LoanProductValueConditionType.fromInt(this.valueConditionType.getId().intValue()); return LoanProductValueConditionType.fromInt(this.valueConditionType.getId().intValue());
} }
public BigDecimal getDefaultValue() { public BigDecimal getDefaultValue() {
return this.defaultValue; return this.defaultValue;
} }
@@ -19,7 +19,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
@Table(name = "m_product_loan_variations_borrower_cycle") @Table(name = "m_product_loan_variations_borrower_cycle")
public class LoanProductBorrowerCycleVariations extends AbstractPersistable<Long> { public class LoanProductBorrowerCycleVariations extends AbstractPersistable<Long> {
@SuppressWarnings("unused")
@ManyToOne @ManyToOne
@JoinColumn(name = "loan_product_id", nullable = false) @JoinColumn(name = "loan_product_id", nullable = false)
private LoanProduct loanProduct; private LoanProduct loanProduct;
@@ -69,30 +68,29 @@ public class LoanProductBorrowerCycleVariations extends AbstractPersistable<Long
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(final Object obj) {
LoanProductBorrowerCycleVariations borrowerCycleVariations = (LoanProductBorrowerCycleVariations) obj; final LoanProductBorrowerCycleVariations borrowerCycleVariations = (LoanProductBorrowerCycleVariations) obj;
boolean minValequal = false; boolean minValequal = false;
if(borrowerCycleVariations.minValue == null && this.minValue == null){ if (borrowerCycleVariations.minValue == null && this.minValue == null) {
minValequal = true; minValequal = true;
}else if(borrowerCycleVariations.minValue != null && this.minValue != null){ } else if (borrowerCycleVariations.minValue != null && this.minValue != null) {
minValequal = borrowerCycleVariations.minValue.equals(this.minValue); minValequal = borrowerCycleVariations.minValue.equals(this.minValue);
} }
boolean maxValequal = false; boolean maxValequal = false;
if(borrowerCycleVariations.maxValue == null && this.maxValue == null){ if (borrowerCycleVariations.maxValue == null && this.maxValue == null) {
maxValequal = true; maxValequal = true;
}else if(borrowerCycleVariations.maxValue != null && this.maxValue != null){ } else if (borrowerCycleVariations.maxValue != null && this.maxValue != null) {
maxValequal = borrowerCycleVariations.maxValue.equals(this.maxValue); maxValequal = borrowerCycleVariations.maxValue.equals(this.maxValue);
} }
if (borrowerCycleVariations.borrowerCycleNumber.equals(this.borrowerCycleNumber) if (borrowerCycleVariations.borrowerCycleNumber.equals(this.borrowerCycleNumber)
&& borrowerCycleVariations.defaultValue.equals(this.defaultValue) && borrowerCycleVariations.defaultValue.equals(this.defaultValue) && minValequal && maxValequal
&& minValequal && maxValequal
&& borrowerCycleVariations.valueConditionType.equals(this.valueConditionType) && borrowerCycleVariations.valueConditionType.equals(this.valueConditionType)
&& borrowerCycleVariations.paramType.equals(this.paramType)) { return true; } && borrowerCycleVariations.paramType.equals(this.paramType)) { return true; }
return false; return false;
} }
public void copy(LoanProductBorrowerCycleVariations borrowerCycleVariations){ public void copy(final LoanProductBorrowerCycleVariations borrowerCycleVariations) {
this.defaultValue = borrowerCycleVariations.defaultValue; this.defaultValue = borrowerCycleVariations.defaultValue;
this.minValue = borrowerCycleVariations.minValue; this.minValue = borrowerCycleVariations.minValue;
this.maxValue = borrowerCycleVariations.maxValue; this.maxValue = borrowerCycleVariations.maxValue;
@@ -100,22 +98,18 @@ public class LoanProductBorrowerCycleVariations extends AbstractPersistable<Long
this.borrowerCycleNumber = borrowerCycleVariations.borrowerCycleNumber; this.borrowerCycleNumber = borrowerCycleVariations.borrowerCycleNumber;
} }
public Integer getBorrowerCycleNumber() { public Integer getBorrowerCycleNumber() {
return this.borrowerCycleNumber; return this.borrowerCycleNumber;
} }
public BigDecimal getMinValue() { public BigDecimal getMinValue() {
return this.minValue; return this.minValue;
} }
public BigDecimal getMaxValue() { public BigDecimal getMaxValue() {
return this.maxValue; return this.maxValue;
} }
public BigDecimal getDefaultValue() { public BigDecimal getDefaultValue() {
return this.defaultValue; return this.defaultValue;
} }
@@ -51,8 +51,8 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
try { try {
final Collection<ChargeData> charges = this.chargeReadPlatformService.retrieveLoanProductCharges(loanProductId); final Collection<ChargeData> charges = this.chargeReadPlatformService.retrieveLoanProductCharges(loanProductId);
final Collection<LoanProductBorrowerCycleVariationData> borrowerCycleVariationDatas = this.retrieveLoanProductBorrowerCycleVariations(loanProductId); final Collection<LoanProductBorrowerCycleVariationData> borrowerCycleVariationDatas = retrieveLoanProductBorrowerCycleVariations(loanProductId);
final LoanProductMapper rm = new LoanProductMapper(charges,borrowerCycleVariationDatas); final LoanProductMapper rm = new LoanProductMapper(charges, borrowerCycleVariationDatas);
final String sql = "select " + rm.loanProductSchema() + " where lp.id = ?"; final String sql = "select " + rm.loanProductSchema() + " where lp.id = ?";
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId }); return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId });
@@ -61,11 +61,11 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
throw new LoanProductNotFoundException(loanProductId); throw new LoanProductNotFoundException(loanProductId);
} }
} }
@Override @Override
public Collection<LoanProductBorrowerCycleVariationData> retrieveLoanProductBorrowerCycleVariations(final Long loanProductId) { public Collection<LoanProductBorrowerCycleVariationData> retrieveLoanProductBorrowerCycleVariations(final Long loanProductId) {
LoanProductBorrowerCycleMapper rm = new LoanProductBorrowerCycleMapper(); final LoanProductBorrowerCycleMapper rm = new LoanProductBorrowerCycleMapper();
String sql = "select " + rm.schema() +" where bc.loan_product_id=? order by bc.borrower_cycle_number,bc.value_condition"; 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 }); return this.jdbcTemplate.query(sql, rm, new Object[] { loanProductId });
} }
@@ -74,7 +74,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
this.context.authenticatedUser(); this.context.authenticatedUser();
final LoanProductMapper rm = new LoanProductMapper(null,null); final LoanProductMapper rm = new LoanProductMapper(null, null);
final String sql = "select " + rm.loanProductSchema(); final String sql = "select " + rm.loanProductSchema();
@@ -101,10 +101,11 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
private static final class LoanProductMapper implements RowMapper<LoanProductData> { private static final class LoanProductMapper implements RowMapper<LoanProductData> {
private final Collection<ChargeData> charges; private final Collection<ChargeData> charges;
private final Collection<LoanProductBorrowerCycleVariationData> borrowerCycleVariationDatas; private final Collection<LoanProductBorrowerCycleVariationData> borrowerCycleVariationDatas;
public LoanProductMapper(final Collection<ChargeData> charges,final Collection<LoanProductBorrowerCycleVariationData> borrowerCycleVariationDatas) { public LoanProductMapper(final Collection<ChargeData> charges,
final Collection<LoanProductBorrowerCycleVariationData> borrowerCycleVariationDatas) {
this.charges = charges; this.charges = charges;
this.borrowerCycleVariationDatas = borrowerCycleVariationDatas; this.borrowerCycleVariationDatas = borrowerCycleVariationDatas;
} }
@@ -196,29 +197,30 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
status = "loanProduct.active"; status = "loanProduct.active";
} }
final String externalId = rs.getString("externalId"); final String externalId = rs.getString("externalId");
Collection<LoanProductBorrowerCycleVariationData> principalVariationsForBorrowerCycle = new ArrayList<LoanProductBorrowerCycleVariationData>();; final Collection<LoanProductBorrowerCycleVariationData> principalVariationsForBorrowerCycle = new ArrayList<LoanProductBorrowerCycleVariationData>();
Collection<LoanProductBorrowerCycleVariationData> interestRateVariationsForBorrowerCycle = new ArrayList<LoanProductBorrowerCycleVariationData>();; final Collection<LoanProductBorrowerCycleVariationData> interestRateVariationsForBorrowerCycle = new ArrayList<LoanProductBorrowerCycleVariationData>();
Collection<LoanProductBorrowerCycleVariationData> numberOfRepaymentVariationsForBorrowerCycle = new ArrayList<LoanProductBorrowerCycleVariationData>();; final Collection<LoanProductBorrowerCycleVariationData> numberOfRepaymentVariationsForBorrowerCycle = new ArrayList<LoanProductBorrowerCycleVariationData>();
if(this.borrowerCycleVariationDatas!=null){ if (this.borrowerCycleVariationDatas != null) {
for(LoanProductBorrowerCycleVariationData borrowerCycleVariationData:this.borrowerCycleVariationDatas){ for (final LoanProductBorrowerCycleVariationData borrowerCycleVariationData : this.borrowerCycleVariationDatas) {
LoanProductParamType loanProductParamType =borrowerCycleVariationData.getParamType(); final LoanProductParamType loanProductParamType = borrowerCycleVariationData.getParamType();
if(loanProductParamType.isParamTypePrincipal()){ if (loanProductParamType.isParamTypePrincipal()) {
principalVariationsForBorrowerCycle.add(borrowerCycleVariationData); principalVariationsForBorrowerCycle.add(borrowerCycleVariationData);
}else if(loanProductParamType.isParamTypeInterestTate()){ } else if (loanProductParamType.isParamTypeInterestTate()) {
interestRateVariationsForBorrowerCycle.add(borrowerCycleVariationData); interestRateVariationsForBorrowerCycle.add(borrowerCycleVariationData);
}else if(loanProductParamType.isParamTypeRepayment()){ } else if (loanProductParamType.isParamTypeRepayment()) {
numberOfRepaymentVariationsForBorrowerCycle.add(borrowerCycleVariationData); numberOfRepaymentVariationsForBorrowerCycle.add(borrowerCycleVariationData);
} }
} }
} }
return new LoanProductData(id, name, description, currency, principal, minPrincipal, maxPrincipal, tolerance, return new LoanProductData(id, name, description, currency, principal, minPrincipal, maxPrincipal, tolerance,
numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod, numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod,
minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType, minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType,
interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId, fundName, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId, fundName,
transactionStrategyId, transactionStrategyName, graceOnPrincipalPayment, graceOnInterestPayment, transactionStrategyId, transactionStrategyName, graceOnPrincipalPayment, graceOnInterestPayment,
graceOnInterestCharged, this.charges, accountingRuleType, includeInBorrowerCycle, useBorrowerCycle, startDate, closeDate, graceOnInterestCharged, this.charges, accountingRuleType, includeInBorrowerCycle, useBorrowerCycle, startDate,
status, externalId, principalVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle, numberOfRepaymentVariationsForBorrowerCycle); closeDate, status, externalId, principalVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle,
numberOfRepaymentVariationsForBorrowerCycle);
} }
} }
@@ -251,16 +253,18 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
return LoanProductData.lookup(id, name); return LoanProductData.lookup(id, name);
} }
} }
private static final class LoanProductBorrowerCycleMapper implements RowMapper<LoanProductBorrowerCycleVariationData> { private static final class LoanProductBorrowerCycleMapper implements RowMapper<LoanProductBorrowerCycleVariationData> {
public String schema(){
return "bc.id as id,bc.borrower_cycle_number as cycleNumber,bc.value_condition as conditionType,bc.param_type as paramType," + public String schema() {
"bc.default_value as defaultValue,bc.max_value as maxVal,bc.min_value as minVal "+ return "bc.id as id,bc.borrower_cycle_number as cycleNumber,bc.value_condition as conditionType,bc.param_type as paramType,"
"from m_product_loan_variations_borrower_cycle bc"; + "bc.default_value as defaultValue,bc.max_value as maxVal,bc.min_value as minVal "
+ "from m_product_loan_variations_borrower_cycle bc";
} }
@Override @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 Long id = rs.getLong("id");
final Integer cycleNumber = JdbcSupport.getInteger(rs, "cycleNumber"); final Integer cycleNumber = JdbcSupport.getInteger(rs, "cycleNumber");
final Integer conditionType = JdbcSupport.getInteger(rs, "conditionType"); final Integer conditionType = JdbcSupport.getInteger(rs, "conditionType");
@@ -270,11 +274,12 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
final BigDecimal defaultValue = rs.getBigDecimal("defaultValue"); final BigDecimal defaultValue = rs.getBigDecimal("defaultValue");
final BigDecimal maxValue = rs.getBigDecimal("maxVal"); final BigDecimal maxValue = rs.getBigDecimal("maxVal");
final BigDecimal minValue = rs.getBigDecimal("minVal"); 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; return borrowerCycleVariationData;
} }
} }
@Override @Override