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 a779abaf7 Add custom Configuration class for accounting/rule module 
(FINERACT-1932)
a779abaf7 is described below

commit a779abaf7d2db6fe848876d8453e697b1698c194
Author: Sinha, Abhinav <[email protected]>
AuthorDate: Mon Oct 23 14:45:36 2023 -0400

    Add custom Configuration class for accounting/rule module (FINERACT-1932)
---
 .../AccountingRuleReadPlatformServiceImpl.java     |  2 -
 ...gRuleWritePlatformServiceJpaRepositoryImpl.java |  2 -
 .../rule/starter/AccountingRuleConfiguration.java  | 57 ++++++++++++++++++++++
 3 files changed, 57 insertions(+), 4 deletions(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java
 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java
index 7e03d423b..21ecff0d1 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java
@@ -41,9 +41,7 @@ import org.springframework.dao.EmptyResultDataAccessException;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.ResultSetExtractor;
 import org.springframework.jdbc.core.RowMapper;
-import org.springframework.stereotype.Service;
 
-@Service
 @RequiredArgsConstructor
 public class AccountingRuleReadPlatformServiceImpl implements 
AccountingRuleReadPlatformService {
 
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java
 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java
index 010e0d01b..f466f804a 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java
@@ -52,10 +52,8 @@ import 
org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper;
 import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.dao.NonTransientDataAccessException;
 import org.springframework.orm.jpa.JpaSystemException;
-import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-@Service
 @RequiredArgsConstructor
 @Slf4j
 public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements 
AccountingRuleWritePlatformService {
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/starter/AccountingRuleConfiguration.java
 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/starter/AccountingRuleConfiguration.java
new file mode 100644
index 000000000..d84671aa1
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/starter/AccountingRuleConfiguration.java
@@ -0,0 +1,57 @@
+/**
+ * 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.accounting.rule.starter;
+
+import 
org.apache.fineract.accounting.glaccount.domain.GLAccountRepositoryWrapper;
+import 
org.apache.fineract.accounting.glaccount.service.GLAccountReadPlatformService;
+import org.apache.fineract.accounting.rule.domain.AccountingRuleRepository;
+import 
org.apache.fineract.accounting.rule.domain.AccountingRuleRepositoryWrapper;
+import 
org.apache.fineract.accounting.rule.serialization.AccountingRuleCommandFromApiJsonDeserializer;
+import 
org.apache.fineract.accounting.rule.service.AccountingRuleReadPlatformService;
+import 
org.apache.fineract.accounting.rule.service.AccountingRuleReadPlatformServiceImpl;
+import 
org.apache.fineract.accounting.rule.service.AccountingRuleWritePlatformService;
+import 
org.apache.fineract.accounting.rule.service.AccountingRuleWritePlatformServiceJpaRepositoryImpl;
+import org.apache.fineract.infrastructure.codes.domain.CodeValueRepository;
+import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper;
+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 AccountingRuleConfiguration {
+
+    @Bean
+    @ConditionalOnMissingBean(AccountingRuleReadPlatformService.class)
+    public AccountingRuleReadPlatformService 
accountingRuleReadPlatformService(JdbcTemplate jdbcTemplate,
+            GLAccountReadPlatformService glAccountReadPlatformService) {
+        return new AccountingRuleReadPlatformServiceImpl(jdbcTemplate, 
glAccountReadPlatformService);
+    }
+
+    @Bean
+    @ConditionalOnMissingBean(AccountingRuleWritePlatformService.class)
+    public AccountingRuleWritePlatformService 
accountingRuleWritePlatformService(
+            AccountingRuleRepositoryWrapper accountingRuleRepositoryWrapper, 
AccountingRuleRepository accountingRuleRepository,
+            GLAccountRepositoryWrapper accountRepositoryWrapper, 
OfficeRepositoryWrapper officeRepositoryWrapper,
+            AccountingRuleCommandFromApiJsonDeserializer 
fromApiJsonDeserializer, CodeValueRepository codeValueRepository) {
+        return new 
AccountingRuleWritePlatformServiceJpaRepositoryImpl(accountingRuleRepositoryWrapper,
 accountingRuleRepository,
+                accountRepositoryWrapper, officeRepositoryWrapper, 
fromApiJsonDeserializer, codeValueRepository);
+    }
+
+}

Reply via email to