Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fineract-provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ dependencyManagement {
dependency 'org.apache.bval:org.apache.bval.bundle:2.0.3'
dependency 'org.mockito:mockito-core:3.3.3'
dependency 'org.mockito:mockito-junit-jupiter:3.3.3'
dependency 'io.github.classgraph:classgraph:4.8.86'
dependency 'io.github.classgraph:classgraph:4.8.87'
dependency 'org.awaitility:awaitility:4.0.3'
dependency 'com.github.spotbugs:spotbugs-annotations:4.0.6'
dependency 'javax.cache:cache-api:1.1.1'
Expand Down Expand Up @@ -385,7 +385,6 @@ tasks.withType(JavaCompile) {
"UnusedVariable",
"SameNameButDifferent",
"TypeParameterUnusedInFormals",
"UndefinedEquals",
"JdkObsolete",
"EmptyBlockTag",
"MissingSummary",
Expand Down Expand Up @@ -453,6 +452,7 @@ tasks.withType(JavaCompile) {
"NarrowingCompoundAssignment",
"MissingCasesInEnumSwitch",
"ReferenceEquality",
"UndefinedEquals",
"OperatorPrecedence",
"EqualsGetClass",
"EqualsUnsafeCast",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ public boolean equals(Object obj) {
}
TrialBalance other = (TrialBalance) obj;
return Objects.equals(other.officeId, officeId) && Objects.equals(other.glAccountId, glAccountId)
&& Objects.equals(other.amount, amount) && Objects.equals(other.entryDate, entryDate)
&& Objects.equals(other.transactionDate, transactionDate) && Objects.equals(other.closingBalance, closingBalance);
&& Objects.equals(other.amount, amount) && other.entryDate.compareTo(entryDate) == 0 ? Boolean.TRUE
: Boolean.FALSE && other.transactionDate.compareTo(transactionDate) == 0 ? Boolean.TRUE
: Boolean.FALSE && Objects.equals(other.closingBalance, closingBalance);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,9 @@ public void checkForBranchClosures(final GLClosure latestGLClosure, final Date t
* check if an accounting closure has happened for this branch after the transaction Date
**/
if (latestGLClosure != null) {
if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().equals(transactionDate)) {
if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().compareTo(transactionDate) == 0
? Boolean.TRUE
: Boolean.FALSE) {
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate(),
null, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ public String revertJournalEntry(final List<JournalEntry> journalEntries, String
final GLClosure latestGLClosureByBranch = this.glClosureRepository.getLatestGLClosureByBranch(officeId);
if (latestGLClosureByBranch != null) {
if (latestGLClosureByBranch.getClosingDate().after(journalEntriesTransactionDate)
|| latestGLClosureByBranch.getClosingDate().equals(journalEntriesTransactionDate)) {
|| latestGLClosureByBranch.getClosingDate().compareTo(journalEntriesTransactionDate) == 0 ? Boolean.TRUE
: Boolean.FALSE) {
final String accountName = null;
final String accountGLCode = null;
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.ACCOUNTING_CLOSED,
Expand Down Expand Up @@ -597,7 +598,9 @@ private void validateBusinessRulesForJournalEntries(final JournalEntryCommand co
// shouldn't be before an accounting closure
final GLClosure latestGLClosure = this.glClosureRepository.getLatestGLClosureByBranch(command.getOfficeId());
if (latestGLClosure != null) {
if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().equals(transactionDate)) {
if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().compareTo(transactionDate) == 0
? Boolean.TRUE
: Boolean.FALSE) {
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate(),
null, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private void revertAndAddJournalEntries(ProvisioningEntryData existingEntryData,
private void validateForCreateJournalEntry(ProvisioningEntryData existingEntry, ProvisioningEntry requested) {
Date existingDate = existingEntry.getCreatedDate();
Date requestedDate = requested.getCreatedDate();
if (existingDate.after(requestedDate) || existingDate.equals(requestedDate)) {
if (existingDate.after(requestedDate) || existingDate.compareTo(requestedDate) == 0 ? Boolean.TRUE : Boolean.FALSE) {
throw new ProvisioningJournalEntriesCannotbeCreatedException(existingEntry.getCreatedDate(), requestedDate);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/
package org.apache.fineract.infrastructure.core.exception;

import java.util.ArrayList;
import java.util.List;

/**
* A {@link RuntimeException} thrown when resources that are queried for are not found.
*/
Expand All @@ -27,11 +30,31 @@ public abstract class AbstractPlatformResourceNotFoundException extends RuntimeE
private final String defaultUserMessage;
private final Object[] defaultUserMessageArgs;

public AbstractPlatformResourceNotFoundException(final String globalisationMessageCode, final String defaultUserMessage,
protected AbstractPlatformResourceNotFoundException(final String globalisationMessageCode, final String defaultUserMessage,
final Object... defaultUserMessageArgs) {
super(findThrowableCause(defaultUserMessageArgs));
this.globalisationMessageCode = globalisationMessageCode;
this.defaultUserMessage = defaultUserMessage;
this.defaultUserMessageArgs = defaultUserMessageArgs;
this.defaultUserMessageArgs = filterThrowableCause(defaultUserMessageArgs);
}

private static Throwable findThrowableCause(Object[] defaultUserMessageArgs) {
for (Object defaultUserMessageArg : defaultUserMessageArgs) {
if (defaultUserMessageArg instanceof Throwable) {
return (Throwable) defaultUserMessageArg;
}
}
return null;
}

private static Object[] filterThrowableCause(Object[] defaultUserMessageArgs) {
List<Object> filteredDefaultUserMessageArgs = new ArrayList<>(defaultUserMessageArgs.length);
for (Object defaultUserMessageArg : defaultUserMessageArgs) {
if (!(defaultUserMessageArg instanceof Throwable)) {
filteredDefaultUserMessageArgs.add(defaultUserMessageArg);
}
}
return filteredDefaultUserMessageArgs.toArray();
}

public String getGlobalisationMessageCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.fineract.portfolio.loanproduct.data.LoanProductData;
import org.apache.fineract.portfolio.savings.data.SavingsProductData;

Expand Down Expand Up @@ -69,7 +70,8 @@ public boolean equals(Object o) {
return Objects.equals(entities, that.entities) && Objects.equals(statusClient, that.statusClient)
&& Objects.equals(statusGroup, that.statusGroup) && Objects.equals(statusSavings, that.statusSavings)
&& Objects.equals(statusLoans, that.statusLoans) && Objects.equals(datatables, that.datatables)
&& Objects.equals(loanProductDatas, that.loanProductDatas) && Objects.equals(savingsProductDatas, that.savingsProductDatas);
&& CollectionUtils.isEqualCollection(loanProductDatas, that.loanProductDatas)
&& CollectionUtils.isEqualCollection(savingsProductDatas, that.savingsProductDatas);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@
@Scope("singleton")
@Api(tags = { "Fetch authenticated user details" })
@SwaggerDefinition(tags = { @Tag(name = "Fetch authenticated user details", description = "") })
@SuppressWarnings("deprecation") // TODO FINERACT-1012

@EnableResourceServer // TODO FINERACT-1012
public class UserDetailsApiResource {

private final ResourceServerTokenServices tokenServices;
private final oauth2ResourceServer tokenServices;
private final ToApiJsonSerializer<AuthenticatedOauthUserData> apiJsonSerializerService;
private final SpringSecurityPlatformSecurityContext springSecurityPlatformSecurityContext;
private final TwoFactorUtils twoFactorUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
chain.doFilter(req, res);
}

@SuppressWarnings("deprecation") // TODO FINERACT-1012
@Bean
@EnableOAuth2Sso // TODO FINERACT-1012
private Authentication createUpdatedAuthentication(final Authentication currentAuthentication,
final List<GrantedAuthority> updatedAuthorities) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.portfolio.calendar.domain.CalendarFrequencyType;
import org.apache.fineract.portfolio.calendar.domain.CalendarRemindBy;
Expand Down Expand Up @@ -525,8 +526,10 @@ public boolean equals(Object o) {
&& Objects.equals(frequency, that.frequency) && Objects.equals(interval, that.interval)
&& Objects.equals(repeatsOnDay, that.repeatsOnDay) && Objects.equals(repeatsOnNthDayOfMonth, that.repeatsOnNthDayOfMonth)
&& Objects.equals(remindBy, that.remindBy) && Objects.equals(firstReminder, that.firstReminder)
&& Objects.equals(secondReminder, that.secondReminder) && Objects.equals(recurringDates, that.recurringDates)
&& Objects.equals(nextTenRecurringDates, that.nextTenRecurringDates) && Objects.equals(humanReadable, that.humanReadable)
&& Objects.equals(secondReminder, that.secondReminder)
&& CollectionUtils.isEqualCollection(recurringDates, that.recurringDates)
&& CollectionUtils.isEqualCollection(nextTenRecurringDates, that.nextTenRecurringDates)
&& Objects.equals(humanReadable, that.humanReadable)
&& Objects.equals(recentEligibleMeetingDate, that.recentEligibleMeetingDate)
&& Objects.equals(createdDate, that.createdDate) && Objects.equals(lastUpdatedDate, that.lastUpdatedDate)
&& Objects.equals(createdByUserId, that.createdByUserId) && Objects.equals(createdByUsername, that.createdByUsername)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.dataqueries.data.DatatableData;
Expand Down Expand Up @@ -280,11 +281,12 @@ public boolean equals(Object o) {
&& Objects.equals(officeName, that.officeName) && Objects.equals(staffId, that.staffId)
&& Objects.equals(staffName, that.staffName) && Objects.equals(hierarchy, that.hierarchy)
&& Objects.equals(status, that.status) && Objects.equals(activationDate, that.activationDate)
&& Objects.equals(timeline, that.timeline) && Objects.equals(groupMembers, that.groupMembers)
&& Objects.equals(groupMembersOptions, that.groupMembersOptions)
&& Objects.equals(timeline, that.timeline) && CollectionUtils.isEqualCollection(groupMembers, that.groupMembers)
&& CollectionUtils.isEqualCollection(groupMembersOptions, that.groupMembersOptions)
&& Objects.equals(collectionMeetingCalendar, that.collectionMeetingCalendar)
&& Objects.equals(closureReasons, that.closureReasons) && Objects.equals(officeOptions, that.officeOptions)
&& Objects.equals(staffOptions, that.staffOptions) && Objects.equals(totalCollected, that.totalCollected)
&& CollectionUtils.isEqualCollection(closureReasons, that.closureReasons)
&& CollectionUtils.isEqualCollection(officeOptions, that.officeOptions)
&& CollectionUtils.isEqualCollection(staffOptions, that.staffOptions) && Objects.equals(totalCollected, that.totalCollected)
&& Objects.equals(totalOverdue, that.totalOverdue) && Objects.equals(totaldue, that.totaldue)
&& Objects.equals(installmentDue, that.installmentDue) && Objects.equals(datatables, that.datatables)
&& Objects.equals(rowIndex, that.rowIndex) && Objects.equals(dateFormat, that.dateFormat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.dataqueries.data.DatatableData;
Expand Down Expand Up @@ -380,14 +381,17 @@ public boolean equals(Object o) {
&& Objects.equals(officeName, that.officeName) && Objects.equals(centerId, that.centerId)
&& Objects.equals(centerName, that.centerName) && Objects.equals(staffId, that.staffId)
&& Objects.equals(staffName, that.staffName) && Objects.equals(hierarchy, that.hierarchy)
&& Objects.equals(groupLevel, that.groupLevel) && Objects.equals(clientMembers, that.clientMembers)
&& Objects.equals(activeClientMembers, that.activeClientMembers) && Objects.equals(groupRoles, that.groupRoles)
&& Objects.equals(calendarsData, that.calendarsData)
&& Objects.equals(groupLevel, that.groupLevel) && CollectionUtils.isEqualCollection(clientMembers, that.clientMembers)
&& CollectionUtils.isEqualCollection(activeClientMembers, that.activeClientMembers)
&& CollectionUtils.isEqualCollection(groupRoles, that.groupRoles)
&& CollectionUtils.isEqualCollection(calendarsData, that.calendarsData)
&& Objects.equals(collectionMeetingCalendar, that.collectionMeetingCalendar)
&& Objects.equals(centerOptions, that.centerOptions) && Objects.equals(officeOptions, that.officeOptions)
&& Objects.equals(staffOptions, that.staffOptions) && Objects.equals(clientOptions, that.clientOptions)
&& Objects.equals(availableRoles, that.availableRoles) && Objects.equals(selectedRole, that.selectedRole)
&& Objects.equals(closureReasons, that.closureReasons) && Objects.equals(timeline, that.timeline)
&& CollectionUtils.isEqualCollection(centerOptions, that.centerOptions)
&& CollectionUtils.isEqualCollection(officeOptions, that.officeOptions)
&& CollectionUtils.isEqualCollection(staffOptions, that.staffOptions)
&& CollectionUtils.isEqualCollection(clientOptions, that.clientOptions)
&& CollectionUtils.isEqualCollection(availableRoles, that.availableRoles) && Objects.equals(selectedRole, that.selectedRole)
&& CollectionUtils.isEqualCollection(closureReasons, that.closureReasons) && Objects.equals(timeline, that.timeline)
&& Objects.equals(datatables, that.datatables) && Objects.equals(rowIndex, that.rowIndex)
&& Objects.equals(dateFormat, that.dateFormat) && Objects.equals(locale, that.locale)
&& Objects.equals(submittedOnDate, that.submittedOnDate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2529,7 +2529,7 @@ private Collection<LoanDisbursementDetails> fetchUndisbursedDetail() {
Date date = null;
for (LoanDisbursementDetails disbursementDetail : this.disbursementDetails) {
if (disbursementDetail.actualDisbursementDate() == null) {
if (date == null || disbursementDetail.expectedDisbursementDate().equals(date)) {
if (date == null || disbursementDetail.expectedDisbursementDate().compareTo(date) == 0 ? Boolean.TRUE : Boolean.FALSE) {
disbursementDetails.add(disbursementDetail);
date = disbursementDetail.expectedDisbursementDate();
} else if (disbursementDetail.expectedDisbursementDate().before(date)) {
Expand All @@ -2549,7 +2549,7 @@ private LoanDisbursementDetails fetchLastDisburseDetail() {
for (LoanDisbursementDetails disbursementDetail : this.disbursementDetails) {
if (disbursementDetail.actualDisbursementDate() != null) {
if (disbursementDetail.actualDisbursementDate().after(date)
|| disbursementDetail.actualDisbursementDate().equals(date)) {
|| disbursementDetail.actualDisbursementDate().compareTo(date) == 0 ? Boolean.TRUE : Boolean.FALSE) {
date = disbursementDetail.actualDisbursementDate();
details = disbursementDetail;
}
Expand Down Expand Up @@ -2752,7 +2752,7 @@ private void handleDisbursementTransaction(final LocalDate disbursedOn, final Lo
if (getExpectedFirstRepaymentOnDate() != null
&& (disbursedOn.isAfter(this.fetchRepaymentScheduleInstallment(1).getDueDate())
|| disbursedOn.isAfter(getExpectedFirstRepaymentOnDate()))
&& disbursedOn.toDate().equals(this.actualDisbursementDate)) {
&& disbursedOn.toDate().compareTo(this.actualDisbursementDate) == 0 ? Boolean.TRUE : Boolean.FALSE) {
final String errorMessage = "submittedOnDate cannot be after the loans expectedFirstRepaymentOnDate: "
+ getExpectedFirstRepaymentOnDate().toString();
throw new InvalidLoanStateTransitionException("disbursal", "cannot.be.after.expected.first.repayment.date", errorMessage,
Expand Down Expand Up @@ -3970,7 +3970,8 @@ private boolean isActualDisbursedOnDateEarlierOrLaterThanExpected(final LocalDat
boolean isRegenerationRequired = false;
if (this.loanProduct.isMultiDisburseLoan()) {
LoanDisbursementDetails details = fetchLastDisburseDetail();
if (details != null && !details.expectedDisbursementDate().equals(details.actualDisbursementDate())) {
if (details != null && details.expectedDisbursementDate().compareTo(details.actualDisbursementDate()) == 0 ? Boolean.FALSE
: Boolean.TRUE) {
isRegenerationRequired = true;
}
}
Expand Down Expand Up @@ -6016,7 +6017,8 @@ public Map<String, Object> undoLastDisbursal(ScheduleGeneratorDTO scheduleGenera
if ((loanTermVariations.getTermType().isDueDateVariation()
&& loanTermVariations.fetchDateValue().isAfter(actualDisbursementDate))
|| (loanTermVariations.getTermType().isEMIAmountVariation()
&& loanTermVariations.getTermApplicableFrom().equals(actualDisbursementDate.toDate()))
&& loanTermVariations.getTermApplicableFrom().compareTo(actualDisbursementDate.toDate()) == 0 ? Boolean.TRUE
: Boolean.FALSE)
|| loanTermVariations.getTermApplicableFrom().after(actualDisbursementDate.toDate())) {
iterator.remove();
}
Expand Down
Loading