fixed typo : listner -> listener (#1365)

Also breaks up BusinessEventNotificationConstants enum to one per line

Co-authored-by: Vincent FUCHS <vincent.fuchs@gefa.de>
This commit is contained in:
Vincent Fuchs
2020-10-03 16:46:41 +02:00
committed by GitHub
co-authored by Vincent FUCHS
parent 20bf4d6939
commit ab2acb8ad2
10 changed files with 157 additions and 140 deletions
@@ -43,7 +43,7 @@ import org.apache.fineract.portfolio.client.domain.Client;
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants;
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
import org.apache.fineract.portfolio.common.service.BusinessEventListner;
import org.apache.fineract.portfolio.common.service.BusinessEventListener;
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
import org.apache.fineract.portfolio.group.domain.Group;
import org.apache.fineract.portfolio.group.domain.GroupRepository;
@@ -94,18 +94,19 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
}
@PostConstruct
public void addListners() {
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_APPROVED, new SendSmsOnLoanApproved());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_REJECTED, new SendSmsOnLoanRejected());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_MAKE_REPAYMENT, new SendSmsOnLoanRepayment());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.CLIENTS_ACTIVATE, new ClientActivatedListener());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.CLIENTS_REJECT, new ClientRejectedListener());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_ACTIVATE,
public void addListeners() {
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_APPROVED, new SendSmsOnLoanApproved());
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_REJECTED, new SendSmsOnLoanRejected());
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_MAKE_REPAYMENT, new SendSmsOnLoanRepayment());
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.CLIENTS_ACTIVATE, new ClientActivatedListener());
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.CLIENTS_REJECT, new ClientRejectedListener());
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SAVINGS_ACTIVATE,
new SavingsAccountActivatedListener());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_REJECT, new SavingsAccountRejectedListener());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_DEPOSIT,
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SAVINGS_REJECT,
new SavingsAccountRejectedListener());
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SAVINGS_DEPOSIT,
new SavingsAccountTransactionListener(true));
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_WITHDRAWAL,
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SAVINGS_WITHDRAWAL,
new SavingsAccountTransactionListener(false));
}
@@ -384,7 +385,7 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
return smsParams;
}
private abstract static class SmsBusinessEventAdapter implements BusinessEventListner {
private abstract static class SmsBusinessEventAdapter implements BusinessEventListener {
@Override
public void businessEventToBeExecuted(Map<BusinessEntity, Object> businessEventEntity) {
@@ -29,7 +29,7 @@ public interface SchedulerServiceConstants {
String JOB_METHOD_INVOCATION_FAILED_EXCEPTION = "JobMethodInvocationFailedException";
String STATUS_SUCCESS = "success";
String STATUS_FAILED = "failed";
String DEFAULT_LISTENER_NAME = "Global Listner";
String DEFAULT_LISTENER_NAME = "Global Listener";
int STACK_TRACE_LEVEL = 7;
String TENANT_IDENTIFIER = "tenantIdentifier";
String SCHEDULER = "Scheduler";
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
@Component
public class SchedulerStopListener implements JobListener {
private static final String name = "Singlr Trigger Global Listner";
private static final String name = "Singlr Trigger Global Listener";
// MIFOSX-1184: This class cannot use constructor injection, because one of
// its dependencies (SchedulerStopListener) has a circular dependency to
@@ -38,7 +38,7 @@ import org.apache.fineract.portfolio.client.domain.Client;
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants;
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
import org.apache.fineract.portfolio.common.service.BusinessEventListner;
import org.apache.fineract.portfolio.common.service.BusinessEventListener;
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
@@ -81,32 +81,33 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
@PostConstruct
public void addListeners() {
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.CLIENTS_CREATE, new ClientCreatedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_APPROVE, new SavingsAccountApprovedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.CENTERS_CREATE, new CenterCreatedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.GROUPS_CREATE, new GroupCreatedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_DEPOSIT, new SavingsAccountDepositListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SHARE_PRODUCT_DIVIDENDS_CREATE,
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.CLIENTS_CREATE, new ClientCreatedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SAVINGS_APPROVE, new SavingsAccountApprovedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.CENTERS_CREATE, new CenterCreatedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.GROUPS_CREATE, new GroupCreatedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SAVINGS_DEPOSIT, new SavingsAccountDepositListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SHARE_PRODUCT_DIVIDENDS_CREATE,
new ShareProductDividendCreatedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.FIXED_DEPOSIT_ACCOUNT_CREATE,
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.FIXED_DEPOSIT_ACCOUNT_CREATE,
new FixedDepositAccountCreatedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.RECURRING_DEPOSIT_ACCOUNT_CREATE,
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.RECURRING_DEPOSIT_ACCOUNT_CREATE,
new RecurringDepositAccountCreatedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_POST_INTEREST, new SavingsPostInterestListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_CREATE, new LoanCreatedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_APPROVED, new LoanApprovedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_CLOSE, new LoanClosedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_CLOSE_AS_RESCHEDULE,
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SAVINGS_POST_INTEREST, new SavingsPostInterestListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_CREATE, new LoanCreatedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_APPROVED, new LoanApprovedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_CLOSE, new LoanClosedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_CLOSE_AS_RESCHEDULE,
new LoanCloseAsRescheduledListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_MAKE_REPAYMENT, new LoanMakeRepaymentListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_PRODUCT_CREATE, new LoanProductCreatedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_CREATE, new SavingsAccountCreatedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_CLOSE, new SavingsAccountClosedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SHARE_ACCOUNT_CREATE, new ShareAccountCreatedListener());
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SHARE_ACCOUNT_APPROVE, new ShareAccountApprovedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_MAKE_REPAYMENT, new LoanMakeRepaymentListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_PRODUCT_CREATE, new LoanProductCreatedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SAVINGS_CREATE, new SavingsAccountCreatedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SAVINGS_CLOSE, new SavingsAccountClosedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SHARE_ACCOUNT_CREATE, new ShareAccountCreatedListener());
businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.SHARE_ACCOUNT_APPROVE,
new ShareAccountApprovedListener());
}
private abstract static class NotificationBusinessEventAdapter implements BusinessEventListner {
private abstract static class NotificationBusinessEventAdapter implements BusinessEventListener {
@Override
public void businessEventToBeExecuted(Map<BusinessEventNotificationConstants.BusinessEntity, Object> businessEventEntity) {}
@@ -25,47 +25,55 @@ public class BusinessEventNotificationConstants {
public enum BusinessEvents {
LOAN_APPROVED("loan_approved"), LOAN_REJECTED("loan_reject"), LOAN_UNDO_APPROVAL("loan_undo_approval"), LOAN_UNDO_DISBURSAL(
"loan_undo_disbursal"), LOAN_UNDO_LASTDISBURSAL("loan_undo_lastdisbursal"), LOAN_UNDO_TRANSACTION(
"loan_undo_transaction"), LOAN_ADJUST_TRANSACTION("loan_adjust_transaction"), LOAN_MAKE_REPAYMENT(
"loan_repayment_transaction"), LOAN_WRITTEN_OFF("loan_writtenoff"), LOAN_UNDO_WRITTEN_OFF(
"loan_undo_writtenoff"), LOAN_DISBURSAL("loan_disbursal"), LOAN_WAIVE_INTEREST(
"loan_waive_interest"), LOAN_CLOSE("loan_close"), LOAN_CLOSE_AS_RESCHEDULE(
"loan_close_as_reschedule"), LOAN_ADD_CHARGE("loan_add_charge"), LOAN_UPDATE_CHARGE(
"loan_update_charge"), LOAN_WAIVE_CHARGE(
"loan_waive_charge"), LOAN_DELETE_CHARGE(
"loan_delete_charge"), LOAN_CHARGE_PAYMENT(
"loan_charge_payment"), LOAN_INITIATE_TRANSFER(
"loan_initiate_transfer"), LOAN_ACCEPT_TRANSFER(
"loan_accept_transfer"), LOAN_WITHDRAW_TRANSFER(
"loan_withdraw_transfer"), LOAN_REJECT_TRANSFER(
"loan_reject_transfer"), LOAN_REASSIGN_OFFICER(
"loan_reassign_officer"), LOAN_REMOVE_OFFICER(
"loan_remove_officer"), LOAN_APPLY_OVERDUE_CHARGE(
"loan_apply_overdue_charge"), LOAN_INTEREST_RECALCULATION(
"loan_interest_recalculation"), LOAN_REFUND(
"loan_refund"), LOAN_FORECLOSURE(
"loan_foreclosure"), LOAN_CREATE(
"loan_create"), LOAN_PRODUCT_CREATE(
"loan_product_create"), SAVINGS_ACTIVATE(
"savings_activated"), SAVINGS_REJECT(
"savings_reject"), SAVINGS_POST_INTEREST(
"savings_post_interest"), SAVINGS_DEPOSIT(
"savings_deposit"), SAVINGS_CLOSE(
"savings_close"), SAVINGS_WITHDRAWAL(
"savings_withdrawal"), SAVINGS_APPROVE(
"savings_approve"), SAVINGS_CREATE(
"savings_create"), CLIENTS_ACTIVATE(
"clients_activate"), SHARE_ACCOUNT_CREATE(
"share_account_create"), CLIENTS_REJECT(
"clients_reject"), CLIENTS_CREATE(
"clients_create"), CENTERS_CREATE(
"centers_create"), GROUPS_CREATE(
"groups_create"), SHARE_PRODUCT_DIVIDENDS_CREATE(
"share_product_dividends_create"), FIXED_DEPOSIT_ACCOUNT_CREATE(
"fixed_deposit_account_create"), SHARE_ACCOUNT_APPROVE(
"share_account_approve"), RECURRING_DEPOSIT_ACCOUNT_CREATE(
"recurring_deposit_account_create");
LOAN_APPROVED("loan_approved"), //
LOAN_REJECTED("loan_reject"), //
LOAN_UNDO_APPROVAL("loan_undo_approval"), //
LOAN_UNDO_DISBURSAL("loan_undo_disbursal"), //
LOAN_UNDO_LASTDISBURSAL("loan_undo_lastdisbursal"), //
LOAN_UNDO_TRANSACTION("loan_undo_transaction"), //
LOAN_ADJUST_TRANSACTION("loan_adjust_transaction"), //
LOAN_MAKE_REPAYMENT("loan_repayment_transaction"), //
LOAN_WRITTEN_OFF("loan_writtenoff"), //
LOAN_UNDO_WRITTEN_OFF("loan_undo_writtenoff"), //
LOAN_DISBURSAL("loan_disbursal"), //
LOAN_WAIVE_INTEREST("loan_waive_interest"), //
LOAN_CLOSE("loan_close"), //
LOAN_CLOSE_AS_RESCHEDULE("loan_close_as_reschedule"), //
LOAN_ADD_CHARGE("loan_add_charge"), //
LOAN_UPDATE_CHARGE("loan_update_charge"), //
LOAN_WAIVE_CHARGE("loan_waive_charge"), //
LOAN_DELETE_CHARGE("loan_delete_charge"), //
LOAN_CHARGE_PAYMENT("loan_charge_payment"), //
LOAN_INITIATE_TRANSFER("loan_initiate_transfer"), //
LOAN_ACCEPT_TRANSFER("loan_accept_transfer"), //
LOAN_WITHDRAW_TRANSFER("loan_withdraw_transfer"), //
LOAN_REJECT_TRANSFER("loan_reject_transfer"), //
LOAN_REASSIGN_OFFICER("loan_reassign_officer"), //
LOAN_REMOVE_OFFICER("loan_remove_officer"), //
LOAN_APPLY_OVERDUE_CHARGE("loan_apply_overdue_charge"), //
LOAN_INTEREST_RECALCULATION("loan_interest_recalculation"), //
LOAN_REFUND("loan_refund"), //
LOAN_FORECLOSURE("loan_foreclosure"), //
LOAN_CREATE("loan_create"), //
LOAN_PRODUCT_CREATE("loan_product_create"), //
SAVINGS_ACTIVATE("savings_activated"), //
SAVINGS_REJECT("savings_reject"), //
SAVINGS_POST_INTEREST("savings_post_interest"), //
SAVINGS_DEPOSIT("savings_deposit"), //
SAVINGS_CLOSE("savings_close"), //
SAVINGS_WITHDRAWAL("savings_withdrawal"), //
SAVINGS_APPROVE("savings_approve"), //
SAVINGS_CREATE("savings_create"), //
CLIENTS_ACTIVATE("clients_activate"), //
SHARE_ACCOUNT_CREATE("share_account_create"), //
CLIENTS_REJECT("clients_reject"), //
CLIENTS_CREATE("clients_create"), //
CENTERS_CREATE("centers_create"), //
GROUPS_CREATE("groups_create"), //
SHARE_PRODUCT_DIVIDENDS_CREATE("share_product_dividends_create"), //
FIXED_DEPOSIT_ACCOUNT_CREATE("fixed_deposit_account_create"), //
SHARE_ACCOUNT_APPROVE("share_account_approve"), //
RECURRING_DEPOSIT_ACCOUNT_CREATE("recurring_deposit_account_create");
private final String value;
@@ -91,10 +99,17 @@ public class BusinessEventNotificationConstants {
public enum BusinessEntity {
LOAN("loan"), LOAN_TRANSACTION("loan_transaction"), LOAN_CHARGE("loan_charge"), LOAN_ADJUSTED_TRANSACTION(
"loan_adjusted_transaction"), SAVING("saving"), CLIENT("client"), SAVINGS_TRANSACTION("Savings Transaction"), GROUP(
"group"), SHARE_ACCOUNT("share_account"), SHARE_PRODUCT(
"share_product"), DEPOSIT_ACCOUNT("deposit_account"), LOAN_PRODUCT("loan_product");
LOAN("loan"), //
LOAN_TRANSACTION("loan_transaction"), //
LOAN_CHARGE("loan_charge"), //
LOAN_ADJUSTED_TRANSACTION("loan_adjusted_transaction"), SAVING("saving"), //
CLIENT("client"), //
SAVINGS_TRANSACTION("Savings Transaction"), //
GROUP("group"), //
SHARE_ACCOUNT("share_account"), //
SHARE_PRODUCT("share_product"), //
DEPOSIT_ACCOUNT("deposit_account"), //
LOAN_PRODUCT("loan_product");
private final String value;
@@ -26,7 +26,7 @@ import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.B
* completion of loan approval event need to block guarantor funds
*
*/
public interface BusinessEventListner {
public interface BusinessEventListener {
/**
* Implement this method for notifications before executing Business Event
@@ -41,11 +41,11 @@ public interface BusinessEventNotifierService {
/**
* Method is to register a class as listener for pre-processing of any Business event
*/
void addBusinessEventPreListners(BusinessEvents businessEvent, BusinessEventListner businessEventListner);
void addBusinessEventPreListeners(BusinessEvents businessEvent, BusinessEventListener businessEventListener);
/**
* Method is to register a class as listener for post-processing of any Business event
*/
void addBusinessEventPostListners(BusinessEvents businessEvent, BusinessEventListner businessEventListner);
void addBusinessEventPostListeners(BusinessEvents businessEvent, BusinessEventListener businessEventListener);
}
@@ -29,8 +29,8 @@ import org.springframework.stereotype.Service;
@Service
public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierService {
private final Map<BusinessEvents, List<BusinessEventListner>> preListners = new HashMap<>(5);
private final Map<BusinessEvents, List<BusinessEventListner>> postListners = new HashMap<>(5);
private final Map<BusinessEvents, List<BusinessEventListener>> preListeners = new HashMap<>(5);
private final Map<BusinessEvents, List<BusinessEventListener>> postListeners = new HashMap<>(5);
/*
* (non-Javadoc)
@@ -41,10 +41,10 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe
*/
@Override
public void notifyBusinessEventToBeExecuted(BusinessEvents businessEvent, Map<BusinessEntity, Object> businessEventEntity) {
List<BusinessEventListner> businessEventListners = this.preListners.get(businessEvent);
if (businessEventListners != null) {
for (BusinessEventListner eventListner : businessEventListners) {
eventListner.businessEventToBeExecuted(businessEventEntity);
List<BusinessEventListener> businessEventListeners = this.preListeners.get(businessEvent);
if (businessEventListeners != null) {
for (BusinessEventListener eventListener : businessEventListeners) {
eventListener.businessEventToBeExecuted(businessEventEntity);
}
}
}
@@ -58,10 +58,10 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe
*/
@Override
public void notifyBusinessEventWasExecuted(BusinessEvents businessEvent, Map<BusinessEntity, Object> businessEventEntity) {
List<BusinessEventListner> businessEventListners = this.postListners.get(businessEvent);
if (businessEventListners != null) {
for (BusinessEventListner eventListner : businessEventListners) {
eventListner.businessEventWasExecuted(businessEventEntity);
List<BusinessEventListener> businessEventListeners = this.postListeners.get(businessEvent);
if (businessEventListeners != null) {
for (BusinessEventListener eventListener : businessEventListeners) {
eventListener.businessEventWasExecuted(businessEventEntity);
}
}
}
@@ -69,35 +69,35 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe
/*
* (non-Javadoc)
*
* @see org.apache.fineract.portfolio.common.service.BusinessEventNotifierService #addBusinessEventPreListners
* @see org.apache.fineract.portfolio.common.service.BusinessEventNotifierService #addBusinessEventPreListeners
* (org.apache.fineract.portfolio.common.BusinessEventNotificationConstants .BusinessEvents,
* org.apache.fineract.portfolio.common.service.BusinessEventListner)
* org.apache.fineract.portfolio.common.service.BusinessEventListener)
*/
@Override
public void addBusinessEventPreListners(BusinessEvents businessEvent, BusinessEventListner businessEventListner) {
addBusinessEventListners(businessEvent, businessEventListner, preListners);
public void addBusinessEventPreListeners(BusinessEvents businessEvent, BusinessEventListener businessEventListener) {
addBusinessEventListeners(businessEvent, businessEventListener, preListeners);
}
/*
* (non-Javadoc)
*
* @see org.apache.fineract.portfolio.common.service.BusinessEventNotifierService #addBusinessEventPostListners
* @see org.apache.fineract.portfolio.common.service.BusinessEventNotifierService #addBusinessEventPostListeners
* (org.apache.fineract.portfolio.common.BusinessEventNotificationConstants .BusinessEvents,
* org.apache.fineract.portfolio.common.service.BusinessEventListner)
* org.apache.fineract.portfolio.common.service.BusinessEventListener)
*/
@Override
public void addBusinessEventPostListners(BusinessEvents businessEvent, BusinessEventListner businessEventListner) {
addBusinessEventListners(businessEvent, businessEventListner, postListners);
public void addBusinessEventPostListeners(BusinessEvents businessEvent, BusinessEventListener businessEventListener) {
addBusinessEventListeners(businessEvent, businessEventListener, postListeners);
}
private void addBusinessEventListners(BusinessEvents businessEvent, BusinessEventListner businessEventListner,
final Map<BusinessEvents, List<BusinessEventListner>> businessEventListnerMap) {
List<BusinessEventListner> businessEventListners = businessEventListnerMap.get(businessEvent);
if (businessEventListners == null) {
businessEventListners = new ArrayList<>();
businessEventListnerMap.put(businessEvent, businessEventListners);
private void addBusinessEventListeners(BusinessEvents businessEvent, BusinessEventListener businessEventListener,
final Map<BusinessEvents, List<BusinessEventListener>> businessEventListenerMap) {
List<BusinessEventListener> businessEventListeners = businessEventListenerMap.get(businessEvent);
if (businessEventListeners == null) {
businessEventListeners = new ArrayList<>();
businessEventListenerMap.put(businessEvent, businessEventListeners);
}
businessEventListners.add(businessEventListner);
businessEventListeners.add(businessEventListener);
}
}
@@ -37,7 +37,7 @@ import org.apache.fineract.portfolio.account.domain.AccountTransferType;
import org.apache.fineract.portfolio.account.service.AccountTransfersWritePlatformService;
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
import org.apache.fineract.portfolio.common.service.BusinessEventListner;
import org.apache.fineract.portfolio.common.service.BusinessEventListener;
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
@@ -92,18 +92,18 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
}
@PostConstruct
public void addListners() {
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_APPROVED, new ValidateOnBusinessEvent());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_APPROVED, new HoldFundsOnBusinessEvent());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_UNDO_APPROVAL, new UndoAllFundTransactions());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_UNDO_DISBURSAL,
public void addListeners() {
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_APPROVED, new ValidateOnBusinessEvent());
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_APPROVED, new HoldFundsOnBusinessEvent());
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_UNDO_APPROVAL, new UndoAllFundTransactions());
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_UNDO_DISBURSAL,
new ReverseAllFundsOnBusinessEvent());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_ADJUST_TRANSACTION,
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_ADJUST_TRANSACTION,
new AdjustFundsOnBusinessEvent());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_MAKE_REPAYMENT,
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_MAKE_REPAYMENT,
new ReleaseFundsOnBusinessEvent());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_WRITTEN_OFF, new ReleaseAllFunds());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_UNDO_WRITTEN_OFF,
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_WRITTEN_OFF, new ReleaseAllFunds());
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_UNDO_WRITTEN_OFF,
new ReverseFundsOnBusinessEvent());
}
@@ -524,7 +524,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
}
}
private class ValidateOnBusinessEvent implements BusinessEventListner {
private class ValidateOnBusinessEvent implements BusinessEventListener {
@Override
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
@@ -539,7 +539,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
}
}
private class HoldFundsOnBusinessEvent implements BusinessEventListner {
private class HoldFundsOnBusinessEvent implements BusinessEventListener {
@Override
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
@@ -554,7 +554,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
}
}
private class ReleaseFundsOnBusinessEvent implements BusinessEventListner {
private class ReleaseFundsOnBusinessEvent implements BusinessEventListener {
@Override
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
@@ -573,7 +573,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
}
}
private class ReverseFundsOnBusinessEvent implements BusinessEventListner {
private class ReverseFundsOnBusinessEvent implements BusinessEventListener {
@Override
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
@@ -590,7 +590,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
}
}
private class AdjustFundsOnBusinessEvent implements BusinessEventListner {
private class AdjustFundsOnBusinessEvent implements BusinessEventListener {
@Override
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
@@ -612,7 +612,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
}
}
private class ReverseAllFundsOnBusinessEvent implements BusinessEventListner {
private class ReverseAllFundsOnBusinessEvent implements BusinessEventListener {
@Override
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
@@ -629,7 +629,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
}
}
private class UndoAllFundTransactions implements BusinessEventListner {
private class UndoAllFundTransactions implements BusinessEventListener {
@Override
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
@@ -644,7 +644,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
}
}
private class ReleaseAllFunds implements BusinessEventListner {
private class ReleaseAllFunds implements BusinessEventListener {
@Override
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
@@ -33,7 +33,7 @@ import org.apache.fineract.infrastructure.jobs.annotation.CronTarget;
import org.apache.fineract.infrastructure.jobs.service.JobName;
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
import org.apache.fineract.portfolio.common.service.BusinessEventListner;
import org.apache.fineract.portfolio.common.service.BusinessEventListener;
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
import org.apache.fineract.portfolio.loanaccount.domain.LoanCharge;
@@ -54,7 +54,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, BusinessEventListner {
public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, BusinessEventListener {
private static final Logger LOG = LoggerFactory.getLogger(LoanArrearsAgingServiceImpl.class);
private final BusinessEventNotifierService businessEventNotifierService;
@@ -70,17 +70,17 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
@PostConstruct
public void registerForNotification() {
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_REFUND, this);
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_ADJUST_TRANSACTION, this);
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_MAKE_REPAYMENT, this);
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_UNDO_WRITTEN_OFF, this);
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_WAIVE_INTEREST, this);
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_ADD_CHARGE, this);
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_WAIVE_CHARGE, this);
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_CHARGE_PAYMENT, this);
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_APPLY_OVERDUE_CHARGE, this);
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_DISBURSAL, new DisbursementEventListner());
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_FORECLOSURE, this);
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_REFUND, this);
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_ADJUST_TRANSACTION, this);
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_MAKE_REPAYMENT, this);
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_UNDO_WRITTEN_OFF, this);
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_WAIVE_INTEREST, this);
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_ADD_CHARGE, this);
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_WAIVE_CHARGE, this);
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_CHARGE_PAYMENT, this);
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_APPLY_OVERDUE_CHARGE, this);
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_DISBURSAL, new DisbursementEventListener());
this.businessEventNotifierService.addBusinessEventPostListeners(BusinessEvents.LOAN_FORECLOSURE, this);
}
@Transactional
@@ -503,7 +503,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
}
}
private class DisbursementEventListner implements BusinessEventListner {
private class DisbursementEventListener implements BusinessEventListener {
@SuppressWarnings("unused")
@Override