Add custom Configuration class for organisation/monetary module (FINERACT-1932)
This commit is contained in:
committed by
Aleksandar Vidakovic
parent
01e7dcf4ce
commit
ff8a186b5c
+4
-12
@@ -21,27 +21,19 @@ package org.apache.fineract.organisation.monetary.service;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
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 CurrencyReadPlatformServiceImpl implements CurrencyReadPlatformService {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final PlatformSecurityContext context;
|
||||
private final CurrencyMapper currencyRowMapper;
|
||||
|
||||
@Autowired
|
||||
public CurrencyReadPlatformServiceImpl(final PlatformSecurityContext context, final JdbcTemplate jdbcTemplate) {
|
||||
this.context = context;
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.currencyRowMapper = new CurrencyMapper();
|
||||
}
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final CurrencyMapper currencyRowMapper = new CurrencyMapper();
|
||||
|
||||
@Override
|
||||
public Collection<CurrencyData> retrieveAllowedCurrencies() {
|
||||
|
||||
+2
-18
@@ -24,6 +24,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
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.data.CommandProcessingResultBuilder;
|
||||
@@ -37,11 +38,9 @@ import org.apache.fineract.organisation.office.domain.OrganisationCurrencyReposi
|
||||
import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
|
||||
import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService;
|
||||
import org.apache.fineract.portfolio.savings.service.SavingsProductReadPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CurrencyWritePlatformServiceJpaRepositoryImpl implements CurrencyWritePlatformService {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -52,21 +51,6 @@ public class CurrencyWritePlatformServiceJpaRepositoryImpl implements CurrencyWr
|
||||
private final SavingsProductReadPlatformService savingsProductService;
|
||||
private final ChargeReadPlatformService chargeService;
|
||||
|
||||
@Autowired
|
||||
public CurrencyWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context,
|
||||
final CurrencyCommandFromApiJsonDeserializer fromApiJsonDeserializer,
|
||||
final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepository,
|
||||
final OrganisationCurrencyRepository organisationCurrencyRepository, final LoanProductReadPlatformService loanProductService,
|
||||
final SavingsProductReadPlatformService savingsProductService, final ChargeReadPlatformService chargeService) {
|
||||
this.context = context;
|
||||
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
|
||||
this.applicationCurrencyRepository = applicationCurrencyRepository;
|
||||
this.organisationCurrencyRepository = organisationCurrencyRepository;
|
||||
this.loanProductService = loanProductService;
|
||||
this.savingsProductService = savingsProductService;
|
||||
this.chargeService = chargeService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult updateAllowedCurrencies(final JsonCommand command) {
|
||||
|
||||
+2
-8
@@ -19,21 +19,15 @@
|
||||
package org.apache.fineract.organisation.monetary.service;
|
||||
|
||||
import java.util.Collection;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.organisation.monetary.data.ApplicationCurrencyConfigurationData;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class OrganisationCurrencyReadPlatformServiceImpl implements OrganisationCurrencyReadPlatformService {
|
||||
|
||||
private final CurrencyReadPlatformService currencyReadPlatformService;
|
||||
|
||||
@Autowired
|
||||
public OrganisationCurrencyReadPlatformServiceImpl(final CurrencyReadPlatformService currencyReadPlatformService) {
|
||||
this.currencyReadPlatformService = currencyReadPlatformService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationCurrencyConfigurationData retrieveCurrencyConfiguration() {
|
||||
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* 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.monetary.starter;
|
||||
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.monetary.domain.ApplicationCurrencyRepositoryWrapper;
|
||||
import org.apache.fineract.organisation.monetary.serialization.CurrencyCommandFromApiJsonDeserializer;
|
||||
import org.apache.fineract.organisation.monetary.service.CurrencyReadPlatformService;
|
||||
import org.apache.fineract.organisation.monetary.service.CurrencyReadPlatformServiceImpl;
|
||||
import org.apache.fineract.organisation.monetary.service.CurrencyWritePlatformService;
|
||||
import org.apache.fineract.organisation.monetary.service.CurrencyWritePlatformServiceJpaRepositoryImpl;
|
||||
import org.apache.fineract.organisation.monetary.service.OrganisationCurrencyReadPlatformService;
|
||||
import org.apache.fineract.organisation.monetary.service.OrganisationCurrencyReadPlatformServiceImpl;
|
||||
import org.apache.fineract.organisation.office.domain.OrganisationCurrencyRepository;
|
||||
import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
|
||||
import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService;
|
||||
import org.apache.fineract.portfolio.savings.service.SavingsProductReadPlatformService;
|
||||
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 OrganisationMonetaryConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(CurrencyReadPlatformService.class)
|
||||
public CurrencyReadPlatformService currencyReadPlatformService(PlatformSecurityContext context, JdbcTemplate jdbcTemplate) {
|
||||
return new CurrencyReadPlatformServiceImpl(context, jdbcTemplate);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(CurrencyWritePlatformService.class)
|
||||
public CurrencyWritePlatformService currencyWritePlatformService(PlatformSecurityContext context,
|
||||
ApplicationCurrencyRepositoryWrapper applicationCurrencyRepository,
|
||||
OrganisationCurrencyRepository organisationCurrencyRepository, CurrencyCommandFromApiJsonDeserializer fromApiJsonDeserializer,
|
||||
LoanProductReadPlatformService loanProductService, SavingsProductReadPlatformService savingsProductService,
|
||||
ChargeReadPlatformService chargeService) {
|
||||
return new CurrencyWritePlatformServiceJpaRepositoryImpl(context, applicationCurrencyRepository, organisationCurrencyRepository,
|
||||
fromApiJsonDeserializer, loanProductService, savingsProductService, chargeService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(OrganisationCurrencyReadPlatformService.class)
|
||||
public OrganisationCurrencyReadPlatformService organisationCurrencyReadPlatformService(
|
||||
CurrencyReadPlatformService currencyReadPlatformService) {
|
||||
return new OrganisationCurrencyReadPlatformServiceImpl(currencyReadPlatformService);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user