This is an automated email from the ASF dual-hosted git repository.
adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new f59ae6422 FINERACT-2075: (chore) introduce lombok annotations to
`LoanProduct` class.
f59ae6422 is described below
commit f59ae6422260ab490c6bcc9028eea3cb8308adb2
Author: zeyad2003 <[email protected]>
AuthorDate: Thu Apr 18 23:59:11 2024 +0200
FINERACT-2075: (chore) introduce lombok annotations to `LoanProduct` class.
- remove the redundant getters/setters methods from LoanProduct class.
- replace the non-standard methods with the convenient ones.
- modify other files that were depending on the old naming.
---
.../portfolio/loanaccount/domain/Loan.java | 6 +-
.../portfolio/loanproduct/domain/LoanProduct.java | 201 +--------------------
.../service/GuarantorDomainServiceImpl.java | 4 +-
...ntorWritePlatformServiceJpaRepositoryIImpl.java | 2 +-
.../service/LoanScheduleAssembler.java | 2 +-
...LoanScheduleCalculationPlatformServiceImpl.java | 2 +-
.../LoanApplicationCommandFromApiJsonHelper.java | 10 +-
.../VariableLoanScheduleFromApiJsonValidator.java | 2 +-
...ationWritePlatformServiceJpaRepositoryImpl.java | 36 ++--
.../loanaccount/service/LoanAssembler.java | 2 +-
.../service/LoanReadPlatformServiceImpl.java | 2 +-
.../LoanWritePlatformServiceJpaRepositoryImpl.java | 4 +-
.../serialization/LoanProductDataValidator.java | 4 +-
...oductWritePlatformServiceJpaRepositoryImpl.java | 4 +-
14 files changed, 44 insertions(+), 237 deletions(-)
diff --git
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
index 0769c1c26..1486deb62 100644
---
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
+++
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
@@ -1699,7 +1699,7 @@ public class Loan extends
AbstractAuditableWithUTCDateTimeCustom {
this.disbursementDetails.clear();
}
- if (loanProduct.isMultiDisburseLoan() ||
loanProduct.canDefineInstallmentAmount()) {
+ if (loanProduct.isMultiDisburseLoan() ||
loanProduct.isCanDefineInstallmentAmount()) {
if
(command.isChangeInBigDecimalParameterNamed(LoanApiConstants.emiAmountParameterName,
this.fixedEmiAmount)) {
this.fixedEmiAmount =
command.bigDecimalValueOfParameterNamed(LoanApiConstants.emiAmountParameterName);
actualChanges.put(LoanApiConstants.emiAmountParameterName,
this.fixedEmiAmount);
@@ -2561,7 +2561,7 @@ public class Loan extends
AbstractAuditableWithUTCDateTimeCustom {
final LocalDate actualDisbursementDate, BigDecimal emiAmount,
LocalDate nextPossibleRepaymentDate,
LocalDate rescheduledRepaymentDate) {
boolean isEmiAmountChanged = false;
- if ((this.loanProduct.isMultiDisburseLoan() ||
this.loanProduct.canDefineInstallmentAmount()) && emiAmount != null
+ if ((this.loanProduct.isMultiDisburseLoan() ||
this.loanProduct.isCanDefineInstallmentAmount()) && emiAmount != null
&& emiAmount.compareTo(retriveLastEmiAmount()) != 0) {
if (this.loanProduct.isMultiDisburseLoan()) {
final LocalDate dateValue = null;
@@ -5057,7 +5057,7 @@ public class Loan extends
AbstractAuditableWithUTCDateTimeCustom {
}
private void validateActivityNotBeforeLastTransactionDate(final LoanEvent
event, final LocalDate activityDate) {
- if (!(this.repaymentScheduleDetail().isInterestRecalculationEnabled()
|| this.loanProduct().isHoldGuaranteeFundsEnabled())) {
+ if (!(this.repaymentScheduleDetail().isInterestRecalculationEnabled()
|| this.loanProduct().isHoldGuaranteeFunds())) {
return;
}
LocalDate lastTransactionDate = getLastUserTransactionDate();
diff --git
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java
index 53abbff42..ce70dfb70 100644
---
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java
+++
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java
@@ -44,6 +44,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.accounting.common.AccountingRuleType;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
@@ -77,6 +79,8 @@ import org.apache.fineract.portfolio.rate.domain.Rate;
* They allow for constraints to be added at product level.
*/
@Entity
+@Getter
+@Setter
@Table(name = "m_product_loan", uniqueConstraints = {
@UniqueConstraint(columnNames = { "name" }, name = "unq_name"),
@UniqueConstraint(columnNames = { "external_id" }, name =
"external_id_UNIQUE"),
@UniqueConstraint(columnNames = { "short_name" }, name =
"unq_short_name") })
@@ -844,26 +848,6 @@ public class LoanProduct extends AbstractPersistableCustom
{
return this.loanProductRelatedDetail.getCurrency();
}
- public void update(final Fund fund) {
- this.fund = fund;
- }
-
- public void setTransactionProcessingStrategyCode(final String
transactionProcessingStrategyCode) {
- this.transactionProcessingStrategyCode =
transactionProcessingStrategyCode;
- }
-
- public String getTransactionProcessingStrategyCode() {
- return this.transactionProcessingStrategyCode;
- }
-
- public void setTransactionProcessingStrategyName(final String
transactionProcessingStrategyName) {
- this.transactionProcessingStrategyName =
transactionProcessingStrategyName;
- }
-
- public String getRepaymentStrategy() {
- return this.transactionProcessingStrategyCode;
- }
-
public boolean hasCurrencyCodeOf(final String currencyCode) {
return this.loanProductRelatedDetail.hasCurrencyCodeOf(currencyCode);
}
@@ -910,30 +894,6 @@ public class LoanProduct extends AbstractPersistableCustom
{
return updated;
}
- public Integer getAccountingType() {
- return this.accountingRule;
- }
-
- public List<Charge> getLoanProductCharges() {
- return this.charges;
- }
-
- public List<LoanProductPaymentAllocationRule> getPaymentAllocationRules() {
- return this.paymentAllocationRules;
- }
-
- public List<LoanProductCreditAllocationRule> getCreditAllocationRules() {
- return this.creditAllocationRules;
- }
-
- public void update(final LoanProductConfigurableAttributes
loanConfigurableAttributes) {
- this.loanConfigurableAttributes = loanConfigurableAttributes;
- }
-
- public LoanProductConfigurableAttributes
getLoanProductConfigurableAttributes() {
- return this.loanConfigurableAttributes;
- }
-
public Map<String, Object> update(final JsonCommand command, final
AprCalculator aprCalculator, FloatingRate floatingRate) {
final Map<String, Object> actualChanges =
this.loanProductRelatedDetail.update(command, aprCalculator);
@@ -1395,10 +1355,6 @@ public class LoanProduct extends
AbstractPersistableCustom {
return
AccountingRuleType.CASH_BASED.getValue().equals(this.accountingRule);
}
- public boolean isAccrualBasedAccountingEnabled() {
- return isUpfrontAccrualAccountingEnabled() ||
isPeriodicAccrualAccountingEnabled();
- }
-
public boolean isUpfrontAccrualAccountingEnabled() {
return
AccountingRuleType.ACCRUAL_UPFRONT.getValue().equals(this.accountingRule);
}
@@ -1457,30 +1413,6 @@ public class LoanProduct extends
AbstractPersistableCustom {
return this.loanProductMinMaxConstraints;
}
- public boolean isIncludeInBorrowerCycle() {
- return this.includeInBorrowerCycle;
- }
-
- public LocalDate getStartDate() {
- return this.startDate;
- }
-
- public LocalDate getCloseDate() {
- return this.closeDate;
- }
-
- public String productName() {
- return this.name;
- }
-
- public ExternalId getExternalId() {
- return this.externalId;
- }
-
- public boolean useBorrowerCycle() {
- return this.useBorrowerCycle;
- }
-
public boolean isMultiDisburseLoan() {
return this.loanProductTrancheDetails.isMultiDisburseLoan();
}
@@ -1512,14 +1444,6 @@ public class LoanProduct extends
AbstractPersistableCustom {
return borrowerCycleVariation;
}
- public boolean syncExpectedWithDisbursementDate() {
- return syncExpectedWithDisbursementDate;
- }
-
- public void setSyncExpectedWithDisbursementDate(boolean
syncExpectedWithDisbursementDate) {
- this.syncExpectedWithDisbursementDate =
syncExpectedWithDisbursementDate;
- }
-
public Map<String, BigDecimal>
fetchBorrowerCycleVariationsForCycleNumber(final Integer cycleNumber) {
Map<String, BigDecimal> borrowerCycleVariations = new HashMap<>();
borrowerCycleVariations.put(LoanProductConstants.PRINCIPAL,
this.loanProductRelatedDetail.getPrincipal().getAmount());
@@ -1627,26 +1551,6 @@ public class LoanProduct extends
AbstractPersistableCustom {
return this.loanProductRelatedDetail.fetchDaysInYearType();
}
- public LoanProductInterestRecalculationDetails
getProductInterestRecalculationDetails() {
- return this.productInterestRecalculationDetails;
- }
-
- public boolean isHoldGuaranteeFundsEnabled() {
- return this.holdGuaranteeFunds;
- }
-
- public LoanProductGuaranteeDetails getLoanProductGuaranteeDetails() {
- return this.loanProductGuaranteeDetails;
- }
-
- public String getShortName() {
- return this.shortName;
- }
-
- public BigDecimal getPrincipalThresholdForLastInstallment() {
- return this.principalThresholdForLastInstallment;
- }
-
public boolean isArrearsBasedOnOriginalSchedule() {
boolean isBasedOnOriginalSchedule = false;
if (getProductInterestRecalculationDetails() != null) {
@@ -1655,14 +1559,6 @@ public class LoanProduct extends
AbstractPersistableCustom {
return isBasedOnOriginalSchedule;
}
- public boolean canDefineInstallmentAmount() {
- return this.canDefineInstallmentAmount;
- }
-
- public Integer getInstallmentAmountInMultiplesOf() {
- return this.installmentAmountInMultiplesOf;
- }
-
public LoanPreClosureInterestCalculationStrategy
preCloseInterestCalculationStrategy() {
LoanPreClosureInterestCalculationStrategy
preCloseInterestCalculationStrategy =
LoanPreClosureInterestCalculationStrategy.NONE;
if (this.isInterestRecalculationEnabled()) {
@@ -1671,18 +1567,6 @@ public class LoanProduct extends
AbstractPersistableCustom {
return preCloseInterestCalculationStrategy;
}
- public LoanProductRelatedDetail getLoanProductRelatedDetail() {
- return loanProductRelatedDetail;
- }
-
- public boolean isLinkedToFloatingInterestRate() {
- return this.isLinkedToFloatingInterestRate;
- }
-
- public LoanProductFloatingRates getFloatingRates() {
- return this.floatingRates;
- }
-
public Collection<FloatingRatePeriodData> fetchInterestRates(final
FloatingRateDTO floatingRateDTO) {
Collection<FloatingRatePeriodData> applicableRates = new
ArrayList<>(1);
if (isLinkedToFloatingInterestRate()) {
@@ -1691,92 +1575,15 @@ public class LoanProduct extends
AbstractPersistableCustom {
return applicableRates;
}
- public boolean allowVariabeInstallments() {
- return this.allowVariabeInstallments;
- }
-
- public boolean canUseForTopup() {
- return this.canUseForTopup;
- }
-
public boolean isEqualAmortization() {
return loanProductRelatedDetail.isEqualAmortization();
}
- public List<Rate> getRates() {
- return rates;
- }
-
- public void setRates(List<Rate> rates) {
- this.rates = rates;
- }
-
- public BigDecimal getFixedPrincipalPercentagePerInstallment() {
- return fixedPrincipalPercentagePerInstallment;
- }
-
- public boolean isDisallowExpectedDisbursements() {
- return disallowExpectedDisbursements;
- }
-
- public boolean isAllowApprovedDisbursedAmountsOverApplied() {
- return allowApprovedDisbursedAmountsOverApplied;
- }
-
- public String getOverAppliedCalculationType() {
- return overAppliedCalculationType;
- }
-
- public Integer getOverAppliedNumber() {
- return overAppliedNumber;
- }
-
- public void setDisallowExpectedDisbursements(boolean
disallowExpectedDisbursements) {
- this.disallowExpectedDisbursements = disallowExpectedDisbursements;
- }
-
- public void setAllowApprovedDisbursedAmountsOverApplied(boolean
allowApprovedDisbursedAmountsOverApplied) {
- this.allowApprovedDisbursedAmountsOverApplied =
allowApprovedDisbursedAmountsOverApplied;
- }
-
- public void setOverAppliedCalculationType(String
overAppliedCalculationType) {
- this.overAppliedCalculationType = overAppliedCalculationType;
- }
-
- public void setOverAppliedNumber(Integer overAppliedNumber) {
- this.overAppliedNumber = overAppliedNumber;
- }
-
- public void setLoanProductTrancheDetails(LoanProductTrancheDetails
loanProducTrancheDetails) {
- this.loanProductTrancheDetails = loanProducTrancheDetails;
- }
-
- public DelinquencyBucket getDelinquencyBucket() {
- return delinquencyBucket;
- }
-
- public void setDelinquencyBucket(DelinquencyBucket delinquencyBucket) {
- this.delinquencyBucket = delinquencyBucket;
- }
-
- public Integer getDueDaysForRepaymentEvent() {
- return this.dueDaysForRepaymentEvent;
- }
-
- public Integer getOverDueDaysForRepaymentEvent() {
- return this.overDueDaysForRepaymentEvent;
- }
-
public RepaymentStartDateType getRepaymentStartDateType() {
return this.repaymentStartDateType == null ?
RepaymentStartDateType.INVALID : this.repaymentStartDateType;
}
- public boolean isEnableInstallmentLevelDelinquency() {
- return enableInstallmentLevelDelinquency;
- }
-
public void updateEnableInstallmentLevelDelinquency(boolean
enableInstallmentLevelDelinquency) {
this.enableInstallmentLevelDelinquency =
enableInstallmentLevelDelinquency;
}
-
}
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java
index 209df00da..4a4f44e12 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java
@@ -107,7 +107,7 @@ public class GuarantorDomainServiceImpl implements
GuarantorDomainService {
public void validateGuarantorBusinessRules(Loan loan) {
LoanProduct loanProduct = loan.loanProduct();
BigDecimal principal = loan.getPrincipal().getAmount();
- if (loanProduct.isHoldGuaranteeFundsEnabled()) {
+ if (loanProduct.isHoldGuaranteeFunds()) {
LoanProductGuaranteeDetails guaranteeData =
loanProduct.getLoanProductGuaranteeDetails();
final List<Guarantor> existGuarantorList =
this.guarantorRepository.findByLoan(loan);
BigDecimal mandatoryAmount =
principal.multiply(guaranteeData.getMandatoryGuarantee()).divide(BigDecimal.valueOf(100));
@@ -313,7 +313,7 @@ public class GuarantorDomainServiceImpl implements
GuarantorDomainService {
*
*/
private void holdGuarantorFunds(final Loan loan) {
- if (loan.loanProduct().isHoldGuaranteeFundsEnabled()) {
+ if (loan.loanProduct().isHoldGuaranteeFunds()) {
final List<Guarantor> existGuarantorList =
this.guarantorRepository.findByLoan(loan);
List<GuarantorFundingDetails> guarantorFundingDetailList = new
ArrayList<>();
List<DepositAccountOnHoldTransaction> onHoldTransactions = new
ArrayList<>();
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java
index 375e83d15..7e71bd14c 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java
@@ -123,7 +123,7 @@ public class
GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto
GuarantorFundStatusType.ACTIVE.getValue(),
guarantorCommand.getAmount());
guarantorFundingDetails.add(fundingDetails);
if (loan.isDisbursed()
- || (loan.isApproved() && (loan.getGuaranteeAmount() !=
null || loan.loanProduct().isHoldGuaranteeFundsEnabled()))) {
+ || (loan.isApproved() && (loan.getGuaranteeAmount() !=
null || loan.loanProduct().isHoldGuaranteeFunds()))) {
this.guarantorDomainService.assignGuarantor(fundingDetails,
DateUtils.getBusinessLocalDate());
loan.updateGuaranteeAmount(fundingDetails.getAmount());
}
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java
index 3ddff00e3..751573146 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java
@@ -1004,7 +1004,7 @@ public class LoanScheduleAssembler {
private void extractLoanTermVariations(final Loan loan, final String json,
final List<LoanTermVariations> loanTermVariations) {
final JsonElement element = this.fromApiJsonHelper.parse(json);
- if (loan.loanProduct().allowVariabeInstallments()) {
+ if (loan.loanProduct().isAllowVariabeInstallments()) {
if (element.isJsonObject() &&
this.fromApiJsonHelper.parameterExists(LoanApiConstants.exceptionParamName,
element)) {
final JsonObject topLevelJsonElement =
element.getAsJsonObject();
final String dateFormat =
this.fromApiJsonHelper.extractDateFormatParameter(topLevelJsonElement);
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java
index 6dba41379..43044ac18 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java
@@ -118,7 +118,7 @@ public class LoanScheduleCalculationPlatformServiceImpl
implements LoanScheduleC
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new
DataValidatorBuilder(dataValidationErrors).resource("loan");
- if (loanProduct.useBorrowerCycle()) {
+ if (loanProduct.isUseBorrowerCycle()) {
final Long clientId =
this.fromJsonHelper.extractLongNamed("clientId", query.parsedJson());
final Long groupId =
this.fromJsonHelper.extractLongNamed("groupId", query.parsedJson());
Integer cycleNumber = 0;
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java
index b8a5fff5b..f11acacd7 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java
@@ -517,7 +517,7 @@ public final class LoanApplicationCommandFromApiJsonHelper {
}
if
(this.fromApiJsonHelper.parameterExists(LoanApiConstants.emiAmountParameterName,
element)) {
- if (!(loanProduct.canDefineInstallmentAmount() ||
loanProduct.isMultiDisburseLoan())) {
+ if (!(loanProduct.isCanDefineInstallmentAmount() ||
loanProduct.isMultiDisburseLoan())) {
List<String> unsupportedParameterList = new ArrayList<>();
unsupportedParameterList.add(LoanApiConstants.emiAmountParameterName);
throw new
UnsupportedParameterException(unsupportedParameterList);
@@ -536,7 +536,7 @@ public final class LoanApplicationCommandFromApiJsonHelper {
.ignoreIfNull().positiveAmount();
}
- if (loanProduct.canUseForTopup() &&
this.fromApiJsonHelper.parameterExists(LoanApiConstants.isTopup, element)) {
+ if (loanProduct.isCanUseForTopup() &&
this.fromApiJsonHelper.parameterExists(LoanApiConstants.isTopup, element)) {
final Boolean isTopup =
this.fromApiJsonHelper.extractBooleanNamed(LoanApiConstants.isTopup, element);
baseDataValidator.reset().parameter(LoanApiConstants.isTopup).value(isTopup).validateForBooleanValue();
@@ -1079,7 +1079,7 @@ public final class
LoanApplicationCommandFromApiJsonHelper {
}
if
(this.fromApiJsonHelper.parameterExists(LoanApiConstants.emiAmountParameterName,
element)) {
- if (!(loanProduct.canDefineInstallmentAmount() ||
loanProduct.isMultiDisburseLoan())) {
+ if (!(loanProduct.isCanDefineInstallmentAmount() ||
loanProduct.isMultiDisburseLoan())) {
List<String> unsupportedParameterList = new ArrayList<>();
unsupportedParameterList.add(LoanApiConstants.emiAmountParameterName);
throw new
UnsupportedParameterException(unsupportedParameterList);
@@ -1099,7 +1099,7 @@ public final class
LoanApplicationCommandFromApiJsonHelper {
.ignoreIfNull().positiveAmount();
}
- if (loanProduct.canUseForTopup() &&
this.fromApiJsonHelper.parameterExists(LoanApiConstants.isTopup, element)) {
+ if (loanProduct.isCanUseForTopup() &&
this.fromApiJsonHelper.parameterExists(LoanApiConstants.isTopup, element)) {
final Boolean isTopup =
this.fromApiJsonHelper.extractBooleanNamed(LoanApiConstants.isTopup, element);
baseDataValidator.reset().parameter(LoanApiConstants.isTopup).value(isTopup).ignoreIfNull().validateForBooleanValue();
@@ -1422,7 +1422,7 @@ public final class
LoanApplicationCommandFromApiJsonHelper {
.failWithCode("not.supported.for.selected.interest.calcualtion.type");
}
- if (loanProduct.allowVariabeInstallments()) {
+ if (loanProduct.isAllowVariabeInstallments()) {
baseDataValidator.reset().parameter(LoanProductConstants.allowVariableInstallmentsParamName)
.failWithCode("not.supported.for.selected.interest.calcualtion.type");
}
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/VariableLoanScheduleFromApiJsonValidator.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/VariableLoanScheduleFromApiJsonValidator.java
index 1143998c8..56f795451 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/VariableLoanScheduleFromApiJsonValidator.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/VariableLoanScheduleFromApiJsonValidator.java
@@ -85,7 +85,7 @@ public class VariableLoanScheduleFromApiJsonValidator {
}
final JsonElement element = this.fromApiJsonHelper.parse(json);
- if (loan.loanProduct().allowVariabeInstallments()) {
+ if (loan.loanProduct().isAllowVariabeInstallments()) {
if (element.isJsonObject() &&
this.fromApiJsonHelper.parameterExists(LoanApiConstants.exceptionParamName,
element)) {
final JsonObject topLevelJsonElement =
element.getAsJsonObject();
final String dateFormat =
this.fromApiJsonHelper.extractDateFormatParameter(topLevelJsonElement);
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
index c54983445..6d59184d9 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
@@ -235,7 +235,7 @@ public class
LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
final List<ApiParameterError> dataValidationErrors = new
ArrayList<>();
final DataValidatorBuilder baseDataValidator = new
DataValidatorBuilder(dataValidationErrors).resource("loan");
- if (loanProduct.useBorrowerCycle()) {
+ if (loanProduct.isUseBorrowerCycle()) {
Integer cycleNumber = 0;
if (clientId != null) {
cycleNumber =
this.loanReadPlatformService.retriveLoanCounter(clientId, loanProduct.getId());
@@ -264,7 +264,7 @@ public class
LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
final LoanProductRelatedDetail productRelatedDetail =
newLoanApplication.repaymentScheduleDetail();
- if (loanProduct.getLoanProductConfigurableAttributes() != null) {
+ if (loanProduct.getLoanConfigurableAttributes() != null) {
updateProductRelatedDetails(productRelatedDetail,
newLoanApplication);
}
@@ -273,7 +273,7 @@ public class
LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
productRelatedDetail.getRepayEvery(),
productRelatedDetail.getRepaymentPeriodFrequencyType().getValue(),
newLoanApplication);
- if (loanProduct.canUseForTopup() && clientId != null) {
+ if (loanProduct.isCanUseForTopup() && clientId != null) {
final Boolean isTopup =
command.booleanObjectValueOfParameterNamed(LoanApiConstants.isTopup);
if (null == isTopup) {
newLoanApplication.setIsTopup(false);
@@ -553,7 +553,7 @@ public class
LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
activeLoansLoanProductIds =
this.loanRepositoryWrapper.findActiveLoansLoanProductIdsByClient(loan.getClientId(),
LoanStatus.ACTIVE.getValue());
}
- checkForProductMixRestrictions(activeLoansLoanProductIds, productId,
loan.loanProduct().productName());
+ checkForProductMixRestrictions(activeLoansLoanProductIds, productId,
loan.loanProduct().getName());
}
private void checkForProductMixRestrictions(final List<Long>
activeLoansLoanProductIds, final Long productId,
@@ -574,15 +574,15 @@ public class
LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
}
private void updateProductRelatedDetails(LoanProductRelatedDetail
productRelatedDetail, Loan loan) {
- final Boolean amortization =
loan.loanProduct().getLoanProductConfigurableAttributes().getAmortizationBoolean();
- final Boolean arrearsTolerance =
loan.loanProduct().getLoanProductConfigurableAttributes().getArrearsToleranceBoolean();
- final Boolean graceOnArrearsAging =
loan.loanProduct().getLoanProductConfigurableAttributes().getGraceOnArrearsAgingBoolean();
- final Boolean interestCalcPeriod =
loan.loanProduct().getLoanProductConfigurableAttributes().getInterestCalcPeriodBoolean();
- final Boolean interestMethod =
loan.loanProduct().getLoanProductConfigurableAttributes().getInterestMethodBoolean();
- final Boolean graceOnPrincipalAndInterestPayment =
loan.loanProduct().getLoanProductConfigurableAttributes()
+ final Boolean amortization =
loan.loanProduct().getLoanConfigurableAttributes().getAmortizationBoolean();
+ final Boolean arrearsTolerance =
loan.loanProduct().getLoanConfigurableAttributes().getArrearsToleranceBoolean();
+ final Boolean graceOnArrearsAging =
loan.loanProduct().getLoanConfigurableAttributes().getGraceOnArrearsAgingBoolean();
+ final Boolean interestCalcPeriod =
loan.loanProduct().getLoanConfigurableAttributes().getInterestCalcPeriodBoolean();
+ final Boolean interestMethod =
loan.loanProduct().getLoanConfigurableAttributes().getInterestMethodBoolean();
+ final Boolean graceOnPrincipalAndInterestPayment =
loan.loanProduct().getLoanConfigurableAttributes()
.getGraceOnPrincipalAndInterestPaymentBoolean();
- final Boolean repaymentEvery =
loan.loanProduct().getLoanProductConfigurableAttributes().getRepaymentEveryBoolean();
- final Boolean transactionProcessingStrategy =
loan.loanProduct().getLoanProductConfigurableAttributes()
+ final Boolean repaymentEvery =
loan.loanProduct().getLoanConfigurableAttributes().getRepaymentEveryBoolean();
+ final Boolean transactionProcessingStrategy =
loan.loanProduct().getLoanConfigurableAttributes()
.getTransactionProcessingStrategyBoolean();
if (!amortization) {
@@ -609,9 +609,9 @@ public class
LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
productRelatedDetail.setRepayEvery(loan.loanProduct().getLoanProductRelatedDetail().getRepayEvery());
}
if (!transactionProcessingStrategy) {
-
loan.updateTransactionProcessingStrategy(loan.loanProduct().getRepaymentStrategy(),
-
this.loanRepaymentScheduleTransactionProcessorFactory.determineProcessor(loan.loanProduct().getRepaymentStrategy())
- .getName());
+
loan.updateTransactionProcessingStrategy(loan.loanProduct().getTransactionProcessingStrategyCode(),
+ this.loanRepaymentScheduleTransactionProcessorFactory
+
.determineProcessor(loan.loanProduct().getTransactionProcessingStrategyCode()).getName());
}
}
@@ -807,7 +807,7 @@ public class
LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
}
final List<ApiParameterError> dataValidationErrors = new
ArrayList<>();
final DataValidatorBuilder baseDataValidator = new
DataValidatorBuilder(dataValidationErrors).resource("loan");
- if (newLoanProduct.useBorrowerCycle()) {
+ if (newLoanProduct.isUseBorrowerCycle()) {
final Long clientId =
this.fromJsonHelper.extractLongNamed("clientId", command.parsedJson());
final Long groupId =
this.fromJsonHelper.extractLongNamed("groupId", command.parsedJson());
Integer cycleNumber = 0;
@@ -838,11 +838,11 @@ public class
LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
validateSubmittedOnDate(existingLoanApplication);
final LoanProductRelatedDetail productRelatedDetail =
existingLoanApplication.repaymentScheduleDetail();
- if
(existingLoanApplication.loanProduct().getLoanProductConfigurableAttributes()
!= null) {
+ if
(existingLoanApplication.loanProduct().getLoanConfigurableAttributes() != null)
{
updateProductRelatedDetails(productRelatedDetail,
existingLoanApplication);
}
- if (existingLoanApplication.getLoanProduct().canUseForTopup() &&
existingLoanApplication.getClientId() != null) {
+ if (existingLoanApplication.getLoanProduct().isCanUseForTopup() &&
existingLoanApplication.getClientId() != null) {
final Boolean isTopup =
command.booleanObjectValueOfParameterNamed(LoanApiConstants.isTopup);
if
(command.isChangeInBooleanParameterNamed(LoanApiConstants.isTopup,
existingLoanApplication.isTopup())) {
existingLoanApplication.setIsTopup(isTopup);
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java
index 708155759..e8dd42def 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java
@@ -164,7 +164,7 @@ public class LoanAssembler {
}
List<LoanDisbursementDetails> disbursementDetails = new ArrayList<>();
BigDecimal fixedEmiAmount = null;
- if (loanProduct.isMultiDisburseLoan() ||
loanProduct.canDefineInstallmentAmount()) {
+ if (loanProduct.isMultiDisburseLoan() ||
loanProduct.isCanDefineInstallmentAmount()) {
fixedEmiAmount =
this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(LoanApiConstants.emiAmountParameterName,
element);
}
BigDecimal maxOutstandingLoanBalance = null;
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
index 5f7efd020..3c77d7279 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
@@ -1676,7 +1676,7 @@ public class LoanReadPlatformServiceImpl implements
LoanReadPlatformService, Loa
if (!backdatePenalties && !isDueToday) {
continue;
}
- Optional<Charge> penaltyCharge =
loan.getLoanProduct().getLoanProductCharges().stream()
+ Optional<Charge> penaltyCharge =
loan.getLoanProduct().getCharges().stream()
.filter((e) ->
ChargeTimeType.OVERDUE_INSTALLMENT.getValue().equals(e.getChargeTimeType()) &&
e.isLoanCharge())
.findFirst();
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
index 30178a248..696980d58 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
@@ -347,7 +347,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl
implements LoanWritePlatf
// validate ActualDisbursement Date Against Expected Disbursement Date
LoanProduct loanProduct = loan.loanProduct();
- if (loanProduct.syncExpectedWithDisbursementDate()) {
+ if (loanProduct.isSyncExpectedWithDisbursementDate()) {
syncExpectedDateWithActualDisbursementDate(loan,
actualDisbursementDate);
}
@@ -725,7 +725,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl
implements LoanWritePlatf
// validate ActualDisbursement Date Against Expected Disbursement
// Date
LoanProduct loanProduct = loan.loanProduct();
- if (loanProduct.syncExpectedWithDisbursementDate()) {
+ if (loanProduct.isSyncExpectedWithDisbursementDate()) {
syncExpectedDateWithActualDisbursementDate(loan,
actualDisbursementDate);
}
checkClientOrGroupActive(loan);
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
index 8bcee6782..b1d6d3d34 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
@@ -1556,7 +1556,7 @@ public final class LoanProductDataValidator {
baseDataValidator);
// Guarantee Funds
- Boolean holdGuaranteeFunds = loanProduct.isHoldGuaranteeFundsEnabled();
+ Boolean holdGuaranteeFunds = loanProduct.isHoldGuaranteeFunds();
if
(this.fromApiJsonHelper.parameterExists(LoanProductConstants.holdGuaranteeFundsParamName,
element)) {
holdGuaranteeFunds =
this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.holdGuaranteeFundsParamName,
element);
baseDataValidator.reset().parameter(LoanProductConstants.holdGuaranteeFundsParamName).value(holdGuaranteeFunds).notNull()
@@ -2378,7 +2378,7 @@ public final class LoanProductDataValidator {
variableInstallments = this.fromApiJsonHelper
.extractBooleanNamed(LoanProductConstants.allowVariableInstallmentsParamName,
element);
} else if (loanProduct != null) {
- variableInstallments =
loanProduct.allowVariabeInstallments();
+ variableInstallments =
loanProduct.isAllowVariabeInstallments();
}
if (variableInstallments != null && variableInstallments) {
baseDataValidator.reset().parameter(LoanProductConstants.allowVariableInstallmentsParamName)
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java
index 0408406b2..55266d185 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java
@@ -205,7 +205,7 @@ public class
LoanProductWritePlatformServiceJpaRepositoryImpl implements LoanPro
if (changes.containsKey("fundId")) {
final Long fundId = (Long) changes.get("fundId");
final Fund fund = findFundByIdIfProvided(fundId);
- product.update(fund);
+ product.setFund(fund);
}
if (changes.containsKey("delinquencyBucketId")) {
@@ -253,7 +253,7 @@ public class
LoanProductWritePlatformServiceJpaRepositoryImpl implements LoanPro
// accounting related changes
final boolean accountingTypeChanged =
changes.containsKey("accountingRule");
final Map<String, Object> accountingMappingChanges =
this.accountMappingWritePlatformService
- .updateLoanProductToGLAccountMapping(product.getId(),
command, accountingTypeChanged, product.getAccountingType());
+ .updateLoanProductToGLAccountMapping(product.getId(),
command, accountingTypeChanged, product.getAccountingRule());
changes.putAll(accountingMappingChanges);
if (changes.containsKey(LoanProductConstants.RATES_PARAM_NAME)) {