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