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

aleks 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 8710b1cff Add custom Configuration class for interoperation module 
(FINERACT-1932)
8710b1cff is described below

commit 8710b1cff0006d68007bf468ad4b561b5f557784
Author: Sinha, Abhinav <[email protected]>
AuthorDate: Mon Oct 23 18:50:16 2023 -0400

    Add custom Configuration class for interoperation module (FINERACT-1932)
---
 .../interoperation/service/InteropServiceImpl.java | 40 ++------------
 .../starter/InteroperationConfiguration.java       | 62 ++++++++++++++++++++++
 2 files changed, 67 insertions(+), 35 deletions(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/interoperation/service/InteropServiceImpl.java
 
b/fineract-provider/src/main/java/org/apache/fineract/interoperation/service/InteropServiceImpl.java
index 828821c14..7b884d4fd 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/interoperation/service/InteropServiceImpl.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/interoperation/service/InteropServiceImpl.java
@@ -38,6 +38,8 @@ import java.time.format.DateTimeFormatter;
 import java.util.List;
 import java.util.Locale;
 import java.util.function.Predicate;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.apache.fineract.commands.domain.CommandWrapper;
@@ -104,22 +106,17 @@ import 
org.apache.fineract.portfolio.savings.domain.SavingsHelper;
 import 
org.apache.fineract.portfolio.savings.exception.InsufficientAccountBalanceException;
 import 
org.apache.fineract.portfolio.savings.exception.SavingsAccountNotFoundException;
 import org.apache.fineract.useradministration.domain.AppUser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.dao.EmptyResultDataAccessException;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.RowMapper;
 import org.springframework.orm.jpa.JpaSystemException;
-import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-@Service
+@Slf4j
+@RequiredArgsConstructor
 public class InteropServiceImpl implements InteropService {
 
-    private static final Logger LOG = 
LoggerFactory.getLogger(InteropServiceImpl.class);
-
     private final PlatformSecurityContext securityContext;
     private final InteropDataValidator dataValidator;
 
@@ -143,33 +140,6 @@ public class InteropServiceImpl implements InteropService {
     private final DefaultToApiJsonSerializer<LoanAccountData> 
toApiJsonSerializer;
     private final DatabaseSpecificSQLGenerator sqlGenerator;
 
-    @Autowired
-    public InteropServiceImpl(PlatformSecurityContext securityContext, 
InteropDataValidator interopDataValidator,
-            SavingsAccountRepository savingsAccountRepository, 
SavingsAccountTransactionRepository savingsAccountTransactionRepository,
-            ApplicationCurrencyRepository applicationCurrencyRepository, 
NoteRepository noteRepository,
-            PaymentTypeRepository paymentTypeRepository, 
InteropIdentifierRepository identifierRepository, LoanRepository loanRepository,
-            SavingsHelper savingsHelper, 
SavingsAccountTransactionSummaryWrapper savingsAccountTransactionSummaryWrapper,
-            SavingsAccountDomainService savingsAccountService, final 
JdbcTemplate jdbcTemplate,
-            final PortfolioCommandSourceWritePlatformService 
commandsSourceWritePlatformService,
-            final DefaultToApiJsonSerializer<LoanAccountData> 
toApiJsonSerializer, DatabaseSpecificSQLGenerator sqlGenerator) {
-        this.securityContext = securityContext;
-        this.dataValidator = interopDataValidator;
-        this.savingsAccountRepository = savingsAccountRepository;
-        this.savingsAccountTransactionRepository = 
savingsAccountTransactionRepository;
-        this.currencyRepository = applicationCurrencyRepository;
-        this.noteRepository = noteRepository;
-        this.paymentTypeRepository = paymentTypeRepository;
-        this.identifierRepository = identifierRepository;
-        this.loanRepository = loanRepository;
-        this.savingsHelper = savingsHelper;
-        this.savingsAccountTransactionSummaryWrapper = 
savingsAccountTransactionSummaryWrapper;
-        this.savingsAccountService = savingsAccountService;
-        this.jdbcTemplate = jdbcTemplate;
-        this.commandsSourceWritePlatformService = 
commandsSourceWritePlatformService;
-        this.toApiJsonSerializer = toApiJsonSerializer;
-        this.sqlGenerator = sqlGenerator;
-    }
-
     private static final class KycMapper implements RowMapper<InteropKycData> {
 
         private final DatabaseSpecificSQLGenerator sqlGenerator;
@@ -661,7 +631,7 @@ public class InteropServiceImpl implements InteropService {
                     "idType", idType.name(), accountId);
         }
 
-        LOG.error("Error occured.", dve);
+        log.error("Error occured.", dve);
         throw new 
PlatformDataIntegrityException("error.msg.interop.unknown.data.integrity.issue",
                 "Unknown data integrity issue with resource.");
     }
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/interoperation/starter/InteroperationConfiguration.java
 
b/fineract-provider/src/main/java/org/apache/fineract/interoperation/starter/InteroperationConfiguration.java
new file mode 100644
index 000000000..9f5ce202d
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/interoperation/starter/InteroperationConfiguration.java
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.interoperation.starter;
+
+import 
org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
+import 
org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
+import 
org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
+import 
org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.apache.fineract.interoperation.domain.InteropIdentifierRepository;
+import org.apache.fineract.interoperation.serialization.InteropDataValidator;
+import org.apache.fineract.interoperation.service.InteropService;
+import org.apache.fineract.interoperation.service.InteropServiceImpl;
+import 
org.apache.fineract.organisation.monetary.domain.ApplicationCurrencyRepository;
+import org.apache.fineract.portfolio.loanaccount.data.LoanAccountData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanRepository;
+import org.apache.fineract.portfolio.note.domain.NoteRepository;
+import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepository;
+import 
org.apache.fineract.portfolio.savings.domain.SavingsAccountDomainService;
+import org.apache.fineract.portfolio.savings.domain.SavingsAccountRepository;
+import 
org.apache.fineract.portfolio.savings.domain.SavingsAccountTransactionRepository;
+import 
org.apache.fineract.portfolio.savings.domain.SavingsAccountTransactionSummaryWrapper;
+import org.apache.fineract.portfolio.savings.domain.SavingsHelper;
+import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+@Configuration
+public class InteroperationConfiguration {
+
+    @Bean
+    @ConditionalOnMissingBean(InteropService.class)
+    public InteropService interopService(PlatformSecurityContext 
securityContext, InteropDataValidator interopDataValidator,
+            SavingsAccountRepository savingsAccountRepository, 
SavingsAccountTransactionRepository savingsAccountTransactionRepository,
+            ApplicationCurrencyRepository applicationCurrencyRepository, 
NoteRepository noteRepository,
+            PaymentTypeRepository paymentTypeRepository, 
InteropIdentifierRepository identifierRepository, LoanRepository loanRepository,
+            SavingsHelper savingsHelper, 
SavingsAccountTransactionSummaryWrapper savingsAccountTransactionSummaryWrapper,
+            SavingsAccountDomainService savingsAccountService, JdbcTemplate 
jdbcTemplate,
+            PortfolioCommandSourceWritePlatformService 
commandsSourceWritePlatformService,
+            DefaultToApiJsonSerializer<LoanAccountData> toApiJsonSerializer, 
DatabaseSpecificSQLGenerator sqlGenerator) {
+        return new InteropServiceImpl(securityContext, interopDataValidator, 
savingsAccountRepository, savingsAccountTransactionRepository,
+                applicationCurrencyRepository, noteRepository, 
paymentTypeRepository, identifierRepository, loanRepository, savingsHelper,
+                savingsAccountTransactionSummaryWrapper, 
savingsAccountService, jdbcTemplate, commandsSourceWritePlatformService,
+                toApiJsonSerializer, sqlGenerator);
+    }
+}

Reply via email to