This is an automated email from the ASF dual-hosted git repository.

arnold 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 78c541e99 refactor: add lombok to producttoaccountmapping module
78c541e99 is described below

commit 78c541e992b8eefc9e931dce502d21d8695847cc
Author: Hemant Gupta <[email protected]>
AuthorDate: Mon Aug 29 03:51:39 2022 +0530

    refactor: add lombok to producttoaccountmapping module
---
 .../data/ChargeToGLAccountMapper.java              |  9 ++-
 .../data/PaymentTypeToGLAccountMapper.java         | 15 ++--
 .../domain/ProductToGLAccountMapping.java          | 87 +++-------------------
 .../service/ProductToGLAccountMappingHelper.java   | 22 +++---
 ...tToGLAccountMappingReadPlatformServiceImpl.java |  8 +-
 5 files changed, 42 insertions(+), 99 deletions(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java
 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java
index b0dcc452d..4159d5e7f 100755
--- 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java
@@ -21,13 +21,18 @@ package 
org.apache.fineract.accounting.producttoaccountmapping.data;
 import java.io.Serializable;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.experimental.Accessors;
 import org.apache.fineract.accounting.glaccount.data.GLAccountData;
 import org.apache.fineract.portfolio.charge.data.ChargeData;
 
 @RequiredArgsConstructor
 @Getter
+@Setter
+@Accessors(chain = true)
 public class ChargeToGLAccountMapper implements Serializable {
 
-    private final ChargeData charge;
-    private final GLAccountData incomeAccount;
+    private static final long serialVersionUID = 1L;
+    private ChargeData charge;
+    private GLAccountData incomeAccount;
 }
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java
 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java
index e0e80d4d9..f2f40c6fe 100755
--- 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java
@@ -19,15 +19,18 @@
 package org.apache.fineract.accounting.producttoaccountmapping.data;
 
 import java.io.Serializable;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
 import org.apache.fineract.accounting.glaccount.data.GLAccountData;
 import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
 
-@RequiredArgsConstructor
-@Getter
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
 public class PaymentTypeToGLAccountMapper implements Serializable {
 
-    private final PaymentTypeData paymentType;
-    private final GLAccountData fundSourceAccount;
+    private static final long serialVersionUID = 1L;
+    private PaymentTypeData paymentType;
+    private GLAccountData fundSourceAccount;
 }
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/domain/ProductToGLAccountMapping.java
 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/domain/ProductToGLAccountMapping.java
index 82b4faaa2..1d73a7101 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/domain/ProductToGLAccountMapping.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/domain/ProductToGLAccountMapping.java
@@ -24,11 +24,19 @@ import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import javax.persistence.UniqueConstraint;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.experimental.Accessors;
 import org.apache.fineract.accounting.glaccount.domain.GLAccount;
 import 
org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
 import org.apache.fineract.portfolio.charge.domain.Charge;
 import org.apache.fineract.portfolio.paymenttype.domain.PaymentType;
 
+@Getter
+@Setter
+@NoArgsConstructor
+@Accessors(chain = true)
 @Entity
 @Table(name = "acc_product_mapping", uniqueConstraints = { 
@UniqueConstraint(columnNames = { "product_id", "product_type",
         "financial_account_type", "payment_type" }, name = "financial_action") 
})
@@ -57,84 +65,9 @@ public class ProductToGLAccountMapping extends 
AbstractPersistableCustom {
 
     public static ProductToGLAccountMapping createNew(final GLAccount 
glAccount, final Long productId, final int productType,
             final int financialAccountType) {
-        return new ProductToGLAccountMapping(glAccount, productId, 
productType, financialAccountType);
-    }
-
-    protected ProductToGLAccountMapping() {
-        //
-    }
-
-    public ProductToGLAccountMapping(final GLAccount glAccount, final Long 
productId, final int productType,
-            final int financialAccountType) {
-        this(glAccount, productId, productType, financialAccountType, null, 
null);
-    }
-
-    public ProductToGLAccountMapping(final GLAccount glAccount, final Long 
productId, final int productType, final int financialAccountType,
-            final Charge charge) {
-        this(glAccount, productId, productType, financialAccountType, null, 
charge);
-    }
-
-    public ProductToGLAccountMapping(final GLAccount glAccount, final Long 
productId, final int productType, final int financialAccountType,
-            final PaymentType paymentType) {
-        this(glAccount, productId, productType, financialAccountType, 
paymentType, null);
-    }
-
-    private ProductToGLAccountMapping(final GLAccount glAccount, final Long 
productId, final int productType,
-            final int financialAccountType, final PaymentType paymentType, 
final Charge charge) {
-        this.glAccount = glAccount;
-        this.productId = productId;
-        this.productType = productType;
-        this.financialAccountType = financialAccountType;
-        this.paymentType = paymentType;
-        this.charge = charge;
-    }
-
-    public GLAccount getGlAccount() {
-        return this.glAccount;
-    }
-
-    public void setGlAccount(final GLAccount glAccount) {
-        this.glAccount = glAccount;
-    }
-
-    public Long getProductId() {
-        return this.productId;
-    }
-
-    public void setProductId(final Long productId) {
-        this.productId = productId;
-    }
-
-    public int getProductType() {
-        return this.productType;
-    }
-
-    public void setProductType(final int productType) {
-        this.productType = productType;
-    }
-
-    public int getFinancialAccountType() {
-        return this.financialAccountType;
-    }
-
-    public void setFinancialAccountType(final int financialAccountType) {
-        this.financialAccountType = financialAccountType;
-    }
-
-    public PaymentType getPaymentType() {
-        return this.paymentType;
-    }
-
-    public void setPaymentType(final PaymentType paymentType) {
-        this.paymentType = paymentType;
-    }
-
-    public Charge getCharge() {
-        return this.charge;
-    }
 
-    public void setCharge(final Charge charge) {
-        this.charge = charge;
+        return new 
ProductToGLAccountMapping().setGlAccount(glAccount).setProductId(productId).setProductType(productType)
+                .setFinancialAccountType(financialAccountType);
     }
 
 }
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java
 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java
index c127be060..3b594ba56 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java
@@ -66,8 +66,8 @@ public class ProductToGLAccountMappingHelper {
         if (accountId != null) { // optional entries may be null
             final GLAccount glAccount = getAccountByIdAndType(paramName, 
expectedAccountType, accountId);
 
-            final ProductToGLAccountMapping accountMapping = new 
ProductToGLAccountMapping(glAccount, productId,
-                    portfolioProductType.getValue(), placeHolderTypeId);
+            final ProductToGLAccountMapping accountMapping = new 
ProductToGLAccountMapping().setGlAccount(glAccount).setProductId(productId)
+                    
.setProductType(portfolioProductType.getValue()).setFinancialAccountType(placeHolderTypeId);
             this.accountMappingRepository.saveAndFlush(accountMapping);
         }
     }
@@ -112,8 +112,8 @@ public class ProductToGLAccountMappingHelper {
             if (accountMapping == null) {
                 final GLAccount glAccount = getAccountByIdAndType(paramName, 
expectedAccountType, accountId);
                 changes.put(paramName, accountId);
-                ProductToGLAccountMapping newAccountMapping = new 
ProductToGLAccountMapping(glAccount, productId,
-                        portfolioProductType.getValue(), accountTypeId);
+                ProductToGLAccountMapping newAccountMapping = new 
ProductToGLAccountMapping().setGlAccount(glAccount)
+                        
.setProductId(productId).setProductType(portfolioProductType.getValue()).setFinancialAccountType(accountTypeId);
                 this.accountMappingRepository.saveAndFlush(newAccountMapping);
             } else if 
(!accountMapping.getGlAccount().getId().equals(accountId)) {
                 final GLAccount glAccount = getAccountByIdAndType(paramName, 
expectedAccountType, accountId);
@@ -354,20 +354,21 @@ public class ProductToGLAccountMappingHelper {
 
     /**
      * @param productId
-     * @param jsonObject
+     *
      */
     private void savePaymentChannelToFundSourceMapping(final Long productId, 
final Long paymentTypeId,
             final Long paymentTypeSpecificFundAccountId, final 
PortfolioProductType portfolioProductType) {
         final PaymentType paymentType = 
this.paymentTypeRepositoryWrapper.findOneWithNotFoundDetection(paymentTypeId);
         final GLAccount glAccount = 
getAccountById(LoanProductAccountingParams.FUND_SOURCE.getValue(), 
paymentTypeSpecificFundAccountId);
-        final ProductToGLAccountMapping accountMapping = new 
ProductToGLAccountMapping(glAccount, productId,
-                portfolioProductType.getValue(), 
CashAccountsForLoan.FUND_SOURCE.getValue(), paymentType);
+        final ProductToGLAccountMapping accountMapping = new 
ProductToGLAccountMapping().setGlAccount(glAccount).setProductId(productId)
+                
.setProductType(portfolioProductType.getValue()).setFinancialAccountType(CashAccountsForLoan.FUND_SOURCE.getValue())
+                .setPaymentType(paymentType);
         this.accountMappingRepository.saveAndFlush(accountMapping);
     }
 
     /**
      * @param productId
-     * @param jsonObject
+     *
      */
     private void saveChargeToFundSourceMapping(final Long productId, final 
Long chargeId, final Long incomeAccountId,
             final PortfolioProductType portfolioProductType, final boolean 
isPenalty) {
@@ -391,8 +392,9 @@ public class ProductToGLAccountMappingHelper {
                     incomeAccountId);
             placeHolderAccountType = CashAccountsForLoan.INCOME_FROM_FEES;
         }
-        final ProductToGLAccountMapping accountMapping = new 
ProductToGLAccountMapping(glAccount, productId,
-                portfolioProductType.getValue(), 
placeHolderAccountType.getValue(), charge);
+        final ProductToGLAccountMapping accountMapping = new 
ProductToGLAccountMapping().setGlAccount(glAccount).setProductId(productId)
+                
.setProductType(portfolioProductType.getValue()).setFinancialAccountType(placeHolderAccountType.getValue())
+                .setCharge(charge);
         this.accountMappingRepository.saveAndFlush(accountMapping);
     }
 
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java
 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java
index e7362ed3f..5cf3f735d 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java
@@ -246,7 +246,6 @@ public class 
ProductToGLAccountMappingReadPlatformServiceImpl implements Product
 
     /**
      * @param loanProductId
-     * @param paymentTypeToGLAccountMappers
      * @return
      */
     private List<PaymentTypeToGLAccountMapper> 
fetchPaymentTypeToFundSourceMappings(final PortfolioProductType 
portfolioProductType,
@@ -271,8 +270,8 @@ public class 
ProductToGLAccountMappingReadPlatformServiceImpl implements Product
 
             final GLAccountData gLAccountData = new 
GLAccountData().setId(glAccountId).setName(glAccountName).setGlCode(glCode);
 
-            final PaymentTypeToGLAccountMapper paymentTypeToGLAccountMapper = 
new PaymentTypeToGLAccountMapper(paymentTypeData,
-                    gLAccountData);
+            final PaymentTypeToGLAccountMapper paymentTypeToGLAccountMapper = 
new PaymentTypeToGLAccountMapper()
+                    
.setPaymentType(paymentTypeData).setFundSourceAccount(gLAccountData);
             paymentTypeToGLAccountMappers.add(paymentTypeToGLAccountMapper);
         }
         return paymentTypeToGLAccountMappers;
@@ -323,7 +322,8 @@ public class 
ProductToGLAccountMappingReadPlatformServiceImpl implements Product
             final String chargeName = (String) 
chargeToIncomeAccountMap.get("chargeName");
             final Boolean penalty1 = (Boolean) 
chargeToIncomeAccountMap.get("penalty");
             final ChargeData chargeData = ChargeData.lookup(chargeId, 
chargeName, penalty1);
-            final ChargeToGLAccountMapper chargeToGLAccountMapper = new 
ChargeToGLAccountMapper(chargeData, gLAccountData);
+            final ChargeToGLAccountMapper chargeToGLAccountMapper = new 
ChargeToGLAccountMapper().setCharge(chargeData)
+                    .setIncomeAccount(gLAccountData);
             chargeToGLAccountMappers.add(chargeToGLAccountMapper);
         }
         return chargeToGLAccountMappers;

Reply via email to