squash changes in interest-calculation-extension branch

This commit is contained in:
Keith Woodlock
2012-05-01 17:31:32 +01:00
parent ff120f925c
commit d3d40cabe0
37 changed files with 1639 additions and 406 deletions
@@ -22,6 +22,8 @@ public class LoanProductData implements Serializable {
private int interestRatePeriod;
private BigDecimal annualInterestRate = BigDecimal.ZERO;
private int interestMethod;
private int interestRateCalculatedInPeriod;
private Integer numberOfInterestFreePeriods = Integer.valueOf(0);
private Integer repaidEvery;
private int repaymentPeriodFrequency;
@@ -34,6 +36,7 @@ public class LoanProductData implements Serializable {
private List<CurrencyData> possibleCurrencies = new ArrayList<CurrencyData>();
private List<EnumOptionReadModel> possibleAmortizationOptions = new ArrayList<EnumOptionReadModel>();
private List<EnumOptionReadModel> possibleInterestOptions = new ArrayList<EnumOptionReadModel>();
private List<EnumOptionReadModel> possibleInterestRateCalculatedInPeriodOptions = new ArrayList<EnumOptionReadModel>();
private List<EnumOptionReadModel> repaymentFrequencyOptions = new ArrayList<EnumOptionReadModel>();
private List<EnumOptionReadModel> interestFrequencyOptions = new ArrayList<EnumOptionReadModel>();
@@ -47,7 +50,8 @@ public class LoanProductData implements Serializable {
final MoneyData principalMoney,
final BigDecimal interestRatePerPeriod,
final int interestRatePeriod, final BigDecimal annualInterestRate,
final int interestMethod, final Integer repaidEvery,
final int interestMethod, final int interestCalculationInPeriodMethod,
final Integer repaidEvery,
final int repaymentPeriodFrequency, final Integer numberOfRepayments,
final int amortizationMethod, MoneyData inArrearsTolerance, DateTime createdOn, DateTime lastModifedOn) {
this.id = id;
@@ -60,6 +64,7 @@ public class LoanProductData implements Serializable {
this.interestRatePeriod = interestRatePeriod;
this.annualInterestRate = annualInterestRate;
this.interestMethod = interestMethod;
this.interestRateCalculatedInPeriod = interestCalculationInPeriodMethod;
this.numberOfRepayments = numberOfRepayments;
this.repaidEvery = repaidEvery;
this.repaymentPeriodFrequency = repaymentPeriodFrequency;
@@ -256,4 +261,21 @@ public class LoanProductData implements Serializable {
public void setNumberOfInterestFreePeriods(Integer numberOfInterestFreePeriods) {
this.numberOfInterestFreePeriods = numberOfInterestFreePeriods;
}
public int getInterestRateCalculatedInPeriod() {
return interestRateCalculatedInPeriod;
}
public void setInterestRateCalculatedInPeriod(int interestRateCalculatedInPeriod) {
this.interestRateCalculatedInPeriod = interestRateCalculatedInPeriod;
}
public List<EnumOptionReadModel> getPossibleInterestRateCalculatedInPeriodOptions() {
return possibleInterestRateCalculatedInPeriodOptions;
}
public void setPossibleInterestRateCalculatedInPeriodOptions(
List<EnumOptionReadModel> possibleInterestRateCalculatedInPeriodOptions) {
this.possibleInterestRateCalculatedInPeriodOptions = possibleInterestRateCalculatedInPeriodOptions;
}
}
@@ -21,14 +21,15 @@ public class CalculateLoanScheduleCommand {
public CalculateLoanScheduleCommand(final String currencyCode,
final Integer digitsAfterDecimal, final Number principal,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod, final Integer interestCalculationPeriodMethod,
final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod,
final boolean flexibleRepaymentSchedule,
final boolean interestRebateAllowed,
final LocalDate expectedDisbursementDate,
final LocalDate repaymentsStartingFromDate, final LocalDate interestCalculatedFromDate) {
commonLoanProperties = new CommonLoanProperties(currencyCode, digitsAfterDecimal, principal, interestRatePerPeriod, interestRateFrequencyMethod, interestMethod,
commonLoanProperties = new CommonLoanProperties(currencyCode, digitsAfterDecimal, principal, interestRatePerPeriod, interestRateFrequencyMethod,
interestMethod, interestCalculationPeriodMethod,
repaymentEvery, repaymentFrequency, numberOfRepayments, amortizationMethod, Integer.valueOf(0),
flexibleRepaymentSchedule, interestRebateAllowed);
@@ -173,4 +174,12 @@ public class CalculateLoanScheduleCommand {
public void setInterestCalculatedFromDate(LocalDate interestCalculatedFromDate) {
this.interestCalculatedFromDate = interestCalculatedFromDate;
}
public Integer getInterestCalculationPeriodMethod() {
return this.commonLoanProperties.getInterestCalculationPeriodMethod();
}
public void setInterestCalculationPeriodMethod(final Integer interestCalculationPeriodMethod) {
this.commonLoanProperties.setInterestCalculationPeriodMethod(interestCalculationPeriodMethod);
}
}
@@ -21,6 +21,7 @@ public class CommonLoanProperties {
private BigDecimal interestRatePerPeriod;
private Integer interestRateFrequencyMethod;
private Integer interestMethod;
private Integer interestCalculationPeriodMethod;
private boolean flexibleRepaymentSchedule = false;
private boolean interestRebateAllowed = false;
@@ -31,7 +32,8 @@ public class CommonLoanProperties {
public CommonLoanProperties(final String currencyCode,
final Integer digitsAfterDecimal, final Number principal,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod,
final Integer interestMethod, final Integer interestCalculationPeriodMethod,
final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod, final Number toleranceAmount,
final boolean flexibleRepaymentSchedule,
final boolean interestRebateAllowed) {
@@ -46,6 +48,7 @@ public class CommonLoanProperties {
}
this.interestRateFrequencyMethod = interestRateFrequencyMethod;
this.interestMethod = interestMethod;
this.interestCalculationPeriodMethod = interestCalculationPeriodMethod;
this.repaymentEvery = repaymentEvery;
this.repaymentFrequency = repaymentFrequency;
@@ -169,4 +172,13 @@ public class CommonLoanProperties {
public void setInArrearsToleranceAmount(BigDecimal inArrearsToleranceAmount) {
this.inArrearsToleranceAmount = inArrearsToleranceAmount;
}
public Integer getInterestCalculationPeriodMethod() {
return interestCalculationPeriodMethod;
}
public void setInterestCalculationPeriodMethod(
Integer interestCalculationPeriodMethod) {
this.interestCalculationPeriodMethod = interestCalculationPeriodMethod;
}
}
@@ -19,14 +19,16 @@ public class CreateLoanProductCommand implements LoanProductCommandData {
public CreateLoanProductCommand(final String currencyCode,
final Integer digitsAfterDecimal, final Number principal,
final String name, final String description,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod,
final Integer interestMethod, final Integer interestCalculationPeriodMethod,
final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod, final Number toleranceAmount,
final boolean flexibleRepaymentSchedule,
final boolean interestRebateAllowed) {
this.name = name;
this.description = description;
commonLoanProperties = new CommonLoanProperties(currencyCode, digitsAfterDecimal, principal, interestRatePerPeriod, interestRateFrequencyMethod, interestMethod,
commonLoanProperties = new CommonLoanProperties(currencyCode, digitsAfterDecimal, principal, interestRatePerPeriod, interestRateFrequencyMethod,
interestMethod, interestCalculationPeriodMethod,
repaymentEvery, repaymentFrequency, numberOfRepayments, amortizationMethod, toleranceAmount, flexibleRepaymentSchedule, interestRebateAllowed);
}
@@ -238,4 +240,13 @@ public class CreateLoanProductCommand implements LoanProductCommandData {
public void setInArrearsToleranceAmount(BigDecimal inArrearsToleranceAmount) {
this.commonLoanProperties.setInArrearsToleranceAmount(inArrearsToleranceAmount);
}
@Override
public Integer getInterestCalculationPeriodMethod() {
return this.commonLoanProperties.getInterestCalculationPeriodMethod();
}
public void setInterestCalculationPeriodMethod(final Integer interestCalculationPeriodMethod) {
this.commonLoanProperties.setInterestCalculationPeriodMethod(interestCalculationPeriodMethod);
}
}
@@ -4,40 +4,41 @@ import java.math.BigDecimal;
public interface LoanProductCommandData {
public abstract String getName();
String getName();
public abstract String getDescription();
String getDescription();
public abstract String getCurrencyCode();
String getCurrencyCode();
public abstract Integer getDigitsAfterDecimal();
Integer getDigitsAfterDecimal();
public abstract Integer getRepaymentEvery();
Integer getRepaymentEvery();
public abstract Integer getRepaymentFrequency();
Integer getRepaymentFrequency();
public abstract Boolean isFlexibleRepaymentSchedule();
Boolean isFlexibleRepaymentSchedule();
public abstract Boolean isInterestRebateAllowed();
Boolean isInterestRebateAllowed();
public abstract BigDecimal getPrincipal();
BigDecimal getPrincipal();
public abstract Boolean getFlexibleRepaymentSchedule();
Boolean getFlexibleRepaymentSchedule();
public abstract Boolean getInterestRebateAllowed();
Boolean getInterestRebateAllowed();
public abstract Integer getInterestRateFrequencyMethod();
Integer getInterestRateFrequencyMethod();
public abstract Integer getInterestMethod();
Integer getInterestMethod();
public abstract Integer getAmortizationMethod();
Integer getAmortizationMethod();
public abstract Integer getNumberOfRepayments();
Integer getNumberOfRepayments();
public abstract BigDecimal getInterestRatePerPeriod();
BigDecimal getInterestRatePerPeriod();
public abstract CommonLoanProperties getCommonLoanProperties();
public abstract BigDecimal getInArrearsToleranceAmount();
CommonLoanProperties getCommonLoanProperties();
BigDecimal getInArrearsToleranceAmount();
Integer getInterestCalculationPeriodMethod();
}
@@ -37,7 +37,7 @@ public class SubmitLoanApplicationCommand {
final LocalDate interestCalculatedFromDate,
final LoanSchedule loanSchedule, final String currencyCode,
final Integer digitsAfterDecimal, final Number principal,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod, final Integer interestCalculationPeriodMethod,
final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod, final Number toleranceAmount,
final boolean flexibleRepaymentSchedule,
final boolean interestRebateAllowed) {
@@ -46,7 +46,8 @@ public class SubmitLoanApplicationCommand {
this.submittedOnDate = submittedOnDate;
this.submittedOnNote = submittedOnNote;
commonLoanProperties = new CommonLoanProperties(currencyCode, digitsAfterDecimal, principal, interestRatePerPeriod, interestRateFrequencyMethod, interestMethod,
commonLoanProperties = new CommonLoanProperties(currencyCode, digitsAfterDecimal, principal, interestRatePerPeriod, interestRateFrequencyMethod,
interestMethod, interestCalculationPeriodMethod,
repaymentEvery, repaymentFrequency, numberOfRepayments, amortizationMethod, toleranceAmount, flexibleRepaymentSchedule, interestRebateAllowed);
this.expectedDisbursementDate = expectedDisbursementDate;
@@ -249,4 +250,12 @@ public class SubmitLoanApplicationCommand {
public void setInterestCalculatedFromDate(LocalDate interestCalculatedFromDate) {
this.interestCalculatedFromDate = interestCalculatedFromDate;
}
public Integer getInterestCalculationPeriodMethod() {
return this.commonLoanProperties.getInterestCalculationPeriodMethod();
}
public void setInterestCalculationPeriodMethod(final Integer interestCalculationPeriodMethod) {
this.commonLoanProperties.setInterestCalculationPeriodMethod(interestCalculationPeriodMethod);
}
}
@@ -21,14 +21,15 @@ public class UpdateLoanProductCommand implements LoanProductCommandData {
public UpdateLoanProductCommand(final String currencyCode,
final Integer digitsAfterDecimal, final Number principal,
final String name, final String description,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod, final Integer interestCalculationPeriodMethod,
final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod, final Number toleranceAmount,
final boolean flexibleRepaymentSchedule,
final boolean interestRebateAllowed) {
this.name = name;
this.description = description;
commonLoanProperties = new CommonLoanProperties(currencyCode, digitsAfterDecimal, principal, interestRatePerPeriod, interestRateFrequencyMethod, interestMethod,
commonLoanProperties = new CommonLoanProperties(currencyCode, digitsAfterDecimal, principal, interestRatePerPeriod, interestRateFrequencyMethod,
interestMethod, interestCalculationPeriodMethod,
repaymentEvery, repaymentFrequency, numberOfRepayments, amortizationMethod, toleranceAmount, flexibleRepaymentSchedule, interestRebateAllowed);
}
@@ -184,4 +185,13 @@ public class UpdateLoanProductCommand implements LoanProductCommandData {
public void setExternalId(String externalId) {
this.externalId = externalId;
}
@Override
public Integer getInterestCalculationPeriodMethod() {
return this.commonLoanProperties.getInterestCalculationPeriodMethod();
}
public void setInterestCalculationPeriodMethod(final Integer interestCalculationPeriodMethod) {
this.commonLoanProperties.setInterestCalculationPeriodMethod(interestCalculationPeriodMethod);
}
}