filter) {
- return Arrays.stream(VALUES).filter(filter).toList();
+ return Arrays.stream(values()).filter(filter).toList();
}
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java
index c6607c9d136..860af9ab639 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java
@@ -35,6 +35,7 @@ public class SavingsApiConstants {
public static final String withdrawnByApplicantAction = ".withdrawnByApplicant";
public static final String activateAction = ".activate";
public static final String modifyApplicationAction = ".modify";
+ public static final String undoActivateAction = ".undoactivate";
public static final String deleteApplicationAction = ".delete";
public static final String undoTransactionAction = ".undotransaction";
public static final String applyAnnualFeeTransactionAction = ".applyannualfee";
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsCompoundingInterestPeriodType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsCompoundingInterestPeriodType.java
index ba4b61296a8..3a326cd723a 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsCompoundingInterestPeriodType.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsCompoundingInterestPeriodType.java
@@ -18,8 +18,7 @@
*/
package org.apache.fineract.portfolio.savings;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Arrays;
/**
*
@@ -28,18 +27,15 @@
*/
public enum SavingsCompoundingInterestPeriodType {
- INVALID(0, "savingsCompoundingInterestPeriodType.invalid"), //
- DAILY(1, "savingsCompoundingInterestPeriodType.daily"), //
- // WEEKLY(2, "savingsCompoundingInterestPeriodType.weekly"), //
- // BIWEEKLY(3, "savingsCompoundingInterestPeriodType.biweekly"), //
+ INVALID(0, "savingsCompoundingInterestPeriodType.invalid"), DAILY(1, "savingsCompoundingInterestPeriodType.daily"),
+ // WEEKLY(2, "savingsCompoundingInterestPeriodType.weekly"),
+ // BIWEEKLY(3, "savingsCompoundingInterestPeriodType.biweekly"),
MONTHLY(4, "savingsCompoundingInterestPeriodType.monthly"),
- QUATERLY(5, "savingsCompoundingInterestPeriodType.quarterly"), //
- BI_ANNUAL(6, "savingsCompoundingInterestPeriodType.biannual"), //
- ANNUAL(7, "savingsCompoundingInterestPeriodType.annual"); //
+ QUATERLY(5, "savingsCompoundingInterestPeriodType.quarterly"), BI_ANNUAL(6, "savingsCompoundingInterestPeriodType.biannual"), ANNUAL(7,
+ "savingsCompoundingInterestPeriodType.annual");
- // NO_COMPOUNDING_SIMPLE_INTEREST(8,
- // "savingsCompoundingInterestPeriodType.nocompounding");
+ // NO_COMPOUNDING_SIMPLE_INTEREST(8, "savingsCompoundingInterestPeriodType.nocompounding");
private final Integer value;
private final String code;
@@ -57,50 +53,35 @@ public String getCode() {
return this.code;
}
+ // TODO: do we really need this?!?
public static Object[] integerValues() {
- final List values = new ArrayList<>();
- for (final SavingsCompoundingInterestPeriodType enumType : values()) {
- if (enumType.getValue() > 0) {
- values.add(enumType.getValue());
- }
- }
-
- return values.toArray();
+ return Arrays.stream(values()).filter(value -> !INVALID.equals(value)).map(value -> value.value).toList().toArray();
}
- public static SavingsCompoundingInterestPeriodType fromInt(final Integer type) {
- SavingsCompoundingInterestPeriodType repaymentFrequencyType = SavingsCompoundingInterestPeriodType.INVALID;
- if (type != null) {
- switch (type) {
- case 1:
- repaymentFrequencyType = SavingsCompoundingInterestPeriodType.DAILY;
- break;
- case 2:
- // repaymentFrequencyType =
- // SavingsCompoundingInterestPeriodType.WEEKLY;
- break;
- case 3:
- // repaymentFrequencyType =
- // SavingsCompoundingInterestPeriodType.BIWEEKLY;
- break;
- case 4:
- repaymentFrequencyType = SavingsCompoundingInterestPeriodType.MONTHLY;
- break;
- case 5:
- repaymentFrequencyType = SavingsCompoundingInterestPeriodType.QUATERLY;
- break;
- case 6:
- repaymentFrequencyType = SavingsCompoundingInterestPeriodType.BI_ANNUAL;
- break;
- case 7:
- repaymentFrequencyType = SavingsCompoundingInterestPeriodType.ANNUAL;
- break;
- case 8:
- // repaymentFrequencyType =
- // SavingsCompoundingInterestPeriodType.NO_COMPOUNDING_SIMPLE_INTEREST;
- break;
- }
+ public static SavingsCompoundingInterestPeriodType fromInt(final Integer v) {
+ if (v == null) {
+ return INVALID;
+ }
+
+ switch (v) {
+ case 1:
+ return DAILY;
+ // case 2:
+ // return WEEKLY;
+ // case 3:
+ // return BIWEEKLY;
+ case 4:
+ return MONTHLY;
+ case 5:
+ return QUATERLY;
+ case 6:
+ return BI_ANNUAL;
+ case 7:
+ return ANNUAL;
+ // case 8:
+ // return NO_COMPOUNDING_SIMPLE_INTEREST;
+ default:
+ return INVALID;
}
- return repaymentFrequencyType;
}
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsInterestCalculationDaysInYearType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsInterestCalculationDaysInYearType.java
index 616f017ab2d..e495b7fbd70 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsInterestCalculationDaysInYearType.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsInterestCalculationDaysInYearType.java
@@ -18,8 +18,7 @@
*/
package org.apache.fineract.portfolio.savings;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Arrays;
/**
*
@@ -51,29 +50,23 @@ public String getCode() {
return this.code;
}
+ // TODO: do we really need this?!?
public static Object[] integerValues() {
- final List values = new ArrayList<>();
- for (final SavingsInterestCalculationDaysInYearType enumType : values()) {
- if (enumType.getValue() > 0) {
- values.add(enumType.getValue());
- }
- }
-
- return values.toArray();
+ return Arrays.stream(values()).filter(value -> !INVALID.equals(value)).map(value -> value.value).toList().toArray();
}
- public static SavingsInterestCalculationDaysInYearType fromInt(final Integer type) {
- SavingsInterestCalculationDaysInYearType repaymentFrequencyType = SavingsInterestCalculationDaysInYearType.INVALID;
- if (type != null) {
- switch (type) {
- case 360:
- repaymentFrequencyType = SavingsInterestCalculationDaysInYearType.DAYS_360;
- break;
- case 365:
- repaymentFrequencyType = SavingsInterestCalculationDaysInYearType.DAYS_365;
- break;
- }
+ public static SavingsInterestCalculationDaysInYearType fromInt(final Integer v) {
+ if (v == null) {
+ return INVALID;
+ }
+
+ switch (v) {
+ case 360:
+ return DAYS_360;
+ case 365:
+ return DAYS_365;
+ default:
+ return INVALID;
}
- return repaymentFrequencyType;
}
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsInterestCalculationType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsInterestCalculationType.java
index 72701c72ff1..c3f63ddfb44 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsInterestCalculationType.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsInterestCalculationType.java
@@ -18,8 +18,7 @@
*/
package org.apache.fineract.portfolio.savings;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Arrays;
/**
*
@@ -64,29 +63,23 @@ public String getCode() {
return this.code;
}
+ // TODO: do we really need this?!?
public static Object[] integerValues() {
- final List values = new ArrayList<>();
- for (final SavingsInterestCalculationType enumType : values()) {
- if (enumType.getValue() > 0) {
- values.add(enumType.getValue());
- }
- }
-
- return values.toArray();
+ return Arrays.stream(values()).filter(value -> !INVALID.equals(value)).map(value -> value.value).toList().toArray();
}
- public static SavingsInterestCalculationType fromInt(final Integer type) {
- SavingsInterestCalculationType repaymentFrequencyType = SavingsInterestCalculationType.INVALID;
- if (type != null) {
- switch (type) {
- case 1:
- repaymentFrequencyType = SavingsInterestCalculationType.DAILY_BALANCE;
- break;
- case 2:
- repaymentFrequencyType = SavingsInterestCalculationType.AVERAGE_DAILY_BALANCE;
- break;
- }
+ public static SavingsInterestCalculationType fromInt(final Integer v) {
+ if (v == null) {
+ return INVALID;
+ }
+
+ switch (v) {
+ case 1:
+ return DAILY_BALANCE;
+ case 2:
+ return AVERAGE_DAILY_BALANCE;
+ default:
+ return INVALID;
}
- return repaymentFrequencyType;
}
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsPeriodFrequencyType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsPeriodFrequencyType.java
index 0fb4ccbc974..cfebadce205 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsPeriodFrequencyType.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsPeriodFrequencyType.java
@@ -18,8 +18,7 @@
*/
package org.apache.fineract.portfolio.savings;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Arrays;
/**
* An enumeration of supported calendar periods used in savings.
@@ -48,39 +47,32 @@ public String getCode() {
return this.code;
}
- public static SavingsPeriodFrequencyType fromInt(final Integer type) {
- SavingsPeriodFrequencyType repaymentFrequencyType = SavingsPeriodFrequencyType.INVALID;
- if (type != null) {
- switch (type) {
- case 0:
- repaymentFrequencyType = SavingsPeriodFrequencyType.DAYS;
- break;
- case 1:
- repaymentFrequencyType = SavingsPeriodFrequencyType.WEEKS;
- break;
- case 2:
- repaymentFrequencyType = SavingsPeriodFrequencyType.MONTHS;
- break;
- case 3:
- repaymentFrequencyType = SavingsPeriodFrequencyType.YEARS;
- break;
- }
+ public static SavingsPeriodFrequencyType fromInt(final Integer v) {
+ if (v == null) {
+ return INVALID;
+ }
+
+ switch (v) {
+ case 0:
+ return DAYS;
+ case 1:
+ return WEEKS;
+ case 2:
+ return MONTHS;
+ case 3:
+ return YEARS;
+ default:
+ return INVALID;
}
- return repaymentFrequencyType;
}
+ // TODO: why not just use the enum values... just more boilerplate code here!!
public boolean isInvalid() {
- return this.value.equals(SavingsPeriodFrequencyType.INVALID.value);
+ return this.equals(INVALID);
}
+ // TODO: do we really need this?!?
public static Object[] integerValues() {
- final List values = new ArrayList<>();
- for (final SavingsPeriodFrequencyType enumType : values()) {
- if (!enumType.isInvalid()) {
- values.add(enumType.getValue());
- }
- }
-
- return values.toArray();
+ return Arrays.stream(values()).filter(value -> !INVALID.equals(value)).map(value -> value.value).toList().toArray();
}
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsPostingInterestPeriodType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsPostingInterestPeriodType.java
index aefdb5f080b..4da0987a676 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsPostingInterestPeriodType.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsPostingInterestPeriodType.java
@@ -18,8 +18,7 @@
*/
package org.apache.fineract.portfolio.savings;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Arrays;
/**
* The interest posting period is the span of time at the end of which savings earned but not yet credited/posted in a
@@ -49,38 +48,29 @@ public String getCode() {
return this.code;
}
+ // TODO: do we really need this?!?
public static Object[] integerValues() {
- final List values = new ArrayList<>();
- for (final SavingsPostingInterestPeriodType enumType : values()) {
- if (enumType.getValue() > 0) {
- values.add(enumType.getValue());
- }
- }
-
- return values.toArray();
+ return Arrays.stream(values()).filter(value -> !INVALID.equals(value)).map(value -> value.value).toList().toArray();
}
- public static SavingsPostingInterestPeriodType fromInt(final Integer type) {
- SavingsPostingInterestPeriodType repaymentFrequencyType = SavingsPostingInterestPeriodType.INVALID;
- if (type != null) {
- switch (type) {
- case 1:
- repaymentFrequencyType = SavingsPostingInterestPeriodType.DAILY;
- break;
- case 4:
- repaymentFrequencyType = SavingsPostingInterestPeriodType.MONTHLY;
- break;
- case 5:
- repaymentFrequencyType = SavingsPostingInterestPeriodType.QUATERLY;
- break;
- case 6:
- repaymentFrequencyType = SavingsPostingInterestPeriodType.BIANNUAL;
- break;
- case 7:
- repaymentFrequencyType = SavingsPostingInterestPeriodType.ANNUAL;
- break;
- }
+ public static SavingsPostingInterestPeriodType fromInt(final Integer v) {
+ if (v == null) {
+ return INVALID;
+ }
+
+ switch (v) {
+ case 1:
+ return DAILY;
+ case 4:
+ return MONTHLY;
+ case 5:
+ return QUATERLY;
+ case 6:
+ return BIANNUAL;
+ case 7:
+ return ANNUAL;
+ default:
+ return INVALID;
}
- return repaymentFrequencyType;
}
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsWithdrawalFeesType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsWithdrawalFeesType.java
index e8b1f801894..7aaaed0d854 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsWithdrawalFeesType.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsWithdrawalFeesType.java
@@ -18,8 +18,7 @@
*/
package org.apache.fineract.portfolio.savings;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Arrays;
public enum SavingsWithdrawalFeesType {
@@ -43,28 +42,23 @@ public String getCode() {
return this.code;
}
+ // TODO: do we really need this?!?
public static Object[] integerValues() {
- final List values = new ArrayList<>();
- for (final SavingsWithdrawalFeesType enumType : values()) {
- if (enumType.getValue() > 0) {
- values.add(enumType.getValue());
- }
- }
-
- return values.toArray();
+ return Arrays.stream(values()).filter(value -> !INVALID.equals(value)).map(value -> value.value).toList().toArray();
}
- public static SavingsWithdrawalFeesType fromInt(final Integer type) {
+ public static SavingsWithdrawalFeesType fromInt(final Integer v) {
+ if (v == null) {
+ return INVALID;
+ }
- SavingsWithdrawalFeesType withdrawalFeeType = SavingsWithdrawalFeesType.INVALID;
- switch (type) {
+ switch (v) {
case 1:
- withdrawalFeeType = FLAT;
- break;
+ return FLAT;
case 2:
- withdrawalFeeType = PERCENT_OF_AMOUNT;
- break;
+ return PERCENT_OF_AMOUNT;
+ default:
+ return INVALID;
}
- return withdrawalFeeType;
}
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java b/fineract-core/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
index db2972cfbb6..cce8954dead 100644
--- a/fineract-core/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
+++ b/fineract-core/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java
@@ -657,6 +657,10 @@ public void validateHasCheckerPermissionTo(final String function) {
}
}
+ public boolean isCheckerSuperUser() {
+ return hasPermissionTo("CHECKER_SUPER_USER");
+ }
+
public void validateHasDatatableReadPermission(final String datatable) {
if (hasNotPermissionForDatatable(datatable, "READ")) {
throw new NoAuthorizationException("Not authorised to read datatable: " + datatable);
diff --git a/fineract-core/src/test/java/org/apache/fineract/infrastructure/core/exception/IdempotencyCommandProcessFailedExceptionTest.java b/fineract-core/src/test/java/org/apache/fineract/infrastructure/core/exception/IdempotencyCommandProcessFailedExceptionTest.java
index 91e4095a16c..04ba9aa541f 100644
--- a/fineract-core/src/test/java/org/apache/fineract/infrastructure/core/exception/IdempotencyCommandProcessFailedExceptionTest.java
+++ b/fineract-core/src/test/java/org/apache/fineract/infrastructure/core/exception/IdempotencyCommandProcessFailedExceptionTest.java
@@ -34,6 +34,7 @@
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
import org.apache.fineract.infrastructure.core.exceptionmapper.IdempotentCommandExceptionMapper;
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
+import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -48,6 +49,11 @@ public void setUp() {
ThreadLocalContextUtil.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, actualDate)));
}
+ @AfterEach
+ public void tearDown() {
+ ThreadLocalContextUtil.reset();
+ }
+
@Test
public void testInconsistentStatus() {
IdempotentCommandExceptionMapper mapper = new IdempotentCommandExceptionMapper();
diff --git a/fineract-doc/.asciidoctorconfig b/fineract-doc/.asciidoctorconfig
index b8b62167628..c6fcc35fe2a 100644
--- a/fineract-doc/.asciidoctorconfig
+++ b/fineract-doc/.asciidoctorconfig
@@ -1,5 +1,5 @@
-:years: 2015-2022
-:revnumber: 1.8.0
+:years: 2015-2024
+:revnumber: 1.9.0-xxxx
:draft: true
:rootdir: {asciidoctorconfigdir}/..
:generated: {asciidoctorconfigdir}/build/generated/asciidoc
diff --git a/fineract-doc/build.gradle b/fineract-doc/build.gradle
index d9464d20bfa..7f1c6bb679a 100644
--- a/fineract-doc/build.gradle
+++ b/fineract-doc/build.gradle
@@ -30,7 +30,7 @@ asciidoctorj {
generated: "${buildDir}/generated/asciidoc",
imagesdir: "${projectDir}/src/docs/en/images",
diagramsdir: "${projectDir}/src/docs/en/diagrams",
- years: '2015-2022',
+ years: '2015-2024',
revnumber: "${project.version}".toString(),
rootdir: "${rootDir}".toString(),
baseurl: 'fineract.apache.org',
diff --git a/fineract-doc/src/docs/en/config.adoc b/fineract-doc/src/docs/en/config.adoc
index dd47f4ec746..fe60469584d 100644
--- a/fineract-doc/src/docs/en/config.adoc
+++ b/fineract-doc/src/docs/en/config.adoc
@@ -14,7 +14,7 @@
:source-highlighter: coderay
:experimental:
:source-language: java
-:years: 2015-2022
+:years: 2015-2024
:lang: en
:encoding: utf-8
:linkattrs:
diff --git a/fineract-investor/dependencies.gradle b/fineract-investor/dependencies.gradle
index 44a84d1d9be..943673f452e 100644
--- a/fineract-investor/dependencies.gradle
+++ b/fineract-investor/dependencies.gradle
@@ -52,7 +52,7 @@ dependencies {
'org.springdoc:springdoc-openapi-starter-webmvc-ui',
'org.mapstruct:mapstruct',
- 'io.github.resilience4j:resilience4j-spring-boot2',
+ 'io.github.resilience4j:resilience4j-spring-boot3',
)
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnerJournalEntryServiceImpl.java b/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnerJournalEntryServiceImpl.java
index dcd41fcb2b4..186bb64c70c 100644
--- a/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnerJournalEntryServiceImpl.java
+++ b/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnerJournalEntryServiceImpl.java
@@ -22,7 +22,6 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.accounting.journalentry.domain.JournalEntry;
-import org.apache.fineract.infrastructure.event.business.BusinessEventListener;
import org.apache.fineract.infrastructure.event.business.domain.journalentry.LoanJournalEntryCreatedBusinessEvent;
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
import org.apache.fineract.investor.config.InvestorModuleIsEnabledCondition;
@@ -46,26 +45,17 @@ public class ExternalAssetOwnerJournalEntryServiceImpl implements ExternalAssetO
@PostConstruct
public void addListeners() {
- businessEventNotifierService.addPostBusinessEventListener(LoanJournalEntryCreatedBusinessEvent.class,
- new HandleLoanJournalEntryCreatedBusinessEvent());
- }
-
- private final class HandleLoanJournalEntryCreatedBusinessEvent implements BusinessEventListener {
-
- @Override
- public void onBusinessEvent(LoanJournalEntryCreatedBusinessEvent event) {
+ businessEventNotifierService.addPostBusinessEventListener(LoanJournalEntryCreatedBusinessEvent.class, event -> {
JournalEntry journalEntry = event.get();
- createMapping(journalEntry);
- }
- private void createMapping(JournalEntry journalEntry) {
Long loanId = loanTransactionRepository.findLoanIdById(journalEntry.getLoanTransactionId()).orElseThrow();
+
externalAssetOwnerTransferLoanMappingRepository.findByLoanId(loanId).ifPresent(transferLoanMapping -> {
ExternalAssetOwnerJournalEntryMapping mapping = new ExternalAssetOwnerJournalEntryMapping();
mapping.setJournalEntry(journalEntry);
mapping.setOwner(transferLoanMapping.getOwnerTransfer().getOwner());
externalAssetOwnerJournalEntryMappingRepository.saveAndFlush(mapping);
});
- }
+ });
}
}
diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanStatusChangePlatformServiceImpl.java b/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanStatusChangePlatformServiceImpl.java
index e1855f0b178..efe3d72140e 100644
--- a/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanStatusChangePlatformServiceImpl.java
+++ b/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanStatusChangePlatformServiceImpl.java
@@ -21,7 +21,6 @@
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.configuration.service.ConfigurationReadPlatformService;
-import org.apache.fineract.infrastructure.event.business.BusinessEventListener;
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanStatusChangedBusinessEvent;
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
@@ -39,19 +38,12 @@ public class ExternalAssetOwnerLoanStatusChangePlatformServiceImpl implements Ex
@PostConstruct
public void addListeners() {
- businessEventNotifierService.addPostBusinessEventListener(LoanStatusChangedBusinessEvent.class,
- new ExternalAssetOwnerLoanStatusChangedListener());
- }
-
- private final class ExternalAssetOwnerLoanStatusChangedListener implements BusinessEventListener {
-
- @Override
- public void onBusinessEvent(LoanStatusChangedBusinessEvent event) {
+ businessEventNotifierService.addPostBusinessEventListener(LoanStatusChangedBusinessEvent.class, event -> {
final Loan loan = event.get();
if (configurationReadPlatformService.retrieveGlobalConfiguration(ASSET_EXTERNALIZATION_OF_NON_ACTIVE_LOANS).isEnabled()
&& (loan.isClosed() || loan.getStatus().isOverpaid())) {
loanAccountOwnerTransferService.handleLoanClosedOrOverpaid(loan);
}
- }
+ });
}
}
diff --git a/fineract-investor/src/test/java/org/apache/fineract/investor/cob/loan/LoanAccountOwnerTransferBusinessStepTest.java b/fineract-investor/src/test/java/org/apache/fineract/investor/cob/loan/LoanAccountOwnerTransferBusinessStepTest.java
index bd1eab0fc16..8286eed6f22 100644
--- a/fineract-investor/src/test/java/org/apache/fineract/investor/cob/loan/LoanAccountOwnerTransferBusinessStepTest.java
+++ b/fineract-investor/src/test/java/org/apache/fineract/investor/cob/loan/LoanAccountOwnerTransferBusinessStepTest.java
@@ -54,6 +54,7 @@
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
import org.apache.fineract.portfolio.loanaccount.domain.LoanSummary;
import org.jetbrains.annotations.NotNull;
+import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -90,6 +91,11 @@ public void setUp() {
externalAssetOwnerTransferLoanMappingRepository, accountingService, businessEventNotifierService);
}
+ @AfterEach
+ public void tearDown() {
+ ThreadLocalContextUtil.reset();
+ }
+
@Test
public void givenLoanNoTransfer() {
// given
diff --git a/fineract-loan/dependencies.gradle b/fineract-loan/dependencies.gradle
index c6f4d7c1a65..bd2a15867e5 100644
--- a/fineract-loan/dependencies.gradle
+++ b/fineract-loan/dependencies.gradle
@@ -47,7 +47,7 @@ dependencies {
'org.springdoc:springdoc-openapi-starter-webmvc-ui',
'org.mapstruct:mapstruct',
- 'io.github.resilience4j:resilience4j-spring-boot2',
+ 'io.github.resilience4j:resilience4j-spring-boot3',
'org.apache.httpcomponents:httpcore',
)
compileOnly 'org.projectlombok:lombok'
diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralApiConstants.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralApiConstants.java
index 597791b35cc..cc0d8b3ef0e 100644
--- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralApiConstants.java
+++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralApiConstants.java
@@ -18,8 +18,9 @@
*/
package org.apache.fineract.portfolio.collateral.api;
-import java.util.HashSet;
+import java.util.Arrays;
import java.util.Set;
+import java.util.stream.Collectors;
public final class CollateralApiConstants {
@@ -43,16 +44,8 @@ public enum CollateralJSONinputParams {
this.value = value;
}
- private static final Set values = new HashSet<>();
-
- static {
- for (final CollateralJSONinputParams type : CollateralJSONinputParams.values()) {
- values.add(type.value);
- }
- }
-
public static Set getAllValues() {
- return values;
+ return Arrays.stream(values()).map(CollateralJSONinputParams::getValue).collect(Collectors.toSet());
}
@Override
diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/command/LoanChargeCommand.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/command/LoanChargeCommand.java
index 4b906bd0c51..a135c5ab5aa 100644
--- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/command/LoanChargeCommand.java
+++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/command/LoanChargeCommand.java
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.portfolio.loanaccount.command;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.math.BigDecimal;
import java.time.LocalDate;
import org.apache.fineract.portfolio.loanaccount.domain.LoanCharge;
@@ -49,6 +50,7 @@ public LoanChargeCommand(final Long id, final Long chargeId, final BigDecimal am
}
@Override
+ @SuppressFBWarnings(value = "EQ_COMPARETO_USE_OBJECT_EQUALS", justification = "TODO: fix this! See: https://stackoverflow.com/questions/2609037/findbugs-how-to-solve-eq-compareto-use-object-equals")
public int compareTo(final LoanChargeCommand o) {
int comparison = this.chargeId.compareTo(o.chargeId);
if (comparison == 0) {
diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java
index 52ca276fed6..c258ef1eea0 100644
--- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java
+++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java
@@ -26,6 +26,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import org.apache.fineract.infrastructure.core.service.DateUtils;
@@ -688,7 +689,7 @@ protected void updateChargesPaidAmountBy(final LoanTransaction loanTransaction,
if (loanTransaction.isChargePayment()) {
for (final LoanChargePaidBy chargePaidBy : chargesPaidBies) {
LoanCharge loanCharge = chargePaidBy.getLoanCharge();
- if (loanCharge.getId().equals(unpaidCharge.getId())) {
+ if (loanCharge != null && Objects.equals(loanCharge.getId(), unpaidCharge.getId())) {
chargePaidBy.setAmount(amountPaidTowardsCharge.getAmount());
}
}
diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ChargeOrTransaction.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ChargeOrTransaction.java
index 5c5a4a0437d..4e69c90c3f8 100644
--- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ChargeOrTransaction.java
+++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/ChargeOrTransaction.java
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
@@ -81,6 +82,7 @@ private OffsetDateTime getCreatedDateTime() {
}
@Override
+ @SuppressFBWarnings(value = "EQ_COMPARETO_USE_OBJECT_EQUALS", justification = "TODO: fix this! See: https://stackoverflow.com/questions/2609037/findbugs-how-to-solve-eq-compareto-use-object-equals")
public int compareTo(@NotNull ChargeOrTransaction o) {
int datePortion = this.getEffectiveDate().compareTo(o.getEffectiveDate());
if (datePortion == 0) {
diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/HeavensFamilyLoanRepaymentScheduleTransactionProcessor.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/HeavensFamilyLoanRepaymentScheduleTransactionProcessor.java
index 984609ec6f2..f9d065abe6b 100644
--- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/HeavensFamilyLoanRepaymentScheduleTransactionProcessor.java
+++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/HeavensFamilyLoanRepaymentScheduleTransactionProcessor.java
@@ -221,7 +221,6 @@ protected Money handleRefundTransactionPaymentOfInstallment(final LoanRepaymentS
List transactionMappings) {
final LocalDate transactionDate = loanTransaction.getTransactionDate();
- final MonetaryCurrency currency = transactionAmountUnprocessed.getCurrency();
Money transactionAmountRemaining = transactionAmountUnprocessed;
Money principalPortion = Money.zero(transactionAmountRemaining.getCurrency());
Money interestPortion = Money.zero(transactionAmountRemaining.getCurrency());
diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle
index c767aa1a388..f4fb4fec0ce 100644
--- a/fineract-provider/build.gradle
+++ b/fineract-provider/build.gradle
@@ -264,22 +264,6 @@ jib {
creationTime = 'USE_CURRENT_TIMESTAMP'
mainClass = 'org.apache.fineract.ServerApplication'
extraClasspath = ['/app/plugins/*']
- jvmFlags = [
- '-Xms1G',
- '-XshowSettings:vm',
- '-XX:+UseContainerSupport',
- '-XX:+UseStringDeduplication',
- '-XX:MinRAMPercentage=25',
- '-XX:MaxRAMPercentage=80',
- '--add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED',
- '--add-opens=java.base/java.lang=ALL-UNNAMED',
- '--add-opens=java.base/java.lang.invoke=ALL-UNNAMED',
- '--add-opens=java.base/java.io=ALL-UNNAMED',
- '--add-opens=java.base/java.security=ALL-UNNAMED',
- '--add-opens=java.base/java.util=ALL-UNNAMED',
- '--add-opens=java.management/javax.management=ALL-UNNAMED',
- '--add-opens=java.naming/javax.naming=ALL-UNNAMED'
- ]
args = [
'-Duser.home=/tmp',
'-Dfile.encoding=UTF-8',
@@ -336,6 +320,12 @@ cucumber {
tags = 'not @ignore'
main = 'io.cucumber.core.cli.Main'
shorten = 'argfile'
+ plugin = [
+ 'pretty',
+ 'html:build/reports/cucumber/report.html',
+ 'json:build/reports/cucumber/report.json',
+ 'junit:build/reports/cucumber/report.xml'
+ ]
}
tasks.jibDockerBuild.dependsOn(bootJar)
diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle
index 60a5e7c824e..75ba8b9d886 100644
--- a/fineract-provider/dependencies.gradle
+++ b/fineract-provider/dependencies.gradle
@@ -18,6 +18,12 @@
*/
dependencies {
+ modules {
+ module("io.swagger.core.v3:swagger-annotations") {
+ replacedBy("io.swagger.core.v3:swagger-annotations-jakarta")
+ }
+ }
+
implementation(project(path: ':fineract-core'))
implementation(project(path: ':fineract-investor'))
implementation(project(path: ':fineract-loan'))
@@ -96,14 +102,14 @@ dependencies {
'org.springdoc:springdoc-openapi-starter-webmvc-ui',
'org.mapstruct:mapstruct',
- 'io.github.resilience4j:resilience4j-spring-boot2',
+ 'io.github.resilience4j:resilience4j-spring-boot3',
)
- implementation ('software.amazon.msk:aws-msk-iam-auth:2.0.0') {
+ implementation ('software.amazon.msk:aws-msk-iam-auth:2.0.2') {
exclude group: 'commons-logging'
}
- implementation 'io.swagger.core.v3:swagger-jaxrs2-jakarta:2.2.11'
+ implementation 'io.swagger.core.v3:swagger-jaxrs2-jakarta:2.2.19'
implementation ('org.apache.commons:commons-email') {
exclude group: 'com.sun.mail', module: 'javax.mail'
@@ -122,7 +128,7 @@ dependencies {
implementation ('jakarta.xml.bind:jakarta.xml.bind-api') {
exclude group: 'jakarta.activation'
}
- implementation ('org.apache.activemq:activemq-client') {
+ implementation ('org.apache.activemq:activemq-client-jakarta') {
exclude group: 'org.apache.geronimo.specs'
exclude group: 'javax.annotation', module: 'javax.annotation-api'
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java
index c107c8a60b3..48b655a251c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java
@@ -83,7 +83,7 @@ public class JournalEntriesApiResource {
"entityType", "entityId", "createdByUserId", "createdDate", "submittedOnDate", "createdByUserName", "comments", "reversed",
"referenceNumber", "currency", "transactionDetails"));
- private final String resourceNameForPermission = "JOURNALENTRY";
+ private static final String RESOURCE_NAME_FOR_PERMISSION = "JOURNALENTRY";
private final PlatformSecurityContext context;
private final JournalEntryReadPlatformService journalEntryReadPlatformService;
@@ -125,7 +125,7 @@ public String retrieveAll(@Context final UriInfo uriInfo,
@QueryParam("runningBalance") @Parameter(description = "runningBalance") final boolean runningBalance,
@QueryParam("transactionDetails") @Parameter(description = "transactionDetails") final boolean transactionDetails) {
- this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
+ this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSION);
final DateFormat dateFormat = StringUtils.isBlank(rawDateFormat) ? null : new DateFormat(rawDateFormat);
@@ -174,7 +174,7 @@ public String retrieveJournalEntryById(
@QueryParam("runningBalance") @Parameter(description = "runningBalance") final boolean runningBalance,
@QueryParam("transactionDetails") @Parameter(description = "transactionDetails") final boolean transactionDetails) {
- this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
+ this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSION);
JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails,
runningBalance);
final JournalEntryData glJournalEntryData = this.journalEntryReadPlatformService.retrieveGLJournalEntryById(journalEntryId,
@@ -260,7 +260,7 @@ public String retrieveJournalEntries(@QueryParam("offset") final Integer offset,
public String retrieveOpeningBalance(@Context final UriInfo uriInfo, @QueryParam("officeId") final Long officeId,
@QueryParam("currencyCode") final String currencyCode) {
- this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
+ this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSION);
final OfficeOpeningBalancesData officeOpeningBalancesData = this.journalEntryReadPlatformService
.retrieveOfficeOpeningBalances(officeId, currencyCode);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java
index 1272055ca01..49aaf44a50b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java
@@ -724,10 +724,6 @@ private void createJournalEntriesForChargeOffLoanRepaymentAndWriteOffs(LoanDTO l
populateCreditDebitMaps(loanProductId, overPaymentAmount, paymentTypeId, AccrualAccountsForLoan.OVERPAYMENT.getValue(),
AccrualAccountsForLoan.GOODWILL_CREDIT.getValue(), accountMapForCredit, accountMapForDebit);
- } else if (loanTransactionDTO.getTransactionType().isRepayment()) {
- populateCreditDebitMaps(loanProductId, overPaymentAmount, paymentTypeId, AccrualAccountsForLoan.OVERPAYMENT.getValue(),
- AccrualAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
-
} else {
populateCreditDebitMaps(loanProductId, overPaymentAmount, paymentTypeId, AccrualAccountsForLoan.OVERPAYMENT.getValue(),
AccrualAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForLoan.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForLoan.java
index 6786c8a7fbe..88f5f39c59b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForLoan.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForLoan.java
@@ -701,10 +701,6 @@ private void createJournalEntriesForChargeOffLoanRepayments(LoanDTO loanDTO, Loa
} else if (loanTransactionDTO.getTransactionType().isGoodwillCredit()) {
populateCreditDebitMaps(loanProductId, overPaymentAmount, paymentTypeId, CashAccountsForLoan.OVERPAYMENT.getValue(),
CashAccountsForLoan.GOODWILL_CREDIT.getValue(), accountMapForCredit, accountMapForDebit);
- } else if (loanTransactionDTO.getTransactionType().isRepayment()) {
- populateCreditDebitMaps(loanProductId, overPaymentAmount, paymentTypeId, CashAccountsForLoan.OVERPAYMENT.getValue(),
- CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
-
} else {
populateCreditDebitMaps(loanProductId, overPaymentAmount, paymentTypeId, CashAccountsForLoan.OVERPAYMENT.getValue(),
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
index bfc192996a6..fa1d7273748 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
@@ -27,7 +27,6 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Set;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -401,50 +400,46 @@ public String createProvisioningJournalEntries(ProvisioningEntry provisioningEnt
}
}
- Set officeSet = officeMap.keySet();
Map liabilityMap = new HashMap<>();
Map expenseMap = new HashMap<>();
- for (OfficeCurrencyKey key : officeSet) {
+ for (Map.Entry> entry : officeMap.entrySet()) {
liabilityMap.clear();
expenseMap.clear();
- List entries = officeMap.get(key);
- for (LoanProductProvisioningEntry entry : entries) {
- if (liabilityMap.containsKey(entry.getLiabilityAccount())) {
- BigDecimal amount = liabilityMap.get(entry.getLiabilityAccount());
- amount = amount.add(entry.getReservedAmount());
- liabilityMap.put(entry.getLiabilityAccount(), amount);
+ for (LoanProductProvisioningEntry lppEntry : entry.getValue()) {
+ if (liabilityMap.containsKey(lppEntry.getLiabilityAccount())) {
+ BigDecimal amount = liabilityMap.get(lppEntry.getLiabilityAccount());
+ amount = amount.add(lppEntry.getReservedAmount());
+ liabilityMap.put(lppEntry.getLiabilityAccount(), amount);
} else {
- BigDecimal amount = BigDecimal.ZERO.add(entry.getReservedAmount());
- liabilityMap.put(entry.getLiabilityAccount(), amount);
+ BigDecimal amount = BigDecimal.ZERO.add(lppEntry.getReservedAmount());
+ liabilityMap.put(lppEntry.getLiabilityAccount(), amount);
}
- if (expenseMap.containsKey(entry.getExpenseAccount())) {
- BigDecimal amount = expenseMap.get(entry.getExpenseAccount());
- amount = amount.add(entry.getReservedAmount());
- expenseMap.put(entry.getExpenseAccount(), amount);
+ if (expenseMap.containsKey(lppEntry.getExpenseAccount())) {
+ BigDecimal amount = expenseMap.get(lppEntry.getExpenseAccount());
+ amount = amount.add(lppEntry.getReservedAmount());
+ expenseMap.put(lppEntry.getExpenseAccount(), amount);
} else {
- BigDecimal amount = BigDecimal.ZERO.add(entry.getReservedAmount());
- expenseMap.put(entry.getExpenseAccount(), amount);
+ BigDecimal amount = BigDecimal.ZERO.add(lppEntry.getReservedAmount());
+ expenseMap.put(lppEntry.getExpenseAccount(), amount);
}
}
- createJournalEntry(provisioningEntry.getCreatedDate(), provisioningEntry.getId(), key.office, key.currency, liabilityMap,
- expenseMap);
+ createJournalEntry(provisioningEntry.getCreatedDate(), provisioningEntry.getId(), entry.getKey().office,
+ entry.getKey().currency, liabilityMap, expenseMap);
}
return "P" + provisioningEntry.getId();
}
private void createJournalEntry(LocalDate transactionDate, Long entryId, Office office, String currencyCode,
Map liabilityMap, Map expenseMap) {
- Set liabilityAccounts = liabilityMap.keySet();
- for (GLAccount account : liabilityAccounts) {
- this.helper.createProvisioningCreditJournalEntry(transactionDate, entryId, office, currencyCode, account,
- liabilityMap.get(account));
- }
- Set expenseAccounts = expenseMap.keySet();
- for (GLAccount account : expenseAccounts) {
- this.helper.createProvisioningDebitJournalEntry(transactionDate, entryId, office, currencyCode, account,
- expenseMap.get(account));
+ for (Map.Entry entry : liabilityMap.entrySet()) {
+ this.helper.createProvisioningCreditJournalEntry(transactionDate, entryId, office, currencyCode, entry.getKey(),
+ entry.getValue());
+ }
+ for (Map.Entry entry : expenseMap.entrySet()) {
+ this.helper.createProvisioningDebitJournalEntry(transactionDate, entryId, office, currencyCode, entry.getKey(),
+ entry.getValue());
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java
index 114db8359b4..40e155e4831 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java
@@ -86,7 +86,7 @@ public class AccountingRuleApiResource {
"allowedCreditTagOptions", "allowedDebitTagOptions", "debitTags", "creditTags", "creditAccounts", "debitAccounts",
"allowMultipleCreditEntries", "allowMultipleDebitEntries", "tag"));
- private final String resourceNameForPermission = "ACCOUNTINGRULE";
+ private static final String RESOURCE_NAME_FOR_PERMISSION = "ACCOUNTINGRULE";
private final AccountingRuleReadPlatformService accountingRuleReadPlatformService;
private final GLAccountReadPlatformService accountReadPlatformService;
@@ -107,7 +107,7 @@ public class AccountingRuleApiResource {
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.GetAccountRulesTemplateResponse.class))) })
public String retrieveTemplate(@Context final UriInfo uriInfo) {
- this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
+ this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSION);
AccountingRuleData accountingRuleData = null;
accountingRuleData = handleTemplate(accountingRuleData);
@@ -126,7 +126,7 @@ public String retrieveTemplate(@Context final UriInfo uriInfo) {
public String retrieveAllAccountingRules(@Context final UriInfo uriInfo) {
final AppUser currentUser = this.context.authenticatedUser();
- currentUser.validateHasReadPermission(this.resourceNameForPermission);
+ currentUser.validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSION);
final String hierarchy = currentUser.getOffice().getHierarchy();
final String hierarchySearchString = hierarchy + "%";
@@ -159,7 +159,7 @@ public String retreiveAccountingRule(
@PathParam("accountingRuleId") @Parameter(description = "accountingRuleId") final Long accountingRuleId,
@Context final UriInfo uriInfo) {
- this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
+ this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSION);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
AccountingRuleData accountingRuleData = this.accountingRuleReadPlatformService.retrieveAccountingRuleById(accountingRuleId);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByQueryCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByQueryCommandStrategy.java
index 75e71808e63..4bb42c1e851 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByQueryCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByQueryCommandStrategy.java
@@ -23,6 +23,7 @@
import jakarta.ws.rs.core.UriInfo;
import java.util.Map;
import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.batch.command.CommandStrategy;
import org.apache.fineract.batch.command.CommandStrategyUtils;
@@ -39,6 +40,7 @@
* raised by {@link DatatablesApiResource} and map those errors to appropriate status codes in BatchResponse.
*/
@Component
+@Slf4j
@RequiredArgsConstructor
public class GetDatatableEntryByQueryCommandStrategy implements CommandStrategy {
@@ -81,6 +83,7 @@ public BatchResponse execute(final BatchRequest request, @SuppressWarnings("unus
case "columnFilter" -> columnFilter = entry.getValue();
case "valueFilter" -> valueFilter = entry.getValue();
case "resultColumns" -> resultColumns = entry.getValue();
+ default -> log.warn("Query parameter could not be mapped: {}", entry.getKey());
}
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/cob/listener/AbstractLoanItemListener.java b/fineract-provider/src/main/java/org/apache/fineract/cob/listener/AbstractLoanItemListener.java
index d02179180a0..df2bc95a181 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/cob/listener/AbstractLoanItemListener.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/cob/listener/AbstractLoanItemListener.java
@@ -68,9 +68,12 @@ protected void doInTransactionWithoutResult(@NotNull TransactionStatus status) {
@OnReadError
public void onReadError(Exception e) {
- LoanReadException ee = (LoanReadException) e;
- log.warn("Error was triggered during reading of Loan (id={}) due to: {}", ee.getId(), ThrowableSerialization.serialize(e));
- updateAccountLockWithError(List.of(ee.getId()), "Loan (id: %d) reading is failed", e);
+ if (e instanceof LoanReadException ee) {
+ log.warn("Error was triggered during reading of Loan (id={}) due to: {}", ee.getId(), ThrowableSerialization.serialize(e));
+ updateAccountLockWithError(List.of(ee.getId()), "Loan (id: %d) reading is failed", e);
+ } else {
+ log.error("Could not handle read error", e);
+ }
}
@OnProcessError
diff --git a/fineract-provider/src/main/java/org/apache/fineract/cob/loan/SetLoanDelinquencyTagsBusinessStep.java b/fineract-provider/src/main/java/org/apache/fineract/cob/loan/SetLoanDelinquencyTagsBusinessStep.java
index c94ad88bdca..732af1ba345 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/cob/loan/SetLoanDelinquencyTagsBusinessStep.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/cob/loan/SetLoanDelinquencyTagsBusinessStep.java
@@ -25,7 +25,6 @@
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
import org.apache.fineract.infrastructure.core.domain.ActionContext;
import org.apache.fineract.infrastructure.core.domain.ExternalId;
import org.apache.fineract.infrastructure.core.service.DateUtils;
@@ -97,9 +96,9 @@ public Loan execute(Loan loan) {
}
private boolean isDelinquencyOnPause(Loan loan, List effectiveDelinquencyList) {
- LocalDate cobBusinessDate = ThreadLocalContextUtil.getBusinessDateByType(BusinessDateType.COB_DATE);
- boolean isPaused = isPausedOnDate(cobBusinessDate, effectiveDelinquencyList);
- boolean wasPausedOneDayBefore = isPausedOnDate(cobBusinessDate.minusDays(1), effectiveDelinquencyList);
+ LocalDate businessDate = DateUtils.getBusinessLocalDate();
+ boolean isPaused = isPausedOnDate(businessDate, effectiveDelinquencyList);
+ boolean wasPausedOneDayBefore = isPausedOnDate(businessDate.minusDays(1), effectiveDelinquencyList);
if ((isPaused && !wasPausedOneDayBefore) || (!isPaused && wasPausedOneDayBefore)) {
businessEventNotifierService.notifyPostBusinessEvent(new LoanDelinquencyRangeChangeBusinessEvent(loan));
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/cob/service/LoanCOBCatchUpServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/cob/service/LoanCOBCatchUpServiceImpl.java
index 07a427fc164..8643df3b606 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/cob/service/LoanCOBCatchUpServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/cob/service/LoanCOBCatchUpServiceImpl.java
@@ -18,7 +18,6 @@
*/
package org.apache.fineract.cob.service;
-import com.google.gson.Gson;
import java.time.LocalDate;
import java.util.List;
import lombok.RequiredArgsConstructor;
@@ -30,11 +29,8 @@
import org.apache.fineract.cob.loan.RetrieveLoanIdService;
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
import org.apache.fineract.infrastructure.core.domain.FineractContext;
-import org.apache.fineract.infrastructure.core.serialization.GoogleGsonSerializerHelper;
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
-import org.apache.fineract.infrastructure.jobs.domain.CustomJobParameterRepository;
import org.apache.fineract.infrastructure.jobs.domain.JobExecutionRepository;
-import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.context.annotation.Conditional;
import org.springframework.stereotype.Service;
@@ -45,12 +41,8 @@ public class LoanCOBCatchUpServiceImpl implements LoanCOBCatchUpService {
private final AsyncLoanCOBExecutorService asyncLoanCOBExecutorService;
private final JobExecutionRepository jobExecutionRepository;
- private final JobExplorer jobExplorer;
private final RetrieveLoanIdService retrieveLoanIdService;
-
private final LoanAccountLockService accountLockService;
- private final CustomJobParameterRepository customJobParameterRepository;
- protected Gson gson = GoogleGsonSerializerHelper.createSimpleGson();
@Override
public void unlockHardLockedLoans() {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java
index 744b100106a..43486506c40 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java
@@ -105,7 +105,7 @@ public String retrieveAuditEntries(@Context final UriInfo uriInfo,
@QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy,
@QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) {
- this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSIONS);
+ this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
final PaginationParameters parameters = PaginationParameters.instance(paged, offset, limit, orderBy, sortOrder);
final SQLBuilder extraCriteria = getExtraCriteria(actionName, entityName, resourceId, makerId, makerDateTimeFrom, makerDateTimeTo,
checkerId, checkerDateTimeFrom, checkerDateTimeTo, processingResult, officeId, groupId, clientId, loanId, savingsAccountId);
@@ -135,7 +135,7 @@ public String retrieveAuditEntries(@Context final UriInfo uriInfo,
public String retrieveAuditEntry(@PathParam("auditId") @Parameter(description = "auditId") final Long auditId,
@Context final UriInfo uriInfo) {
- this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSIONS);
+ this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
final AuditData auditEntry = this.auditReadPlatformService.retrieveAuditEntry(auditId);
@@ -153,7 +153,7 @@ public String retrieveAuditEntry(@PathParam("auditId") @Parameter(description =
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = MakercheckersApiResourceSwagger.GetMakerCheckersSearchTemplateResponse.class))) })
public String retrieveAuditSearchTemplate(@Context final UriInfo uriInfo) {
- this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSIONS);
+ this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java
index 07c720d205d..9adaee5aea8 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java
@@ -21,6 +21,8 @@
import com.google.common.base.Splitter;
import java.time.LocalDate;
import java.util.List;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
@@ -40,6 +42,7 @@
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellReference;
+@Slf4j
public final class ImportHandlerUtils {
private ImportHandlerUtils() {
@@ -73,20 +76,20 @@ public static Long readAsLong(int colIndex, Row row) {
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if (c.getCellType() == CellType.FORMULA) {
if (eval != null) {
- CellValue val = null;
+ CellValue value;
try {
- val = eval.evaluate(c);
- } catch (NullPointerException npe) {
- return null;
+ value = eval.evaluate(c);
+ return ((Double) value.getNumberValue()).longValue();
+ } catch (Exception e) {
+ log.error("Cell evaluation error: ", e);
}
- return ((Double) val.getNumberValue()).longValue();
}
+ return null;
} else if (c.getCellType() == CellType.NUMERIC) {
return ((Double) c.getNumericCellValue()).longValue();
} else {
return Long.parseLong(row.getCell(colIndex).getStringCellValue());
}
- return null;
}
public static String readAsString(int colIndex, Row row) {
@@ -98,26 +101,20 @@ public static String readAsString(int colIndex, Row row) {
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if (c.getCellType() == CellType.FORMULA) {
if (eval != null) {
- CellValue val = null;
+ CellValue value;
try {
- val = eval.evaluate(c);
- } catch (NullPointerException npe) {
- return null;
- }
+ value = eval.evaluate(c);
- String res = trimEmptyDecimalPortion(val.getStringValue());
- if (res != null) {
- if (!res.equals("")) {
+ String res = trimEmptyDecimalPortion(value.getStringValue());
+
+ if (!StringUtils.isNotEmpty(res)) {
return res.trim();
- } else {
- return null;
}
- } else {
- return null;
+ } catch (Exception e) {
+ log.error("Cell evaluation error: ", e);
}
- } else {
- return null;
}
+ return null;
} else if (c.getCellType() == CellType.STRING) {
String res = trimEmptyDecimalPortion(c.getStringCellValue().trim());
return res.trim();
@@ -156,13 +153,13 @@ public static Boolean readAsBoolean(int colIndex, Row row) {
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if (c.getCellType() == CellType.FORMULA) {
if (eval != null) {
- CellValue val = null;
+ CellValue value;
try {
- val = eval.evaluate(c);
- } catch (NullPointerException npe) {
- return false;
+ value = eval.evaluate(c);
+ return value.getBooleanValue();
+ } catch (Exception e) {
+ log.error("Cell evaluation error: ", e);
}
- return val.getBooleanValue();
}
return false;
} else if (c.getCellType() == CellType.BOOLEAN) {
@@ -185,13 +182,13 @@ public static Integer readAsInt(int colIndex, Row row) {
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if (c.getCellType() == CellType.FORMULA) {
if (eval != null) {
- CellValue val = null;
+ CellValue value;
try {
- val = eval.evaluate(c);
- } catch (NullPointerException npe) {
- return null;
+ value = eval.evaluate(c);
+ return ((Double) value.getNumberValue()).intValue();
+ } catch (Exception e) {
+ log.error("Cell evaluation error: ", e);
}
- return ((Double) val.getNumberValue()).intValue();
}
return null;
} else if (c.getCellType() == CellType.NUMERIC) {
@@ -209,16 +206,15 @@ public static Double readAsDouble(int colIndex, Row row) {
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if (c.getCellType() == CellType.FORMULA) {
if (eval != null) {
- CellValue val = null;
+ CellValue value;
try {
- val = eval.evaluate(c);
- } catch (NullPointerException npe) {
- return 0.0;
+ value = eval.evaluate(c);
+ return value.getNumberValue();
+ } catch (Exception e) {
+ log.error("Cell evaluation error: ", e);
}
- return val.getNumberValue();
- } else {
- return 0.0;
}
+ return 0.0;
} else if (c.getCellType() == CellType.NUMERIC) {
return row.getCell(colIndex).getNumericCellValue();
} else {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/savings/SavingsImportHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/savings/SavingsImportHandler.java
index d375ad3dabb..42d16b395e1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/savings/SavingsImportHandler.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/savings/SavingsImportHandler.java
@@ -38,6 +38,7 @@
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.serialization.GoogleGsonSerializerHelper;
+import org.apache.fineract.portfolio.savings.SavingsPostingInterestPeriodType;
import org.apache.fineract.portfolio.savings.data.SavingsAccountChargeData;
import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
import org.apache.fineract.portfolio.savings.data.SavingsActivation;
@@ -147,7 +148,9 @@ private SavingsAccountData readSavings(final Workbook workbook, final Row row, f
Long interestPostingPeriodTypeId = null;
EnumOptionData interestPostingPeriodTypeEnum = null;
if (interestPostingPeriodType != null) {
- if (interestPostingPeriodType.equalsIgnoreCase(MONTHLY)) {
+ if (interestPostingPeriodType.equalsIgnoreCase(DAILY)) {
+ interestPostingPeriodTypeId = SavingsPostingInterestPeriodType.DAILY.getValue().longValue();
+ } else if (interestPostingPeriodType.equalsIgnoreCase(MONTHLY)) {
interestPostingPeriodTypeId = 4L;
} else if (interestPostingPeriodType.equalsIgnoreCase(QUARTERLY)) {
interestPostingPeriodTypeId = 5L;
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/CenterSheetPopulator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/CenterSheetPopulator.java
index d4064072c9d..d3dad4e89b7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/CenterSheetPopulator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/CenterSheetPopulator.java
@@ -58,7 +58,7 @@ public void populate(Workbook workbook, String dateFormat) {
}
private void centerNameToCenterIdMap() {
- centerNameToCenterId = new HashMap();
+ centerNameToCenterId = new HashMap<>();
for (CenterData centerData : allCenters) {
centerNameToCenterId.put(centerData.getName(), centerData.getId());
}
@@ -68,12 +68,12 @@ private void populateCentersByOfficeName(Sheet centerSheet) {
int rowIndex = 1;
int officeIndex = 0;
int startIndex = 1;
- officeNameToBeginEndIndexesOfCenters = new HashMap();
+ officeNameToBeginEndIndexesOfCenters = new HashMap<>();
Row row = centerSheet.createRow(rowIndex);
for (OfficeData office : offices) {
startIndex = rowIndex + 1;
writeString(OFFICE_NAME_COL, row, office.getName());
- ArrayList centersList = new ArrayList();
+ ArrayList centersList;
if (officeToCenters.containsKey(office.getName().trim().replaceAll("[ )(]", "_"))) {
centersList = officeToCenters.get(office.getName().trim().replaceAll("[ )(]", "_"));
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/SavingsAccountSheetPopulator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/SavingsAccountSheetPopulator.java
index 133fd508223..f33bdc3008c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/SavingsAccountSheetPopulator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/SavingsAccountSheetPopulator.java
@@ -19,9 +19,7 @@
package org.apache.fineract.infrastructure.bulkimport.populator;
import java.util.List;
-import java.util.Map;
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
-import org.apache.fineract.portfolio.client.data.ClientData;
import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
@@ -30,8 +28,6 @@
public class SavingsAccountSheetPopulator extends AbstractWorkbookPopulator {
private List savingsAccountDataList;
- private Map> clientToSavingsMap;
-
private static final int SAVINGS_ACCOUNT_ID_COL = 0;
private static final int SAVING_ACCOUNT_NO = 1;
private static final int CURRENCY_COL = 2;
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/comparator/LoanComparatorByStatusActive.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/comparator/LoanComparatorByStatusActive.java
index 5bfc7721c7d..4a29c916b56 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/comparator/LoanComparatorByStatusActive.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/comparator/LoanComparatorByStatusActive.java
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.infrastructure.bulkimport.populator.comparator;
+import java.io.Serializable;
import java.util.Comparator;
import org.apache.fineract.portfolio.loanaccount.data.LoanAccountData;
@@ -25,7 +26,7 @@
* Sorting the loan values based on loan status giving priority to active loans
*/
-public class LoanComparatorByStatusActive implements Comparator {
+public class LoanComparatorByStatusActive implements Comparator, Serializable {
@Override
public int compare(LoanAccountData o1, LoanAccountData o2) {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/constants/CampaignType.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/constants/CampaignType.java
index 13e765c68dd..fffe54ad2c9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/constants/CampaignType.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/constants/CampaignType.java
@@ -41,19 +41,20 @@ public String getCode() {
}
public static CampaignType fromInt(final Integer typeValue) {
- CampaignType type = null;
+ if (typeValue == null) {
+ return INVALID;
+ }
+
switch (typeValue) {
case 0:
- type = INVALID;
- break;
+ return INVALID;
case 1:
- type = SMS;
- break;
+ return SMS;
case 2:
- type = NOTIFICATION;
- break;
+ return NOTIFICATION;
+ default:
+ return INVALID;
}
- return type;
}
public static EnumOptionData campaignType(final Integer campaignTypeId) {
@@ -61,28 +62,22 @@ public static EnumOptionData campaignType(final Integer campaignTypeId) {
}
public static EnumOptionData campaignType(final CampaignType campaignType) {
- EnumOptionData optionData = new EnumOptionData(CampaignType.INVALID.getValue().longValue(), CampaignType.INVALID.getCode(),
- "Invalid");
+ EnumOptionData optionData = new EnumOptionData(INVALID.getValue().longValue(), INVALID.getCode(), "Invalid");
switch (campaignType) {
case INVALID:
- optionData = new EnumOptionData(CampaignType.INVALID.getValue().longValue(), CampaignType.INVALID.getCode(), "Invalid");
+ optionData = new EnumOptionData(INVALID.getValue().longValue(), INVALID.getCode(), "Invalid");
break;
case SMS:
- optionData = new EnumOptionData(CampaignType.SMS.getValue().longValue(), CampaignType.SMS.getCode(), "SMS");
+ optionData = new EnumOptionData(SMS.getValue().longValue(), SMS.getCode(), "SMS");
break;
case NOTIFICATION:
- optionData = new EnumOptionData(CampaignType.NOTIFICATION.getValue().longValue(), CampaignType.NOTIFICATION.getCode(),
- "NOTIFICATION");
+ optionData = new EnumOptionData(NOTIFICATION.getValue().longValue(), NOTIFICATION.getCode(), "NOTIFICATION");
break;
}
return optionData;
}
public boolean isSms() {
- return this.value.equals(CampaignType.SMS.getValue());
- }
-
- public boolean isNotificaion() {
- return this.value.equals(CampaignType.NOTIFICATION.getValue());
+ return this.equals(SMS);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignReadPlatformServiceImpl.java
index 0ef6b2bd06f..ce0aee75c67 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignReadPlatformServiceImpl.java
@@ -30,7 +30,6 @@
import org.apache.fineract.infrastructure.campaigns.email.data.EmailBusinessRulesData;
import org.apache.fineract.infrastructure.campaigns.email.data.EmailCampaignData;
import org.apache.fineract.infrastructure.campaigns.email.data.EmailCampaignTimeLine;
-import org.apache.fineract.infrastructure.campaigns.email.data.ScheduledEmailEnumerations;
import org.apache.fineract.infrastructure.campaigns.email.domain.EmailCampaignStatus;
import org.apache.fineract.infrastructure.campaigns.email.domain.EmailCampaignStatusEnumerations;
import org.apache.fineract.infrastructure.campaigns.email.domain.EmailCampaignType;
@@ -116,24 +115,7 @@ public EmailCampaignData mapRow(ResultSet rs, int rowNum) throws SQLException {
final String emailMessage = rs.getString("emailMessage");
final String emailAttachmentFileFormatString = rs.getString("emailAttachmentFileFormat");
final String stretchyReportParamMap = rs.getString("stretchyReportParamMap");
- EnumOptionData emailAttachmentFileFormat = null;
- if (emailAttachmentFileFormatString != null) {
- emailAttachmentFileFormat = ScheduledEmailEnumerations.emailAttachementFileFormat(emailAttachmentFileFormatString);
- }
final Long reportId = JdbcSupport.getLong(rs, "stretchyReportId");
- final String reportName = rs.getString("reportName");
- final String reportType = rs.getString("reportType");
- final String reportSubType = rs.getString("reportSubType");
- final String reportCategory = rs.getString("reportCategory");
- final String reportSql = rs.getString("reportSql");
- final String reportDescription = rs.getString("reportDescription");
- final boolean coreReport = rs.getBoolean("coreReport");
- final boolean useReport = rs.getBoolean("useReport");
-
- /*
- * final ReportData stretchyReport = new ReportData(reportId, reportName, reportType, reportSubType,
- * reportCategory, reportDescription, reportSql, coreReport, useReport, null);
- */
final Integer statusId = JdbcSupport.getInteger(rs, "statusEnum");
final EnumOptionData status = EmailCampaignStatusEnumerations.status(statusId);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignWritePlatformCommandHandlerImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignWritePlatformCommandHandlerImpl.java
index 3b206bc75cb..ba3e487a412 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignWritePlatformCommandHandlerImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignWritePlatformCommandHandlerImpl.java
@@ -350,11 +350,11 @@ public List> getRunReportByServiceImpl(final String repo
throws IOException {
final String reportType = "report";
- List> resultList = new ArrayList>();
+ List> resultList;
final GenericResultsetData results = this.readReportingService.retrieveGenericResultSetForSmsEmailCampaign(reportName, reportType,
queryParams);
final String response = this.genericDataService.generateJsonFromGenericResultsetData(results);
- resultList = new ObjectMapper().readValue(response, new TypeReference>>() {});
+ resultList = new ObjectMapper().readValue(response, new TypeReference<>() {});
// loop changes array date to string date
for (Iterator> it = resultList.iterator(); it.hasNext();) {
HashMap entry = it.next();
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailConfigurationWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailConfigurationWritePlatformServiceImpl.java
index 21f7a6cf511..9409e997205 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailConfigurationWritePlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailConfigurationWritePlatformServiceImpl.java
@@ -30,7 +30,6 @@
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.apache.fineract.useradministration.domain.AppUser;
import org.springframework.stereotype.Service;
@Service
@@ -43,8 +42,9 @@ public class EmailConfigurationWritePlatformServiceImpl implements EmailConfigur
@Override
public CommandProcessingResult update(final JsonCommand command) {
-
- final AppUser currentUser = this.context.authenticatedUser();
+ // TODO: leaving function call for backward compatibility... but security configuration should be done somewhere
+ // else
+ this.context.authenticatedUser();
this.emailConfigurationValidator.validateUpdateConfiguration(command.json());
final String smtpUsername = command.stringValueOfParameterNamed("SMTP_USERNAME");
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/jobs/executeemail/ExecuteEmailTasklet.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/jobs/executeemail/ExecuteEmailTasklet.java
index 069afb9ca47..90168797c85 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/jobs/executeemail/ExecuteEmailTasklet.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/jobs/executeemail/ExecuteEmailTasklet.java
@@ -193,6 +193,8 @@ private HashMap replaceStretchyParamsWithActualClientParams(fina
case "environementUrl":
actualParams.put(entry.getKey(), entry.getKey());
break;
+ default:
+ log.warn("Query parameter could not be mapped: {}", entry.getKey());
}
}
return actualParams;
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/constants/SmsCampaignStatus.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/constants/SmsCampaignStatus.java
index 399e90ac680..5f02b2a8b93 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/constants/SmsCampaignStatus.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/constants/SmsCampaignStatus.java
@@ -34,20 +34,16 @@ public enum SmsCampaignStatus {
}
public static SmsCampaignStatus fromInt(final Integer statusValue) {
-
- SmsCampaignStatus enumeration = SmsCampaignStatus.INVALID;
switch (statusValue) {
case 100:
- enumeration = SmsCampaignStatus.PENDING;
- break;
+ return PENDING;
case 300:
- enumeration = SmsCampaignStatus.ACTIVE;
- break;
+ return ACTIVE;
case 600:
- enumeration = SmsCampaignStatus.CLOSED;
- break;
+ return CLOSED;
+ default:
+ return INVALID;
}
- return enumeration;
}
public Integer getValue() {
@@ -58,15 +54,18 @@ public String getCode() {
return code;
}
+ // TODO: why not just use the enum values... just more boilerplate code here!!
public boolean isActive() {
- return this.value.equals(SmsCampaignStatus.ACTIVE.getValue());
+ return this.equals(ACTIVE);
}
+ // TODO: why not just use the enum values... just more boilerplate code here!!
public boolean isPending() {
- return this.value.equals(SmsCampaignStatus.PENDING.getValue());
+ return this.equals(PENDING);
}
+ // TODO: why not just use the enum values... just more boilerplate code here!!
public boolean isClosed() {
- return this.value.equals(SmsCampaignStatus.CLOSED.getValue());
+ return this.equals(CLOSED);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/constants/SmsCampaignTriggerType.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/constants/SmsCampaignTriggerType.java
index 83349e9bb37..7f4cdef79f9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/constants/SmsCampaignTriggerType.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/constants/SmsCampaignTriggerType.java
@@ -41,20 +41,21 @@ public String getCode() {
return code;
}
- public static SmsCampaignTriggerType fromInt(final Integer typeValue) {
- SmsCampaignTriggerType type = null;
- switch (typeValue) {
+ public static SmsCampaignTriggerType fromInt(final Integer v) {
+ if (v == null) {
+ return INVALID;
+ }
+
+ switch (v) {
case 1:
- type = DIRECT;
- break;
+ return DIRECT;
case 2:
- type = SCHEDULE;
- break;
+ return SCHEDULE;
case 3:
- type = TRIGGERED;
- break;
+ return TRIGGERED;
+ default:
+ return INVALID;
}
- return type;
}
public static EnumOptionData triggerType(final Integer triggerTypeId) {
@@ -62,38 +63,32 @@ public static EnumOptionData triggerType(final Integer triggerTypeId) {
}
public static EnumOptionData triggerType(final SmsCampaignTriggerType triggerType) {
- EnumOptionData optionData = new EnumOptionData(SmsCampaignTriggerType.INVALID.getValue().longValue(),
- SmsCampaignTriggerType.INVALID.getCode(), "Invalid");
switch (triggerType) {
case INVALID:
- optionData = new EnumOptionData(SmsCampaignTriggerType.INVALID.getValue().longValue(),
- SmsCampaignTriggerType.INVALID.getCode(), "Invalid");
- break;
+ return new EnumOptionData(INVALID.getValue().longValue(), INVALID.getCode(), "Invalid");
case DIRECT:
- optionData = new EnumOptionData(SmsCampaignTriggerType.DIRECT.getValue().longValue(),
- SmsCampaignTriggerType.DIRECT.getCode(), "Direct");
- break;
+ return new EnumOptionData(DIRECT.getValue().longValue(), DIRECT.getCode(), "Direct");
case SCHEDULE:
- optionData = new EnumOptionData(SmsCampaignTriggerType.SCHEDULE.getValue().longValue(),
- SmsCampaignTriggerType.SCHEDULE.getCode(), "Schedule");
- break;
+ return new EnumOptionData(SCHEDULE.getValue().longValue(), SCHEDULE.getCode(), "Schedule");
case TRIGGERED:
- optionData = new EnumOptionData(SmsCampaignTriggerType.TRIGGERED.getValue().longValue(),
- SmsCampaignTriggerType.TRIGGERED.getCode(), "Triggered");
- break;
+ return new EnumOptionData(TRIGGERED.getValue().longValue(), TRIGGERED.getCode(), "Triggered");
+ default:
+ return new EnumOptionData(INVALID.getValue().longValue(), INVALID.getCode(), "Invalid");
}
- return optionData;
}
+ // TODO: why not just use the enum values... just more boilerplate code here!!
public boolean isDirect() {
- return this.value.equals(SmsCampaignTriggerType.DIRECT.getValue());
+ return this.equals(DIRECT);
}
+ // TODO: why not just use the enum values... just more boilerplate code here!!
public boolean isSchedule() {
- return this.value.equals(SmsCampaignTriggerType.SCHEDULE.getValue());
+ return this.equals(SCHEDULE);
}
+ // TODO: why not just use the enum values... just more boilerplate code here!!
public boolean isTriggered() {
- return this.value.equals(SmsCampaignTriggerType.TRIGGERED.getValue());
+ return this.equals(TRIGGERED);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDomainServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDomainServiceImpl.java
index 62debdffeb9..2cdf3d2652e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDomainServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDomainServiceImpl.java
@@ -183,18 +183,18 @@ private void sendSmsForLoanRepayment(LoanTransaction loanTransaction) {
});
- if (groupClients.size() > 0) {
+ if (!groupClients.isEmpty()) {
for (Client client : groupClients) {
HashMap smsParams = processRepaymentDataForSms(loanTransaction, client);
- for (String key : campaignParams.keySet()) {
- String value = campaignParams.get(key);
+ for (Map.Entry entry : campaignParams.entrySet()) {
+ String value = entry.getValue();
String spvalue = null;
- boolean spkeycheck = smsParams.containsKey(key);
+ boolean spkeycheck = smsParams.containsKey(entry.getKey());
if (spkeycheck) {
- spvalue = smsParams.get(key).toString();
+ spvalue = smsParams.get(entry.getKey()).toString();
}
if (spkeycheck && !(value.equals("-1") || spvalue.equals(value))) {
- if (key.equals("officeId")) {
+ if (entry.getKey().equals("officeId")) {
Long officeId = Long.valueOf(value);
Office campaignOffice = this.officeRepository.findById(Long.valueOf(value))
.orElseThrow(() -> new OfficeNotFoundException(officeId));
@@ -244,15 +244,15 @@ private void sendSmsForSavingsTransaction(final SavingsAccountTransaction saving
});
HashMap smsParams = processSavingsTransactionDataForSms(savingsTransaction, client);
- for (String key : campaignParams.keySet()) {
- String value = campaignParams.get(key);
+ for (Map.Entry entry : campaignParams.entrySet()) {
+ String value = entry.getValue();
String spvalue = null;
- boolean spkeycheck = smsParams.containsKey(key);
+ boolean spkeycheck = smsParams.containsKey(entry.getKey());
if (spkeycheck) {
- spvalue = smsParams.get(key).toString();
+ spvalue = smsParams.get(entry.getKey()).toString();
}
if (spkeycheck && !(value.equals("-1") || spvalue.equals(value))) {
- if (key.equals("officeId")) {
+ if (entry.getKey().equals("officeId")) {
Long officeId = Long.valueOf(value);
Office campaignOffice = this.officeRepository.findById(officeId)
.orElseThrow(() -> new OfficeNotFoundException(officeId));
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDropdownReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDropdownReadPlatformServiceImpl.java
index 61e5df6d2bf..c333a4203da 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDropdownReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDropdownReadPlatformServiceImpl.java
@@ -19,7 +19,6 @@
package org.apache.fineract.infrastructure.campaigns.sms.service;
import java.net.URI;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -72,7 +71,7 @@ public Collection retrieveCampaignTriggerTypes() {
@Override
public Collection retrieveSmsProviders() {
- Collection smsProviderOptions = new ArrayList<>();
+ Collection smsProviderOptions;
Map hostConfig = this.smsConfigUtils.getMessageGateWayRequestURI("smsbridges", null);
URI uri = (URI) hostConfig.get("uri");
HttpEntity> entity = (HttpEntity>) hostConfig.get("entity");
@@ -80,8 +79,7 @@ public Collection retrieveSmsProviders() {
ResponseEntity> responseOne = null;
try {
- responseOne = restTemplate.exchange(uri, HttpMethod.GET, entity,
- new ParameterizedTypeReference>() {});
+ responseOne = restTemplate.exchange(uri, HttpMethod.GET, entity, new ParameterizedTypeReference<>() {});
} catch (ResourceAccessException ex) {
LOG.debug("Mobile service provider {} not available", uri, ex);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
index b176a2a415e..3cb8a4b6b8f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.infrastructure.configuration.domain;
+import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -74,6 +75,11 @@ public boolean isMakerCheckerEnabledForTask(final String taskPermissionCode) {
return false;
}
+ @Override
+ public boolean isSameMakerCheckerEnabled() {
+ return getGlobalConfigurationPropertyData("enable-same-maker-checker").isEnabled();
+ }
+
@Override
public boolean isAmazonS3Enabled() {
return getGlobalConfigurationPropertyData("amazon-S3").isEnabled();
@@ -379,18 +385,14 @@ public Long retrieveRelaxingDaysConfigForPivotDate() {
return property.getValue();
}
+ @NotNull
private GlobalConfigurationPropertyData getGlobalConfigurationPropertyData(final String propertyName) {
return globalConfigurationRepository.findOneByNameWithNotFoundDetection(propertyName).toData();
}
@Override
public boolean isSubRatesEnabled() {
- GlobalConfigurationPropertyData configuration = getGlobalConfigurationPropertyData("sub-rates");
- if (configuration == null) {
- return false;
- } else {
- return configuration.isEnabled();
- }
+ return getGlobalConfigurationPropertyData("sub-rates").isEnabled();
}
@Override
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/OkHttp3Config.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/OkHttp3Config.java
new file mode 100644
index 00000000000..eb5d81c1b22
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/OkHttp3Config.java
@@ -0,0 +1,71 @@
+/**
+ * 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.core.config;
+
+import java.security.SecureRandom;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.OkHttpClient;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Slf4j
+@RequiredArgsConstructor
+@Configuration
+public class OkHttp3Config {
+
+ private final FineractProperties fineractProperties;
+
+ @Bean
+ public OkHttpClient okHttpClient() throws Exception {
+ var okBuilder = new OkHttpClient.Builder();
+
+ if (Boolean.TRUE.equals(fineractProperties.getInsecureHttpClient())) {
+ final X509TrustManager insecureX509TrustManager = new X509TrustManager() {
+
+ @Override
+ public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {}// NOSONAR
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {}// NOSONAR
+
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return new X509Certificate[] {};
+ }
+ };
+
+ SSLContext insecureSSLContext = SSLContext.getInstance("TLS");
+ insecureSSLContext.init(null, new TrustManager[] { insecureX509TrustManager }, new SecureRandom());
+
+ okBuilder.sslSocketFactory(insecureSSLContext.getSocketFactory(), insecureX509TrustManager);
+ HostnameVerifier insecureHostnameVerifier = (hostname, session) -> true;// NOSONAR
+ okBuilder.hostnameVerifier(insecureHostnameVerifier);
+ }
+
+ return okBuilder.build();
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/cache/CacheConfig.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/cache/CacheConfig.java
index e4202ae3479..216328bb854 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/cache/CacheConfig.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/cache/CacheConfig.java
@@ -61,25 +61,53 @@ private CacheManager getInternalEhCacheManager() {
CacheConfigurationBuilder.newCacheConfigurationBuilder(Object.class, Object.class, ResourcePoolsBuilder.heap(10000))
.withExpiry(ExpiryPolicyBuilder.noExpiration()).build());
- cacheManager.createCache("users", defaultTemplate);
- cacheManager.createCache("usersByUsername", defaultTemplate);
- cacheManager.createCache("tenantsById", defaultTemplate);
- cacheManager.createCache("offices", defaultTemplate);
- cacheManager.createCache("officesForDropdown", defaultTemplate);
- cacheManager.createCache("officesById", defaultTemplate);
- cacheManager.createCache("charges", defaultTemplate);
- cacheManager.createCache("funds", defaultTemplate);
- cacheManager.createCache("code_values", defaultTemplate);
- cacheManager.createCache("codes", defaultTemplate);
- cacheManager.createCache("hooks", defaultTemplate);
- cacheManager.createCache("tfConfig", defaultTemplate);
- cacheManager.createCache(CONFIG_BY_NAME_CACHE_NAME, defaultTemplate);
+ if (cacheManager.getCache("users") == null) {
+ cacheManager.createCache("users", defaultTemplate);
+ }
+ if (cacheManager.getCache("usersByUsername") == null) {
+ cacheManager.createCache("usersByUsername", defaultTemplate);
+ }
+ if (cacheManager.getCache("tenantsById") == null) {
+ cacheManager.createCache("tenantsById", defaultTemplate);
+ }
+ if (cacheManager.getCache("offices") == null) {
+ cacheManager.createCache("offices", defaultTemplate);
+ }
+ if (cacheManager.getCache("officesForDropdown") == null) {
+ cacheManager.createCache("officesForDropdown", defaultTemplate);
+ }
+ if (cacheManager.getCache("officesById") == null) {
+ cacheManager.createCache("officesById", defaultTemplate);
+ }
+ if (cacheManager.getCache("charges") == null) {
+ cacheManager.createCache("charges", defaultTemplate);
+ }
+ if (cacheManager.getCache("funds") == null) {
+ cacheManager.createCache("funds", defaultTemplate);
+ }
+ if (cacheManager.getCache("code_values") == null) {
+ cacheManager.createCache("code_values", defaultTemplate);
+ }
+ if (cacheManager.getCache("codes") == null) {
+ cacheManager.createCache("codes", defaultTemplate);
+ }
+ if (cacheManager.getCache("hooks") == null) {
+ cacheManager.createCache("hooks", defaultTemplate);
+ }
+ if (cacheManager.getCache("tfConfig") == null) {
+ cacheManager.createCache("tfConfig", defaultTemplate);
+ }
+ if (cacheManager.getCache(CONFIG_BY_NAME_CACHE_NAME) == null) {
+ cacheManager.createCache(CONFIG_BY_NAME_CACHE_NAME, defaultTemplate);
+ }
javax.cache.configuration.Configuration