Add custom Configuration class for collectionsheet module (FINERACT-1932)

This commit is contained in:
Sinha, Abhinav
2023-10-02 15:15:57 +02:00
committed by Arnold Gálovics
parent ad63024b4f
commit 666c097ec8
3 changed files with 86 additions and 26 deletions
@@ -68,16 +68,13 @@ import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService;
import org.apache.fineract.portfolio.savings.data.SavingsProductData;
import org.apache.fineract.useradministration.domain.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.stereotype.Service;
@Service
public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetReadPlatformService {
private final PlatformSecurityContext context;
@@ -95,7 +92,6 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
private final CalendarInstanceRepository calendarInstanceRepository;
private final DatabaseSpecificSQLGenerator sqlGenerator;
@Autowired
public CollectionSheetReadPlatformServiceImpl(final PlatformSecurityContext context,
final NamedParameterJdbcTemplate namedParameterJdbcTemplate, final CenterReadPlatformService centerReadPlatformService,
final GroupReadPlatformService groupReadPlatformService,
@@ -23,6 +23,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
@@ -41,10 +42,8 @@ import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionDTO;
import org.apache.fineract.portfolio.savings.domain.DepositAccountAssembler;
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements CollectionSheetWritePlatformService {
private final LoanWritePlatformService loanWritePlatformService;
@@ -57,25 +56,6 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col
private final PaymentDetailAssembler paymentDetailAssembler;
private final PaymentDetailWritePlatformService paymentDetailWritePlatformService;
@Autowired
public CollectionSheetWritePlatformServiceJpaRepositoryImpl(final LoanWritePlatformService loanWritePlatformService,
final CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer bulkRepaymentCommandFromApiJsonDeserializer,
final CollectionSheetBulkDisbursalCommandFromApiJsonDeserializer bulkDisbursalCommandFromApiJsonDeserializer,
final CollectionSheetTransactionDataValidator transactionDataValidator,
final MeetingWritePlatformService meetingWritePlatformService, final DepositAccountAssembler accountAssembler,
final DepositAccountWritePlatformService accountWritePlatformService, final PaymentDetailAssembler paymentDetailAssembler,
final PaymentDetailWritePlatformService paymentDetailWritePlatformService) {
this.loanWritePlatformService = loanWritePlatformService;
this.bulkRepaymentCommandFromApiJsonDeserializer = bulkRepaymentCommandFromApiJsonDeserializer;
this.bulkDisbursalCommandFromApiJsonDeserializer = bulkDisbursalCommandFromApiJsonDeserializer;
this.transactionDataValidator = transactionDataValidator;
this.meetingWritePlatformService = meetingWritePlatformService;
this.accountAssembler = accountAssembler;
this.accountWritePlatformService = accountWritePlatformService;
this.paymentDetailAssembler = paymentDetailAssembler;
this.paymentDetailWritePlatformService = paymentDetailWritePlatformService;
}
@Override
public CommandProcessingResult updateCollectionSheet(final JsonCommand command) {
@@ -0,0 +1,84 @@
/**
* 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.collectionsheet.starter;
import org.apache.fineract.infrastructure.codes.service.CodeValueReadPlatformService;
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
import org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.calendar.domain.CalendarInstanceRepository;
import org.apache.fineract.portfolio.calendar.domain.CalendarRepositoryWrapper;
import org.apache.fineract.portfolio.calendar.service.CalendarReadPlatformService;
import org.apache.fineract.portfolio.collectionsheet.data.CollectionSheetTransactionDataValidator;
import org.apache.fineract.portfolio.collectionsheet.serialization.CollectionSheetBulkDisbursalCommandFromApiJsonDeserializer;
import org.apache.fineract.portfolio.collectionsheet.serialization.CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer;
import org.apache.fineract.portfolio.collectionsheet.serialization.CollectionSheetGenerateCommandFromApiJsonDeserializer;
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetReadPlatformService;
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetReadPlatformServiceImpl;
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService;
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformServiceJpaRepositoryImpl;
import org.apache.fineract.portfolio.group.service.CenterReadPlatformService;
import org.apache.fineract.portfolio.group.service.GroupReadPlatformService;
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
import org.apache.fineract.portfolio.meeting.attendance.service.AttendanceDropdownReadPlatformService;
import org.apache.fineract.portfolio.meeting.service.MeetingWritePlatformService;
import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetailAssembler;
import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService;
import org.apache.fineract.portfolio.savings.domain.DepositAccountAssembler;
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
@Configuration
public class CollectionSheetConfiguration {
@Bean
@ConditionalOnMissingBean(CollectionSheetReadPlatformService.class)
public CollectionSheetReadPlatformService collectionSheetReadPlatformService(PlatformSecurityContext context,
NamedParameterJdbcTemplate namedParameterJdbcTemplate, CenterReadPlatformService centerReadPlatformService,
GroupReadPlatformService groupReadPlatformService,
CollectionSheetGenerateCommandFromApiJsonDeserializer collectionSheetGenerateCommandFromApiJsonDeserializer,
CalendarRepositoryWrapper calendarRepositoryWrapper,
AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService,
CodeValueReadPlatformService codeValueReadPlatformService, PaymentTypeReadPlatformService paymentTypeReadPlatformService,
CalendarReadPlatformService calendarReadPlatformService, ConfigurationDomainService configurationDomainService,
CalendarInstanceRepository calendarInstanceRepository, DatabaseSpecificSQLGenerator sqlGenerator) {
return new CollectionSheetReadPlatformServiceImpl(context, namedParameterJdbcTemplate, centerReadPlatformService,
groupReadPlatformService, collectionSheetGenerateCommandFromApiJsonDeserializer, calendarRepositoryWrapper,
attendanceDropdownReadPlatformService, codeValueReadPlatformService, paymentTypeReadPlatformService,
calendarReadPlatformService, configurationDomainService, calendarInstanceRepository, sqlGenerator);
}
@Bean
@ConditionalOnMissingBean(CollectionSheetWritePlatformService.class)
public CollectionSheetWritePlatformService collectionSheetWritePlatformService(LoanWritePlatformService loanWritePlatformService,
CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer bulkRepaymentCommandFromApiJsonDeserializer,
CollectionSheetBulkDisbursalCommandFromApiJsonDeserializer bulkDisbursalCommandFromApiJsonDeserializer,
CollectionSheetTransactionDataValidator transactionDataValidator, MeetingWritePlatformService meetingWritePlatformService,
DepositAccountAssembler accountAssembler, DepositAccountWritePlatformService accountWritePlatformService,
PaymentDetailAssembler paymentDetailAssembler, PaymentDetailWritePlatformService paymentDetailWritePlatformService) {
return new CollectionSheetWritePlatformServiceJpaRepositoryImpl(loanWritePlatformService,
bulkRepaymentCommandFromApiJsonDeserializer, bulkDisbursalCommandFromApiJsonDeserializer, transactionDataValidator,
meetingWritePlatformService, accountAssembler, accountWritePlatformService, paymentDetailAssembler,
paymentDetailWritePlatformService);
}
}