FINERACT-1932: Add stater configuration class for template module services
This commit is contained in:
committed by
Arnold Gálovics
parent
0c1997aa9a
commit
e4af9b30ea
+3
-5
@@ -22,6 +22,7 @@ import com.google.gson.JsonArray;
|
|||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||||
@@ -31,11 +32,9 @@ import org.apache.fineract.template.domain.TemplateMapper;
|
|||||||
import org.apache.fineract.template.domain.TemplateRepository;
|
import org.apache.fineract.template.domain.TemplateRepository;
|
||||||
import org.apache.fineract.template.domain.TemplateType;
|
import org.apache.fineract.template.domain.TemplateType;
|
||||||
import org.apache.fineract.template.exception.TemplateNotFoundException;
|
import org.apache.fineract.template.exception.TemplateNotFoundException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
@RequiredArgsConstructor
|
||||||
public class JpaTemplateDomainService implements TemplateDomainService {
|
public class JpaTemplateDomainService implements TemplateDomainService {
|
||||||
|
|
||||||
private static final String PROPERTY_NAME = "name";
|
private static final String PROPERTY_NAME = "name";
|
||||||
@@ -44,8 +43,7 @@ public class JpaTemplateDomainService implements TemplateDomainService {
|
|||||||
private static final String PROPERTY_ENTITY = "entity";
|
private static final String PROPERTY_ENTITY = "entity";
|
||||||
private static final String PROPERTY_TYPE = "type";
|
private static final String PROPERTY_TYPE = "type";
|
||||||
|
|
||||||
@Autowired
|
private final TemplateRepository templateRepository;
|
||||||
private TemplateRepository templateRepository;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Template> getAll() {
|
public List<Template> getAll() {
|
||||||
|
|||||||
-2
@@ -48,11 +48,9 @@ import org.apache.fineract.template.domain.Template;
|
|||||||
import org.apache.fineract.template.domain.TemplateFunctions;
|
import org.apache.fineract.template.domain.TemplateFunctions;
|
||||||
import org.apache.fineract.template.exception.TemplateForbiddenException;
|
import org.apache.fineract.template.exception.TemplateForbiddenException;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Service
|
|
||||||
public class TemplateMergeService {
|
public class TemplateMergeService {
|
||||||
|
|
||||||
private final FineractProperties fineractProperties;
|
private final FineractProperties fineractProperties;
|
||||||
|
|||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* 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.template.starter;
|
||||||
|
|
||||||
|
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
||||||
|
import org.apache.fineract.template.domain.TemplateRepository;
|
||||||
|
import org.apache.fineract.template.service.JpaTemplateDomainService;
|
||||||
|
import org.apache.fineract.template.service.TemplateDomainService;
|
||||||
|
import org.apache.fineract.template.service.TemplateMergeService;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class TemplateConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(TemplateDomainService.class)
|
||||||
|
public TemplateDomainService templateDomainService(TemplateRepository templateRepository) {
|
||||||
|
return new JpaTemplateDomainService(templateRepository);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(TemplateMergeService.class)
|
||||||
|
public TemplateMergeService templateMergeService(FineractProperties fineractProperties) {
|
||||||
|
return new TemplateMergeService(fineractProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user