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 0b1ca2dce FINERACT-1932: Add custom Configuration class for
shareproduct services
0b1ca2dce is described below
commit 0b1ca2dcedaffde0e0697afd5b019b0ee5b0728a
Author: Mohamed Magdi-Abdelmonem <[email protected]>
AuthorDate: Fri Aug 25 19:27:40 2023 +0300
FINERACT-1932: Add custom Configuration class for shareproduct services
---
.../service/ShareProductCommandsServiceImpl.java | 10 +-
.../service/ShareProductDividendAssembler.java | 12 +--
...hareProductDividendReadPlatformServiceImpl.java | 14 +--
...hareProductDropdownReadPlatformServiceImpl.java | 4 +-
.../ShareProductReadPlatformServiceImpl.java | 2 -
...oductWritePlatformServiceJpaRepositoryImpl.java | 2 -
.../starter/ShareProductsConfiguration.java | 108 +++++++++++++++++++++
7 files changed, 116 insertions(+), 36 deletions(-)
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java
index 52c6bf3e8..fcc54c495 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java
@@ -19,24 +19,18 @@
package org.apache.fineract.portfolio.shareproducts.service;
import com.google.gson.JsonElement;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.portfolio.products.service.ProductCommandsService;
import
org.apache.fineract.portfolio.shareproducts.constants.ShareProductApiConstants;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-@Service(value = "SHAREPRODUCT_COMMANDSERVICE")
+@RequiredArgsConstructor
public class ShareProductCommandsServiceImpl implements ProductCommandsService
{
private final FromJsonHelper fromApiJsonHelper;
- @Autowired
- public ShareProductCommandsServiceImpl(final FromJsonHelper
fromApiJsonHelper) {
- this.fromApiJsonHelper = fromApiJsonHelper;
- }
-
public CommandProcessingResult postDividends(Long productId, JsonCommand
jsonCommand) {
return null;
}
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java
index 30625c22d..57e444b6f 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java
@@ -24,6 +24,7 @@ import java.time.temporal.ChronoUnit;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.Money;
@@ -36,22 +37,13 @@ import
org.apache.fineract.portfolio.shareaccounts.service.ShareAccountReadPlatf
import org.apache.fineract.portfolio.shareproducts.data.ShareProductData;
import
org.apache.fineract.portfolio.shareproducts.domain.ShareProductDividendPayOutDetails;
import
org.apache.fineract.portfolio.shareproducts.exception.ShareAccountsNotFoundException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-@Component
+@RequiredArgsConstructor
public class ShareProductDividendAssembler {
private final ShareProductReadPlatformService
shareProductReadPlatformService;
private final ShareAccountReadPlatformService
shareAccountReadPlatformService;
- @Autowired
- public ShareProductDividendAssembler(final ShareProductReadPlatformService
shareProductReadPlatformService,
- final ShareAccountReadPlatformService
shareAccountReadPlatformService) {
- this.shareProductReadPlatformService = shareProductReadPlatformService;
- this.shareAccountReadPlatformService = shareAccountReadPlatformService;
- }
-
public ShareProductDividendPayOutDetails calculateDividends(final Long
productId, final BigDecimal amount,
final LocalDate dividendPeriodStartDate, final LocalDate
dividendPeriodEndDate) {
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendReadPlatformServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendReadPlatformServiceImpl.java
index 2c7fc7743..2e8bc0b6c 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendReadPlatformServiceImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendReadPlatformServiceImpl.java
@@ -25,6 +25,7 @@ import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
import org.apache.fineract.infrastructure.core.service.Page;
@@ -36,12 +37,10 @@ import
org.apache.fineract.portfolio.shareaccounts.data.ShareAccountDividendData
import org.apache.fineract.portfolio.shareaccounts.service.SharesEnumerations;
import org.apache.fineract.portfolio.shareproducts.data.ShareProductData;
import
org.apache.fineract.portfolio.shareproducts.data.ShareProductDividendPayOutData;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
-import org.springframework.stereotype.Service;
-@Service
+@RequiredArgsConstructor
public class ShareProductDividendReadPlatformServiceImpl implements
ShareProductDividendReadPlatformService {
private final JdbcTemplate jdbcTemplate;
@@ -49,15 +48,6 @@ public class ShareProductDividendReadPlatformServiceImpl
implements ShareProduct
private final PaginationHelper paginationHelper;
private final DatabaseSpecificSQLGenerator sqlGenerator;
- @Autowired
- public ShareProductDividendReadPlatformServiceImpl(final JdbcTemplate
jdbcTemplate, final ColumnValidator columnValidator,
- DatabaseSpecificSQLGenerator sqlGenerator, PaginationHelper
paginationHelper) {
- this.jdbcTemplate = jdbcTemplate;
- this.columnValidator = columnValidator;
- this.paginationHelper = paginationHelper;
- this.sqlGenerator = sqlGenerator;
- }
-
@Override
public Page<ShareProductDividendPayOutData> retriveAll(final Long
productId, final Integer status,
final SearchParameters searchParameters) {
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDropdownReadPlatformServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDropdownReadPlatformServiceImpl.java
index e2800e965..620ea3a2b 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDropdownReadPlatformServiceImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDropdownReadPlatformServiceImpl.java
@@ -21,12 +21,12 @@ package org.apache.fineract.portfolio.shareproducts.service;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
+import lombok.NoArgsConstructor;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.portfolio.shareaccounts.service.SharesEnumerations;
import org.apache.fineract.portfolio.shareproducts.SharePeriodFrequencyType;
-import org.springframework.stereotype.Service;
-@Service
+@NoArgsConstructor
public class ShareProductDropdownReadPlatformServiceImpl implements
ShareProductDropdownReadPlatformService {
@Override
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductReadPlatformServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductReadPlatformServiceImpl.java
index 2e2d5b9f8..7b3ac1274 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductReadPlatformServiceImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductReadPlatformServiceImpl.java
@@ -52,9 +52,7 @@ import
org.apache.fineract.portfolio.shareproducts.data.ShareProductMarketPriceD
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
-import org.springframework.stereotype.Service;
-@Service(value = "shareReadPlatformService")
@RequiredArgsConstructor
public class ShareProductReadPlatformServiceImpl implements
ShareProductReadPlatformService {
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductWritePlatformServiceJpaRepositoryImpl.java
index e22aed950..fa7e3ba5d 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductWritePlatformServiceJpaRepositoryImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductWritePlatformServiceJpaRepositoryImpl.java
@@ -43,9 +43,7 @@ import
org.apache.fineract.portfolio.shareproducts.exception.DividentProcessingE
import
org.apache.fineract.portfolio.shareproducts.serialization.ShareProductDataSerializer;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.orm.jpa.JpaSystemException;
-import org.springframework.stereotype.Service;
-@Service
@Slf4j
@RequiredArgsConstructor
public class ShareProductWritePlatformServiceJpaRepositoryImpl implements
ShareProductWritePlatformService {
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/starter/ShareProductsConfiguration.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/starter/ShareProductsConfiguration.java
new file mode 100644
index 000000000..2cbe6469d
--- /dev/null
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/starter/ShareProductsConfiguration.java
@@ -0,0 +1,108 @@
+/**
+ * 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.portfolio.shareproducts.starter;
+
+import
org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService;
+import
org.apache.fineract.accounting.producttoaccountmapping.service.ProductToGLAccountMappingReadPlatformService;
+import
org.apache.fineract.accounting.producttoaccountmapping.service.ProductToGLAccountMappingWritePlatformService;
+import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.infrastructure.core.service.PaginationHelper;
+import
org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
+import
org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
+import org.apache.fineract.infrastructure.security.utils.ColumnValidator;
+import
org.apache.fineract.organisation.monetary.service.CurrencyReadPlatformService;
+import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
+import
org.apache.fineract.portfolio.products.service.ShareProductReadPlatformService;
+import
org.apache.fineract.portfolio.shareaccounts.service.ShareAccountReadPlatformService;
+import
org.apache.fineract.portfolio.shareproducts.domain.ShareProductDividentPayOutDetailsRepositoryWrapper;
+import
org.apache.fineract.portfolio.shareproducts.domain.ShareProductRepositoryWrapper;
+import
org.apache.fineract.portfolio.shareproducts.serialization.ShareProductDataSerializer;
+import
org.apache.fineract.portfolio.shareproducts.service.ShareProductCommandsServiceImpl;
+import
org.apache.fineract.portfolio.shareproducts.service.ShareProductDividendAssembler;
+import
org.apache.fineract.portfolio.shareproducts.service.ShareProductDividendReadPlatformService;
+import
org.apache.fineract.portfolio.shareproducts.service.ShareProductDividendReadPlatformServiceImpl;
+import
org.apache.fineract.portfolio.shareproducts.service.ShareProductDropdownReadPlatformService;
+import
org.apache.fineract.portfolio.shareproducts.service.ShareProductDropdownReadPlatformServiceImpl;
+import
org.apache.fineract.portfolio.shareproducts.service.ShareProductReadPlatformServiceImpl;
+import
org.apache.fineract.portfolio.shareproducts.service.ShareProductWritePlatformService;
+import
org.apache.fineract.portfolio.shareproducts.service.ShareProductWritePlatformServiceJpaRepositoryImpl;
+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 ShareProductsConfiguration {
+
+ @Bean(value = "SHAREPRODUCT_COMMANDSERVICE")
+ @ConditionalOnMissingBean(ShareProductCommandsServiceImpl.class)
+ public ShareProductCommandsServiceImpl
shareProductCommandsService(FromJsonHelper fromApiJsonHelper) {
+ return new ShareProductCommandsServiceImpl(fromApiJsonHelper);
+
+ }
+
+ @Bean
+ @ConditionalOnMissingBean(ShareProductDividendAssembler.class)
+ public ShareProductDividendAssembler
shareProductDividendAssembler(ShareProductReadPlatformService
shareProductReadPlatformService,
+ ShareAccountReadPlatformService shareAccountReadPlatformService) {
+ return new
ShareProductDividendAssembler(shareProductReadPlatformService,
shareAccountReadPlatformService);
+
+ }
+
+ @Bean
+ @ConditionalOnMissingBean(ShareProductDividendReadPlatformService.class)
+ public ShareProductDividendReadPlatformService
shareProductDividendReadPlatformService(JdbcTemplate jdbcTemplate,
+ ColumnValidator columnValidator, PaginationHelper
paginationHelper, DatabaseSpecificSQLGenerator sqlGenerator) {
+ return new ShareProductDividendReadPlatformServiceImpl(jdbcTemplate,
columnValidator, paginationHelper, sqlGenerator);
+
+ }
+
+ @Bean
+ @ConditionalOnMissingBean(ShareProductDropdownReadPlatformService.class)
+ public ShareProductDropdownReadPlatformService
shareProductDropdownReadPlatformService() {
+ return new ShareProductDropdownReadPlatformServiceImpl();
+ }
+
+ @Bean(value = "shareReadPlatformService")
+ @ConditionalOnMissingBean(ShareProductReadPlatformService.class)
+ public ShareProductReadPlatformService
shareProductReadPlatformService(JdbcTemplate jdbcTemplate,
+ CurrencyReadPlatformService currencyReadPlatformService,
ChargeReadPlatformService chargeReadPlatformService,
+ ShareProductDropdownReadPlatformService
shareProductDropdownReadPlatformService,
+ AccountingDropdownReadPlatformService
accountingDropdownReadPlatformService,
+ ProductToGLAccountMappingReadPlatformService
accountMappingReadPlatformService,
+ PaginationHelper shareProductDataPaginationHelper,
DatabaseSpecificSQLGenerator sqlGenerator) {
+ return new ShareProductReadPlatformServiceImpl(jdbcTemplate,
currencyReadPlatformService, chargeReadPlatformService,
+ shareProductDropdownReadPlatformService,
accountingDropdownReadPlatformService, accountMappingReadPlatformService,
+ shareProductDataPaginationHelper, sqlGenerator);
+ }
+
+ @Bean
+ @ConditionalOnMissingBean(ShareProductWritePlatformService.class)
+ public ShareProductWritePlatformService
shareProductWritePlatformService(ShareProductRepositoryWrapper repository,
+ ShareProductDataSerializer serializer, FromJsonHelper
fromApiJsonHelper,
+ ShareProductDividentPayOutDetailsRepositoryWrapper
shareProductDividentPayOutDetailsRepository,
+ ShareProductDividendAssembler shareProductDividendAssembler,
+ ProductToGLAccountMappingWritePlatformService
accountMappingWritePlatformService,
+ BusinessEventNotifierService businessEventNotifierService) {
+ return new
ShareProductWritePlatformServiceJpaRepositoryImpl(repository, serializer,
fromApiJsonHelper,
+ shareProductDividentPayOutDetailsRepository,
shareProductDividendAssembler, accountMappingWritePlatformService,
+ businessEventNotifierService);
+ }
+
+}