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 66341db85 Add custom Configuration class for organisation/teller 
module (FINERACT-1932)
66341db85 is described below

commit 66341db853ad68f911d88ddde1bc5e6c1129b374
Author: Sinha, Abhinav <[email protected]>
AuthorDate: Mon Oct 23 18:28:20 2023 -0400

    Add custom Configuration class for organisation/teller module 
(FINERACT-1932)
---
 .../TellerManagementReadPlatformServiceImpl.java   |  2 -
 .../service/TellerWritePlatformServiceJpaImpl.java | 10 +--
 .../starter/OrganisationTellerConfiguration.java   | 71 ++++++++++++++++++++++
 3 files changed, 74 insertions(+), 9 deletions(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerManagementReadPlatformServiceImpl.java
 
b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerManagementReadPlatformServiceImpl.java
index 0a40087b4..4effdf981 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerManagementReadPlatformServiceImpl.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerManagementReadPlatformServiceImpl.java
@@ -56,10 +56,8 @@ import org.springframework.cache.annotation.Cacheable;
 import org.springframework.dao.EmptyResultDataAccessException;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.RowMapper;
-import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
-@Service
 @RequiredArgsConstructor
 public class TellerManagementReadPlatformServiceImpl implements 
TellerManagementReadPlatformService {
 
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerWritePlatformServiceJpaImpl.java
 
b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerWritePlatformServiceJpaImpl.java
index 4a3068019..0150cfae7 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerWritePlatformServiceJpaImpl.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerWritePlatformServiceJpaImpl.java
@@ -22,6 +22,7 @@ import jakarta.persistence.PersistenceException;
 import java.util.Map;
 import java.util.Set;
 import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.exception.ExceptionUtils;
 import 
org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
 import 
org.apache.fineract.accounting.financialactivityaccount.domain.FinancialActivityAccount;
@@ -53,19 +54,14 @@ import 
org.apache.fineract.organisation.teller.exception.CashierExistForTellerEx
 import 
org.apache.fineract.organisation.teller.exception.CashierNotFoundException;
 import 
org.apache.fineract.organisation.teller.serialization.TellerCommandFromApiJsonDeserializer;
 import org.apache.fineract.useradministration.domain.AppUser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.orm.jpa.JpaSystemException;
-import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 @AllArgsConstructor
-@Service
+@Slf4j
 public class TellerWritePlatformServiceJpaImpl implements 
TellerWritePlatformService {
 
-    private static final Logger LOG = 
LoggerFactory.getLogger(TellerWritePlatformServiceJpaImpl.class);
-
     private final PlatformSecurityContext context;
     private final TellerCommandFromApiJsonDeserializer fromApiJsonDeserializer;
     private final TellerRepositoryWrapper tellerRepositoryWrapper;
@@ -193,7 +189,7 @@ public class TellerWritePlatformServiceJpaImpl implements 
TellerWritePlatformSer
                     "name", name);
         }
 
-        LOG.error("Error occured.", dve);
+        log.error("Error occured.", dve);
         throw new 
PlatformDataIntegrityException("error.msg.teller.unknown.data.integrity.issue",
                 "Unknown data integrity issue with resource.");
     }
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/starter/OrganisationTellerConfiguration.java
 
b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/starter/OrganisationTellerConfiguration.java
new file mode 100644
index 000000000..fab742fdb
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/starter/OrganisationTellerConfiguration.java
@@ -0,0 +1,71 @@
+/**
+ * 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.organisation.teller.starter;
+
+import 
org.apache.fineract.accounting.financialactivityaccount.domain.FinancialActivityAccountRepositoryWrapper;
+import 
org.apache.fineract.accounting.journalentry.domain.JournalEntryRepository;
+import org.apache.fineract.infrastructure.core.service.PaginationHelper;
+import 
org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
+import 
org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.apache.fineract.infrastructure.security.utils.ColumnValidator;
+import 
org.apache.fineract.organisation.monetary.service.CurrencyReadPlatformService;
+import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper;
+import 
org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
+import org.apache.fineract.organisation.staff.domain.StaffRepository;
+import org.apache.fineract.organisation.staff.service.StaffReadPlatformService;
+import 
org.apache.fineract.organisation.teller.data.CashierTransactionDataValidator;
+import org.apache.fineract.organisation.teller.domain.CashierRepository;
+import 
org.apache.fineract.organisation.teller.domain.CashierTransactionRepository;
+import org.apache.fineract.organisation.teller.domain.TellerRepositoryWrapper;
+import 
org.apache.fineract.organisation.teller.serialization.TellerCommandFromApiJsonDeserializer;
+import 
org.apache.fineract.organisation.teller.service.TellerManagementReadPlatformService;
+import 
org.apache.fineract.organisation.teller.service.TellerManagementReadPlatformServiceImpl;
+import 
org.apache.fineract.organisation.teller.service.TellerWritePlatformService;
+import 
org.apache.fineract.organisation.teller.service.TellerWritePlatformServiceJpaImpl;
+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 OrganisationTellerConfiguration {
+
+    @Bean
+    @ConditionalOnMissingBean(TellerManagementReadPlatformService.class)
+    public TellerManagementReadPlatformService 
tellerManagementReadPlatformService(JdbcTemplate jdbcTemplate,
+            PlatformSecurityContext context, OfficeReadPlatformService 
officeReadPlatformService,
+            StaffReadPlatformService staffReadPlatformService, 
CurrencyReadPlatformService currencyReadPlatformService,
+            DatabaseSpecificSQLGenerator sqlGenerator, PaginationHelper 
paginationHelper, ColumnValidator columnValidator) {
+        return new TellerManagementReadPlatformServiceImpl(jdbcTemplate, 
context, officeReadPlatformService, staffReadPlatformService,
+                currencyReadPlatformService, sqlGenerator, paginationHelper, 
columnValidator);
+    }
+
+    @Bean
+    @ConditionalOnMissingBean(TellerWritePlatformService.class)
+    public TellerWritePlatformService 
tellerWritePlatformService(PlatformSecurityContext context,
+            TellerCommandFromApiJsonDeserializer fromApiJsonDeserializer, 
TellerRepositoryWrapper tellerRepositoryWrapper,
+            OfficeRepositoryWrapper officeRepositoryWrapper, StaffRepository 
staffRepository, CashierRepository cashierRepository,
+            CashierTransactionRepository cashierTxnRepository, 
JournalEntryRepository glJournalEntryRepository,
+            FinancialActivityAccountRepositoryWrapper 
financialActivityAccountRepositoryWrapper,
+            CashierTransactionDataValidator cashierTransactionDataValidator) {
+        return new TellerWritePlatformServiceJpaImpl(context, 
fromApiJsonDeserializer, tellerRepositoryWrapper, officeRepositoryWrapper,
+                staffRepository, cashierRepository, cashierTxnRepository, 
glJournalEntryRepository,
+                financialActivityAccountRepositoryWrapper, 
cashierTransactionDataValidator);
+    }
+}

Reply via email to