Add custom Configuration class for notification module (FINERACT-1932)
This commit is contained in:
committed by
Aleksandar Vidakovic
parent
8cea837a5b
commit
e75e758e71
-2
@@ -55,9 +55,7 @@ import org.apache.fineract.portfolio.savings.domain.RecurringDepositAccount;
|
|||||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
|
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
|
||||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;
|
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;
|
||||||
import org.apache.fineract.portfolio.shareaccounts.domain.ShareAccount;
|
import org.apache.fineract.portfolio.shareaccounts.domain.ShareAccount;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NotificationDomainServiceImpl implements NotificationDomainService {
|
public class NotificationDomainServiceImpl implements NotificationDomainService {
|
||||||
|
|||||||
+2
-6
@@ -19,21 +19,17 @@
|
|||||||
package org.apache.fineract.notification.service;
|
package org.apache.fineract.notification.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.notification.domain.Notification;
|
import org.apache.fineract.notification.domain.Notification;
|
||||||
import org.apache.fineract.notification.domain.NotificationRepository;
|
import org.apache.fineract.notification.domain.NotificationRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class NotificationGeneratorReadRepositoryWrapperImpl implements NotificationGeneratorReadRepositoryWrapper {
|
public class NotificationGeneratorReadRepositoryWrapperImpl implements NotificationGeneratorReadRepositoryWrapper {
|
||||||
|
|
||||||
private final NotificationRepository notificationRepository;
|
private final NotificationRepository notificationRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public NotificationGeneratorReadRepositoryWrapperImpl(NotificationRepository notificationRepository) {
|
|
||||||
this.notificationRepository = notificationRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Notification findById(Long id) {
|
public Notification findById(Long id) {
|
||||||
return this.notificationRepository.findById(id).orElse(null);
|
return this.notificationRepository.findById(id).orElse(null);
|
||||||
|
|||||||
+2
-6
@@ -19,21 +19,17 @@
|
|||||||
package org.apache.fineract.notification.service;
|
package org.apache.fineract.notification.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.notification.domain.NotificationMapper;
|
import org.apache.fineract.notification.domain.NotificationMapper;
|
||||||
import org.apache.fineract.notification.domain.NotificationMapperRepository;
|
import org.apache.fineract.notification.domain.NotificationMapperRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class NotificationMapperReadRepositoryWrapperImpl implements NotificationMapperReadRepositoryWrapper {
|
public class NotificationMapperReadRepositoryWrapperImpl implements NotificationMapperReadRepositoryWrapper {
|
||||||
|
|
||||||
private final NotificationMapperRepository notificationMapperRepository;
|
private final NotificationMapperRepository notificationMapperRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public NotificationMapperReadRepositoryWrapperImpl(NotificationMapperRepository notificationMapperRepository) {
|
|
||||||
this.notificationMapperRepository = notificationMapperRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NotificationMapper findById(Long id) {
|
public NotificationMapper findById(Long id) {
|
||||||
return this.notificationMapperRepository.findById(id).orElse(null);
|
return this.notificationMapperRepository.findById(id).orElse(null);
|
||||||
|
|||||||
+2
-6
@@ -18,21 +18,17 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.notification.service;
|
package org.apache.fineract.notification.service;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.notification.domain.NotificationMapper;
|
import org.apache.fineract.notification.domain.NotificationMapper;
|
||||||
import org.apache.fineract.notification.domain.NotificationMapperRepository;
|
import org.apache.fineract.notification.domain.NotificationMapperRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class NotificationMapperWritePlatformServiceImpl implements NotificationMapperWritePlatformService {
|
public class NotificationMapperWritePlatformServiceImpl implements NotificationMapperWritePlatformService {
|
||||||
|
|
||||||
private final NotificationMapperRepository notificationMapperRepository;
|
private final NotificationMapperRepository notificationMapperRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public NotificationMapperWritePlatformServiceImpl(NotificationMapperRepository notificationMapperRepository) {
|
|
||||||
this.notificationMapperRepository = notificationMapperRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long create(NotificationMapper notificationMapper) {
|
public Long create(NotificationMapper notificationMapper) {
|
||||||
this.notificationMapperRepository.saveAndFlush(notificationMapper);
|
this.notificationMapperRepository.saveAndFlush(notificationMapper);
|
||||||
|
|||||||
-2
@@ -35,9 +35,7 @@ import org.apache.fineract.notification.data.NotificationData;
|
|||||||
import org.apache.fineract.notification.data.NotificationMapperData;
|
import org.apache.fineract.notification.data.NotificationMapperData;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.core.RowMapper;
|
import org.springframework.jdbc.core.RowMapper;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class NotificationReadPlatformServiceImpl implements NotificationReadPlatformService {
|
public class NotificationReadPlatformServiceImpl implements NotificationReadPlatformService {
|
||||||
|
|
||||||
|
|||||||
-2
@@ -27,10 +27,8 @@ import org.apache.fineract.notification.domain.Notification;
|
|||||||
import org.apache.fineract.notification.domain.NotificationMapper;
|
import org.apache.fineract.notification.domain.NotificationMapper;
|
||||||
import org.apache.fineract.useradministration.domain.AppUser;
|
import org.apache.fineract.useradministration.domain.AppUser;
|
||||||
import org.apache.fineract.useradministration.domain.AppUserRepository;
|
import org.apache.fineract.useradministration.domain.AppUserRepository;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class NotificationWritePlatformServiceImpl implements NotificationWritePlatformService {
|
public class NotificationWritePlatformServiceImpl implements NotificationWritePlatformService {
|
||||||
|
|||||||
-2
@@ -33,9 +33,7 @@ import org.apache.fineract.notification.data.NotificationData;
|
|||||||
import org.apache.fineract.notification.eventandlistener.NotificationEventPublisher;
|
import org.apache.fineract.notification.eventandlistener.NotificationEventPublisher;
|
||||||
import org.apache.fineract.useradministration.domain.AppUser;
|
import org.apache.fineract.useradministration.domain.AppUser;
|
||||||
import org.apache.fineract.useradministration.domain.AppUserRepository;
|
import org.apache.fineract.useradministration.domain.AppUserRepository;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class UserNotificationServiceImpl implements UserNotificationService {
|
public class UserNotificationServiceImpl implements UserNotificationService {
|
||||||
|
|||||||
+81
@@ -0,0 +1,81 @@
|
|||||||
|
/**
|
||||||
|
* 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.notification.starter;
|
||||||
|
|
||||||
|
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
||||||
|
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.service.PlatformSecurityContext;
|
||||||
|
import org.apache.fineract.infrastructure.security.utils.ColumnValidator;
|
||||||
|
import org.apache.fineract.notification.eventandlistener.NotificationEventPublisher;
|
||||||
|
import org.apache.fineract.notification.service.NotificationDomainService;
|
||||||
|
import org.apache.fineract.notification.service.NotificationDomainServiceImpl;
|
||||||
|
import org.apache.fineract.notification.service.NotificationGeneratorReadRepositoryWrapper;
|
||||||
|
import org.apache.fineract.notification.service.NotificationGeneratorWritePlatformService;
|
||||||
|
import org.apache.fineract.notification.service.NotificationMapperWritePlatformService;
|
||||||
|
import org.apache.fineract.notification.service.NotificationReadPlatformService;
|
||||||
|
import org.apache.fineract.notification.service.NotificationReadPlatformServiceImpl;
|
||||||
|
import org.apache.fineract.notification.service.NotificationWritePlatformService;
|
||||||
|
import org.apache.fineract.notification.service.NotificationWritePlatformServiceImpl;
|
||||||
|
import org.apache.fineract.notification.service.UserNotificationService;
|
||||||
|
import org.apache.fineract.notification.service.UserNotificationServiceImpl;
|
||||||
|
import org.apache.fineract.useradministration.domain.AppUserRepository;
|
||||||
|
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 NotificationConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(NotificationDomainService.class)
|
||||||
|
public NotificationDomainService notificationDomainService(BusinessEventNotifierService businessEventNotifierService,
|
||||||
|
PlatformSecurityContext context, UserNotificationService userNotificationService) {
|
||||||
|
return new NotificationDomainServiceImpl(businessEventNotifierService, context, userNotificationService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(NotificationReadPlatformService.class)
|
||||||
|
public NotificationReadPlatformService notificationReadPlatformService(JdbcTemplate jdbcTemplate, PlatformSecurityContext context,
|
||||||
|
ColumnValidator columnValidator, PaginationHelper paginationHelper, DatabaseSpecificSQLGenerator sqlGenerator) {
|
||||||
|
return new NotificationReadPlatformServiceImpl(jdbcTemplate, context, columnValidator, paginationHelper, sqlGenerator);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(NotificationWritePlatformService.class)
|
||||||
|
public NotificationWritePlatformService notificationWritePlatformService(
|
||||||
|
NotificationGeneratorWritePlatformService notificationGeneratorWritePlatformService,
|
||||||
|
NotificationGeneratorReadRepositoryWrapper notificationGeneratorReadRepositoryWrapper, AppUserRepository appUserRepository,
|
||||||
|
NotificationMapperWritePlatformService notificationMapperWritePlatformService) {
|
||||||
|
return new NotificationWritePlatformServiceImpl(notificationGeneratorWritePlatformService,
|
||||||
|
notificationGeneratorReadRepositoryWrapper, appUserRepository, notificationMapperWritePlatformService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(UserNotificationService.class)
|
||||||
|
public UserNotificationService userNotificationService(NotificationEventPublisher notificationEventPublisher,
|
||||||
|
AppUserRepository appUserRepository, FineractProperties fineractProperties,
|
||||||
|
NotificationReadPlatformService notificationReadPlatformService,
|
||||||
|
NotificationWritePlatformService notificationWritePlatformService) {
|
||||||
|
return new UserNotificationServiceImpl(notificationEventPublisher, appUserRepository, fineractProperties,
|
||||||
|
notificationReadPlatformService, notificationWritePlatformService);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user