[GitHub] [fineract] adamsaghy commented on a diff in pull request #2882: FINERACT-1854: Undo last disbursal function deletes all disbursals on…

2023-01-20 Thread GitBox


adamsaghy commented on code in PR #2882:
URL: https://github.com/apache/fineract/pull/2882#discussion_r1073679864


##
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##
@@ -6301,26 +6307,27 @@ public Map 
undoLastDisbursal(ScheduleGeneratorDTO scheduleGenera
 List existingReversedTransactionIds, Loan loan) {
 
 validateAccountStatus(LoanEvent.LOAN_DISBURSAL_UNDO_LAST);
-existingTransactionIds.addAll(findExistingTransactionIds());
-
existingReversedTransactionIds.addAll(findExistingReversedTransactionIds());
-final Map actualChanges = new LinkedHashMap<>();
 
validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.LOAN_DISBURSAL_UNDO_LAST,
 getDisbursementDate());
-LocalDate actualDisbursementDate = null;
-LocalDate lastTransactionDate = getDisbursementDate();
-List loanTransactions = 
retrieveListOfTransactionsExcludeAccruals();
+
+final Map actualChanges = new LinkedHashMap<>();
+List loanTransactions = 
retrieveListOfTransactionsByType(LoanTransactionType.DISBURSEMENT);
+loanTransactions.sort(Comparator.comparing(LoanTransaction::getId));
+final LoanTransaction lastDisbursalTransaction = 
loanTransactions.get(loanTransactions.size() - 1);

Review Comment:
   This might not be true. There could be Accrual transaction or any other one 
as well.
   Please make it sure you understand what the legacy logic was doing and not 
do any regression!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [fineract] adamsaghy commented on a diff in pull request #2882: FINERACT-1854: Undo last disbursal function deletes all disbursals on…

2023-01-20 Thread GitBox


adamsaghy commented on code in PR #2882:
URL: https://github.com/apache/fineract/pull/2882#discussion_r1082702226


##
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##
@@ -6301,26 +6307,27 @@ public Map 
undoLastDisbursal(ScheduleGeneratorDTO scheduleGenera
 List existingReversedTransactionIds, Loan loan) {
 
 validateAccountStatus(LoanEvent.LOAN_DISBURSAL_UNDO_LAST);
-existingTransactionIds.addAll(findExistingTransactionIds());
-
existingReversedTransactionIds.addAll(findExistingReversedTransactionIds());
-final Map actualChanges = new LinkedHashMap<>();
 
validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.LOAN_DISBURSAL_UNDO_LAST,
 getDisbursementDate());
-LocalDate actualDisbursementDate = null;
-LocalDate lastTransactionDate = getDisbursementDate();
-List loanTransactions = 
retrieveListOfTransactionsExcludeAccruals();
+
+final Map actualChanges = new LinkedHashMap<>();
+List loanTransactions = 
retrieveListOfTransactionsByType(LoanTransactionType.DISBURSEMENT);

Review Comment:
   This is wrong, we filter the transactions to have only the transactions 
which are disbursement, but at line 6323, we are iterating through on the same 
list and try to decide whether there was any transaction after the last 
disbursement which prevent to undo the disbursement... (any repayment happened, 
we cannot undo them)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[fineract] branch develop updated: FINERACT-1724: Added JMS connection pooling to the external event producer

2023-01-20 Thread arnold
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


The following commit(s) were added to refs/heads/develop by this push:
 new 5a89c19d0 FINERACT-1724: Added JMS connection pooling to the external 
event producer
5a89c19d0 is described below

commit 5a89c19d0a392d61513560dec6fb565e2d733d85
Author: Arnold Galovics 
AuthorDate: Fri Jan 20 13:36:11 2023 +0100

FINERACT-1724: Added JMS connection pooling to the external event producer
---
 .../config/ExternalEventJMSConfiguration.java  | 19 --
 .../jms/JMSMultiExternalEventProducer.java | 68 +--
 .../jms/JMSMultiExternalEventProducerTest.java | 76 --
 3 files changed, 68 insertions(+), 95 deletions(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/config/ExternalEventJMSConfiguration.java
 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/config/ExternalEventJMSConfiguration.java
index b38f90e58..3b384b672 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/config/ExternalEventJMSConfiguration.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/config/ExternalEventJMSConfiguration.java
@@ -28,6 +28,7 @@ import 
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.jms.connection.CachingConnectionFactory;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 
 @Configuration
@@ -37,27 +38,31 @@ public class ExternalEventJMSConfiguration {
 @Autowired
 private FineractProperties fineractProperties;
 
-@Bean
-public ActiveMQConnectionFactory connectionFactory() {
+@Bean(name = "externalEventConnectionFactory")
+public CachingConnectionFactory connectionFactory() {
+FineractExternalEventsProducerJmsProperties jmsProps = 
fineractProperties.getEvents().getExternal().getProducer().getJms();
 ActiveMQConnectionFactory connectionFactory = new 
ActiveMQConnectionFactory();
-
connectionFactory.setBrokerURL(fineractProperties.getEvents().getExternal().getProducer().getJms().getBrokerUrl());
+connectionFactory.setBrokerURL(jmsProps.getBrokerUrl());
 connectionFactory.setTrustAllPackages(true);
-FineractExternalEventsProducerJmsProperties jmsProps = 
fineractProperties.getEvents().getExternal().getProducer().getJms();
 if (jmsProps.isBrokerPasswordProtected()) {
 connectionFactory.setUserName(jmsProps.getBrokerUsername());
 connectionFactory.setPassword(jmsProps.getBrokerPassword());
 }
-return connectionFactory;
+CachingConnectionFactory cachingConnectionFactory = new 
CachingConnectionFactory();
+
cachingConnectionFactory.setSessionCacheSize(jmsProps.getProducerCount());
+cachingConnectionFactory.setReconnectOnException(true);
+cachingConnectionFactory.setTargetConnectionFactory(connectionFactory);
+return cachingConnectionFactory;
 }
 
 @Conditional(EnableExternalEventTopicCondition.class)
-@Bean(name = "eventDestination")
+@Bean(name = "externalEventDestination")
 public ActiveMQTopic activeMqTopic() {
 return new 
ActiveMQTopic(fineractProperties.getEvents().getExternal().getProducer().getJms().getEventTopicName());
 }
 
 @Conditional(EnableExternalEventQueueCondition.class)
-@Bean(name = "eventDestination")
+@Bean(name = "externalEventDestination")
 public ActiveMQQueue activeMqQueue() {
 return new 
ActiveMQQueue(fineractProperties.getEvents().getExternal().getProducer().getJms().getEventQueueName());
 }
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/producer/jms/JMSMultiExternalEventProducer.java
 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/producer/jms/JMSMultiExternalEventProducer.java
index 794c45cc3..3511780d8 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/producer/jms/JMSMultiExternalEventProducer.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/producer/jms/JMSMultiExternalEventProducer.java
@@ -39,8 +39,6 @@ import 
org.apache.fineract.infrastructure.core.messaging.jms.MessageFactory;
 import org.apache.fineract.infrastructure.core.service.HashingService;
 import 
org.apache.fineract.infrastructure.event.external.exception.AcknowledgementTimeoutException;
 import 
org.apache.fineract.infrastructure.event.external.producer.ExternalEventProducer;
-import org.springframework.

[GitHub] [fineract] galovics merged pull request #2904: FINERACT-1724: Added JMS connection pooling to the external event producer

2023-01-20 Thread GitBox


galovics merged PR #2904:
URL: https://github.com/apache/fineract/pull/2904


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[fineract] branch develop updated: [FINERACT-1678] Inline Loan COB for Batch API

2023-01-20 Thread arnold
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


The following commit(s) were added to refs/heads/develop by this push:
 new 760102e3b [FINERACT-1678] Inline Loan COB for Batch API
760102e3b is described below

commit 760102e3bbee792f8dc03d74c72df81d585c843f
Author: taskain7 
AuthorDate: Fri Jan 20 07:41:49 2023 +0100

[FINERACT-1678] Inline Loan COB for Batch API
---
 .../apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java
 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java
index 95b09bd70..61e665e52 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java
@@ -217,7 +217,7 @@ public class LoanCOBApiFilter extends OncePerRequestFilter 
implements BatchFilte
 } else {
 try {
 List result = calculateRelevantLoanIds("/" + 
batchRequest.getRelativeUrl());
-if (!isLoanSoftLocked(result)) {
+if (isLoanSoftLocked(result)) {
 executeInlineCob(result);
 }
 return chain.serviceCall(batchRequest, uriInfo);



[GitHub] [fineract] galovics merged pull request #2903: [FINERACT-1678] Inline Loan COB for Batch API

2023-01-20 Thread GitBox


galovics merged PR #2903:
URL: https://github.com/apache/fineract/pull/2903


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[fineract] branch develop updated: [FINERACT-1859] Avro schema for LoanAccountsStayedLockedBusinessEvent

2023-01-20 Thread arnold
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


The following commit(s) were added to refs/heads/develop by this push:
 new ef153c2b6 [FINERACT-1859] Avro schema for 
LoanAccountsStayedLockedBusinessEvent
ef153c2b6 is described below

commit ef153c2b69b5427e2045a57fa8d01ffc83490eb5
Author: taskain7 
AuthorDate: Wed Jan 18 12:49:47 2023 +0100

[FINERACT-1859] Avro schema for LoanAccountsStayedLockedBusinessEvent
---
 .../loan/v1/LoanAccountStayedLockedDataV1.avsc | 27 +++
 .../loan/v1/LoanAccountsStayedLockedDataV1.avsc| 12 +
 .../LoanAccountStayedLockedData.java}  | 35 --
 .../LoanAccountsStayedLockedData.java} | 31 +++--
 .../LoanIdAndExternalIdAndAccountNo.java}  | 29 +++-
 .../fineract/cob/domain/LoanAccountLock.java   |  8 
 .../LoanAccountsStayedLockedBusinessEvent.java |  6 +--
 .../cob/loan/LoanCOBManagerConfiguration.java  |  5 +-
 .../cob/loan/StayedLockedLoansTasklet.java | 29 +---
 .../loan/LoanAccountsStayedLockedDataMapper.java}  | 33 -
 ...ccountsStayedLockedBusinessEventSerializer.java | 54 ++
 .../loanaccount/domain/LoanRepository.java |  6 +++
 .../db/changelog/tenant/changelog-tenant.xml   |  1 +
 ...add_cob_business_date_to_loan_account_locks.xml | 31 +
 14 files changed, 199 insertions(+), 108 deletions(-)

diff --git 
a/fineract-avro-schemas/src/main/avro/loan/v1/LoanAccountStayedLockedDataV1.avsc
 
b/fineract-avro-schemas/src/main/avro/loan/v1/LoanAccountStayedLockedDataV1.avsc
new file mode 100644
index 0..172fceae3
--- /dev/null
+++ 
b/fineract-avro-schemas/src/main/avro/loan/v1/LoanAccountStayedLockedDataV1.avsc
@@ -0,0 +1,27 @@
+{
+"name": "LoanAccountStayedLockedDataV1",
+"namespace": "org.apache.fineract.avro.loan.v1",
+"type": "record",
+"fields": [
+{
+"name": "id",
+"type": "long"
+},
+{
+"default": null,
+"name": "externalId",
+"type": [
+"null",
+"string"
+]
+},
+{
+"default": null,
+"name": "accountNo",
+"type": [
+"null",
+"string"
+]
+}
+]
+}
diff --git 
a/fineract-avro-schemas/src/main/avro/loan/v1/LoanAccountsStayedLockedDataV1.avsc
 
b/fineract-avro-schemas/src/main/avro/loan/v1/LoanAccountsStayedLockedDataV1.avsc
new file mode 100644
index 0..2f9db112f
--- /dev/null
+++ 
b/fineract-avro-schemas/src/main/avro/loan/v1/LoanAccountsStayedLockedDataV1.avsc
@@ -0,0 +1,12 @@
+{
+"name": "LoanAccountsStayedLockedDataV1",
+"namespace": "org.apache.fineract.avro.loan.v1",
+"type": "record",
+"fields": [{
+"name": "loanAccounts",
+"type": {
+"type": "array",
+"items": 
"org.apache.fineract.avro.loan.v1.LoanAccountStayedLockedDataV1"
+}
+}]
+}
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/cob/loan/LoanAccountsStayedLockedBusinessEvent.java
 
b/fineract-provider/src/main/java/org/apache/fineract/cob/data/LoanAccountStayedLockedData.java
similarity index 53%
copy from 
fineract-provider/src/main/java/org/apache/fineract/cob/loan/LoanAccountsStayedLockedBusinessEvent.java
copy to 
fineract-provider/src/main/java/org/apache/fineract/cob/data/LoanAccountStayedLockedData.java
index d9280ae56..c37ac5647 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/cob/loan/LoanAccountsStayedLockedBusinessEvent.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/cob/data/LoanAccountStayedLockedData.java
@@ -16,32 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.fineract.cob.loan;
+package org.apache.fineract.cob.data;
 
-import java.util.List;
-import 
org.apache.fineract.infrastructure.event.business.domain.AbstractBusinessEvent;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.apache.fineract.infrastructure.core.domain.ExternalId;
 
-public class LoanAccountsStayedLockedBusinessEvent extends 
AbstractBusinessEvent> {
+@Getter
+@AllArgsConstructor
+public class LoanAccountStayedLockedData {
 
-private static final String CATEGORY = "Loan COB";
-private static final String TYPE = "LoanAccountsStayedLockedBusinessEvent";
-
-public LoanAccountsStayedLockedBusinessEvent(List value) {
-super(value);
-}
-
-@Override
-public String getType() {
-return TYPE;
-}
-
-@Override
-public String getCategory() {
-return CATEGORY;
-}
-
-@Override
-public Long getAggregateRootId() {
-return null;
-}
+private Long id;
+private ExternalId externalId;
+private S

[GitHub] [fineract] galovics merged pull request #2897: [FINERACT-1859] Avro schema for LoanAccountsStayedLockedBusinessEvent

2023-01-20 Thread GitBox


galovics merged PR #2897:
URL: https://github.com/apache/fineract/pull/2897


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [fineract] galovics opened a new pull request, #2904: FINERACT-1724: Added JMS connection pooling to the external event producer

2023-01-20 Thread GitBox


galovics opened a new pull request, #2904:
URL: https://github.com/apache/fineract/pull/2904

   ## Description
   
   Describe the changes made and why they were made.
   
   Ignore if these details are present on the associated [Apache Fineract JIRA 
ticket](https://github.com/apache/fineract/pull/1284).
   
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request 
- thanks!
   
   - [ ] Write the commit message as per 
https://github.com/apache/fineract/#pull-requests
   
   - [ ] Acknowledge that we will not review PRs that are not passing the build 
_("green")_ - it is your responsibility to get a proposed PR to pass the build, 
not primarily the project's maintainers.
   
   - [ ] Create/update unit or integration tests for verifying the changes made.
   
   - [ ] Follow coding conventions at 
https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
   
   - [ ] Add required Swagger annotation and update API documentation at 
fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with 
details of any API changes
   
   - [ ] Submission is not a "code dump".  (Large changes can be made "in 
repository" via a branch.  Ask on the developer mailing list for guidance, if 
required.)
   
   FYI our guidelines for code reviews are at 
https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org