FINERACT-1724 - Replayed bulk transaction fix
[x] - Remove bulk transaction from ReplayedTransactionBusinessEventService [x] - Create Aspect and custom annotation for CommandHandler and Tasklet bulk events [x] - Add @BulkEventSupport annotation where ReplayedTransactionBusinessEventService was used [x] - Test class for Aspect call failure handling
This commit is contained in:
committed by
Arnold Gálovics
parent
6d3cac8c02
commit
1b2c09eae5
@@ -150,6 +150,7 @@ configurations {
|
|||||||
driver
|
driver
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
|
testImplementation 'org.projectlombok:lombok:1.18.22'
|
||||||
driver 'org.mariadb.jdbc:mariadb-java-client'
|
driver 'org.mariadb.jdbc:mariadb-java-client'
|
||||||
driver 'org.postgresql:postgresql'
|
driver 'org.postgresql:postgresql'
|
||||||
driver 'mysql:mysql-connector-java:8.0.31'
|
driver 'mysql:mysql-connector-java:8.0.31'
|
||||||
|
|||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* 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.infrastructure.event.business.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Inherited;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Annotation to be used to collect events into BulkEvent
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||||
|
@Documented
|
||||||
|
@Inherited
|
||||||
|
public @interface BulkEventSupport {
|
||||||
|
|
||||||
|
}
|
||||||
+55
@@ -0,0 +1,55 @@
|
|||||||
|
/**
|
||||||
|
* 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.infrastructure.event.business.aspect;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.Around;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Aspect
|
||||||
|
public class BulkEventAspect {
|
||||||
|
|
||||||
|
private final BusinessEventNotifierService businessEventNotifierService;
|
||||||
|
|
||||||
|
@Around("execution(@org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport public * *(..)) || execution(public * (@org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport *).*(..))")
|
||||||
|
public Object processCommandJoinPoint(ProceedingJoinPoint proceedingJoinPoint) {
|
||||||
|
return bulkAroundWrapper(proceedingJoinPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
private Object bulkAroundWrapper(ProceedingJoinPoint proceedingJoinPoint) {
|
||||||
|
if (businessEventNotifierService.isExternalEventRecordingEnabled()) {
|
||||||
|
return proceedingJoinPoint.proceed(proceedingJoinPoint.getArgs());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
businessEventNotifierService.startExternalEventRecording();
|
||||||
|
Object result = proceedingJoinPoint.proceed(proceedingJoinPoint.getArgs());
|
||||||
|
businessEventNotifierService.stopExternalEventRecording();
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
businessEventNotifierService.resetEventRecording();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-1
@@ -23,7 +23,6 @@ import org.apache.fineract.infrastructure.event.business.domain.BusinessEvent;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Implemented class is responsible for notifying the business event to registered listeners.
|
* Implemented class is responsible for notifying the business event to registered listeners.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface BusinessEventNotifierService {
|
public interface BusinessEventNotifierService {
|
||||||
|
|
||||||
@@ -47,9 +46,12 @@ public interface BusinessEventNotifierService {
|
|||||||
*/
|
*/
|
||||||
<T extends BusinessEvent<?>> void addPostBusinessEventListener(Class<T> eventType, BusinessEventListener<T> listener);
|
<T extends BusinessEvent<?>> void addPostBusinessEventListener(Class<T> eventType, BusinessEventListener<T> listener);
|
||||||
|
|
||||||
|
boolean isExternalEventRecordingEnabled();
|
||||||
|
|
||||||
void startExternalEventRecording();
|
void startExternalEventRecording();
|
||||||
|
|
||||||
void stopExternalEventRecording();
|
void stopExternalEventRecording();
|
||||||
|
|
||||||
void resetEventRecording();
|
void resetEventRecording();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -110,7 +110,8 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe
|
|||||||
businessEventListeners.add(listener);
|
businessEventListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isExternalEventRecordingEnabled() {
|
@Override
|
||||||
|
public boolean isExternalEventRecordingEnabled() {
|
||||||
return eventRecordingEnabled.get();
|
return eventRecordingEnabled.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,4 +162,5 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe
|
|||||||
eventRecordingEnabled.set(false);
|
eventRecordingEnabled.set(false);
|
||||||
recordedEvents.remove();
|
recordedEvents.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -23,6 +23,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.account.service.AccountTransfersWritePlatformService;
|
import org.apache.fineract.portfolio.account.service.AccountTransfersWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "ACCOUNTTRANSFER", action = "CREATE")
|
@CommandType(entity = "ACCOUNTTRANSFER", action = "CREATE")
|
||||||
|
@BulkEventSupport
|
||||||
public class CreateAccountTransferCommandHandler implements NewCommandSourceHandler {
|
public class CreateAccountTransferCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final AccountTransfersWritePlatformService writePlatformService;
|
private final AccountTransfersWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -30,6 +30,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformService
|
|||||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
|
import org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
|
||||||
|
import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
||||||
import org.apache.fineract.portfolio.account.data.AccountTransferDTO;
|
import org.apache.fineract.portfolio.account.data.AccountTransferDTO;
|
||||||
import org.apache.fineract.portfolio.account.data.StandingInstructionData;
|
import org.apache.fineract.portfolio.account.data.StandingInstructionData;
|
||||||
@@ -52,6 +53,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@BulkEventSupport
|
||||||
public class ExecuteStandingInstructionsTasklet implements Tasklet {
|
public class ExecuteStandingInstructionsTasklet implements Tasklet {
|
||||||
|
|
||||||
private final StandingInstructionReadPlatformService standingInstructionReadPlatformService;
|
private final StandingInstructionReadPlatformService standingInstructionReadPlatformService;
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService;
|
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandType(entity = "COLLECTIONSHEET", action = "SAVE")
|
@CommandType(entity = "COLLECTIONSHEET", action = "SAVE")
|
||||||
|
@BulkEventSupport
|
||||||
public class SaveIndividualCollectionSheetCommandHandler implements NewCommandSourceHandler {
|
public class SaveIndividualCollectionSheetCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final CollectionSheetWritePlatformService collectionSheetWritePlatformService;
|
private final CollectionSheetWritePlatformService collectionSheetWritePlatformService;
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService;
|
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandType(entity = "COLLECTIONSHEET", action = "UPDATE")
|
@CommandType(entity = "COLLECTIONSHEET", action = "UPDATE")
|
||||||
|
@BulkEventSupport
|
||||||
public class UpdateCollectionSheetCommandHandler implements NewCommandSourceHandler {
|
public class UpdateCollectionSheetCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final CollectionSheetWritePlatformService collectionSheetWritePlatformService;
|
private final CollectionSheetWritePlatformService collectionSheetWritePlatformService;
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService;
|
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandType(entity = "CENTER", action = "SAVECOLLECTIONSHEET")
|
@CommandType(entity = "CENTER", action = "SAVECOLLECTIONSHEET")
|
||||||
|
@BulkEventSupport
|
||||||
public class SaveCenterCollectionSheetCommandHandler implements NewCommandSourceHandler {
|
public class SaveCenterCollectionSheetCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final CollectionSheetWritePlatformService writePlatformService;
|
private final CollectionSheetWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService;
|
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetWritePlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandType(entity = "GROUP", action = "SAVECOLLECTIONSHEET")
|
@CommandType(entity = "GROUP", action = "SAVECOLLECTIONSHEET")
|
||||||
|
@BulkEventSupport
|
||||||
public class SaveGroupCollectionSheetCommandHandler implements NewCommandSourceHandler {
|
public class SaveGroupCollectionSheetCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final CollectionSheetWritePlatformService writePlatformService;
|
private final CollectionSheetWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -22,12 +22,14 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@BulkEventSupport
|
||||||
public class AddAndDeleteLoanDisburseDetailsCommandHandler implements NewCommandSourceHandler {
|
public class AddAndDeleteLoanDisburseDetailsCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -24,6 +24,7 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
|||||||
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
import org.springframework.orm.jpa.JpaSystemException;
|
import org.springframework.orm.jpa.JpaSystemException;
|
||||||
@@ -33,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOANCHARGE", action = "CREATE")
|
@CommandType(entity = "LOANCHARGE", action = "CREATE")
|
||||||
|
@BulkEventSupport
|
||||||
public class AddLoanChargeCommandHandler implements NewCommandSourceHandler {
|
public class AddLoanChargeCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanChargeWritePlatformService writePlatformService;
|
private final LoanChargeWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -24,6 +24,7 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
|||||||
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
import org.springframework.orm.jpa.JpaSystemException;
|
import org.springframework.orm.jpa.JpaSystemException;
|
||||||
@@ -33,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "DISBURSE")
|
@CommandType(entity = "LOAN", action = "DISBURSE")
|
||||||
|
@BulkEventSupport
|
||||||
public class DisburseLoanCommandHandler implements NewCommandSourceHandler {
|
public class DisburseLoanCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -23,6 +23,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "DISBURSETOSAVINGS")
|
@CommandType(entity = "LOAN", action = "DISBURSETOSAVINGS")
|
||||||
|
@BulkEventSupport
|
||||||
public class DisburseLoanToSavingsCommandHandler implements NewCommandSourceHandler {
|
public class DisburseLoanToSavingsCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -23,12 +23,14 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "FORECLOSURE")
|
@CommandType(entity = "LOAN", action = "FORECLOSURE")
|
||||||
|
@BulkEventSupport
|
||||||
public class ForeClosureCommandHandler implements NewCommandSourceHandler {
|
public class ForeClosureCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -24,6 +24,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -31,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "GLIMLOAN", action = "DISBURSE")
|
@CommandType(entity = "GLIMLOAN", action = "DISBURSE")
|
||||||
|
@BulkEventSupport
|
||||||
public class GlimLoanApplicationDisburseCommandHandler implements NewCommandSourceHandler {
|
public class GlimLoanApplicationDisburseCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -24,6 +24,7 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
|||||||
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
import org.springframework.orm.jpa.JpaSystemException;
|
import org.springframework.orm.jpa.JpaSystemException;
|
||||||
@@ -33,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "CHARGEREFUND")
|
@CommandType(entity = "LOAN", action = "CHARGEREFUND")
|
||||||
|
@BulkEventSupport
|
||||||
public class LoanChargeRefundCommandHandler implements NewCommandSourceHandler {
|
public class LoanChargeRefundCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanChargeWritePlatformService writePlatformService;
|
private final LoanChargeWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -24,6 +24,7 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
|||||||
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
@@ -34,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "GOODWILLCREDIT")
|
@CommandType(entity = "LOAN", action = "GOODWILLCREDIT")
|
||||||
|
@BulkEventSupport
|
||||||
public class LoanGoodwillCreditCommandHandler implements NewCommandSourceHandler {
|
public class LoanGoodwillCreditCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -24,6 +24,7 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
|||||||
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
@@ -34,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "MERCHANTISSUEDREFUND")
|
@CommandType(entity = "LOAN", action = "MERCHANTISSUEDREFUND")
|
||||||
|
@BulkEventSupport
|
||||||
public class LoanMerchantIssuedRefundCommandHandler implements NewCommandSourceHandler {
|
public class LoanMerchantIssuedRefundCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -24,6 +24,7 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
|||||||
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
@@ -34,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "PAYOUTREFUND")
|
@CommandType(entity = "LOAN", action = "PAYOUTREFUND")
|
||||||
|
@BulkEventSupport
|
||||||
public class LoanPayoutRefundCommandHandler implements NewCommandSourceHandler {
|
public class LoanPayoutRefundCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -23,6 +23,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -30,6 +31,7 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "RECOVERYPAYMENT")
|
@CommandType(entity = "LOAN", action = "RECOVERYPAYMENT")
|
||||||
|
@BulkEventSupport
|
||||||
public class LoanRecoveryPaymentCommandHandler implements NewCommandSourceHandler {
|
public class LoanRecoveryPaymentCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -23,6 +23,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "ADJUST")
|
@CommandType(entity = "LOAN", action = "ADJUST")
|
||||||
|
@BulkEventSupport
|
||||||
public class LoanRepaymentAdjustmentCommandHandler implements NewCommandSourceHandler {
|
public class LoanRepaymentAdjustmentCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -24,6 +24,7 @@ import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
|||||||
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
import org.apache.fineract.infrastructure.DataIntegrityErrorHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
@@ -34,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "REPAYMENT")
|
@CommandType(entity = "LOAN", action = "REPAYMENT")
|
||||||
|
@BulkEventSupport
|
||||||
public class LoanRepaymentCommandHandler implements NewCommandSourceHandler {
|
public class LoanRepaymentCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -23,6 +23,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOANCHARGE", action = "PAY")
|
@CommandType(entity = "LOANCHARGE", action = "PAY")
|
||||||
|
@BulkEventSupport
|
||||||
public class PayLoanChargeCommandHandler implements NewCommandSourceHandler {
|
public class PayLoanChargeCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanChargeWritePlatformService writePlatformService;
|
private final LoanChargeWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -23,12 +23,14 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "RECOVERGUARANTEES")
|
@CommandType(entity = "LOAN", action = "RECOVERGUARANTEES")
|
||||||
|
@BulkEventSupport
|
||||||
public class RecoverFromGuarantorCommandHandler implements NewCommandSourceHandler {
|
public class RecoverFromGuarantorCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -23,6 +23,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "UNDOWRITEOFF")
|
@CommandType(entity = "LOAN", action = "UNDOWRITEOFF")
|
||||||
|
@BulkEventSupport
|
||||||
public class UndoWriteOffLoanCommandHandler implements NewCommandSourceHandler {
|
public class UndoWriteOffLoanCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -22,12 +22,14 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@BulkEventSupport
|
||||||
public class UpdateLoanDisburseDateCommandHandler implements NewCommandSourceHandler {
|
public class UpdateLoanDisburseDateCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -23,6 +23,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CommandType(entity = "LOAN", action = "WAIVEINTERESTPORTION")
|
@CommandType(entity = "LOAN", action = "WAIVEINTERESTPORTION")
|
||||||
|
@BulkEventSupport
|
||||||
public class WaiveInterestPortionOnLoanCommandHandler implements NewCommandSourceHandler {
|
public class WaiveInterestPortionOnLoanCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanWritePlatformService writePlatformService;
|
private final LoanWritePlatformService writePlatformService;
|
||||||
|
|||||||
+2
@@ -29,6 +29,7 @@ import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDoma
|
|||||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
|
import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
||||||
import org.apache.fineract.portfolio.loanaccount.loanschedule.data.OverdueLoanScheduleData;
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.data.OverdueLoanScheduleData;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanChargeWritePlatformService;
|
||||||
@@ -40,6 +41,7 @@ import org.springframework.batch.repeat.RepeatStatus;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@BulkEventSupport
|
||||||
public class ApplyChargeToOverdueLoanInstallmentTasklet implements Tasklet {
|
public class ApplyChargeToOverdueLoanInstallmentTasklet implements Tasklet {
|
||||||
|
|
||||||
private final ConfigurationDomainService configurationDomainService;
|
private final ConfigurationDomainService configurationDomainService;
|
||||||
|
|||||||
+2
@@ -31,6 +31,7 @@ import java.util.concurrent.Future;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
||||||
import org.apache.fineract.organisation.office.data.OfficeData;
|
import org.apache.fineract.organisation.office.data.OfficeData;
|
||||||
import org.apache.fineract.organisation.office.exception.OfficeNotFoundException;
|
import org.apache.fineract.organisation.office.exception.OfficeNotFoundException;
|
||||||
@@ -46,6 +47,7 @@ import org.springframework.batch.repeat.RepeatStatus;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@BulkEventSupport
|
||||||
public class RecalculateInterestForLoanTasklet implements Tasklet {
|
public class RecalculateInterestForLoanTasklet implements Tasklet {
|
||||||
|
|
||||||
private final LoanReadPlatformService loanReadPlatformService;
|
private final LoanReadPlatformService loanReadPlatformService;
|
||||||
|
|||||||
+2
@@ -25,6 +25,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.fineract.infrastructure.core.domain.ExternalId;
|
import org.apache.fineract.infrastructure.core.domain.ExternalId;
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
|
import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
||||||
import org.apache.fineract.portfolio.account.PortfolioAccountType;
|
import org.apache.fineract.portfolio.account.PortfolioAccountType;
|
||||||
import org.apache.fineract.portfolio.account.data.AccountTransferDTO;
|
import org.apache.fineract.portfolio.account.data.AccountTransferDTO;
|
||||||
@@ -45,6 +46,7 @@ import org.springframework.batch.repeat.RepeatStatus;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@BulkEventSupport
|
||||||
public class TransferFeeChargeForLoansTasklet implements Tasklet {
|
public class TransferFeeChargeForLoansTasklet implements Tasklet {
|
||||||
|
|
||||||
private final LoanChargeReadPlatformService loanChargeReadPlatformService;
|
private final LoanChargeReadPlatformService loanChargeReadPlatformService;
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.loanaccount.rescheduleloan.service.LoanRescheduleRequestWritePlatformService;
|
import org.apache.fineract.portfolio.loanaccount.rescheduleloan.service.LoanRescheduleRequestWritePlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandType(entity = "RESCHEDULELOAN", action = "APPROVE")
|
@CommandType(entity = "RESCHEDULELOAN", action = "APPROVE")
|
||||||
|
@BulkEventSupport
|
||||||
public class ApproveLoanRescheduleRequestCommandHandler implements NewCommandSourceHandler {
|
public class ApproveLoanRescheduleRequestCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final LoanRescheduleRequestWritePlatformService loanRescheduleRequestWritePlatformService;
|
private final LoanRescheduleRequestWritePlatformService loanRescheduleRequestWritePlatformService;
|
||||||
|
|||||||
+7
-13
@@ -41,19 +41,13 @@ public class ReplayedTransactionBusinessEventServiceImpl implements ReplayedTran
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Extra safety net to avoid event leaking
|
// Extra safety net to avoid event leaking
|
||||||
try {
|
for (Map.Entry<Long, LoanTransaction> mapEntry : changedTransactionDetail.getNewTransactionMappings().entrySet()) {
|
||||||
businessEventNotifierService.startExternalEventRecording();
|
LoanTransaction oldTransaction = loanTransactionRepository.findById(mapEntry.getKey())
|
||||||
for (Map.Entry<Long, LoanTransaction> mapEntry : changedTransactionDetail.getNewTransactionMappings().entrySet()) {
|
.orElseThrow(() -> new LoanTransactionNotFoundException(mapEntry.getKey()));
|
||||||
LoanTransaction oldTransaction = loanTransactionRepository.findById(mapEntry.getKey())
|
LoanAdjustTransactionBusinessEvent.Data data = new LoanAdjustTransactionBusinessEvent.Data(oldTransaction);
|
||||||
.orElseThrow(() -> new LoanTransactionNotFoundException(mapEntry.getKey()));
|
data.setNewTransactionDetail(mapEntry.getValue());
|
||||||
LoanAdjustTransactionBusinessEvent.Data data = new LoanAdjustTransactionBusinessEvent.Data(oldTransaction);
|
businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(data));
|
||||||
data.setNewTransactionDetail(mapEntry.getValue());
|
|
||||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(data));
|
|
||||||
}
|
|
||||||
businessEventNotifierService.stopExternalEventRecording();
|
|
||||||
} catch (Exception e) {
|
|
||||||
businessEventNotifierService.resetEventRecording();
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandType(entity = "FIXEDDEPOSITACCOUNT", action = "ACTIVATE")
|
@CommandType(entity = "FIXEDDEPOSITACCOUNT", action = "ACTIVATE")
|
||||||
|
@BulkEventSupport
|
||||||
public class ActivateFixedDepositAccountCommandHandler implements NewCommandSourceHandler {
|
public class ActivateFixedDepositAccountCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandType(entity = "RECURRINGDEPOSITACCOUNT", action = "ACTIVATE")
|
@CommandType(entity = "RECURRINGDEPOSITACCOUNT", action = "ACTIVATE")
|
||||||
|
@BulkEventSupport
|
||||||
public class ActivateRecurringDepositAccountCommandHandler implements NewCommandSourceHandler {
|
public class ActivateRecurringDepositAccountCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandType(entity = "FIXEDDEPOSITACCOUNT", action = "CLOSE")
|
@CommandType(entity = "FIXEDDEPOSITACCOUNT", action = "CLOSE")
|
||||||
|
@BulkEventSupport
|
||||||
public class CloseFixedDepositAccountCommandHandler implements NewCommandSourceHandler {
|
public class CloseFixedDepositAccountCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandType(entity = "RECURRINGDEPOSITACCOUNT", action = "CLOSE")
|
@CommandType(entity = "RECURRINGDEPOSITACCOUNT", action = "CLOSE")
|
||||||
|
@BulkEventSupport
|
||||||
public class CloseRecurringDepositAccountCommandHandler implements NewCommandSourceHandler {
|
public class CloseRecurringDepositAccountCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandType(entity = "FIXEDDEPOSITACCOUNT", action = "PREMATURECLOSE")
|
@CommandType(entity = "FIXEDDEPOSITACCOUNT", action = "PREMATURECLOSE")
|
||||||
|
@BulkEventSupport
|
||||||
public class PrematureCloseFixedDepositAccountCommandHandler implements NewCommandSourceHandler {
|
public class PrematureCloseFixedDepositAccountCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import org.apache.fineract.commands.annotation.CommandType;
|
|||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
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.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
import org.apache.fineract.portfolio.savings.service.DepositAccountWritePlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -29,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@CommandType(entity = "RECURRINGDEPOSITACCOUNT", action = "PREMATURECLOSE")
|
@CommandType(entity = "RECURRINGDEPOSITACCOUNT", action = "PREMATURECLOSE")
|
||||||
|
@BulkEventSupport
|
||||||
public class PrematureCloseRecurringDepositAccountCommandHandler implements NewCommandSourceHandler {
|
public class PrematureCloseRecurringDepositAccountCommandHandler implements NewCommandSourceHandler {
|
||||||
|
|
||||||
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
private final DepositAccountWritePlatformService depositAccountWritePlatformService;
|
||||||
|
|||||||
+2
@@ -24,6 +24,7 @@ import java.util.List;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
|
import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
||||||
import org.apache.fineract.portfolio.account.data.AccountTransferDTO;
|
import org.apache.fineract.portfolio.account.data.AccountTransferDTO;
|
||||||
import org.apache.fineract.portfolio.account.service.AccountTransfersWritePlatformService;
|
import org.apache.fineract.portfolio.account.service.AccountTransfersWritePlatformService;
|
||||||
@@ -36,6 +37,7 @@ import org.springframework.batch.repeat.RepeatStatus;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@BulkEventSupport
|
||||||
public class TransferInterestToSavingsTasklet implements Tasklet {
|
public class TransferInterestToSavingsTasklet implements Tasklet {
|
||||||
|
|
||||||
private final DepositAccountReadPlatformService depositAccountReadPlatformService;
|
private final DepositAccountReadPlatformService depositAccountReadPlatformService;
|
||||||
|
|||||||
+2
@@ -25,6 +25,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
|
import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport;
|
||||||
import org.apache.fineract.portfolio.savings.DepositAccountType;
|
import org.apache.fineract.portfolio.savings.DepositAccountType;
|
||||||
import org.apache.fineract.portfolio.savings.data.DepositAccountData;
|
import org.apache.fineract.portfolio.savings.data.DepositAccountData;
|
||||||
import org.apache.fineract.portfolio.savings.service.DepositAccountReadPlatformService;
|
import org.apache.fineract.portfolio.savings.service.DepositAccountReadPlatformService;
|
||||||
@@ -36,6 +37,7 @@ import org.springframework.batch.repeat.RepeatStatus;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@BulkEventSupport
|
||||||
public class UpdateDepositsAccountMaturityDetailsTasklet implements Tasklet {
|
public class UpdateDepositsAccountMaturityDetailsTasklet implements Tasklet {
|
||||||
|
|
||||||
private final DepositAccountReadPlatformService depositAccountReadPlatformService;
|
private final DepositAccountReadPlatformService depositAccountReadPlatformService;
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.TestPropertySource;
|
||||||
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
|
@ExtendWith(SpringExtension.class)
|
||||||
|
@TestPropertySource("classpath:application-test.properties")
|
||||||
|
@WebAppConfiguration
|
||||||
|
@ContextConfiguration(classes = TestConfiguration.class)
|
||||||
|
public class AbstractSpringTest {}
|
||||||
+2
-2
@@ -25,12 +25,12 @@ import org.springframework.test.context.TestPropertySource;
|
|||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import org.springframework.test.context.web.WebAppConfiguration;
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
|
// This configuration class is used for Cucumber tests, it's invoked via Cucumber glue (cucumber.properties)
|
||||||
@CucumberContextConfiguration
|
@CucumberContextConfiguration
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@TestPropertySource("classpath:application-test.properties")
|
@TestPropertySource("classpath:application-test.properties")
|
||||||
@WebAppConfiguration
|
@WebAppConfiguration
|
||||||
@ContextConfiguration(classes = TestConfiguration.class)
|
@ContextConfiguration(classes = TestConfiguration.class)
|
||||||
// @SpringBootTest(classes = TestConfiguration.class)
|
public class CucumberTestSuite {
|
||||||
public class TestSuite {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.mock;
|
|||||||
|
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
import org.apache.fineract.infrastructure.core.config.CacheConfig;
|
||||||
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.database.DatabaseIndependentQueryService;
|
import org.apache.fineract.infrastructure.core.service.database.DatabaseIndependentQueryService;
|
||||||
@@ -54,6 +55,7 @@ import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfigurati
|
|||||||
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
|
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
|
||||||
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.cache.jcache.JCacheCacheManager;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -76,7 +78,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
@EnableConfigurationProperties({ FineractProperties.class, LiquibaseProperties.class })
|
@EnableConfigurationProperties({ FineractProperties.class, LiquibaseProperties.class })
|
||||||
@ComponentScan(basePackages = "org.apache.fineract", excludeFilters = {
|
@ComponentScan(basePackages = "org.apache.fineract", excludeFilters = {
|
||||||
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = ScheduledJobRunnerConfig.class) })
|
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = ScheduledJobRunnerConfig.class),
|
||||||
|
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = CacheConfig.class) })
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
@MockitoSettings(strictness = Strictness.LENIENT)
|
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||||
public class TestConfiguration {
|
public class TestConfiguration {
|
||||||
@@ -196,4 +199,9 @@ public class TestConfiguration {
|
|||||||
public JobRepository jobRepository() {
|
public JobRepository jobRepository() {
|
||||||
return mock(JobRepository.class, RETURNS_MOCKS);
|
return mock(JobRepository.class, RETURNS_MOCKS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public JCacheCacheManager jCacheCacheManager() {
|
||||||
|
return new JCacheCacheManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* 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.bulk;
|
||||||
|
|
||||||
|
import org.apache.fineract.AbstractSpringTest;
|
||||||
|
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||||
|
|
||||||
|
public class BulkAspectTest extends AbstractSpringTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BulkTestEvent testEvent;
|
||||||
|
@SpyBean
|
||||||
|
private BusinessEventNotifierService notifier;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEventOnFail() {
|
||||||
|
|
||||||
|
Assertions.assertThrows(IllegalStateException.class, () -> testEvent.processCommand(null));
|
||||||
|
Mockito.verify(notifier, Mockito.times(1)).startExternalEventRecording();
|
||||||
|
Mockito.verify(notifier, Mockito.times(0)).stopExternalEventRecording();
|
||||||
|
Mockito.verify(notifier, Mockito.times(1)).resetEventRecording();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* 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.bulk;
|
||||||
|
|
||||||
|
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||||
|
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||||
|
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||||
|
import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@BulkEventSupport
|
||||||
|
public class BulkTestEvent implements NewCommandSourceHandler {
|
||||||
|
|
||||||
|
private final NestedBulkTestEvent nestedBulkTestEvent;
|
||||||
|
|
||||||
|
public BulkTestEvent(NestedBulkTestEvent nestedBulkTestEvent) {
|
||||||
|
this.nestedBulkTestEvent = nestedBulkTestEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommandProcessingResult processCommand(JsonCommand command) {
|
||||||
|
nestedBulkTestEvent.exec();
|
||||||
|
return new CommandProcessingResult(1L);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* 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.bulk;
|
||||||
|
|
||||||
|
import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@BulkEventSupport
|
||||||
|
public class NestedBulkTestEvent {
|
||||||
|
|
||||||
|
public void exec() {
|
||||||
|
throw new IllegalStateException("Not implemented");
|
||||||
|
}
|
||||||
|
}
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* 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.loanaccount.service;
|
||||||
|
|
||||||
|
import org.apache.fineract.infrastructure.event.business.annotation.BulkEventSupport;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.domain.ChangedTransactionDetail;
|
||||||
|
import org.springframework.batch.core.StepContribution;
|
||||||
|
import org.springframework.batch.core.scope.context.ChunkContext;
|
||||||
|
import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||||
|
import org.springframework.batch.repeat.RepeatStatus;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class DummyTasklet implements Tasklet {
|
||||||
|
|
||||||
|
private ChangedTransactionDetail changedTransactionDetail;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReplayedTransactionBusinessEventService replayedTransactionBusinessService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@BulkEventSupport
|
||||||
|
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
|
||||||
|
replayedTransactionBusinessService.raiseTransactionReplayedEvents(changedTransactionDetail);
|
||||||
|
return RepeatStatus.FINISHED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChangedTransactionDetail getChangedTransactionDetail() {
|
||||||
|
return changedTransactionDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChangedTransactionDetail(ChangedTransactionDetail changedTransactionDetail) {
|
||||||
|
this.changedTransactionDetail = changedTransactionDetail;
|
||||||
|
}
|
||||||
|
}
|
||||||
+41
-29
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.lenient;
|
|||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import org.apache.fineract.AbstractSpringTest;
|
||||||
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanAdjustTransactionBusinessEvent;
|
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanAdjustTransactionBusinessEvent;
|
||||||
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
|
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.ChangedTransactionDetail;
|
import org.apache.fineract.portfolio.loanaccount.domain.ChangedTransactionDetail;
|
||||||
@@ -31,75 +32,85 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
|
|||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepository;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepository;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.springframework.batch.core.StepContribution;
|
||||||
|
import org.springframework.batch.core.scope.context.ChunkContext;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
class ReplayedTransactionBusinessEventServiceIntegrationTest extends AbstractSpringTest {
|
||||||
class ReplayedTransactionBusinessEventServiceIntegrationTest {
|
|
||||||
|
|
||||||
@Mock
|
@MockBean
|
||||||
private BusinessEventNotifierService businessEventNotifierService;
|
private BusinessEventNotifierService businessEventNotifierService;
|
||||||
|
|
||||||
@Mock
|
@MockBean
|
||||||
private LoanTransactionRepository loanTransactionRepository;
|
private LoanTransactionRepository loanTransactionRepository;
|
||||||
|
|
||||||
private ReplayedTransactionBusinessEventService underTest;
|
@Autowired
|
||||||
|
private DummyTasklet dummyTasklet;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private StepContribution stepContribution;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private ChunkContext chunkContext;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
void setUp() {
|
||||||
underTest = new ReplayedTransactionBusinessEventServiceImpl(businessEventNotifierService, loanTransactionRepository);
|
dummyTasklet.setChangedTransactionDetail(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhenParamIsNull() {
|
public void testWhenParamIsNull() throws Exception {
|
||||||
// given
|
// given
|
||||||
ChangedTransactionDetail changedTransactionDetail = null;
|
dummyTasklet.setChangedTransactionDetail(null);
|
||||||
// when
|
// when
|
||||||
underTest.raiseTransactionReplayedEvents(changedTransactionDetail);
|
dummyTasklet.execute(stepContribution, chunkContext);
|
||||||
// then
|
// then
|
||||||
verify(businessEventNotifierService, Mockito.times(0)).startExternalEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording();
|
||||||
verify(businessEventNotifierService, Mockito.times(0))
|
verify(businessEventNotifierService, Mockito.times(0))
|
||||||
.notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class));
|
.notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class));
|
||||||
verify(businessEventNotifierService, Mockito.times(0)).stopExternalEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).stopExternalEventRecording();
|
||||||
verify(businessEventNotifierService, Mockito.times(0)).resetEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).resetEventRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhenParamHasNoMapping() {
|
public void testWhenParamHasNoMapping() throws Exception {
|
||||||
// given
|
// given
|
||||||
ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail();
|
ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail();
|
||||||
|
dummyTasklet.setChangedTransactionDetail(changedTransactionDetail);
|
||||||
// when
|
// when
|
||||||
underTest.raiseTransactionReplayedEvents(changedTransactionDetail);
|
dummyTasklet.execute(stepContribution, chunkContext);
|
||||||
// then
|
// then
|
||||||
verify(businessEventNotifierService, Mockito.times(0)).startExternalEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording();
|
||||||
verify(businessEventNotifierService, Mockito.times(0))
|
verify(businessEventNotifierService, Mockito.times(0))
|
||||||
.notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class));
|
.notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class));
|
||||||
verify(businessEventNotifierService, Mockito.times(0)).stopExternalEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).stopExternalEventRecording();
|
||||||
verify(businessEventNotifierService, Mockito.times(0)).resetEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).resetEventRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhenParamHasOneNewTransaction() {
|
public void testWhenParamHasOneNewTransaction() throws Exception {
|
||||||
// given
|
// given
|
||||||
LoanTransaction oldLoanTransaction = Mockito.mock(LoanTransaction.class);
|
LoanTransaction oldLoanTransaction = Mockito.mock(LoanTransaction.class);
|
||||||
LoanTransaction newLoanTransaction = Mockito.mock(LoanTransaction.class);
|
LoanTransaction newLoanTransaction = Mockito.mock(LoanTransaction.class);
|
||||||
lenient().when(loanTransactionRepository.findById(1L)).thenReturn(Optional.of(oldLoanTransaction));
|
lenient().when(loanTransactionRepository.findById(1L)).thenReturn(Optional.of(oldLoanTransaction));
|
||||||
ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail();
|
ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail();
|
||||||
changedTransactionDetail.getNewTransactionMappings().put(1L, newLoanTransaction);
|
changedTransactionDetail.getNewTransactionMappings().put(1L, newLoanTransaction);
|
||||||
|
dummyTasklet.setChangedTransactionDetail(changedTransactionDetail);
|
||||||
// when
|
// when
|
||||||
underTest.raiseTransactionReplayedEvents(changedTransactionDetail);
|
dummyTasklet.execute(stepContribution, chunkContext);
|
||||||
// then
|
// then
|
||||||
verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording();
|
||||||
verify(businessEventNotifierService, Mockito.times(1))
|
verify(businessEventNotifierService, Mockito.times(1))
|
||||||
.notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class));
|
.notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class));
|
||||||
verify(businessEventNotifierService, Mockito.times(1)).stopExternalEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).stopExternalEventRecording();
|
||||||
verify(businessEventNotifierService, Mockito.times(0)).resetEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).resetEventRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhenParamHasTwoNewTransaction() {
|
public void testWhenParamHasTwoNewTransaction() throws Exception {
|
||||||
// given
|
// given
|
||||||
LoanTransaction oldLoanTransaction = Mockito.mock(LoanTransaction.class);
|
LoanTransaction oldLoanTransaction = Mockito.mock(LoanTransaction.class);
|
||||||
LoanTransaction newLoanTransaction = Mockito.mock(LoanTransaction.class);
|
LoanTransaction newLoanTransaction = Mockito.mock(LoanTransaction.class);
|
||||||
@@ -108,28 +119,29 @@ class ReplayedTransactionBusinessEventServiceIntegrationTest {
|
|||||||
ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail();
|
ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail();
|
||||||
changedTransactionDetail.getNewTransactionMappings().put(1L, newLoanTransaction);
|
changedTransactionDetail.getNewTransactionMappings().put(1L, newLoanTransaction);
|
||||||
changedTransactionDetail.getNewTransactionMappings().put(2L, newLoanTransaction);
|
changedTransactionDetail.getNewTransactionMappings().put(2L, newLoanTransaction);
|
||||||
|
dummyTasklet.setChangedTransactionDetail(changedTransactionDetail);
|
||||||
// when
|
// when
|
||||||
underTest.raiseTransactionReplayedEvents(changedTransactionDetail);
|
dummyTasklet.execute(stepContribution, chunkContext);
|
||||||
// then
|
// then
|
||||||
verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording();
|
||||||
verify(businessEventNotifierService, Mockito.times(2))
|
verify(businessEventNotifierService, Mockito.times(2))
|
||||||
.notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class));
|
.notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class));
|
||||||
verify(businessEventNotifierService, Mockito.times(1)).stopExternalEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).stopExternalEventRecording();
|
||||||
verify(businessEventNotifierService, Mockito.times(0)).resetEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).resetEventRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhenParamHasError() {
|
public void testWhenParamHasError() {
|
||||||
// given
|
// given
|
||||||
doThrow(new RuntimeException()).when(businessEventNotifierService)
|
doThrow(new RuntimeException()).when(businessEventNotifierService).notifyPostBusinessEvent(Mockito.any());
|
||||||
.notifyPostBusinessEvent(Mockito.any(LoanAdjustTransactionBusinessEvent.class));
|
|
||||||
LoanTransaction oldLoanTransaction = Mockito.mock(LoanTransaction.class);
|
LoanTransaction oldLoanTransaction = Mockito.mock(LoanTransaction.class);
|
||||||
LoanTransaction newLoanTransaction = Mockito.mock(LoanTransaction.class);
|
LoanTransaction newLoanTransaction = Mockito.mock(LoanTransaction.class);
|
||||||
lenient().when(loanTransactionRepository.findById(1L)).thenReturn(Optional.of(oldLoanTransaction));
|
lenient().when(loanTransactionRepository.findById(1L)).thenReturn(Optional.of(oldLoanTransaction));
|
||||||
ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail();
|
ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail();
|
||||||
changedTransactionDetail.getNewTransactionMappings().put(1L, newLoanTransaction);
|
changedTransactionDetail.getNewTransactionMappings().put(1L, newLoanTransaction);
|
||||||
|
dummyTasklet.setChangedTransactionDetail(changedTransactionDetail);
|
||||||
// when
|
// when
|
||||||
assertThrows(RuntimeException.class, () -> underTest.raiseTransactionReplayedEvents(changedTransactionDetail));
|
assertThrows(RuntimeException.class, () -> dummyTasklet.execute(stepContribution, chunkContext));
|
||||||
// then
|
// then
|
||||||
verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording();
|
verify(businessEventNotifierService, Mockito.times(1)).startExternalEventRecording();
|
||||||
verify(businessEventNotifierService, Mockito.times(1))
|
verify(businessEventNotifierService, Mockito.times(1))
|
||||||
|
|||||||
Reference in New Issue
Block a user