You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ar...@apache.org on 2022/09/02 08:03:17 UTC
[fineract] 01/03: FINERACT-1694: Storing events upon raising
This is an automated email from the ASF dual-hosted git repository.
arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
commit 699f61a9e18a2d940450eec1d3edfcc413d7a3d0
Author: Arnold Galovics <ga...@gmail.com>
AuthorDate: Wed Aug 31 22:01:24 2022 +0200
FINERACT-1694: Storing events upon raising
---
fineract-provider/dependencies.gradle | 5 +-
.../BulkImportWorkbookPopulatorServiceImpl.java | 11 ++--
.../core/config/FineractProperties.java | 16 +++++
.../infrastructure/core/config/JPAConfig.java | 2 +-
.../repository/ExternalEventRepository.java} | 8 +--
.../external/repository/domain/ExternalEvent.java | 77 ++++++++++++++++++++++
.../repository/domain/ExternalEventStatus.java} | 7 +-
.../service/DelayedExternalEventService.java | 38 +++++++++++
.../external/service/ExternalEventService.java | 57 ++++++++++++++++
...faultExternalEventIdempotencyKeyGenerator.java} | 14 ++--
.../ExternalEventIdempotencyKeyGenerator.java} | 8 ++-
.../BusinessEventSerializerComparator.java | 43 ++++++++++++
.../BusinessEventSerializerFactory.java | 44 +++++++++++++
.../mapper/client/ClientDataMapper.java} | 13 ++--
.../FixedDepositAccountDataMapper.java} | 13 ++--
.../generic/CommandProcessingResultMapper.java} | 11 ++--
.../mapper/loan/LoanAccountDataMapper.java} | 13 ++--
.../mapper/loan/LoanChargeDataMapper.java} | 13 ++--
.../mapper/loan/LoanProductDataMapper.java} | 13 ++--
.../mapper/loan/LoanTransactionDataMapper.java} | 13 ++--
.../RecurringDepositAccountDataMapper.java} | 13 ++--
.../mapper/savings/SavingsAccountDataMapper.java} | 13 ++--
.../mapper/share/ShareAccountDataMapper.java} | 13 ++--
.../mapper/share/ShareProductDataMapper.java} | 13 ++--
.../serializer/BusinessEventSerializer.java} | 13 ++--
.../client/ClientBusinessEventSerializer.java | 55 ++++++++++++++++
...FixedDepositAccountBusinessEventSerializer.java | 56 ++++++++++++++++
.../group/GroupsBusinessEventSerializer.java | 51 ++++++++++++++
...anAdjustTransactionBusinessEventSerializer.java | 65 ++++++++++++++++++
.../loan/LoanBusinessEventSerializer.java | 55 ++++++++++++++++
.../loan/LoanChargeBusinessEventSerializer.java | 55 ++++++++++++++++
.../loan/LoanProductBusinessEventSerializer.java | 55 ++++++++++++++++
.../LoanTransactionBusinessEventSerializer.java | 55 ++++++++++++++++
...rringDepositAccountBusinessEventSerializer.java | 57 ++++++++++++++++
.../SavingsAccountBusinessEventSerializer.java | 55 ++++++++++++++++
.../share/ShareAccountBusinessEventSerializer.java | 55 ++++++++++++++++
...ductDividentsCreateBusinessEventSerializer.java | 55 ++++++++++++++++
.../service/support/ByteBufferConverter.java | 15 +++++
.../{BusinessEvent.java => BulkBusinessEvent.java} | 13 +++-
.../businessevent/domain/BusinessEvent.java | 2 +
.../domain/client/ClientActivateBusinessEvent.java | 5 ++
.../domain/client/ClientCreateBusinessEvent.java | 5 ++
.../domain/client/ClientRejectBusinessEvent.java | 5 ++
.../FixedDepositAccountCreateBusinessEvent.java | 5 ++
...RecurringDepositAccountCreateBusinessEvent.java | 5 ++
.../domain/group/CentersCreateBusinessEvent.java | 5 ++
.../domain/group/GroupsCreateBusinessEvent.java | 5 ++
.../loan/LoanAcceptTransferBusinessEvent.java | 5 ++
.../loan/LoanAdjustTransactionBusinessEvent.java | 5 ++
.../loan/LoanApplyOverdueChargeBusinessEvent.java | 5 ++
.../domain/loan/LoanApprovedBusinessEvent.java | 5 ++
.../loan/LoanCloseAsRescheduleBusinessEvent.java | 5 ++
.../domain/loan/LoanCloseBusinessEvent.java | 5 ++
.../domain/loan/LoanCreatedBusinessEvent.java | 5 ++
.../domain/loan/LoanDisbursalBusinessEvent.java | 5 ++
.../loan/LoanInitiateTransferBusinessEvent.java | 5 ++
.../LoanInterestRecalculationBusinessEvent.java | 5 ++
.../loan/LoanReassignOfficerBusinessEvent.java | 5 ++
.../loan/LoanRejectTransferBusinessEvent.java | 5 ++
.../domain/loan/LoanRejectedBusinessEvent.java | 5 ++
.../loan/LoanRemoveOfficerBusinessEvent.java | 5 ++
.../domain/loan/LoanUndoApprovalBusinessEvent.java | 5 ++
.../loan/LoanUndoDisbursalBusinessEvent.java | 5 ++
.../loan/LoanUndoLastDisbursalBusinessEvent.java | 5 ++
.../loan/LoanWithdrawTransferBusinessEvent.java | 5 ++
.../loan/charge/LoanAddChargeBusinessEvent.java | 5 ++
.../loan/charge/LoanDeleteChargeBusinessEvent.java | 5 ++
.../loan/charge/LoanUpdateChargeBusinessEvent.java | 5 ++
.../loan/charge/LoanWaiveChargeBusinessEvent.java | 5 ++
.../charge/LoanWaiveChargeUndoBusinessEvent.java | 5 ++
.../product/LoanProductCreateBusinessEvent.java | 5 ++
.../LoanChargePaymentPostBusinessEvent.java | 5 ++
.../LoanChargePaymentPreBusinessEvent.java | 5 ++
.../transaction/LoanChargeRefundBusinessEvent.java | 5 ++
.../LoanCreditBalanceRefundPostBusinessEvent.java | 5 ++
.../LoanCreditBalanceRefundPreBusinessEvent.java | 5 ++
.../LoanForeClosurePostBusinessEvent.java | 5 ++
.../LoanForeClosurePreBusinessEvent.java | 5 ++
.../transaction/LoanRefundPostBusinessEvent.java | 5 ++
.../transaction/LoanRefundPreBusinessEvent.java | 5 ++
...TransactionGoodwillCreditPostBusinessEvent.java | 5 ++
...nTransactionGoodwillCreditPreBusinessEvent.java | 5 ++
...nTransactionMakeRepaymentPostBusinessEvent.java | 5 ++
...anTransactionMakeRepaymentPreBusinessEvent.java | 5 ++
...ctionMerchantIssuedRefundPostBusinessEvent.java | 5 ++
...actionMerchantIssuedRefundPreBusinessEvent.java | 5 ++
...anTransactionPayoutRefundPostBusinessEvent.java | 5 ++
...oanTransactionPayoutRefundPreBusinessEvent.java | 5 ++
...ransactionRecoveryPaymentPostBusinessEvent.java | 5 ++
...TransactionRecoveryPaymentPreBusinessEvent.java | 5 ++
.../LoanUndoWrittenOffBusinessEvent.java | 5 ++
.../LoanWaiveInterestBusinessEvent.java | 5 ++
.../LoanWrittenOffPostBusinessEvent.java | 5 ++
.../LoanWrittenOffPreBusinessEvent.java | 5 ++
.../savings/SavingsActivateBusinessEvent.java | 5 ++
.../savings/SavingsApproveBusinessEvent.java | 5 ++
.../domain/savings/SavingsCloseBusinessEvent.java | 5 ++
.../domain/savings/SavingsCreateBusinessEvent.java | 5 ++
.../savings/SavingsPostInterestBusinessEvent.java | 5 ++
.../domain/savings/SavingsRejectBusinessEvent.java | 5 ++
.../transaction/SavingsDepositBusinessEvent.java | 5 ++
.../SavingsWithdrawalBusinessEvent.java | 5 ++
.../share/ShareAccountApproveBusinessEvent.java | 5 ++
.../share/ShareAccountCreateBusinessEvent.java | 5 ++
.../ShareProductDividentsCreateBusinessEvent.java | 5 ++
.../service/BusinessEventNotifierServiceImpl.java | 30 ++++++++-
.../domain/LoanTermVariationsRepository.java} | 18 +++--
.../products/api/ProductsApiResource.java | 8 +--
...e.java => ShareProductReadPlatformService.java} | 2 +-
.../api/SelfShareAccountsApiResource.java | 13 ++--
.../ShareAccountReadPlatformServiceImpl.java | 6 +-
.../service/ShareProductDividendAssembler.java | 4 +-
.../ShareProductReadPlatformServiceImpl.java | 4 +-
.../src/main/resources/application.properties | 2 +
114 files changed, 1473 insertions(+), 122 deletions(-)
diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle
index a4f1cccc2..be2c1f962 100644
--- a/fineract-provider/dependencies.gradle
+++ b/fineract-provider/dependencies.gradle
@@ -26,6 +26,9 @@ dependencies {
// implementation dependencies are directly used (compiled against) in src/main (and src/test)
//
+ implementation(
+ project(path: ':fineract-avro-schemas')
+ )
implementation(
'org.springframework.boot:spring-boot-starter-web',
'org.springframework.boot:spring-boot-starter-security',
@@ -38,7 +41,7 @@ dependencies {
'org.springframework.integration:spring-integration-event',
'org.springframework.integration:spring-integration-jms',
-
+ 'org.apache.avro:avro',
'jakarta.ws.rs:jakarta.ws.rs-api',
'org.glassfish.jersey.media:jersey-media-multipart',
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookPopulatorServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookPopulatorServiceImpl.java
index 0c1e6d1a9..a636bbdb4 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookPopulatorServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookPopulatorServiceImpl.java
@@ -93,7 +93,7 @@ import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatform
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService;
import org.apache.fineract.portfolio.products.data.ProductData;
-import org.apache.fineract.portfolio.products.service.ProductReadPlatformService;
+import org.apache.fineract.portfolio.products.service.ShareProductReadPlatformService;
import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.data.DepositProductData;
import org.apache.fineract.portfolio.savings.data.FixedDepositProductData;
@@ -132,7 +132,7 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
private final CodeValueReadPlatformService codeValueReadPlatformService;
private final SavingsProductReadPlatformService savingsProductReadPlatformService;
- private final ProductReadPlatformService productReadPlatformService;
+ private final ShareProductReadPlatformService shareProductReadPlatformService;
private final ChargeReadPlatformService chargeReadPlatformService;
private final DepositProductReadPlatformService depositProductReadPlatformService;
private final RoleReadPlatformService roleReadPlatformService;
@@ -149,7 +149,8 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
final SavingsAccountReadPlatformService savingsAccountReadPlatformService,
final CodeValueReadPlatformService codeValueReadPlatformService,
final SavingsProductReadPlatformService savingsProductReadPlatformService,
- final ProductReadPlatformService productReadPlatformService, final ChargeReadPlatformService chargeReadPlatformService,
+ final ShareProductReadPlatformService shareProductReadPlatformService,
+ final ChargeReadPlatformService chargeReadPlatformService,
final DepositProductReadPlatformService depositProductReadPlatformService,
final RoleReadPlatformService roleReadPlatformService) {
this.officeReadPlatformService = officeReadPlatformService;
@@ -167,7 +168,7 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
this.savingsAccountReadPlatformService = savingsAccountReadPlatformService;
this.codeValueReadPlatformService = codeValueReadPlatformService;
this.savingsProductReadPlatformService = savingsProductReadPlatformService;
- this.productReadPlatformService = productReadPlatformService;
+ this.shareProductReadPlatformService = shareProductReadPlatformService;
this.chargeReadPlatformService = chargeReadPlatformService;
this.depositProductReadPlatformService = depositProductReadPlatformService;
this.roleReadPlatformService = roleReadPlatformService;
@@ -536,7 +537,7 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
}
private List<ShareProductData> fetchSharedProducts() {
- List<ProductData> productDataList = productReadPlatformService.retrieveAllProducts(0, 50).getPageItems();
+ List<ProductData> productDataList = shareProductReadPlatformService.retrieveAllProducts(0, 50).getPageItems();
List<ShareProductData> sharedProductDataList = new ArrayList<>();
if (productDataList != null) {
for (ProductData data : productDataList) {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/FineractProperties.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/FineractProperties.java
index 70568a799..d2aab3cf5 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/FineractProperties.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/FineractProperties.java
@@ -41,6 +41,8 @@ public class FineractProperties {
private FineractRemoteJobMessageHandlerProperties remoteJobMessageHandler;
+ private FineractEventsProperties events;
+
@Getter
@Setter
public static class FineractTenantProperties {
@@ -119,4 +121,18 @@ public class FineractProperties {
private String requestQueueName;
private String brokerUrl;
}
+
+ @Getter
+ @Setter
+ public static class FineractEventsProperties {
+
+ private FineractExternalEventsProperties external;
+ }
+
+ @Getter
+ @Setter
+ public static class FineractExternalEventsProperties {
+
+ private boolean enabled;
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JPAConfig.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JPAConfig.java
index 47938cb7f..2061fdb6e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JPAConfig.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JPAConfig.java
@@ -51,7 +51,7 @@ import org.springframework.transaction.support.TransactionTemplate;
@Configuration
@EnableJpaAuditing
-@EnableJpaRepositories(basePackages = "org.apache.fineract.**.domain")
+@EnableJpaRepositories(basePackages = { "org.apache.fineract.**.domain", "org.apache.fineract.**.repository" })
@EnableConfigurationProperties(JpaProperties.class)
@Import(JpaAuditingHandlerRegistrar.class)
public class JPAConfig extends JpaBaseConfiguration {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/repository/ExternalEventRepository.java
similarity index 72%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/repository/ExternalEventRepository.java
index da12bb295..0745503a1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/repository/ExternalEventRepository.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain;
+package org.apache.fineract.infrastructure.event.external.repository;
-public interface BusinessEvent<T> {
+import org.apache.fineract.infrastructure.event.external.repository.domain.ExternalEvent;
+import org.springframework.data.jpa.repository.JpaRepository;
- T get();
-}
+public interface ExternalEventRepository extends JpaRepository<ExternalEvent, Long> {}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/repository/domain/ExternalEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/repository/domain/ExternalEvent.java
new file mode 100644
index 000000000..cfe1a4edf
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/repository/domain/ExternalEvent.java
@@ -0,0 +1,77 @@
+/**
+ * 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.external.repository.domain;
+
+import java.time.LocalDate;
+import java.time.OffsetDateTime;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+import org.apache.fineract.infrastructure.core.service.DateUtils;
+
+@Entity
+@Table(name = "m_external_event")
+@Getter
+@NoArgsConstructor
+public class ExternalEvent extends AbstractPersistableCustom {
+
+ @Column(name = "type", nullable = false)
+ private String type;
+
+ @Basic(fetch = FetchType.LAZY)
+ @Lob
+ @Column(name = "data", nullable = false, columnDefinition = "BLOB NOT NULL")
+ private byte[] data;
+
+ @Column(name = "created_at", nullable = false)
+ private OffsetDateTime createdAt;
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "status", nullable = false)
+ @Setter
+ private ExternalEventStatus status;
+
+ @Column(name = "sent_at", nullable = false)
+ @Setter
+ private OffsetDateTime sentAt;
+
+ @Column(name = "idempotency_key", nullable = false)
+ private String idempotencyKey;
+
+ @Column(name = "business_date", nullable = false)
+ private LocalDate businessDate;
+
+ public ExternalEvent(String type, byte[] data, String idempotencyKey) {
+ this.type = type;
+ this.data = data;
+ this.idempotencyKey = idempotencyKey;
+ this.createdAt = DateUtils.getOffsetDateTimeOfTenant();
+ this.status = ExternalEventStatus.TO_BE_SENT;
+ this.businessDate = DateUtils.getBusinessLocalDate();
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/repository/domain/ExternalEventStatus.java
similarity index 85%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/repository/domain/ExternalEventStatus.java
index da12bb295..0a04399e5 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/repository/domain/ExternalEventStatus.java
@@ -16,9 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain;
+package org.apache.fineract.infrastructure.event.external.repository.domain;
-public interface BusinessEvent<T> {
-
- T get();
+public enum ExternalEventStatus {
+ TO_BE_SENT, SENT
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/DelayedExternalEventService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/DelayedExternalEventService.java
new file mode 100644
index 000000000..b01f7ca29
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/DelayedExternalEventService.java
@@ -0,0 +1,38 @@
+package org.apache.fineract.infrastructure.event.external.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.portfolio.businessevent.domain.BulkBusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.springframework.stereotype.Service;
+
+@Service
+@RequiredArgsConstructor
+public class DelayedExternalEventService {
+
+ private final ThreadLocal<List<BusinessEvent<?>>> localEventStorage = ThreadLocal.withInitial(ArrayList::new);
+
+ private final ExternalEventService delegate;
+
+ public <T> void enqueueEvent(BusinessEvent<T> event) {
+ if (event == null) {
+ throw new IllegalArgumentException("event cannot be null");
+ }
+
+ localEventStorage.get().add(event);
+ }
+
+ public boolean hasEnqueuedEvents() {
+ return !localEventStorage.get().isEmpty();
+ }
+
+ public void postEnqueuedEvents() {
+ List<BusinessEvent<?>> enqueuedEvents = localEventStorage.get();
+ if (enqueuedEvents.isEmpty()) {
+ throw new IllegalStateException("No events have been enqueued");
+ }
+
+ delegate.postEvent(new BulkBusinessEvent(enqueuedEvents));
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventService.java
new file mode 100644
index 000000000..a2bbb6835
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventService.java
@@ -0,0 +1,57 @@
+/**
+ * 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.external.service;
+
+import java.io.IOException;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.infrastructure.event.external.repository.ExternalEventRepository;
+import org.apache.fineract.infrastructure.event.external.repository.domain.ExternalEvent;
+import org.apache.fineract.infrastructure.event.external.service.idempotency.ExternalEventIdempotencyKeyGenerator;
+import org.apache.fineract.infrastructure.event.external.service.serialization.BusinessEventSerializerFactory;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@RequiredArgsConstructor
+@Transactional
+public class ExternalEventService {
+
+ private final ExternalEventRepository repository;
+ private final ExternalEventIdempotencyKeyGenerator idempotencyKeyGenerator;
+ private final BusinessEventSerializerFactory serializerFactory;
+
+ public <T> void postEvent(BusinessEvent<T> event) {
+ if (event == null) {
+ throw new IllegalArgumentException("event cannot be null");
+ }
+
+ String eventType = event.getType();
+ String idempotencyKey = idempotencyKeyGenerator.generate(event);
+ try {
+ byte[] data = serializerFactory.create(event).serialize(event);
+ ExternalEvent externalEvent = new ExternalEvent(eventType, data, idempotencyKey);
+
+ repository.save(externalEvent);
+ } catch (IOException e) {
+ throw new RuntimeException("Error while serializing event " + event.getClass().getSimpleName(), e);
+ }
+
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/idempotency/DefaultExternalEventIdempotencyKeyGenerator.java
similarity index 63%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/idempotency/DefaultExternalEventIdempotencyKeyGenerator.java
index 1099ebd80..875b6c273 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/idempotency/DefaultExternalEventIdempotencyKeyGenerator.java
@@ -16,13 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.deposit;
+package org.apache.fineract.infrastructure.event.external.service.idempotency;
-import org.apache.fineract.portfolio.savings.domain.FixedDepositAccount;
+import java.util.UUID;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.springframework.stereotype.Component;
-public class FixedDepositAccountCreateBusinessEvent extends FixedDepositAccountBusinessEvent {
+@Component
+public class DefaultExternalEventIdempotencyKeyGenerator implements ExternalEventIdempotencyKeyGenerator {
- public FixedDepositAccountCreateBusinessEvent(FixedDepositAccount value) {
- super(value);
+ @Override
+ public <T> String generate(BusinessEvent<T> event) {
+ return UUID.randomUUID().toString();
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/idempotency/ExternalEventIdempotencyKeyGenerator.java
similarity index 75%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/idempotency/ExternalEventIdempotencyKeyGenerator.java
index da12bb295..63646530e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/idempotency/ExternalEventIdempotencyKeyGenerator.java
@@ -16,9 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain;
+package org.apache.fineract.infrastructure.event.external.service.idempotency;
-public interface BusinessEvent<T> {
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
- T get();
+public interface ExternalEventIdempotencyKeyGenerator {
+
+ <T> String generate(BusinessEvent<T> event);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/BusinessEventSerializerComparator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/BusinessEventSerializerComparator.java
new file mode 100644
index 000000000..6cff1b1d5
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/BusinessEventSerializerComparator.java
@@ -0,0 +1,43 @@
+/**
+ * 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.external.service.serialization;
+
+import java.util.Comparator;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
+
+public class BusinessEventSerializerComparator implements Comparator<BusinessEventSerializer> {
+
+ @Override
+ public int compare(BusinessEventSerializer o1, BusinessEventSerializer o2) {
+ int o1Order = getOrderOrDefault(o1);
+ int o2Order = getOrderOrDefault(o2);
+ return Integer.compare(o1Order, o2Order);
+ }
+
+ private int getOrderOrDefault(BusinessEventSerializer serializer) {
+ Order orderAnnotation = serializer.getClass().getAnnotation(Order.class);
+ if (orderAnnotation != null) {
+ return orderAnnotation.value();
+ } else {
+ return Ordered.LOWEST_PRECEDENCE;
+ }
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/BusinessEventSerializerFactory.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/BusinessEventSerializerFactory.java
new file mode 100644
index 000000000..86421db0d
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/BusinessEventSerializerFactory.java
@@ -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.infrastructure.event.external.service.serialization;
+
+import java.util.List;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.springframework.stereotype.Component;
+
+@Component
+public class BusinessEventSerializerFactory {
+
+ private final List<BusinessEventSerializer> serializers;
+
+ public BusinessEventSerializerFactory(List<BusinessEventSerializer> serializers) {
+ this.serializers = serializers.stream().sorted(new BusinessEventSerializerComparator()).toList();
+ }
+
+ public <T> BusinessEventSerializer create(BusinessEvent<T> event) {
+ for (BusinessEventSerializer serializer : serializers) {
+ if (serializer.canSerialize(event)) {
+ return serializer;
+ }
+ }
+ throw new IllegalStateException("There's no serializer that's capable of serializing a " + event.getClass().getSimpleName());
+ }
+
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/client/ClientDataMapper.java
similarity index 69%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/client/ClientDataMapper.java
index 1099ebd80..d6a87cd05 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/client/ClientDataMapper.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.deposit;
+package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.client;
-import org.apache.fineract.portfolio.savings.domain.FixedDepositAccount;
+import org.apache.fineract.avro.client.v1.ClientDataV1;
+import org.apache.fineract.portfolio.client.data.ClientData;
+import org.mapstruct.Mapper;
-public class FixedDepositAccountCreateBusinessEvent extends FixedDepositAccountBusinessEvent {
+@Mapper(componentModel = "spring")
+public interface ClientDataMapper {
- public FixedDepositAccountCreateBusinessEvent(FixedDepositAccount value) {
- super(value);
- }
+ ClientDataV1 map(ClientData source);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/fixeddeposit/FixedDepositAccountDataMapper.java
similarity index 65%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/fixeddeposit/FixedDepositAccountDataMapper.java
index 1099ebd80..c3dabfe12 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/fixeddeposit/FixedDepositAccountDataMapper.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.deposit;
+package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.fixeddeposit;
-import org.apache.fineract.portfolio.savings.domain.FixedDepositAccount;
+import org.apache.fineract.avro.fixeddeposit.v1.FixedDepositAccountDataV1;
+import org.apache.fineract.portfolio.savings.data.FixedDepositAccountData;
+import org.mapstruct.Mapper;
-public class FixedDepositAccountCreateBusinessEvent extends FixedDepositAccountBusinessEvent {
+@Mapper(componentModel = "spring")
+public interface FixedDepositAccountDataMapper {
- public FixedDepositAccountCreateBusinessEvent(FixedDepositAccount value) {
- super(value);
- }
+ FixedDepositAccountDataV1 map(FixedDepositAccountData source);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/group/CentersCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/generic/CommandProcessingResultMapper.java
similarity index 71%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/group/CentersCreateBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/generic/CommandProcessingResultMapper.java
index ccfa2f105..e805709b0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/group/CentersCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/generic/CommandProcessingResultMapper.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.group;
+package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.generic;
+import org.apache.fineract.avro.generic.v1.CommandProcessingResultV1;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.mapstruct.Mapper;
-public class CentersCreateBusinessEvent extends GroupsBusinessEvent {
+@Mapper(componentModel = "spring")
+public interface CommandProcessingResultMapper {
- public CentersCreateBusinessEvent(CommandProcessingResult value) {
- super(value);
- }
+ CommandProcessingResultV1 map(CommandProcessingResult source);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanAccountDataMapper.java
similarity index 68%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanAccountDataMapper.java
index 1099ebd80..c3caeaf25 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanAccountDataMapper.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.deposit;
+package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan;
-import org.apache.fineract.portfolio.savings.domain.FixedDepositAccount;
+import org.apache.fineract.avro.loan.v1.LoanAccountDataV1;
+import org.apache.fineract.portfolio.loanaccount.data.LoanAccountData;
+import org.mapstruct.Mapper;
-public class FixedDepositAccountCreateBusinessEvent extends FixedDepositAccountBusinessEvent {
+@Mapper(componentModel = "spring")
+public interface LoanAccountDataMapper {
- public FixedDepositAccountCreateBusinessEvent(FixedDepositAccount value) {
- super(value);
- }
+ LoanAccountDataV1 map(LoanAccountData source);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanChargeDataMapper.java
similarity index 68%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanChargeDataMapper.java
index 1099ebd80..4aa3ebcb4 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanChargeDataMapper.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.deposit;
+package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan;
-import org.apache.fineract.portfolio.savings.domain.FixedDepositAccount;
+import org.apache.fineract.avro.loan.v1.LoanChargeDataV1;
+import org.apache.fineract.portfolio.loanaccount.data.LoanChargeData;
+import org.mapstruct.Mapper;
-public class FixedDepositAccountCreateBusinessEvent extends FixedDepositAccountBusinessEvent {
+@Mapper(componentModel = "spring")
+public interface LoanChargeDataMapper {
- public FixedDepositAccountCreateBusinessEvent(FixedDepositAccount value) {
- super(value);
- }
+ LoanChargeDataV1 map(LoanChargeData source);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanProductDataMapper.java
similarity index 68%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanProductDataMapper.java
index 1099ebd80..0e37b1ed9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanProductDataMapper.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.deposit;
+package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan;
-import org.apache.fineract.portfolio.savings.domain.FixedDepositAccount;
+import org.apache.fineract.avro.loan.v1.LoanProductDataV1;
+import org.apache.fineract.portfolio.loanproduct.data.LoanProductData;
+import org.mapstruct.Mapper;
-public class FixedDepositAccountCreateBusinessEvent extends FixedDepositAccountBusinessEvent {
+@Mapper(componentModel = "spring")
+public interface LoanProductDataMapper {
- public FixedDepositAccountCreateBusinessEvent(FixedDepositAccount value) {
- super(value);
- }
+ LoanProductDataV1 map(LoanProductData source);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanTransactionDataMapper.java
similarity index 66%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanTransactionDataMapper.java
index 1099ebd80..1d6dc9065 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/loan/LoanTransactionDataMapper.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.deposit;
+package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan;
-import org.apache.fineract.portfolio.savings.domain.FixedDepositAccount;
+import org.apache.fineract.avro.loan.v1.LoanTransactionDataV1;
+import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionData;
+import org.mapstruct.Mapper;
-public class FixedDepositAccountCreateBusinessEvent extends FixedDepositAccountBusinessEvent {
+@Mapper(componentModel = "spring")
+public interface LoanTransactionDataMapper {
- public FixedDepositAccountCreateBusinessEvent(FixedDepositAccount value) {
- super(value);
- }
+ LoanTransactionDataV1 map(LoanTransactionData source);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/recurringdeposit/RecurringDepositAccountDataMapper.java
similarity index 63%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/recurringdeposit/RecurringDepositAccountDataMapper.java
index 1099ebd80..c8943c250 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/recurringdeposit/RecurringDepositAccountDataMapper.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.deposit;
+package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.recurringdeposit;
-import org.apache.fineract.portfolio.savings.domain.FixedDepositAccount;
+import org.apache.fineract.avro.recurringdeposit.v1.RecurringDepositAccountDataV1;
+import org.apache.fineract.portfolio.savings.data.RecurringDepositAccountData;
+import org.mapstruct.Mapper;
-public class FixedDepositAccountCreateBusinessEvent extends FixedDepositAccountBusinessEvent {
+@Mapper(componentModel = "spring")
+public interface RecurringDepositAccountDataMapper {
- public FixedDepositAccountCreateBusinessEvent(FixedDepositAccount value) {
- super(value);
- }
+ RecurringDepositAccountDataV1 map(RecurringDepositAccountData source);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/savings/SavingsAccountDataMapper.java
similarity index 67%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/savings/SavingsAccountDataMapper.java
index 8abb87df7..05a9402fc 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/savings/SavingsAccountDataMapper.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.loan;
+package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.savings;
-import org.apache.fineract.portfolio.loanaccount.domain.Loan;
+import org.apache.fineract.avro.savings.v1.SavingsAccountDataV1;
+import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
+import org.mapstruct.Mapper;
-public class LoanAcceptTransferBusinessEvent extends LoanBusinessEvent {
+@Mapper(componentModel = "spring")
+public interface SavingsAccountDataMapper {
- public LoanAcceptTransferBusinessEvent(Loan value) {
- super(value);
- }
+ SavingsAccountDataV1 map(SavingsAccountData source);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/share/ShareAccountDataMapper.java
similarity index 67%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/share/ShareAccountDataMapper.java
index 1099ebd80..a808e5a79 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/share/ShareAccountDataMapper.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.deposit;
+package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.share;
-import org.apache.fineract.portfolio.savings.domain.FixedDepositAccount;
+import org.apache.fineract.avro.share.v1.ShareAccountDataV1;
+import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountData;
+import org.mapstruct.Mapper;
-public class FixedDepositAccountCreateBusinessEvent extends FixedDepositAccountBusinessEvent {
+@Mapper(componentModel = "spring")
+public interface ShareAccountDataMapper {
- public FixedDepositAccountCreateBusinessEvent(FixedDepositAccount value) {
- super(value);
- }
+ ShareAccountDataV1 map(ShareAccountData source);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/share/ShareProductDataMapper.java
similarity index 67%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/share/ShareProductDataMapper.java
index 1099ebd80..3e96e423d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/mapper/share/ShareProductDataMapper.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.deposit;
+package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.share;
-import org.apache.fineract.portfolio.savings.domain.FixedDepositAccount;
+import org.apache.fineract.avro.share.v1.ShareProductDataV1;
+import org.apache.fineract.portfolio.shareproducts.data.ShareProductData;
+import org.mapstruct.Mapper;
-public class FixedDepositAccountCreateBusinessEvent extends FixedDepositAccountBusinessEvent {
+@Mapper(componentModel = "spring")
+public interface ShareProductDataMapper {
- public FixedDepositAccountCreateBusinessEvent(FixedDepositAccount value) {
- super(value);
- }
+ ShareProductDataV1 map(ShareProductData source);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/BusinessEventSerializer.java
similarity index 69%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/BusinessEventSerializer.java
index 8abb87df7..fa50fa0bf 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/BusinessEventSerializer.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.loan;
+package org.apache.fineract.infrastructure.event.external.service.serialization.serializer;
-import org.apache.fineract.portfolio.loanaccount.domain.Loan;
+import java.io.IOException;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
-public class LoanAcceptTransferBusinessEvent extends LoanBusinessEvent {
+public interface BusinessEventSerializer {
- public LoanAcceptTransferBusinessEvent(Loan value) {
- super(value);
- }
+ <T> boolean canSerialize(BusinessEvent<T> event);
+
+ <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException;
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/client/ClientBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/client/ClientBusinessEventSerializer.java
new file mode 100644
index 000000000..3446818ba
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/client/ClientBusinessEventSerializer.java
@@ -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.external.service.serialization.serializer.client;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.client.v1.ClientDataV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.client.ClientDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.client.ClientBusinessEvent;
+import org.apache.fineract.portfolio.client.data.ClientData;
+import org.apache.fineract.portfolio.client.service.ClientReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class ClientBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final ClientReadPlatformService service;
+ private final ClientDataMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof ClientBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ ClientBusinessEvent event = (ClientBusinessEvent) rawEvent;
+ ClientData data = service.retrieveOne(event.get().getId());
+ ClientDataV1 avroDto = mapper.map(data);
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/fixeddeposit/FixedDepositAccountBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/fixeddeposit/FixedDepositAccountBusinessEventSerializer.java
new file mode 100644
index 000000000..ca07e7009
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/fixeddeposit/FixedDepositAccountBusinessEventSerializer.java
@@ -0,0 +1,56 @@
+/**
+ * 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.external.service.serialization.serializer.fixeddeposit;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.fixeddeposit.v1.FixedDepositAccountDataV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.fixeddeposit.FixedDepositAccountDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.deposit.FixedDepositAccountBusinessEvent;
+import org.apache.fineract.portfolio.savings.DepositAccountType;
+import org.apache.fineract.portfolio.savings.data.FixedDepositAccountData;
+import org.apache.fineract.portfolio.savings.service.DepositAccountReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class FixedDepositAccountBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final DepositAccountReadPlatformService service;
+ private final FixedDepositAccountDataMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof FixedDepositAccountBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ FixedDepositAccountBusinessEvent event = (FixedDepositAccountBusinessEvent) rawEvent;
+ FixedDepositAccountData data = (FixedDepositAccountData) service.retrieveOne(DepositAccountType.FIXED_DEPOSIT, event.get().getId());
+ FixedDepositAccountDataV1 avroDto = mapper.map(data);
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/group/GroupsBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/group/GroupsBusinessEventSerializer.java
new file mode 100644
index 000000000..485fff5c5
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/group/GroupsBusinessEventSerializer.java
@@ -0,0 +1,51 @@
+/**
+ * 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.external.service.serialization.serializer.group;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.generic.v1.CommandProcessingResultV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.generic.CommandProcessingResultMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.group.GroupsBusinessEvent;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class GroupsBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final CommandProcessingResultMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof GroupsBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ GroupsBusinessEvent event = (GroupsBusinessEvent) rawEvent;
+ CommandProcessingResultV1 avroDto = mapper.map(event.get());
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanAdjustTransactionBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanAdjustTransactionBusinessEventSerializer.java
new file mode 100644
index 000000000..62d163d7a
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanAdjustTransactionBusinessEventSerializer.java
@@ -0,0 +1,65 @@
+/**
+ * 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.external.service.serialization.serializer.loan;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.loan.v1.LoanTransactionAdjustmentDataV1;
+import org.apache.fineract.avro.loan.v1.LoanTransactionDataV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan.LoanTransactionDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.loan.LoanAdjustTransactionBusinessEvent;
+import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionData;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
+import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class LoanAdjustTransactionBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final LoanReadPlatformService service;
+ private final LoanTransactionDataMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof LoanAdjustTransactionBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ LoanAdjustTransactionBusinessEvent event = (LoanAdjustTransactionBusinessEvent) rawEvent;
+ LoanTransaction transactionToAdjust = event.get().getTransactionToAdjust();
+ LoanTransaction newTransactionDetail = event.get().getNewTransactionDetail();
+ LoanTransactionData transactionToAdjustData = service.retrieveLoanTransaction(transactionToAdjust.getLoan().getId(),
+ transactionToAdjust.getId());
+ LoanTransactionData newTransactionDetailData = service.retrieveLoanTransaction(newTransactionDetail.getLoan().getId(),
+ newTransactionDetail.getId());
+ LoanTransactionDataV1 transactionToAdjustAvroDto = mapper.map(transactionToAdjustData);
+ LoanTransactionDataV1 newTransactionDetailAvroDto = mapper.map(newTransactionDetailData);
+ LoanTransactionAdjustmentDataV1 avroDto = new LoanTransactionAdjustmentDataV1(transactionToAdjustAvroDto,
+ newTransactionDetailAvroDto);
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanBusinessEventSerializer.java
new file mode 100644
index 000000000..383be874d
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanBusinessEventSerializer.java
@@ -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.external.service.serialization.serializer.loan;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.loan.v1.LoanAccountDataV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan.LoanAccountDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent;
+import org.apache.fineract.portfolio.loanaccount.data.LoanAccountData;
+import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class LoanBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final LoanReadPlatformService service;
+ private final LoanAccountDataMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof LoanBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ LoanBusinessEvent event = (LoanBusinessEvent) rawEvent;
+ LoanAccountData data = service.retrieveOne(event.get().getId());
+ LoanAccountDataV1 avroDto = mapper.map(data);
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanChargeBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanChargeBusinessEventSerializer.java
new file mode 100644
index 000000000..4b1d6d116
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanChargeBusinessEventSerializer.java
@@ -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.external.service.serialization.serializer.loan;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.loan.v1.LoanChargeDataV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan.LoanChargeDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.loan.charge.LoanChargeBusinessEvent;
+import org.apache.fineract.portfolio.loanaccount.data.LoanChargeData;
+import org.apache.fineract.portfolio.loanaccount.service.LoanChargeReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class LoanChargeBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final LoanChargeReadPlatformService service;
+ private final LoanChargeDataMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof LoanChargeBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ LoanChargeBusinessEvent event = (LoanChargeBusinessEvent) rawEvent;
+ LoanChargeData data = service.retrieveLoanChargeDetails(event.get().getId(), event.get().getLoan().getId());
+ LoanChargeDataV1 avroDto = mapper.map(data);
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanProductBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanProductBusinessEventSerializer.java
new file mode 100644
index 000000000..ff5e70284
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanProductBusinessEventSerializer.java
@@ -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.external.service.serialization.serializer.loan;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.loan.v1.LoanProductDataV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan.LoanProductDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.loan.product.LoanProductBusinessEvent;
+import org.apache.fineract.portfolio.loanproduct.data.LoanProductData;
+import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class LoanProductBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final LoanProductReadPlatformService service;
+ private final LoanProductDataMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof LoanProductBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ LoanProductBusinessEvent event = (LoanProductBusinessEvent) rawEvent;
+ LoanProductData data = service.retrieveLoanProduct(event.get().getId());
+ LoanProductDataV1 avroDto = mapper.map(data);
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanTransactionBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanTransactionBusinessEventSerializer.java
new file mode 100644
index 000000000..c41d591e5
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanTransactionBusinessEventSerializer.java
@@ -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.external.service.serialization.serializer.loan;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.loan.v1.LoanTransactionDataV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan.LoanTransactionDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionBusinessEvent;
+import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionData;
+import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class LoanTransactionBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final LoanReadPlatformService service;
+ private final LoanTransactionDataMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof LoanTransactionBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ LoanTransactionBusinessEvent event = (LoanTransactionBusinessEvent) rawEvent;
+ LoanTransactionData data = service.retrieveLoanTransaction(event.get().getLoan().getId(), event.get().getId());
+ LoanTransactionDataV1 avroDto = mapper.map(data);
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/recurringdeposit/RecurringDepositAccountBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/recurringdeposit/RecurringDepositAccountBusinessEventSerializer.java
new file mode 100644
index 000000000..0517c9ed7
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/recurringdeposit/RecurringDepositAccountBusinessEventSerializer.java
@@ -0,0 +1,57 @@
+/**
+ * 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.external.service.serialization.serializer.recurringdeposit;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.recurringdeposit.v1.RecurringDepositAccountDataV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.recurringdeposit.RecurringDepositAccountDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.deposit.RecurringDepositAccountBusinessEvent;
+import org.apache.fineract.portfolio.savings.DepositAccountType;
+import org.apache.fineract.portfolio.savings.data.RecurringDepositAccountData;
+import org.apache.fineract.portfolio.savings.service.DepositAccountReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class RecurringDepositAccountBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final DepositAccountReadPlatformService service;
+ private final RecurringDepositAccountDataMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof RecurringDepositAccountBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ RecurringDepositAccountBusinessEvent event = (RecurringDepositAccountBusinessEvent) rawEvent;
+ RecurringDepositAccountData data = (RecurringDepositAccountData) service.retrieveOne(DepositAccountType.RECURRING_DEPOSIT,
+ event.get().getId());
+ RecurringDepositAccountDataV1 avroDto = mapper.map(data);
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/savings/SavingsAccountBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/savings/SavingsAccountBusinessEventSerializer.java
new file mode 100644
index 000000000..c211a9c29
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/savings/SavingsAccountBusinessEventSerializer.java
@@ -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.external.service.serialization.serializer.savings;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.savings.v1.SavingsAccountDataV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.savings.SavingsAccountDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.savings.SavingsAccountBusinessEvent;
+import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
+import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class SavingsAccountBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final SavingsAccountReadPlatformService service;
+ private final SavingsAccountDataMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof SavingsAccountBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ SavingsAccountBusinessEvent event = (SavingsAccountBusinessEvent) rawEvent;
+ SavingsAccountData data = service.retrieveOne(event.get().getId());
+ SavingsAccountDataV1 avroDto = mapper.map(data);
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/share/ShareAccountBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/share/ShareAccountBusinessEventSerializer.java
new file mode 100644
index 000000000..f69ed9f59
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/share/ShareAccountBusinessEventSerializer.java
@@ -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.external.service.serialization.serializer.share;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.share.v1.ShareAccountDataV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.share.ShareAccountDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.share.ShareAccountBusinessEvent;
+import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountData;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountReadPlatformService;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class ShareAccountBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final ShareAccountReadPlatformService service;
+ private final ShareAccountDataMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof ShareAccountBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ ShareAccountBusinessEvent event = (ShareAccountBusinessEvent) rawEvent;
+ ShareAccountData data = service.retrieveOne(event.get().getId(), false);
+ ShareAccountDataV1 avroDto = mapper.map(data);
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/share/ShareProductDividentsCreateBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/share/ShareProductDividentsCreateBusinessEventSerializer.java
new file mode 100644
index 000000000..50b5abf2e
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/share/ShareProductDividentsCreateBusinessEventSerializer.java
@@ -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.external.service.serialization.serializer.share;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.avro.share.v1.ShareProductDataV1;
+import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.share.ShareProductDataMapper;
+import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.BusinessEventSerializer;
+import org.apache.fineract.infrastructure.event.external.service.support.ByteBufferConverter;
+import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.apache.fineract.portfolio.businessevent.domain.share.ShareProductDividentsCreateBusinessEvent;
+import org.apache.fineract.portfolio.products.service.ShareProductReadPlatformService;
+import org.apache.fineract.portfolio.shareproducts.data.ShareProductData;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class ShareProductDividentsCreateBusinessEventSerializer implements BusinessEventSerializer {
+
+ private final ShareProductReadPlatformService service;
+ private final ShareProductDataMapper mapper;
+ private final ByteBufferConverter byteBufferConverter;
+
+ @Override
+ public <T> boolean canSerialize(BusinessEvent<T> event) {
+ return event instanceof ShareProductDividentsCreateBusinessEvent;
+ }
+
+ @Override
+ public <T> byte[] serialize(BusinessEvent<T> rawEvent) throws IOException {
+ ShareProductDividentsCreateBusinessEvent event = (ShareProductDividentsCreateBusinessEvent) rawEvent;
+ ShareProductData data = (ShareProductData) service.retrieveOne(event.get(), false);
+ ShareProductDataV1 avroDto = mapper.map(data);
+ ByteBuffer buffer = avroDto.toByteBuffer();
+ return byteBufferConverter.convert(buffer);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/support/ByteBufferConverter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/support/ByteBufferConverter.java
new file mode 100644
index 000000000..5ef4daf51
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/support/ByteBufferConverter.java
@@ -0,0 +1,15 @@
+package org.apache.fineract.infrastructure.event.external.service.support;
+
+import java.nio.ByteBuffer;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ByteBufferConverter {
+
+ public byte[] convert(ByteBuffer buffer) {
+ byte[] bytes = new byte[buffer.remaining()];
+ buffer.get(bytes);
+ buffer.position(buffer.position() - bytes.length);
+ return bytes;
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BulkBusinessEvent.java
similarity index 75%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BulkBusinessEvent.java
index da12bb295..11862dce6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BulkBusinessEvent.java
@@ -18,7 +18,16 @@
*/
package org.apache.fineract.portfolio.businessevent.domain;
-public interface BusinessEvent<T> {
+import java.util.List;
- T get();
+public class BulkBusinessEvent extends AbstractBusinessEvent<List<BusinessEvent<?>>> {
+
+ public BulkBusinessEvent(List<BusinessEvent<?>> value) {
+ super(value);
+ }
+
+ @Override
+ public String getType() {
+ return "BulkBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java
index da12bb295..3f6b2403a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/BusinessEvent.java
@@ -21,4 +21,6 @@ package org.apache.fineract.portfolio.businessevent.domain;
public interface BusinessEvent<T> {
T get();
+
+ String getType();
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientActivateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientActivateBusinessEvent.java
index d7efcd423..f42ce00a9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientActivateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientActivateBusinessEvent.java
@@ -25,4 +25,9 @@ public class ClientActivateBusinessEvent extends ClientBusinessEvent {
public ClientActivateBusinessEvent(Client value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "ClientActivateBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientCreateBusinessEvent.java
index 16370acf7..8c7be9754 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientCreateBusinessEvent.java
@@ -25,4 +25,9 @@ public class ClientCreateBusinessEvent extends ClientBusinessEvent {
public ClientCreateBusinessEvent(Client value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "ClientCreateBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientRejectBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientRejectBusinessEvent.java
index 8a4d190ec..8a7ef74cf 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientRejectBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/client/ClientRejectBusinessEvent.java
@@ -25,4 +25,9 @@ public class ClientRejectBusinessEvent extends ClientBusinessEvent {
public ClientRejectBusinessEvent(Client value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "ClientRejectBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
index 1099ebd80..c61c53aa8 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/FixedDepositAccountCreateBusinessEvent.java
@@ -25,4 +25,9 @@ public class FixedDepositAccountCreateBusinessEvent extends FixedDepositAccountB
public FixedDepositAccountCreateBusinessEvent(FixedDepositAccount value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "FixedDepositAccountCreateBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/RecurringDepositAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/RecurringDepositAccountCreateBusinessEvent.java
index ca7096991..498de1c2c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/RecurringDepositAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/deposit/RecurringDepositAccountCreateBusinessEvent.java
@@ -25,4 +25,9 @@ public class RecurringDepositAccountCreateBusinessEvent extends RecurringDeposit
public RecurringDepositAccountCreateBusinessEvent(RecurringDepositAccount value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "RecurringDepositAccountCreateBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/group/CentersCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/group/CentersCreateBusinessEvent.java
index ccfa2f105..d027a2a07 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/group/CentersCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/group/CentersCreateBusinessEvent.java
@@ -25,4 +25,9 @@ public class CentersCreateBusinessEvent extends GroupsBusinessEvent {
public CentersCreateBusinessEvent(CommandProcessingResult value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "CentersCreateBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/group/GroupsCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/group/GroupsCreateBusinessEvent.java
index ee53b704a..5597f9394 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/group/GroupsCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/group/GroupsCreateBusinessEvent.java
@@ -25,4 +25,9 @@ public class GroupsCreateBusinessEvent extends GroupsBusinessEvent {
public GroupsCreateBusinessEvent(CommandProcessingResult value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "GroupsCreateBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java
index 8abb87df7..418b26aab 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanAcceptTransferBusinessEvent extends LoanBusinessEvent {
public LoanAcceptTransferBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanAcceptTransferBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAdjustTransactionBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAdjustTransactionBusinessEvent.java
index ed6ebe588..485232734 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAdjustTransactionBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAdjustTransactionBusinessEvent.java
@@ -30,6 +30,11 @@ public class LoanAdjustTransactionBusinessEvent extends AbstractBusinessEvent<Lo
super(value);
}
+ @Override
+ public String getType() {
+ return "LoanAdjustTransactionBusinessEvent";
+ }
+
@RequiredArgsConstructor
@Getter
public static class Data {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanApplyOverdueChargeBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanApplyOverdueChargeBusinessEvent.java
index a8b55301e..f28867f01 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanApplyOverdueChargeBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanApplyOverdueChargeBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanApplyOverdueChargeBusinessEvent extends LoanBusinessEvent {
public LoanApplyOverdueChargeBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanApplyOverdueChargeBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanApprovedBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanApprovedBusinessEvent.java
index ab2a82116..525027fa7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanApprovedBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanApprovedBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanApprovedBusinessEvent extends LoanBusinessEvent {
public LoanApprovedBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanApprovedBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCloseAsRescheduleBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCloseAsRescheduleBusinessEvent.java
index b3f77b49a..6d7610e22 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCloseAsRescheduleBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCloseAsRescheduleBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanCloseAsRescheduleBusinessEvent extends LoanBusinessEvent {
public LoanCloseAsRescheduleBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanCloseAsRescheduleBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCloseBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCloseBusinessEvent.java
index 05c301ab5..beae15f1f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCloseBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCloseBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanCloseBusinessEvent extends LoanBusinessEvent {
public LoanCloseBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanCloseBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCreatedBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCreatedBusinessEvent.java
index 1673ce007..721972422 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCreatedBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanCreatedBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanCreatedBusinessEvent extends LoanBusinessEvent {
public LoanCreatedBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanCreatedBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanDisbursalBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanDisbursalBusinessEvent.java
index 957be1625..6a82a01c5 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanDisbursalBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanDisbursalBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanDisbursalBusinessEvent extends LoanBusinessEvent {
public LoanDisbursalBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanDisbursalBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanInitiateTransferBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanInitiateTransferBusinessEvent.java
index 27b50b77e..ab1b39ec2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanInitiateTransferBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanInitiateTransferBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanInitiateTransferBusinessEvent extends LoanBusinessEvent {
public LoanInitiateTransferBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanInitiateTransferBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanInterestRecalculationBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanInterestRecalculationBusinessEvent.java
index b77014f6a..ed9954dbc 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanInterestRecalculationBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanInterestRecalculationBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanInterestRecalculationBusinessEvent extends LoanBusinessEvent {
public LoanInterestRecalculationBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanInterestRecalculationBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanReassignOfficerBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanReassignOfficerBusinessEvent.java
index 814d5658e..9511c3f7c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanReassignOfficerBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanReassignOfficerBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanReassignOfficerBusinessEvent extends LoanBusinessEvent {
public LoanReassignOfficerBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanReassignOfficerBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRejectTransferBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRejectTransferBusinessEvent.java
index 99497cf8c..f6cc1a9ca 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRejectTransferBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRejectTransferBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanRejectTransferBusinessEvent extends LoanBusinessEvent {
public LoanRejectTransferBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanRejectTransferBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRejectedBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRejectedBusinessEvent.java
index e58e9c13d..9e9863436 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRejectedBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRejectedBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanRejectedBusinessEvent extends LoanBusinessEvent {
public LoanRejectedBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanRejectedBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRemoveOfficerBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRemoveOfficerBusinessEvent.java
index 7e11f7524..e121b9db3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRemoveOfficerBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanRemoveOfficerBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanRemoveOfficerBusinessEvent extends LoanBusinessEvent {
public LoanRemoveOfficerBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanRemoveOfficerBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoApprovalBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoApprovalBusinessEvent.java
index 2a474301d..2529ab5ef 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoApprovalBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoApprovalBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanUndoApprovalBusinessEvent extends LoanBusinessEvent {
public LoanUndoApprovalBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanUndoApprovalBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoDisbursalBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoDisbursalBusinessEvent.java
index 4453dfa5d..4dfee5ffb 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoDisbursalBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoDisbursalBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanUndoDisbursalBusinessEvent extends LoanBusinessEvent {
public LoanUndoDisbursalBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanUndoDisbursalBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoLastDisbursalBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoLastDisbursalBusinessEvent.java
index 77cf23081..c7f573d80 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoLastDisbursalBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanUndoLastDisbursalBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanUndoLastDisbursalBusinessEvent extends LoanBusinessEvent {
public LoanUndoLastDisbursalBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanUndoLastDisbursalBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanWithdrawTransferBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanWithdrawTransferBusinessEvent.java
index a5f70c5f4..0ed2b11d1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanWithdrawTransferBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanWithdrawTransferBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanWithdrawTransferBusinessEvent extends LoanBusinessEvent {
public LoanWithdrawTransferBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanWithdrawTransferBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanAddChargeBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanAddChargeBusinessEvent.java
index 78a4ef7df..08dca068f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanAddChargeBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanAddChargeBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanAddChargeBusinessEvent extends LoanChargeBusinessEvent {
public LoanAddChargeBusinessEvent(LoanCharge value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanAddChargeBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanDeleteChargeBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanDeleteChargeBusinessEvent.java
index e205409c6..098df9d6f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanDeleteChargeBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanDeleteChargeBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanDeleteChargeBusinessEvent extends LoanChargeBusinessEvent {
public LoanDeleteChargeBusinessEvent(LoanCharge value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanDeleteChargeBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanUpdateChargeBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanUpdateChargeBusinessEvent.java
index 80b08933f..1626ccaff 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanUpdateChargeBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanUpdateChargeBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanUpdateChargeBusinessEvent extends LoanChargeBusinessEvent {
public LoanUpdateChargeBusinessEvent(LoanCharge value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanUpdateChargeBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanWaiveChargeBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanWaiveChargeBusinessEvent.java
index 409b64897..2d33f2b47 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanWaiveChargeBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanWaiveChargeBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanWaiveChargeBusinessEvent extends LoanChargeBusinessEvent {
public LoanWaiveChargeBusinessEvent(LoanCharge value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanWaiveChargeBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanWaiveChargeUndoBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanWaiveChargeUndoBusinessEvent.java
index 4e566e3c4..c358aa94a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanWaiveChargeUndoBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/charge/LoanWaiveChargeUndoBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanWaiveChargeUndoBusinessEvent extends LoanChargeBusinessEvent {
public LoanWaiveChargeUndoBusinessEvent(LoanCharge value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanWaiveChargeUndoBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/product/LoanProductCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/product/LoanProductCreateBusinessEvent.java
index 1329398a6..63325f295 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/product/LoanProductCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/product/LoanProductCreateBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanProductCreateBusinessEvent extends LoanProductBusinessEvent {
public LoanProductCreateBusinessEvent(LoanProduct value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanProductCreateBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPostBusinessEvent.java
index b0194a2f1..91de41650 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPostBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPostBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanChargePaymentPostBusinessEvent extends LoanTransactionBusinessE
public LoanChargePaymentPostBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanChargePaymentPostBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPreBusinessEvent.java
index fe287cc98..685be9242 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPreBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPreBusinessEvent.java
@@ -26,4 +26,9 @@ public class LoanChargePaymentPreBusinessEvent extends LoanBusinessEvent {
public LoanChargePaymentPreBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanChargePaymentPreBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargeRefundBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargeRefundBusinessEvent.java
index 390742f28..eccd23f6b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargeRefundBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargeRefundBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanChargeRefundBusinessEvent extends LoanTransactionBusinessEvent
public LoanChargeRefundBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanChargeRefundBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPostBusinessEvent.java
index 1ac43e06b..224b665a0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPostBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPostBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanCreditBalanceRefundPostBusinessEvent extends LoanTransactionBus
public LoanCreditBalanceRefundPostBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanCreditBalanceRefundPostBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPreBusinessEvent.java
index 97a1263b5..9c8150b92 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPreBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPreBusinessEvent.java
@@ -26,4 +26,9 @@ public class LoanCreditBalanceRefundPreBusinessEvent extends LoanBusinessEvent {
public LoanCreditBalanceRefundPreBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanCreditBalanceRefundPreBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePostBusinessEvent.java
index 7ec43045a..67ba6b222 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePostBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePostBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanForeClosurePostBusinessEvent extends LoanTransactionBusinessEve
public LoanForeClosurePostBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanForeClosurePostBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePreBusinessEvent.java
index 0f6279d49..36bab83bd 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePreBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePreBusinessEvent.java
@@ -26,4 +26,9 @@ public class LoanForeClosurePreBusinessEvent extends LoanBusinessEvent {
public LoanForeClosurePreBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanForeClosurePreBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPostBusinessEvent.java
index d71cee248..ee8a10132 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPostBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPostBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanRefundPostBusinessEvent extends LoanTransactionBusinessEvent {
public LoanRefundPostBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanRefundPostBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPreBusinessEvent.java
index 20c81c5b8..8bad04202 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPreBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPreBusinessEvent.java
@@ -26,4 +26,9 @@ public class LoanRefundPreBusinessEvent extends LoanBusinessEvent {
public LoanRefundPreBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanRefundPreBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPostBusinessEvent.java
index c9bb1a0f2..2db1360b7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPostBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPostBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanTransactionGoodwillCreditPostBusinessEvent extends LoanTransact
public LoanTransactionGoodwillCreditPostBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanTransactionGoodwillCreditPostBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPreBusinessEvent.java
index fa93ef28e..28b73ca81 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPreBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPreBusinessEvent.java
@@ -26,4 +26,9 @@ public class LoanTransactionGoodwillCreditPreBusinessEvent extends LoanBusinessE
public LoanTransactionGoodwillCreditPreBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanTransactionGoodwillCreditPreBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPostBusinessEvent.java
index 7f1439f9a..40bf3bb91 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPostBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPostBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanTransactionMakeRepaymentPostBusinessEvent extends LoanTransacti
public LoanTransactionMakeRepaymentPostBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanTransactionMakeRepaymentPostBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPreBusinessEvent.java
index 64f837e56..3e19e7bff 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPreBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPreBusinessEvent.java
@@ -26,4 +26,9 @@ public class LoanTransactionMakeRepaymentPreBusinessEvent extends LoanBusinessEv
public LoanTransactionMakeRepaymentPreBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanTransactionMakeRepaymentPreBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPostBusinessEvent.java
index 8f7415104..a1fd4d281 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPostBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPostBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanTransactionMerchantIssuedRefundPostBusinessEvent extends LoanTr
public LoanTransactionMerchantIssuedRefundPostBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanTransactionMerchantIssuedRefundPostBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPreBusinessEvent.java
index 3ee3faa04..5e7f0793d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPreBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPreBusinessEvent.java
@@ -26,4 +26,9 @@ public class LoanTransactionMerchantIssuedRefundPreBusinessEvent extends LoanBus
public LoanTransactionMerchantIssuedRefundPreBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanTransactionMerchantIssuedRefundPreBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPostBusinessEvent.java
index 0b777a5df..4c521f5fc 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPostBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPostBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanTransactionPayoutRefundPostBusinessEvent extends LoanTransactio
public LoanTransactionPayoutRefundPostBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanTransactionPayoutRefundPostBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPreBusinessEvent.java
index dbc51cfda..31ddc69b1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPreBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPreBusinessEvent.java
@@ -26,4 +26,9 @@ public class LoanTransactionPayoutRefundPreBusinessEvent extends LoanBusinessEve
public LoanTransactionPayoutRefundPreBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanTransactionPayoutRefundPreBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPostBusinessEvent.java
index 44cccfb27..47e18f252 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPostBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPostBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanTransactionRecoveryPaymentPostBusinessEvent extends LoanTransac
public LoanTransactionRecoveryPaymentPostBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanTransactionRecoveryPaymentPostBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPreBusinessEvent.java
index 657e327d4..e6a890769 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPreBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPreBusinessEvent.java
@@ -26,4 +26,9 @@ public class LoanTransactionRecoveryPaymentPreBusinessEvent extends LoanBusiness
public LoanTransactionRecoveryPaymentPreBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanTransactionRecoveryPaymentPreBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanUndoWrittenOffBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanUndoWrittenOffBusinessEvent.java
index 0916db798..834acd949 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanUndoWrittenOffBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanUndoWrittenOffBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanUndoWrittenOffBusinessEvent extends LoanTransactionBusinessEven
public LoanUndoWrittenOffBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanUndoWrittenOffBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWaiveInterestBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWaiveInterestBusinessEvent.java
index e0b21d1da..b7ee4708b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWaiveInterestBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWaiveInterestBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanWaiveInterestBusinessEvent extends LoanTransactionBusinessEvent
public LoanWaiveInterestBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanWaiveInterestBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPostBusinessEvent.java
index 5637f9696..4ccb4d790 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPostBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPostBusinessEvent.java
@@ -25,4 +25,9 @@ public class LoanWrittenOffPostBusinessEvent extends LoanTransactionBusinessEven
public LoanWrittenOffPostBusinessEvent(LoanTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanWrittenOffPostBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPreBusinessEvent.java
index 9e51d1f4d..9b7c7cd91 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPreBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPreBusinessEvent.java
@@ -26,4 +26,9 @@ public class LoanWrittenOffPreBusinessEvent extends LoanBusinessEvent {
public LoanWrittenOffPreBusinessEvent(Loan value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "LoanWrittenOffPreBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsActivateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsActivateBusinessEvent.java
index bd9939daf..2fda3fe9a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsActivateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsActivateBusinessEvent.java
@@ -25,4 +25,9 @@ public class SavingsActivateBusinessEvent extends SavingsAccountBusinessEvent {
public SavingsActivateBusinessEvent(SavingsAccount value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "SavingsActivateBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsApproveBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsApproveBusinessEvent.java
index dd62aa95a..918544a56 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsApproveBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsApproveBusinessEvent.java
@@ -25,4 +25,9 @@ public class SavingsApproveBusinessEvent extends SavingsAccountBusinessEvent {
public SavingsApproveBusinessEvent(SavingsAccount value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "SavingsApproveBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsCloseBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsCloseBusinessEvent.java
index 38ec5f25f..dc2f87c1a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsCloseBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsCloseBusinessEvent.java
@@ -25,4 +25,9 @@ public class SavingsCloseBusinessEvent extends SavingsAccountBusinessEvent {
public SavingsCloseBusinessEvent(SavingsAccount value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "SavingsCloseBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsCreateBusinessEvent.java
index 7e754feec..b9bb20106 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsCreateBusinessEvent.java
@@ -25,4 +25,9 @@ public class SavingsCreateBusinessEvent extends SavingsAccountBusinessEvent {
public SavingsCreateBusinessEvent(SavingsAccount value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "SavingsCreateBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsPostInterestBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsPostInterestBusinessEvent.java
index 87a554010..65d4d184c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsPostInterestBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsPostInterestBusinessEvent.java
@@ -25,4 +25,9 @@ public class SavingsPostInterestBusinessEvent extends SavingsAccountBusinessEven
public SavingsPostInterestBusinessEvent(SavingsAccount value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "SavingsPostInterestBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsRejectBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsRejectBusinessEvent.java
index 31f0c5688..0cb8af8bf 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsRejectBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/SavingsRejectBusinessEvent.java
@@ -25,4 +25,9 @@ public class SavingsRejectBusinessEvent extends SavingsAccountBusinessEvent {
public SavingsRejectBusinessEvent(SavingsAccount value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "SavingsRejectBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/transaction/SavingsDepositBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/transaction/SavingsDepositBusinessEvent.java
index 7055234f0..59f737ba3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/transaction/SavingsDepositBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/transaction/SavingsDepositBusinessEvent.java
@@ -25,4 +25,9 @@ public class SavingsDepositBusinessEvent extends SavingsAccountTransactionBusine
public SavingsDepositBusinessEvent(SavingsAccountTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "SavingsDepositBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/transaction/SavingsWithdrawalBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/transaction/SavingsWithdrawalBusinessEvent.java
index c03ce46a8..3f35a5307 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/transaction/SavingsWithdrawalBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/savings/transaction/SavingsWithdrawalBusinessEvent.java
@@ -25,4 +25,9 @@ public class SavingsWithdrawalBusinessEvent extends SavingsAccountTransactionBus
public SavingsWithdrawalBusinessEvent(SavingsAccountTransaction value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "SavingsWithdrawalBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareAccountApproveBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareAccountApproveBusinessEvent.java
index adc843845..bf2587555 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareAccountApproveBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareAccountApproveBusinessEvent.java
@@ -25,4 +25,9 @@ public class ShareAccountApproveBusinessEvent extends ShareAccountBusinessEvent
public ShareAccountApproveBusinessEvent(ShareAccount value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "ShareAccountApproveBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareAccountCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareAccountCreateBusinessEvent.java
index 62e4b5fd2..03b1627b5 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareAccountCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareAccountCreateBusinessEvent.java
@@ -25,4 +25,9 @@ public class ShareAccountCreateBusinessEvent extends ShareAccountBusinessEvent {
public ShareAccountCreateBusinessEvent(ShareAccount value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "ShareAccountCreateBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareProductDividentsCreateBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareProductDividentsCreateBusinessEvent.java
index b0cef9f0c..263a0b451 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareProductDividentsCreateBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/share/ShareProductDividentsCreateBusinessEvent.java
@@ -25,4 +25,9 @@ public class ShareProductDividentsCreateBusinessEvent extends AbstractBusinessEv
public ShareProductDividentsCreateBusinessEvent(Long value) {
super(value);
}
+
+ @Override
+ public String getType() {
+ return "ShareProductDividentsCreateBusinessEvent";
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierServiceImpl.java
index dcc4af8d1..7dbd8b642 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierServiceImpl.java
@@ -22,17 +22,36 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.fineract.infrastructure.core.config.FineractProperties;
+import org.apache.fineract.infrastructure.event.external.service.ExternalEventService;
import org.apache.fineract.portfolio.businessevent.BusinessEventListener;
import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent;
+import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;
@Service
@SuppressWarnings({ "unchecked", "rawtypes" })
-public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierService {
+@RequiredArgsConstructor
+@Slf4j
+public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierService, InitializingBean {
private final Map<Class, List<BusinessEventListener>> preListeners = new HashMap<>();
private final Map<Class, List<BusinessEventListener>> postListeners = new HashMap<>();
+ private final ExternalEventService externalEventService;
+ private final FineractProperties fineractProperties;
+
+ @Override
+ public void afterPropertiesSet() throws Exception {
+ if (isExternalEventPostingEnabled()) {
+ log.info("External event posting is enabled");
+ } else {
+ log.info("External event posting is disabled");
+ }
+ }
+
@Override
public void notifyPreBusinessEvent(BusinessEvent<?> businessEvent) {
List<BusinessEventListener> businessEventListeners = preListeners.get(businessEvent.getClass());
@@ -61,6 +80,14 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe
eventListener.onBusinessEvent(businessEvent);
}
}
+ if (isExternalEventPostingEnabled()) {
+ // we only want to create external events for operations that were successful, hence the post listener
+ externalEventService.postEvent(businessEvent);
+ }
+ }
+
+ private boolean isExternalEventPostingEnabled() {
+ return fineractProperties.getEvents().getExternal().isEnabled();
}
@Override
@@ -72,5 +99,4 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe
}
businessEventListeners.add(listener);
}
-
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/domain/LoanTermVariationsRepository.java
similarity index 52%
copy from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java
copy to fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/domain/LoanTermVariationsRepository.java
index 8abb87df7..70af211d1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/LoanAcceptTransferBusinessEvent.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/domain/LoanTermVariationsRepository.java
@@ -16,13 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.fineract.portfolio.businessevent.domain.loan;
+package org.apache.fineract.portfolio.loanaccount.rescheduleloan.domain;
-import org.apache.fineract.portfolio.loanaccount.domain.Loan;
+import java.util.List;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanTermVariations;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
-public class LoanAcceptTransferBusinessEvent extends LoanBusinessEvent {
+public interface LoanTermVariationsRepository
+ extends JpaRepository<LoanTermVariations, Long>, JpaSpecificationExecutor<LoanTermVariations> {
+
+ @Query("select lrr from LoanTermVariations lrr where lrr.loan.id = :loanId")
+ List<LoanTermVariations> findAllLoanTermVariationsByLoanId(@Param("loanId") Long loanId);
- public LoanAcceptTransferBusinessEvent(Loan value) {
- super(value);
- }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java
index 528164fa2..bc41974b6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java
@@ -49,7 +49,7 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.apache.fineract.portfolio.products.constants.ProductsApiConstants;
import org.apache.fineract.portfolio.products.data.ProductData;
import org.apache.fineract.portfolio.products.exception.ResourceNotFoundException;
-import org.apache.fineract.portfolio.products.service.ProductReadPlatformService;
+import org.apache.fineract.portfolio.products.service.ShareProductReadPlatformService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@@ -87,7 +87,7 @@ public class ProductsApiResource {
@Context final UriInfo uriInfo) {
String serviceName = productType + ProductsApiConstants.READPLATFORM_NAME;
try {
- ProductReadPlatformService service = (ProductReadPlatformService) this.applicationContext.getBean(serviceName);
+ ShareProductReadPlatformService service = (ShareProductReadPlatformService) this.applicationContext.getBean(serviceName);
ProductData data = service.retrieveTemplate();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, data, service.getResponseDataParams());
@@ -108,7 +108,7 @@ public class ProductsApiResource {
@PathParam("type") @Parameter(description = "type") final String productType, @Context final UriInfo uriInfo) {
try {
String serviceName = productType + ProductsApiConstants.READPLATFORM_NAME;
- ProductReadPlatformService service = (ProductReadPlatformService) this.applicationContext.getBean(serviceName);
+ ShareProductReadPlatformService service = (ShareProductReadPlatformService) this.applicationContext.getBean(serviceName);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
ProductData data = service.retrieveOne(productId, settings.isTemplate());
return this.toApiJsonSerializer.serialize(settings, data, service.getResponseDataParams());
@@ -129,7 +129,7 @@ public class ProductsApiResource {
@QueryParam("limit") @Parameter(description = "limit") final Integer limit, @Context final UriInfo uriInfo) {
try {
String serviceName = productType + ProductsApiConstants.READPLATFORM_NAME;
- ProductReadPlatformService service = (ProductReadPlatformService) this.applicationContext.getBean(serviceName);
+ ShareProductReadPlatformService service = (ShareProductReadPlatformService) this.applicationContext.getBean(serviceName);
Page<ProductData> data = service.retrieveAllProducts(offset, limit);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, data, service.getResponseDataParams());
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/service/ProductReadPlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/service/ShareProductReadPlatformService.java
similarity index 96%
rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/products/service/ProductReadPlatformService.java
rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/products/service/ShareProductReadPlatformService.java
index 72cfd4dfc..9c9d15ee2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/service/ProductReadPlatformService.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/service/ShareProductReadPlatformService.java
@@ -23,7 +23,7 @@ import java.util.Set;
import org.apache.fineract.infrastructure.core.service.Page;
import org.apache.fineract.portfolio.products.data.ProductData;
-public interface ProductReadPlatformService {
+public interface ShareProductReadPlatformService {
Page<ProductData> retrieveAllProducts(Integer offSet, Integer limit);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java
index 612e74df5..99ada8b57 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java
@@ -52,7 +52,7 @@ import org.apache.fineract.portfolio.charge.data.ChargeData;
import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
import org.apache.fineract.portfolio.client.exception.ClientNotFoundException;
import org.apache.fineract.portfolio.products.data.ProductData;
-import org.apache.fineract.portfolio.products.service.ProductReadPlatformService;
+import org.apache.fineract.portfolio.products.service.ShareProductReadPlatformService;
import org.apache.fineract.portfolio.self.client.service.AppuserClientMapperReadService;
import org.apache.fineract.portfolio.self.shareaccounts.data.SelfShareAccountsDataValidator;
import org.apache.fineract.portfolio.self.shareaccounts.service.AppUserShareAccountsMapperReadPlatformService;
@@ -78,7 +78,7 @@ public class SelfShareAccountsApiResource {
private final DefaultToApiJsonSerializer<AccountData> toApiJsonSerializer;
private final AppuserClientMapperReadService appuserClientMapperReadService;
private final SelfShareAccountsDataValidator selfShareAccountsDataValidator;
- private final ProductReadPlatformService productReadPlatformService;
+ private final ShareProductReadPlatformService shareProductReadPlatformService;
private final ChargeReadPlatformService chargeReadPlatformService;
private final AppUserShareAccountsMapperReadPlatformService appUserShareAccountsMapperReadPlatformService;
@@ -87,7 +87,8 @@ public class SelfShareAccountsApiResource {
final ShareAccountReadPlatformService readPlatformService, final DefaultToApiJsonSerializer<AccountData> toApiJsonSerializer,
final ApiRequestParameterHelper apiRequestParameterHelper, final AppuserClientMapperReadService appuserClientMapperReadService,
final SelfShareAccountsDataValidator selfShareAccountsDataValidator,
- final ProductReadPlatformService productReadPlatformService, final ChargeReadPlatformService chargeReadPlatformService,
+ final ShareProductReadPlatformService shareProductReadPlatformService,
+ final ChargeReadPlatformService chargeReadPlatformService,
final AppUserShareAccountsMapperReadPlatformService appUserShareAccountsMapperReadPlatformService) {
this.context = context;
this.accountsApiResource = accountsApiResource;
@@ -96,7 +97,7 @@ public class SelfShareAccountsApiResource {
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.selfShareAccountsDataValidator = selfShareAccountsDataValidator;
this.appuserClientMapperReadService = appuserClientMapperReadService;
- this.productReadPlatformService = productReadPlatformService;
+ this.shareProductReadPlatformService = shareProductReadPlatformService;
this.chargeReadPlatformService = chargeReadPlatformService;
this.appUserShareAccountsMapperReadPlatformService = appUserShareAccountsMapperReadPlatformService;
}
@@ -120,9 +121,9 @@ public class SelfShareAccountsApiResource {
Collection<ProductData> productOptions = new ArrayList<ProductData>();
if (productId != null) {
final boolean includeTemplate = true;
- productOptions.add(productReadPlatformService.retrieveOne(productId, includeTemplate));
+ productOptions.add(shareProductReadPlatformService.retrieveOne(productId, includeTemplate));
} else {
- productOptions = productReadPlatformService.retrieveAllForLookup();
+ productOptions = shareProductReadPlatformService.retrieveAllForLookup();
}
String clientName = null;
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountReadPlatformServiceImpl.java
index 2bb840d54..f2ccb0989 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountReadPlatformServiceImpl.java
@@ -46,7 +46,7 @@ import org.apache.fineract.portfolio.client.data.ClientData;
import org.apache.fineract.portfolio.client.service.ClientReadPlatformService;
import org.apache.fineract.portfolio.products.constants.ProductsApiConstants;
import org.apache.fineract.portfolio.products.data.ProductData;
-import org.apache.fineract.portfolio.products.service.ProductReadPlatformService;
+import org.apache.fineract.portfolio.products.service.ShareProductReadPlatformService;
import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
@@ -108,7 +108,7 @@ public class ShareAccountReadPlatformServiceImpl implements ShareAccountReadPlat
public ShareAccountData retrieveTemplate(Long clientId, Long productId) {
ShareAccountData toReturn = null;
String serviceName = "share" + ProductsApiConstants.READPLATFORM_NAME;
- ProductReadPlatformService service = (ProductReadPlatformService) this.applicationContext.getBean(serviceName);
+ ShareProductReadPlatformService service = (ShareProductReadPlatformService) this.applicationContext.getBean(serviceName);
ClientData client = this.clientReadPlatformService.retrieveOne(clientId);
if (productId != null) {
@@ -157,7 +157,7 @@ public class ShareAccountReadPlatformServiceImpl implements ShareAccountReadPlat
String query = "select " + mapper.schema() + "where sa.id=?";
ShareAccountData data = (ShareAccountData) this.jdbcTemplate.queryForObject(query, mapper, new Object[] { id }); // NOSONAR
String serviceName = "share" + ProductsApiConstants.READPLATFORM_NAME;
- ProductReadPlatformService service = (ProductReadPlatformService) this.applicationContext.getBean(serviceName);
+ ShareProductReadPlatformService service = (ShareProductReadPlatformService) this.applicationContext.getBean(serviceName);
final ShareProductData productData = (ShareProductData) service.retrieveOne(data.getProductId(), false);
final BigDecimal currentMarketPrice = deriveMarketPrice(productData);
data.setCurrentMarketPrice(currentMarketPrice);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java
index 3dc5b1f22..91942d2ef 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java
@@ -26,7 +26,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.Money;
-import org.apache.fineract.portfolio.products.service.ProductReadPlatformService;
+import org.apache.fineract.portfolio.products.service.ShareProductReadPlatformService;
import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountData;
import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountTransactionData;
import org.apache.fineract.portfolio.shareaccounts.domain.PurchasedSharesStatusType;
@@ -41,7 +41,7 @@ import org.springframework.stereotype.Component;
@Component
public class ShareProductDividendAssembler {
- private final ProductReadPlatformService shareProductReadPlatformService;
+ private final ShareProductReadPlatformService shareProductReadPlatformService;
private final ShareAccountReadPlatformService shareAccountReadPlatformService;
@Autowired
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductReadPlatformServiceImpl.java
index 4261a384f..2e2d5b9f8 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductReadPlatformServiceImpl.java
@@ -45,7 +45,7 @@ import org.apache.fineract.portfolio.charge.data.ChargeData;
import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
import org.apache.fineract.portfolio.products.data.ProductData;
import org.apache.fineract.portfolio.products.exception.ProductNotFoundException;
-import org.apache.fineract.portfolio.products.service.ProductReadPlatformService;
+import org.apache.fineract.portfolio.products.service.ShareProductReadPlatformService;
import org.apache.fineract.portfolio.shareaccounts.service.SharesEnumerations;
import org.apache.fineract.portfolio.shareproducts.data.ShareProductData;
import org.apache.fineract.portfolio.shareproducts.data.ShareProductMarketPriceData;
@@ -56,7 +56,7 @@ import org.springframework.stereotype.Service;
@Service(value = "shareReadPlatformService")
@RequiredArgsConstructor
-public class ShareProductReadPlatformServiceImpl implements ProductReadPlatformService {
+public class ShareProductReadPlatformServiceImpl implements ShareProductReadPlatformService {
private final JdbcTemplate jdbcTemplate;
private final CurrencyReadPlatformService currencyReadPlatformService;
diff --git a/fineract-provider/src/main/resources/application.properties b/fineract-provider/src/main/resources/application.properties
index 2cce16a7f..9e2f46bef 100644
--- a/fineract-provider/src/main/resources/application.properties
+++ b/fineract-provider/src/main/resources/application.properties
@@ -53,6 +53,8 @@ fineract.remote-job-message-handler.jms.enabled=${FINERACT_REMOTE_JOB_MESSAGE_HA
fineract.remote-job-message-handler.jms.request-queue-name=${FINERACT_REMOTE_JOB_MESSAGE_HANDLER_JMS_QUEUE_NAME:JMS-request-queue}
fineract.remote-job-message-handler.jms.broker-url=${FINERACT_REMOTE_JOB_MESSAGE_HANDLER_JMS_BROKER_URL:tcp://127.0.0.1:61616}
+fineract.events.external.enabled=${FINERACT_EXTERNAL_EVENTS_ENABLED:false}
+
# Logging pattern for the console
logging.pattern.console=${CONSOLE_LOG_PATTERN:%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(%replace([%X{correlationId}]){'\\[\\]', ''}) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:%wEx}}