FINERACT-2326: Refractor redundant and some deprecated code as per new Java 21 style
This commit is contained in:
+2
-2
@@ -42,7 +42,7 @@ public class DelinquencyEffectivePauseHelperImpl implements DelinquencyEffective
|
||||
.collect(Collectors.groupingBy(LoanDelinquencyAction::getAction));
|
||||
List<LoanDelinquencyActionData> effective = new ArrayList<>();
|
||||
List<LoanDelinquencyAction> pauses = partitioned.get(DelinquencyAction.PAUSE);
|
||||
if (pauses != null && pauses.size() > 0) {
|
||||
if (pauses != null && !pauses.isEmpty()) {
|
||||
for (LoanDelinquencyAction loanDelinquencyAction : pauses) {
|
||||
Optional<LoanDelinquencyAction> resume = findMatchingResume(loanDelinquencyAction, partitioned.get(RESUME));
|
||||
LoanDelinquencyActionData loanDelinquencyActionData = new LoanDelinquencyActionData(loanDelinquencyAction);
|
||||
@@ -91,7 +91,7 @@ public class DelinquencyEffectivePauseHelperImpl implements DelinquencyEffective
|
||||
}
|
||||
|
||||
private Optional<LoanDelinquencyAction> findMatchingResume(LoanDelinquencyAction pause, List<LoanDelinquencyAction> resumes) {
|
||||
if (resumes != null && resumes.size() > 0) {
|
||||
if (resumes != null && !resumes.isEmpty()) {
|
||||
for (LoanDelinquencyAction resume : resumes) {
|
||||
if (!pause.getStartDate().isAfter(resume.getStartDate()) && !resume.getStartDate().isAfter(pause.getEndDate())) {
|
||||
return Optional.of(resume);
|
||||
|
||||
+3
-5
@@ -337,11 +337,9 @@ public class DelinquencyReadPlatformServiceImpl implements DelinquencyReadPlatfo
|
||||
isCurrentDateBeforeInstallmentAndLoanPeriod = DateUtils.isEqual(currentBusinessDate, installment.getDueDate())
|
||||
&& DateUtils.isBefore(currentBusinessDate, expectedMaturityDate);
|
||||
}
|
||||
if (isCurrentDateBeforeInstallmentAndLoanPeriod) {
|
||||
if (installment.isNotFullyPaidOff()) {
|
||||
nextUnpaidInstallmentDate = installment.getDueDate();
|
||||
break;
|
||||
}
|
||||
if (isCurrentDateBeforeInstallmentAndLoanPeriod && installment.isNotFullyPaidOff()) {
|
||||
nextUnpaidInstallmentDate = installment.getDueDate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return nextUnpaidInstallmentDate;
|
||||
|
||||
+4
-4
@@ -127,7 +127,7 @@ public class DelinquencyWritePlatformServiceHelper {
|
||||
changes.put("current", loanDelinquencyTag.getDelinquencyRange());
|
||||
}
|
||||
}
|
||||
if (loanDelinquencyTagHistory.size() > 0) {
|
||||
if (!loanDelinquencyTagHistory.isEmpty()) {
|
||||
this.loanDelinquencyTagRepository.saveAllAndFlush(loanDelinquencyTagHistory);
|
||||
// if installment level delinquency is enabled event will be raised at installment level calculation, no
|
||||
// need to raise the event here
|
||||
@@ -173,10 +173,10 @@ public class DelinquencyWritePlatformServiceHelper {
|
||||
private void removeDelinquencyTagsForNonExistingInstallments(Long loanId) {
|
||||
List<LoanInstallmentDelinquencyTag> currentLoanInstallmentDelinquencyTags = loanInstallmentDelinquencyTagRepository
|
||||
.findByLoanId(loanId);
|
||||
if (currentLoanInstallmentDelinquencyTags != null && currentLoanInstallmentDelinquencyTags.size() > 0) {
|
||||
if (currentLoanInstallmentDelinquencyTags != null && !currentLoanInstallmentDelinquencyTags.isEmpty()) {
|
||||
List<Long> loanInstallmentTagsForDelete = currentLoanInstallmentDelinquencyTags.stream()
|
||||
.filter(tag -> tag.getInstallment() == null).map(tag -> tag.getId()).toList();
|
||||
if (loanInstallmentTagsForDelete.size() > 0) {
|
||||
if (!loanInstallmentTagsForDelete.isEmpty()) {
|
||||
loanInstallmentDelinquencyTagRepository.deleteAllLoanInstallmentsTagsByIds(loanInstallmentTagsForDelete);
|
||||
}
|
||||
}
|
||||
@@ -260,7 +260,7 @@ public class DelinquencyWritePlatformServiceHelper {
|
||||
|
||||
}
|
||||
|
||||
if (installmentDelinquencyTags.size() > 0) {
|
||||
if (!installmentDelinquencyTags.isEmpty()) {
|
||||
loanInstallmentDelinquencyTagRepository.saveAllAndFlush(installmentDelinquencyTags);
|
||||
}
|
||||
return isDelinquencyRangeChanged;
|
||||
|
||||
+5
-9
@@ -291,7 +291,7 @@ public class DelinquencyWritePlatformServiceImpl implements DelinquencyWritePlat
|
||||
@Override
|
||||
public void cleanLoanDelinquencyTags(Loan loan) {
|
||||
List<LoanDelinquencyTagHistory> loanDelinquencyTags = this.loanDelinquencyTagRepository.findByLoan(loan);
|
||||
if (loanDelinquencyTags != null && loanDelinquencyTags.size() > 0) {
|
||||
if (loanDelinquencyTags != null && !loanDelinquencyTags.isEmpty()) {
|
||||
this.loanDelinquencyTagRepository.deleteAll(loanDelinquencyTags);
|
||||
}
|
||||
}
|
||||
@@ -362,9 +362,7 @@ public class DelinquencyWritePlatformServiceImpl implements DelinquencyWritePlat
|
||||
|
||||
private void setDelinquencyBucketMappings(DelinquencyBucket delinquencyBucket, DelinquencyBucketData data) {
|
||||
List<Long> rangeIds = new ArrayList<>();
|
||||
data.getRanges().forEach(dataRange -> {
|
||||
rangeIds.add(dataRange.getId());
|
||||
});
|
||||
data.getRanges().forEach(dataRange -> rangeIds.add(dataRange.getId()));
|
||||
|
||||
List<DelinquencyRange> ranges = repositoryRange.findAllById(rangeIds);
|
||||
validateDelinquencyRanges(ranges);
|
||||
@@ -383,11 +381,9 @@ public class DelinquencyWritePlatformServiceImpl implements DelinquencyWritePlat
|
||||
|
||||
DelinquencyRange prevDelinquencyRange = null;
|
||||
for (DelinquencyRange delinquencyRange : ranges) {
|
||||
if (prevDelinquencyRange != null) {
|
||||
if (isOverlapped(prevDelinquencyRange, delinquencyRange)) {
|
||||
final String errorMessage = "The delinquency ranges age days values are overlaped";
|
||||
throw new DelinquencyBucketAgesOverlapedException(errorMessage, prevDelinquencyRange, delinquencyRange);
|
||||
}
|
||||
if (prevDelinquencyRange != null && isOverlapped(prevDelinquencyRange, delinquencyRange)) {
|
||||
final String errorMessage = "The delinquency ranges age days values are overlaped";
|
||||
throw new DelinquencyBucketAgesOverlapedException(errorMessage, prevDelinquencyRange, delinquencyRange);
|
||||
}
|
||||
prevDelinquencyRange = delinquencyRange;
|
||||
}
|
||||
|
||||
+1
-6
@@ -153,7 +153,7 @@ public class DefaultLoanLifecycleStateMachine implements LoanLifecycleStateMachi
|
||||
}
|
||||
break;
|
||||
case LOAN_CHARGE_PAYMENT:
|
||||
case LOAN_REPAYMENT_OR_WAIVER:
|
||||
case LOAN_REPAYMENT_OR_WAIVER, LOAN_CHARGEBACK:
|
||||
if (anyOfAllowedWhenComingFrom(from, LoanStatus.CLOSED_OBLIGATIONS_MET, LoanStatus.OVERPAID)) {
|
||||
newState = activeTransition();
|
||||
}
|
||||
@@ -217,11 +217,6 @@ public class DefaultLoanLifecycleStateMachine implements LoanLifecycleStateMachi
|
||||
newState = activeTransition();
|
||||
}
|
||||
break;
|
||||
case LOAN_CHARGEBACK:
|
||||
if (anyOfAllowedWhenComingFrom(from, LoanStatus.CLOSED_OBLIGATIONS_MET, LoanStatus.OVERPAID)) {
|
||||
newState = activeTransition();
|
||||
}
|
||||
break;
|
||||
case LOAN_CHARGE_ADJUSTMENT:
|
||||
if (from.hasStateOf(LoanStatus.CLOSED_OBLIGATIONS_MET)) {
|
||||
newState = overpaidTransition();
|
||||
|
||||
Reference in New Issue
Block a user