From 4c9450a257491ff9f5f8e1f984a596c53cafc21f Mon Sep 17 00:00:00 2001 From: Keith Woodlock Date: Fri, 21 Sep 2012 20:26:48 +0100 Subject: [PATCH] remove warnings, format sections. --- .../saving/domain/DepositAccount.java | 56 ++++++++++++------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositAccount.java b/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositAccount.java index 984a57004..22e1c6c90 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositAccount.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositAccount.java @@ -83,7 +83,6 @@ public class DepositAccount extends AbstractAuditableCustom { @Column(name = "projected_interest_accrued_on_maturity", scale = 6, precision = 19, nullable = false) private BigDecimal projectedInterestAccruedOnMaturity; - @SuppressWarnings("unused") @Column(name = "actual_interest_accrued", scale = 6, precision = 19, nullable = false) private BigDecimal interestAccrued; @@ -158,13 +157,18 @@ public class DepositAccount extends AbstractAuditableCustom { final boolean isInterstWithdrawable,final boolean interestCompoundingAllowed) { Money futureValueOnMaturity =null; - - if(interestCompoundingAllowed){ - futureValueOnMaturity = fixedTermDepositInterestCalculator.calculateInterestOnMaturityFor(deposit, tenureInMonths, - maturityInterestRate, interestCompoundedEvery, interestCompoundedFrequencyPeriodType); - }else if(!interestCompoundingAllowed){ - futureValueOnMaturity = fixedTermDepositInterestCalculator.calculateInterestOnMaturityForSimpleInterest(deposit, tenureInMonths, - maturityInterestRate, interestCompoundedEvery, interestCompoundedFrequencyPeriodType); + + if (interestCompoundingAllowed) { + futureValueOnMaturity = fixedTermDepositInterestCalculator + .calculateInterestOnMaturityFor(deposit, tenureInMonths, + maturityInterestRate, interestCompoundedEvery, + interestCompoundedFrequencyPeriodType); + } else { + futureValueOnMaturity = fixedTermDepositInterestCalculator + .calculateInterestOnMaturityForSimpleInterest(deposit, + tenureInMonths, maturityInterestRate, + interestCompoundedEvery, + interestCompoundedFrequencyPeriodType); } DepositAccountStatus from = null; @@ -276,15 +280,20 @@ public class DepositAccount extends AbstractAuditableCustom { Money futureValueOnMaturity =null; - if(this.interestCompoundingAllowed){ - futureValueOnMaturity = calculator.calculateInterestOnMaturityFor(getDeposit(), this.tenureInMonths, - this.interestRate, this.interestCompoundedEvery, getInterestCompoundedFrequencyType()); - } else if(!this.interestCompoundingAllowed){ - futureValueOnMaturity = calculator.calculateInterestOnMaturityForSimpleInterest(getDeposit(), this.tenureInMonths, - this.interestRate, this.interestCompoundedEvery, getInterestCompoundedFrequencyType()); - } + if (this.interestCompoundingAllowed) { + futureValueOnMaturity = calculator.calculateInterestOnMaturityFor( + getDeposit(), this.tenureInMonths, this.interestRate, + this.interestCompoundedEvery, + getInterestCompoundedFrequencyType()); + } else { + futureValueOnMaturity = calculator + .calculateInterestOnMaturityForSimpleInterest(getDeposit(), + this.tenureInMonths, this.interestRate, + this.interestCompoundedEvery, + getInterestCompoundedFrequencyType()); + } this.interestAccrued = futureValueOnMaturity.minus(getDeposit()).getAmount(); - this.total = this.interestCompoundingAllowed?futureValueOnMaturity.getAmount():getDeposit().getAmount(); + this.total = this.interestCompoundingAllowed ? futureValueOnMaturity.getAmount() : getDeposit().getAmount(); DepositAccountTransaction depositaccountTransaction = DepositAccountTransaction.deposit(getDeposit(), getActualCommencementDate(),getAccuredInterest()); depositaccountTransaction.updateAccount(this); @@ -572,10 +581,17 @@ public class DepositAccount extends AbstractAuditableCustom { Money deposit = Money.of(account.getDeposit().getCurrency(), account.getDeposit().getAmount()); Money accuredtotalAmount = null; - if(account.isInterestCompoundingAllowed()){ - accuredtotalAmount = fixedTermDepositInterestCalculator.calculateInterestOnMaturityFor(deposit, tenure, preClosureInterestRate, interestCompoundedEvery, this.product.getInterestCompoundedEveryPeriodType()); - }else if(!account.isInterestCompoundingAllowed()){ - accuredtotalAmount = fixedTermDepositInterestCalculator.calculateInterestOnMaturityForSimpleInterest(deposit, tenure, preClosureInterestRate, interestCompoundedEvery, this.product.getInterestCompoundedEveryPeriodType()); + if (account.isInterestCompoundingAllowed()) { + accuredtotalAmount = fixedTermDepositInterestCalculator + .calculateInterestOnMaturityFor(deposit, tenure, + preClosureInterestRate, interestCompoundedEvery, + this.product.getInterestCompoundedEveryPeriodType()); + } else { + accuredtotalAmount = fixedTermDepositInterestCalculator + .calculateInterestOnMaturityForSimpleInterest(deposit, + tenure, preClosureInterestRate, + interestCompoundedEvery, + this.product.getInterestCompoundedEveryPeriodType()); } this.total = account.isInterestCompoundingAllowed()?accuredtotalAmount.getAmount():getDeposit().getAmount(); this.interestAccrued = accuredtotalAmount.minus(deposit).getAmount();