MIFOSX-141: move accountingType out of embedded class which is for fields common to both loan product and loan and move back into loan product only.
This commit is contained in:
+1
-1
@@ -57,6 +57,6 @@ public class LoanProductRelatedDetailAssembler {
|
||||
|
||||
return new LoanProductRelatedDetail(currency, principalAmount, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery, repaymentFrequencyType,
|
||||
defaultNumberOfInstallments, amortizationMethod, inArrearsTolerance, null);
|
||||
defaultNumberOfInstallments, amortizationMethod, inArrearsTolerance);
|
||||
}
|
||||
}
|
||||
+17
-4
@@ -58,6 +58,9 @@ public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
||||
@Embedded
|
||||
private final LoanProductRelatedDetail loanProductRelatedDetail;
|
||||
|
||||
@Column(name = "accounting_type", nullable = false)
|
||||
private Integer accountingType;
|
||||
|
||||
public static LoanProduct assembleFromJson(final Fund fund, final LoanTransactionProcessingStrategy loanTransactionProcessingStrategy,
|
||||
final Set<Charge> productCharges, final JsonCommand command, final AprCalculator aprCalculator) {
|
||||
|
||||
@@ -83,8 +86,7 @@ public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
||||
final Integer repaymentEvery = command.integerValueOfParameterNamed("repaymentEvery");
|
||||
final Integer numberOfRepayments = command.integerValueOfParameterNamed("numberOfRepayments");
|
||||
final BigDecimal inArrearsTolerance = command.bigDecimalValueOfParameterNamed("inArrearsTolerance");
|
||||
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(command
|
||||
.integerValueOfParameterNamed("accountingType"));
|
||||
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(command.integerValueOfParameterNamed("accountingType"));
|
||||
|
||||
return new LoanProduct(fund, loanTransactionProcessingStrategy, name, description, currency, principal, interestRatePerPeriod,
|
||||
interestFrequencyType, annualInterestRate, interestMethod, interestCalculationPeriodMethod, repaymentEvery,
|
||||
@@ -118,7 +120,11 @@ public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
||||
|
||||
this.loanProductRelatedDetail = new LoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod,
|
||||
interestPeriodFrequencyType, defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, repayEvery,
|
||||
repaymentFrequencyType, defaultNumberOfInstallments, amortizationMethod, inArrearsTolerance, accountingRuleType);
|
||||
repaymentFrequencyType, defaultNumberOfInstallments, amortizationMethod, inArrearsTolerance);
|
||||
|
||||
if (accountingRuleType != null) {
|
||||
this.accountingType = accountingRuleType.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
public MonetaryCurrency getCurrency() {
|
||||
@@ -128,7 +134,7 @@ public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
||||
public Set<Charge> getCharges() {
|
||||
return charges;
|
||||
}
|
||||
|
||||
|
||||
public void update(final Fund fund) {
|
||||
this.fund = fund;
|
||||
}
|
||||
@@ -145,6 +151,13 @@ public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
||||
|
||||
final Map<String, Object> actualChanges = this.loanProductRelatedDetail.update(command, aprCalculator);
|
||||
|
||||
final String accountingTypeParamName = "accountingType";
|
||||
if (command.isChangeInIntegerParameterNamed(accountingTypeParamName, this.accountingType)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(accountingTypeParamName);
|
||||
actualChanges.put(accountingTypeParamName, newValue);
|
||||
this.accountingType = newValue;
|
||||
}
|
||||
|
||||
final String nameParamName = "name";
|
||||
if (command.isChangeInStringParameterNamed(nameParamName, this.name)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(nameParamName);
|
||||
|
||||
+2
-34
@@ -73,23 +73,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
|
||||
@Column(name = "arrearstolerance_amount", scale = 6, precision = 19, nullable = true)
|
||||
private BigDecimal inArrearsTolerance;
|
||||
|
||||
@Column(name = "accounting_type", nullable = false)
|
||||
private Integer accountingType;
|
||||
|
||||
public static LoanProductRelatedDetail createFrom(final MonetaryCurrency currency, final BigDecimal principal,
|
||||
final BigDecimal nominalInterestRatePerPeriod, final PeriodFrequencyType interestRatePeriodFrequencyType,
|
||||
final BigDecimal nominalAnnualInterestRate, final InterestMethod interestMethod,
|
||||
final InterestCalculationPeriodMethod interestCalculationPeriodMethod, final Integer repaymentEvery,
|
||||
final PeriodFrequencyType repaymentPeriodFrequencyType, final Integer numberOfRepayments,
|
||||
final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance,
|
||||
final AccountingRuleType accountingRuleType) {
|
||||
|
||||
return new LoanProductRelatedDetail(currency, principal, nominalInterestRatePerPeriod, interestRatePeriodFrequencyType,
|
||||
nominalAnnualInterestRate, interestMethod, interestCalculationPeriodMethod, repaymentEvery, repaymentPeriodFrequencyType,
|
||||
numberOfRepayments, amortizationMethod, inArrearsTolerance, accountingRuleType);
|
||||
}
|
||||
|
||||
public static LoanProductRelatedDetail createFrom(final MonetaryCurrency currency, final BigDecimal principal,
|
||||
final BigDecimal nominalInterestRatePerPeriod, final PeriodFrequencyType interestRatePeriodFrequencyType,
|
||||
final BigDecimal nominalAnnualInterestRate, final InterestMethod interestMethod,
|
||||
@@ -99,7 +83,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
|
||||
return new LoanProductRelatedDetail(currency, principal, nominalInterestRatePerPeriod, interestRatePeriodFrequencyType,
|
||||
nominalAnnualInterestRate, interestMethod, interestCalculationPeriodMethod, repaymentEvery, repaymentPeriodFrequencyType,
|
||||
numberOfRepayments, amortizationMethod, inArrearsTolerance, null);
|
||||
numberOfRepayments, amortizationMethod, inArrearsTolerance);
|
||||
}
|
||||
|
||||
protected LoanProductRelatedDetail() {
|
||||
@@ -111,8 +95,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
final BigDecimal defaultAnnualNominalInterestRate, final InterestMethod interestMethod,
|
||||
final InterestCalculationPeriodMethod interestCalculationPeriodMethod, final Integer repayEvery,
|
||||
final PeriodFrequencyType repaymentFrequencyType, final Integer defaultNumberOfRepayments,
|
||||
final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance,
|
||||
final AccountingRuleType accountingRuleType) {
|
||||
final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance) {
|
||||
this.currency = currency;
|
||||
this.principal = defaultPrincipal;
|
||||
this.nominalInterestRatePerPeriod = defaultNominalInterestRatePerPeriod;
|
||||
@@ -129,9 +112,6 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
} else {
|
||||
this.inArrearsTolerance = inArrearsTolerance;
|
||||
}
|
||||
if(accountingRuleType !=null){
|
||||
this.accountingType = accountingRuleType.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
public MonetaryCurrency getCurrency() {
|
||||
@@ -184,11 +164,6 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
public AmortizationMethod getAmortizationMethod() {
|
||||
return amortizationMethod;
|
||||
}
|
||||
|
||||
|
||||
public Integer getAccountingType() {
|
||||
return this.accountingType;
|
||||
}
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command, final AprCalculator aprCalculator) {
|
||||
|
||||
@@ -310,13 +285,6 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
this.interestCalculationPeriodMethod = InterestCalculationPeriodMethod.fromInt(newValue);
|
||||
}
|
||||
|
||||
final String accountingTypeParamName = "accountingType";
|
||||
if (command.isChangeInIntegerParameterNamed(accountingTypeParamName, this.accountingType)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(accountingTypeParamName);
|
||||
actualChanges.put(accountingTypeParamName, newValue);
|
||||
this.accountingType = newValue;
|
||||
}
|
||||
|
||||
return actualChanges;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user