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.
This commit is contained in:
zeyad2003
2024-05-23 15:01:02 +02:00
committed by Adam Saghy
parent d0e71ed7d6
commit f59ae64222
14 changed files with 44 additions and 237 deletions
@@ -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();
@@ -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;
}
}