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

This commit is contained in:
Sinha, Abhinav
2023-08-30 11:26:20 +02:00
committed by Arnold Gálovics
parent 367896ccf2
commit 5348477afb
4 changed files with 70 additions and 24 deletions
@@ -25,9 +25,7 @@ import org.apache.fineract.portfolio.calendar.domain.CalendarFrequencyType;
import org.apache.fineract.portfolio.calendar.domain.CalendarRemindBy;
import org.apache.fineract.portfolio.calendar.domain.CalendarType;
import org.apache.fineract.portfolio.calendar.domain.CalendarWeekDaysType;
import org.springframework.stereotype.Service;
@Service
public class CalendarDropdownReadPlatformServiceImpl implements CalendarDropdownReadPlatformService {
@Override
@@ -39,10 +39,8 @@ import org.apache.fineract.portfolio.meeting.data.MeetingData;
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 CalendarReadPlatformServiceImpl implements CalendarReadPlatformService {
@@ -26,6 +26,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -52,11 +53,9 @@ import org.apache.fineract.portfolio.loanaccount.domain.Loan;
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper;
import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
@RequiredArgsConstructor
public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWritePlatformService {
private final CalendarRepository calendarRepository;
@@ -69,23 +68,6 @@ public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWr
private final LoanRepositoryWrapper loanRepositoryWrapper;
private final ClientRepositoryWrapper clientRepository;
@Autowired
public CalendarWritePlatformServiceJpaRepositoryImpl(final CalendarRepository calendarRepository,
final CalendarHistoryRepository calendarHistoryRepository, final CalendarCommandFromApiJsonDeserializer fromApiJsonDeserializer,
final CalendarInstanceRepository calendarInstanceRepository, final LoanWritePlatformService loanWritePlatformService,
final ConfigurationDomainService configurationDomainService, final GroupRepositoryWrapper groupRepository,
final LoanRepositoryWrapper loanRepositoryWrapper, final ClientRepositoryWrapper clientRepository) {
this.calendarRepository = calendarRepository;
this.calendarHistoryRepository = calendarHistoryRepository;
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
this.calendarInstanceRepository = calendarInstanceRepository;
this.loanWritePlatformService = loanWritePlatformService;
this.configurationDomainService = configurationDomainService;
this.groupRepository = groupRepository;
this.loanRepositoryWrapper = loanRepositoryWrapper;
this.clientRepository = clientRepository;
}
@Override
public CommandProcessingResult createCalendar(final JsonCommand command) {
@@ -0,0 +1,68 @@
/**
* 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.calendar.starter;
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
import org.apache.fineract.portfolio.calendar.domain.CalendarHistoryRepository;
import org.apache.fineract.portfolio.calendar.domain.CalendarInstanceRepository;
import org.apache.fineract.portfolio.calendar.domain.CalendarRepository;
import org.apache.fineract.portfolio.calendar.serialization.CalendarCommandFromApiJsonDeserializer;
import org.apache.fineract.portfolio.calendar.service.CalendarDropdownReadPlatformService;
import org.apache.fineract.portfolio.calendar.service.CalendarDropdownReadPlatformServiceImpl;
import org.apache.fineract.portfolio.calendar.service.CalendarReadPlatformService;
import org.apache.fineract.portfolio.calendar.service.CalendarReadPlatformServiceImpl;
import org.apache.fineract.portfolio.calendar.service.CalendarWritePlatformService;
import org.apache.fineract.portfolio.calendar.service.CalendarWritePlatformServiceJpaRepositoryImpl;
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
import org.apache.fineract.portfolio.group.domain.GroupRepositoryWrapper;
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper;
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
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 CalendarConfiguration {
@Bean
@ConditionalOnMissingBean(CalendarDropdownReadPlatformService.class)
public CalendarDropdownReadPlatformService calendarDropdownReadPlatformService() {
return new CalendarDropdownReadPlatformServiceImpl();
}
@Bean
@ConditionalOnMissingBean(CalendarReadPlatformService.class)
public CalendarReadPlatformService calendarReadPlatformService(JdbcTemplate jdbcTemplate,
ConfigurationDomainService configurationDomainService) {
return new CalendarReadPlatformServiceImpl(jdbcTemplate, configurationDomainService);
}
@Bean
@ConditionalOnMissingBean(CalendarWritePlatformService.class)
public CalendarWritePlatformService calendarWritePlatformService(CalendarRepository calendarRepository,
CalendarHistoryRepository calendarHistoryRepository, CalendarCommandFromApiJsonDeserializer fromApiJsonDeserializer,
CalendarInstanceRepository calendarInstanceRepository, LoanWritePlatformService loanWritePlatformService,
ConfigurationDomainService configurationDomainService, GroupRepositoryWrapper groupRepository,
LoanRepositoryWrapper loanRepositoryWrapper, ClientRepositoryWrapper clientRepository) {
return new CalendarWritePlatformServiceJpaRepositoryImpl(calendarRepository, calendarHistoryRepository, fromApiJsonDeserializer,
calendarInstanceRepository, loanWritePlatformService, configurationDomainService, groupRepository, loanRepositoryWrapper,
clientRepository);
}
}