FINERACT-2421: Refractor redundant and some deprecated code as per new Java 21 style (Phase 5)
This commit is contained in:
+1
-2
@@ -72,8 +72,7 @@ public final class FinancialActivityAccountDataValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DataValidatorBuilder getDataValidator(final List<ApiParameterError> dataValidationErrors) {
|
private DataValidatorBuilder getDataValidator(final List<ApiParameterError> dataValidationErrors) {
|
||||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("financialactivityaccount");
|
return new DataValidatorBuilder(dataValidationErrors).resource("financialactivityaccount");
|
||||||
return baseDataValidator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateForUpdate(final String json) {
|
public void validateForUpdate(final String json) {
|
||||||
|
|||||||
+36
-89
@@ -33,6 +33,8 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||||
@@ -66,34 +68,41 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
public static final String LOCALE_PARAM_NAME = "locale";
|
public static final String LOCALE_PARAM_NAME = "locale";
|
||||||
public static final String FEE_FREQUENCY_PARAM_NAME = "feeFrequency";
|
public static final String FEE_FREQUENCY_PARAM_NAME = "feeFrequency";
|
||||||
|
|
||||||
|
@Getter
|
||||||
@Column(name = "name", length = 100)
|
@Column(name = "name", length = 100)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Getter
|
||||||
@Column(name = "amount", scale = 6, precision = 19, nullable = false)
|
@Column(name = "amount", scale = 6, precision = 19, nullable = false)
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Getter
|
||||||
@Column(name = "currency_code", length = 3)
|
@Column(name = "currency_code", length = 3)
|
||||||
private String currencyCode;
|
private String currencyCode;
|
||||||
|
|
||||||
@Column(name = "charge_applies_to_enum", nullable = false)
|
@Column(name = "charge_applies_to_enum", nullable = false)
|
||||||
private Integer chargeAppliesTo;
|
private Integer chargeAppliesTo;
|
||||||
|
|
||||||
|
@Getter
|
||||||
@Column(name = "charge_time_enum", nullable = false)
|
@Column(name = "charge_time_enum", nullable = false)
|
||||||
private Integer chargeTimeType;
|
private Integer chargeTimeType;
|
||||||
|
|
||||||
|
@Getter
|
||||||
@Column(name = "charge_calculation_enum")
|
@Column(name = "charge_calculation_enum")
|
||||||
private Integer chargeCalculation;
|
private Integer chargeCalculation;
|
||||||
|
|
||||||
@Column(name = "charge_payment_mode_enum", nullable = true)
|
@Getter
|
||||||
|
@Column(name = "charge_payment_mode_enum")
|
||||||
private Integer chargePaymentMode;
|
private Integer chargePaymentMode;
|
||||||
|
|
||||||
@Column(name = "fee_on_day", nullable = true)
|
@Column(name = "fee_on_day")
|
||||||
private Integer feeOnDay;
|
private Integer feeOnDay;
|
||||||
|
|
||||||
@Column(name = "fee_interval", nullable = true)
|
@Getter
|
||||||
|
@Column(name = "fee_interval")
|
||||||
private Integer feeInterval;
|
private Integer feeInterval;
|
||||||
|
|
||||||
@Column(name = "fee_on_month", nullable = true)
|
@Column(name = "fee_on_month")
|
||||||
private Integer feeOnMonth;
|
private Integer feeOnMonth;
|
||||||
|
|
||||||
@Column(name = "is_penalty", nullable = false)
|
@Column(name = "is_penalty", nullable = false)
|
||||||
@@ -105,10 +114,12 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
@Column(name = "is_deleted", nullable = false)
|
@Column(name = "is_deleted", nullable = false)
|
||||||
private boolean deleted = false;
|
private boolean deleted = false;
|
||||||
|
|
||||||
@Column(name = "min_cap", scale = 6, precision = 19, nullable = true)
|
@Getter
|
||||||
|
@Column(name = "min_cap", scale = 6, precision = 19)
|
||||||
private BigDecimal minCap;
|
private BigDecimal minCap;
|
||||||
|
|
||||||
@Column(name = "max_cap", scale = 6, precision = 19, nullable = true)
|
@Getter
|
||||||
|
@Column(name = "max_cap", scale = 6, precision = 19)
|
||||||
private BigDecimal maxCap;
|
private BigDecimal maxCap;
|
||||||
|
|
||||||
@Column(name = "fee_frequency", nullable = true)
|
@Column(name = "fee_frequency", nullable = true)
|
||||||
@@ -117,26 +128,35 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
@Column(name = "is_free_withdrawal", nullable = false)
|
@Column(name = "is_free_withdrawal", nullable = false)
|
||||||
private boolean enableFreeWithdrawal;
|
private boolean enableFreeWithdrawal;
|
||||||
|
|
||||||
@Column(name = "free_withdrawal_charge_frequency", nullable = true)
|
@Column(name = "free_withdrawal_charge_frequency")
|
||||||
private Integer freeWithdrawalFrequency;
|
private Integer freeWithdrawalFrequency;
|
||||||
|
|
||||||
@Column(name = "restart_frequency", nullable = true)
|
@Getter
|
||||||
|
@Column(name = "restart_frequency")
|
||||||
private Integer restartFrequency;
|
private Integer restartFrequency;
|
||||||
|
|
||||||
@Column(name = "restart_frequency_enum", nullable = true)
|
@Getter
|
||||||
|
@Column(name = "restart_frequency_enum")
|
||||||
private Integer restartFrequencyEnum;
|
private Integer restartFrequencyEnum;
|
||||||
|
|
||||||
|
@Getter
|
||||||
@Column(name = "is_payment_type", nullable = false)
|
@Column(name = "is_payment_type", nullable = false)
|
||||||
private boolean enablePaymentType;
|
private boolean enablePaymentType;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "payment_type_id", nullable = false)
|
@JoinColumn(name = "payment_type_id", nullable = false)
|
||||||
private PaymentType paymentType;
|
private PaymentType paymentType;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "income_or_liability_account_id")
|
@JoinColumn(name = "income_or_liability_account_id")
|
||||||
private GLAccount account;
|
private GLAccount account;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "tax_group_id")
|
@JoinColumn(name = "tax_group_id")
|
||||||
private TaxGroup taxGroup;
|
private TaxGroup taxGroup;
|
||||||
@@ -245,12 +265,9 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
this.restartFrequencyEnum = restartFrequencyEnum.getValue();
|
this.restartFrequencyEnum = restartFrequencyEnum.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enablePaymentType) {
|
if (enablePaymentType && paymentType != null) {
|
||||||
if (paymentType != null) {
|
this.enablePaymentType = true;
|
||||||
|
this.paymentType = paymentType;
|
||||||
this.enablePaymentType = true;
|
|
||||||
this.paymentType = paymentType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (isLoanCharge()) {
|
} else if (isLoanCharge()) {
|
||||||
@@ -279,26 +296,6 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getAmount() {
|
|
||||||
return this.amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCurrencyCode() {
|
|
||||||
return this.currencyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getChargeTimeType() {
|
|
||||||
return this.chargeTimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getChargeCalculation() {
|
|
||||||
return this.chargeCalculation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return this.active;
|
return this.active;
|
||||||
}
|
}
|
||||||
@@ -351,14 +348,6 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
return ChargeCalculationType.fromInt(this.chargeCalculation).isPercentageOfDisbursementAmount();
|
return ChargeCalculationType.fromInt(this.chargeCalculation).isPercentageOfDisbursementAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getMinCap() {
|
|
||||||
return this.minCap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getMaxCap() {
|
|
||||||
return this.maxCap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEnableFreeWithdrawal() {
|
public boolean isEnableFreeWithdrawal() {
|
||||||
return this.enableFreeWithdrawal;
|
return this.enableFreeWithdrawal;
|
||||||
}
|
}
|
||||||
@@ -371,22 +360,6 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
return this.freeWithdrawalFrequency;
|
return this.freeWithdrawalFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getRestartFrequency() {
|
|
||||||
return this.restartFrequency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getRestartFrequencyEnum() {
|
|
||||||
return this.restartFrequencyEnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PaymentType getPaymentType() {
|
|
||||||
return this.paymentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPaymentType(PaymentType paymentType) {
|
|
||||||
this.paymentType = paymentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Long getPaymentTypeId() {
|
private Long getPaymentTypeId() {
|
||||||
Long paymentTypeId = null;
|
Long paymentTypeId = null;
|
||||||
if (this.paymentType != null) {
|
if (this.paymentType != null) {
|
||||||
@@ -450,11 +423,9 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
baseDataValidator.reset().parameter(CHARGE_TIME_PARAM_NAME).value(this.chargeTimeType)
|
baseDataValidator.reset().parameter(CHARGE_TIME_PARAM_NAME).value(this.chargeTimeType)
|
||||||
.failWithCodeNoParameterAddedToErrorCode("not.allowed.charge.time.for.loan");
|
.failWithCodeNoParameterAddedToErrorCode("not.allowed.charge.time.for.loan");
|
||||||
}
|
}
|
||||||
} else if (isClientCharge()) {
|
} else if (isClientCharge() && !isAllowedLoanChargeTime()) {
|
||||||
if (!isAllowedLoanChargeTime()) {
|
baseDataValidator.reset().parameter(CHARGE_TIME_PARAM_NAME).value(this.chargeTimeType)
|
||||||
baseDataValidator.reset().parameter(CHARGE_TIME_PARAM_NAME).value(this.chargeTimeType)
|
.failWithCodeNoParameterAddedToErrorCode("not.allowed.charge.time.for.client");
|
||||||
.failWithCodeNoParameterAddedToErrorCode("not.allowed.charge.time.for.client");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,7 +618,7 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete is a <i>soft delete</i>. Updates flag on charge so it wont appear in query/report results.
|
* Delete is a <i>soft delete</i>. Updates flag on charge so it won't appear in query/report results.
|
||||||
*
|
*
|
||||||
* Any fields with unique constraints and prepended with id of record.
|
* Any fields with unique constraints and prepended with id of record.
|
||||||
*/
|
*/
|
||||||
@@ -690,14 +661,6 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getChargePaymentMode() {
|
|
||||||
return this.chargePaymentMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getFeeInterval() {
|
|
||||||
return this.feeInterval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMonthlyFee() {
|
public boolean isMonthlyFee() {
|
||||||
return ChargeTimeType.fromInt(this.chargeTimeType).isMonthlyFee();
|
return ChargeTimeType.fromInt(this.chargeTimeType).isMonthlyFee();
|
||||||
}
|
}
|
||||||
@@ -726,14 +689,6 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
return this.feeFrequency;
|
return this.feeFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GLAccount getAccount() {
|
|
||||||
return this.account;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccount(GLAccount account) {
|
|
||||||
this.account = account;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getIncomeAccountId() {
|
public Long getIncomeAccountId() {
|
||||||
Long incomeAccountId = null;
|
Long incomeAccountId = null;
|
||||||
if (this.account != null) {
|
if (this.account != null) {
|
||||||
@@ -755,14 +710,6 @@ public class Charge extends AbstractPersistableCustom<Long> {
|
|||||||
|| ChargeTimeType.fromInt(this.chargeTimeType).equals(ChargeTimeType.TRANCHE_DISBURSEMENT);
|
|| ChargeTimeType.fromInt(this.chargeTimeType).equals(ChargeTimeType.TRANCHE_DISBURSEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaxGroup getTaxGroup() {
|
|
||||||
return this.taxGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTaxGroup(TaxGroup taxGroup) {
|
|
||||||
this.taxGroup = taxGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) {
|
if (this == o) {
|
||||||
|
|||||||
+1
-1
@@ -79,7 +79,7 @@ public class FineractErrorDecoder implements ErrorDecoder {
|
|||||||
|
|
||||||
private String extractValidationErrors(JsonNode rootNode) {
|
private String extractValidationErrors(JsonNode rootNode) {
|
||||||
JsonNode errorsNode = rootNode.get("errors");
|
JsonNode errorsNode = rootNode.get("errors");
|
||||||
if (errorsNode != null && errorsNode.isArray() && errorsNode.size() > 0) {
|
if (errorsNode != null && errorsNode.isArray() && !errorsNode.isEmpty()) {
|
||||||
StringBuilder errors = new StringBuilder("Validation errors: ");
|
StringBuilder errors = new StringBuilder("Validation errors: ");
|
||||||
for (JsonNode error : errorsNode) {
|
for (JsonNode error : errorsNode) {
|
||||||
String parameterName = extractField(error, "parameterName");
|
String parameterName = extractField(error, "parameterName");
|
||||||
|
|||||||
+8
-16
@@ -77,21 +77,13 @@ public interface ImagesApi {
|
|||||||
}
|
}
|
||||||
String ext = fileName.substring(dotPos + 1).toLowerCase();
|
String ext = fileName.substring(dotPos + 1).toLowerCase();
|
||||||
|
|
||||||
switch (ext) {
|
return switch (ext) {
|
||||||
case "jpg":
|
case "jpg", "jpeg" -> "image/jpeg";
|
||||||
case "jpeg":
|
case "png" -> "image/png";
|
||||||
return "image/jpeg";
|
case "gif" -> "image/gif";
|
||||||
case "png":
|
case "tif", "tiff" -> "image/tiff";
|
||||||
return "image/png";
|
case "pdf" -> "application/pdf";
|
||||||
case "gif":
|
default -> "application/octet-stream";
|
||||||
return "image/gif";
|
};
|
||||||
case "tif":
|
|
||||||
case "tiff":
|
|
||||||
return "image/tiff";
|
|
||||||
case "pdf":
|
|
||||||
return "application/pdf";
|
|
||||||
default:
|
|
||||||
return "application/octet-stream";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -60,8 +60,7 @@ public final class ApiResponseDecoder implements Decoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isApiResponseType(Type type) {
|
private boolean isApiResponseType(Type type) {
|
||||||
if (type instanceof ParameterizedType) {
|
if (type instanceof ParameterizedType paramType) {
|
||||||
ParameterizedType paramType = (ParameterizedType) type;
|
|
||||||
Type rawType = paramType.getRawType();
|
Type rawType = paramType.getRawType();
|
||||||
return rawType == ApiResponse.class;
|
return rawType == ApiResponse.class;
|
||||||
}
|
}
|
||||||
@@ -69,8 +68,7 @@ public final class ApiResponseDecoder implements Decoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Type getApiResponseInnerType(Type type) {
|
private Type getApiResponseInnerType(Type type) {
|
||||||
if (type instanceof ParameterizedType) {
|
if (type instanceof ParameterizedType paramType) {
|
||||||
ParameterizedType paramType = (ParameterizedType) type;
|
|
||||||
Type[] typeArgs = paramType.getActualTypeArguments();
|
Type[] typeArgs = paramType.getActualTypeArguments();
|
||||||
if (typeArgs.length > 0) {
|
if (typeArgs.length > 0) {
|
||||||
return typeArgs[0];
|
return typeArgs[0];
|
||||||
|
|||||||
+3
-9
@@ -20,7 +20,9 @@ package org.apache.fineract.infrastructure.cache.domain;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum CacheType {
|
public enum CacheType {
|
||||||
|
|
||||||
INVALID(0, "cacheType.invalid"), //
|
INVALID(0, "cacheType.invalid"), //
|
||||||
@@ -54,15 +56,7 @@ public enum CacheType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString().replaceAll("_", " ");
|
return name().replace("_", " ");
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNoCache() {
|
public boolean isNoCache() {
|
||||||
|
|||||||
+3
-4
@@ -20,6 +20,7 @@ package org.apache.fineract.portfolio.calendar;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
public final class CalendarConstants {
|
public final class CalendarConstants {
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ public final class CalendarConstants {
|
|||||||
|
|
||||||
public static final String CALENDAR_RESOURCE_NAME = "calendar";
|
public static final String CALENDAR_RESOURCE_NAME = "calendar";
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum CalendarSupportedParameters {
|
public enum CalendarSupportedParameters {
|
||||||
|
|
||||||
CALENDAR_ID("id"), //
|
CALENDAR_ID("id"), //
|
||||||
@@ -80,12 +82,9 @@ public final class CalendarConstants {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString().replaceAll("_", " ");
|
return name().replace("_", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-43
@@ -20,9 +20,11 @@ package org.apache.fineract.portfolio.calendar.domain;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import lombok.Getter;
|
||||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum CalendarFrequencyType {
|
public enum CalendarFrequencyType {
|
||||||
|
|
||||||
INVALID(0, "calendarFrequencyType.invalid"), //
|
INVALID(0, "calendarFrequencyType.invalid"), //
|
||||||
@@ -39,16 +41,10 @@ public enum CalendarFrequencyType {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<Integer, CalendarFrequencyType> intToEnumMap = new HashMap<>();
|
private static final Map<Integer, CalendarFrequencyType> intToEnumMap = new HashMap<>();
|
||||||
|
@Getter
|
||||||
private static int minValue = CalendarFrequencyType.DAILY.value;
|
private static int minValue = CalendarFrequencyType.DAILY.value;
|
||||||
|
@Getter
|
||||||
private static int maxValue = CalendarFrequencyType.YEARLY.value;
|
private static int maxValue = CalendarFrequencyType.YEARLY.value;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -58,8 +54,7 @@ public enum CalendarFrequencyType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CalendarFrequencyType fromInt(final int i) {
|
public static CalendarFrequencyType fromInt(final int i) {
|
||||||
final CalendarFrequencyType type = intToEnumMap.get(Integer.valueOf(i));
|
return intToEnumMap.get(i);
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CalendarFrequencyType fromString(final String frequencyString) {
|
public static CalendarFrequencyType fromString(final String frequencyString) {
|
||||||
@@ -82,17 +77,9 @@ public enum CalendarFrequencyType {
|
|||||||
return frequency;
|
return frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getMinValue() {
|
|
||||||
return minValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getMaxValue() {
|
|
||||||
return maxValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString();
|
return name();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWeekly() {
|
public boolean isWeekly() {
|
||||||
@@ -115,18 +102,13 @@ public enum CalendarFrequencyType {
|
|||||||
* @return CalendarFrequencyType
|
* @return CalendarFrequencyType
|
||||||
*/
|
*/
|
||||||
public static CalendarFrequencyType from(final PeriodFrequencyType periodFrequencyType) {
|
public static CalendarFrequencyType from(final PeriodFrequencyType periodFrequencyType) {
|
||||||
switch (periodFrequencyType) {
|
return switch (periodFrequencyType) {
|
||||||
case DAYS:
|
case DAYS -> CalendarFrequencyType.DAILY;
|
||||||
return CalendarFrequencyType.DAILY;
|
case WEEKS -> CalendarFrequencyType.WEEKLY;
|
||||||
case WEEKS:
|
case MONTHS -> CalendarFrequencyType.MONTHLY;
|
||||||
return CalendarFrequencyType.WEEKLY;
|
case YEARS -> CalendarFrequencyType.YEARLY;
|
||||||
case MONTHS:
|
default -> CalendarFrequencyType.INVALID;
|
||||||
return CalendarFrequencyType.MONTHLY;
|
};
|
||||||
case YEARS:
|
|
||||||
return CalendarFrequencyType.YEARLY;
|
|
||||||
default:
|
|
||||||
return CalendarFrequencyType.INVALID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,17 +118,12 @@ public enum CalendarFrequencyType {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static PeriodFrequencyType from(final CalendarFrequencyType frequencyType) {
|
public static PeriodFrequencyType from(final CalendarFrequencyType frequencyType) {
|
||||||
switch (frequencyType) {
|
return switch (frequencyType) {
|
||||||
case DAILY:
|
case DAILY -> PeriodFrequencyType.DAYS;
|
||||||
return PeriodFrequencyType.DAYS;
|
case WEEKLY -> PeriodFrequencyType.WEEKS;
|
||||||
case WEEKLY:
|
case MONTHLY -> PeriodFrequencyType.MONTHS;
|
||||||
return PeriodFrequencyType.WEEKS;
|
case YEARLY -> PeriodFrequencyType.YEARS;
|
||||||
case MONTHLY:
|
default -> PeriodFrequencyType.INVALID;
|
||||||
return PeriodFrequencyType.MONTHS;
|
};
|
||||||
case YEARLY:
|
|
||||||
return PeriodFrequencyType.YEARS;
|
|
||||||
default:
|
|
||||||
return PeriodFrequencyType.INVALID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-19
@@ -20,7 +20,9 @@ package org.apache.fineract.portfolio.calendar.domain;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum CalendarRemindBy {
|
public enum CalendarRemindBy {
|
||||||
|
|
||||||
SMS(1, "calendarRemindBy.sms"), //
|
SMS(1, "calendarRemindBy.sms"), //
|
||||||
@@ -35,16 +37,10 @@ public enum CalendarRemindBy {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<Integer, CalendarRemindBy> intToEnumMap = new HashMap<>();
|
private static final Map<Integer, CalendarRemindBy> intToEnumMap = new HashMap<>();
|
||||||
|
@Getter
|
||||||
private static int minValue;
|
private static int minValue;
|
||||||
|
@Getter
|
||||||
private static int maxValue;
|
private static int maxValue;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -65,20 +61,11 @@ public enum CalendarRemindBy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CalendarRemindBy fromInt(final int i) {
|
public static CalendarRemindBy fromInt(final int i) {
|
||||||
final CalendarRemindBy remindBy = intToEnumMap.get(Integer.valueOf(i));
|
return intToEnumMap.get(i);
|
||||||
return remindBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getMinValue() {
|
|
||||||
return minValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getMaxValue() {
|
|
||||||
return maxValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString();
|
return name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-19
@@ -20,7 +20,9 @@ package org.apache.fineract.portfolio.calendar.domain;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum CalendarType {
|
public enum CalendarType {
|
||||||
|
|
||||||
COLLECTION(1, "calendarType.collection"), //
|
COLLECTION(1, "calendarType.collection"), //
|
||||||
@@ -36,16 +38,10 @@ public enum CalendarType {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<Integer, CalendarType> intToEnumMap = new HashMap<>();
|
private static final Map<Integer, CalendarType> intToEnumMap = new HashMap<>();
|
||||||
|
@Getter
|
||||||
private static int minValue;
|
private static int minValue;
|
||||||
|
@Getter
|
||||||
private static int maxValue;
|
private static int maxValue;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -66,21 +62,12 @@ public enum CalendarType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CalendarType fromInt(final int i) {
|
public static CalendarType fromInt(final int i) {
|
||||||
final CalendarType type = intToEnumMap.get(Integer.valueOf(i));
|
return intToEnumMap.get(i);
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getMinValue() {
|
|
||||||
return minValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getMaxValue() {
|
|
||||||
return maxValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString();
|
return name();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCollection() {
|
public boolean isCollection() {
|
||||||
|
|||||||
+6
-19
@@ -20,8 +20,10 @@ package org.apache.fineract.portfolio.calendar.domain;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import lombok.Getter;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum CalendarWeekDaysType {
|
public enum CalendarWeekDaysType {
|
||||||
|
|
||||||
INVALID(0, "calendarWeekDaysType.invalid"), //
|
INVALID(0, "calendarWeekDaysType.invalid"), //
|
||||||
@@ -41,16 +43,10 @@ public enum CalendarWeekDaysType {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<Integer, CalendarWeekDaysType> intToEnumMap = new HashMap<>();
|
private static final Map<Integer, CalendarWeekDaysType> intToEnumMap = new HashMap<>();
|
||||||
|
@Getter
|
||||||
private static int minValue = CalendarWeekDaysType.MO.value;
|
private static int minValue = CalendarWeekDaysType.MO.value;
|
||||||
|
@Getter
|
||||||
private static int maxValue = CalendarWeekDaysType.SU.value;
|
private static int maxValue = CalendarWeekDaysType.SU.value;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -60,21 +56,12 @@ public enum CalendarWeekDaysType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CalendarWeekDaysType fromInt(final int i) {
|
public static CalendarWeekDaysType fromInt(final int i) {
|
||||||
final CalendarWeekDaysType type = intToEnumMap.get(Integer.valueOf(i));
|
return intToEnumMap.get(i);
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getMinValue() {
|
|
||||||
return minValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getMaxValue() {
|
|
||||||
return maxValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString();
|
return name();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInvalid() {
|
public boolean isInvalid() {
|
||||||
|
|||||||
+8
-15
@@ -40,9 +40,7 @@ public final class CalendarEnumerations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumOptionData calendarEntityType(final CalendarEntityType entityType) {
|
public static EnumOptionData calendarEntityType(final CalendarEntityType entityType) {
|
||||||
final EnumOptionData optionData = new EnumOptionData(entityType.getValue().longValue(), entityType.getCode(),
|
return new EnumOptionData(entityType.getValue().longValue(), entityType.getCode(), entityType.toString());
|
||||||
entityType.toString());
|
|
||||||
return optionData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<EnumOptionData> calendarEntityType(final CalendarEntityType[] entityTypes) {
|
public static List<EnumOptionData> calendarEntityType(final CalendarEntityType[] entityTypes) {
|
||||||
@@ -58,8 +56,7 @@ public final class CalendarEnumerations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumOptionData calendarType(final CalendarType type) {
|
public static EnumOptionData calendarType(final CalendarType type) {
|
||||||
final EnumOptionData optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), type.toString());
|
return new EnumOptionData(type.getValue().longValue(), type.getCode(), type.toString());
|
||||||
return optionData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<EnumOptionData> calendarType(final CalendarType[] types) {
|
public static List<EnumOptionData> calendarType(final CalendarType[] types) {
|
||||||
@@ -75,8 +72,7 @@ public final class CalendarEnumerations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumOptionData calendarRemindBy(final CalendarRemindBy remindBy) {
|
public static EnumOptionData calendarRemindBy(final CalendarRemindBy remindBy) {
|
||||||
final EnumOptionData optionData = new EnumOptionData(remindBy.getValue().longValue(), remindBy.getCode(), remindBy.toString());
|
return new EnumOptionData(remindBy.getValue().longValue(), remindBy.getCode(), remindBy.toString());
|
||||||
return optionData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<EnumOptionData> calendarRemindBy(final CalendarRemindBy[] remindBys) {
|
public static List<EnumOptionData> calendarRemindBy(final CalendarRemindBy[] remindBys) {
|
||||||
@@ -138,16 +134,13 @@ public final class CalendarEnumerations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumOptionData calendarFrequencyNthDayType(final NthDayType calendarFrequencyNthDayType) {
|
public static EnumOptionData calendarFrequencyNthDayType(final NthDayType calendarFrequencyNthDayType) {
|
||||||
final EnumOptionData optionData = new EnumOptionData(calendarFrequencyNthDayType.getValue().longValue(),
|
return new EnumOptionData(calendarFrequencyNthDayType.getValue().longValue(), calendarFrequencyNthDayType.getCode(),
|
||||||
calendarFrequencyNthDayType.getCode(), calendarFrequencyNthDayType.toString());
|
calendarFrequencyNthDayType.toString());
|
||||||
return optionData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<EnumOptionData> calendarFrequencyNthDayType() {
|
public static List<EnumOptionData> calendarFrequencyNthDayType() {
|
||||||
final List<EnumOptionData> optionDatas = Arrays.asList(calendarFrequencyNthDayType(NthDayType.ONE),
|
return Arrays.asList(calendarFrequencyNthDayType(NthDayType.ONE), calendarFrequencyNthDayType(NthDayType.TWO),
|
||||||
calendarFrequencyNthDayType(NthDayType.TWO), calendarFrequencyNthDayType(NthDayType.THREE),
|
calendarFrequencyNthDayType(NthDayType.THREE), calendarFrequencyNthDayType(NthDayType.FOUR),
|
||||||
calendarFrequencyNthDayType(NthDayType.FOUR), calendarFrequencyNthDayType(NthDayType.LAST),
|
calendarFrequencyNthDayType(NthDayType.LAST), calendarFrequencyNthDayType(NthDayType.ONDAY));
|
||||||
calendarFrequencyNthDayType(NthDayType.ONDAY));
|
|
||||||
return optionDatas;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-11
@@ -208,8 +208,7 @@ public final class CalendarUtils {
|
|||||||
|
|
||||||
public static LocalDate adjustRecurringDate(final LocalDate recuringDate, final Integer numberOfDays) {
|
public static LocalDate adjustRecurringDate(final LocalDate recuringDate, final Integer numberOfDays) {
|
||||||
if (recuringDate.getDayOfMonth() == 1) {
|
if (recuringDate.getDayOfMonth() == 1) {
|
||||||
LocalDate adjustedRecurringDate = recuringDate.plusDays(numberOfDays);
|
return recuringDate.plusDays(numberOfDays);
|
||||||
return adjustedRecurringDate;
|
|
||||||
}
|
}
|
||||||
return recuringDate;
|
return recuringDate;
|
||||||
}
|
}
|
||||||
@@ -221,9 +220,7 @@ public final class CalendarUtils {
|
|||||||
final RRule rrule = new RRule(recurringRule);
|
final RRule rrule = new RRule(recurringRule);
|
||||||
rrule.validate();
|
rrule.validate();
|
||||||
|
|
||||||
final Recur recur = rrule.getRecur();
|
return rrule.getRecur();
|
||||||
|
|
||||||
return recur;
|
|
||||||
} catch (final ParseException e) {
|
} catch (final ParseException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
log.error("Problem occurred in getICalRecur function", e);
|
log.error("Problem occurred in getICalRecur function", e);
|
||||||
@@ -385,7 +382,7 @@ public final class CalendarUtils {
|
|||||||
final Collection<LocalDate> recurDate = getRecurringDates(recur, seedDate, startDate, date.plusDays(1), 1,
|
final Collection<LocalDate> recurDate = getRecurringDates(recur, seedDate, startDate, date.plusDays(1), 1,
|
||||||
isSkipRepaymentonFirstDayOfMonth, numberOfDays);
|
isSkipRepaymentonFirstDayOfMonth, numberOfDays);
|
||||||
|
|
||||||
return (recurDate == null || recurDate.isEmpty()) ? false : recurDate.contains(date);
|
return recurDate != null && !recurDate.isEmpty() && recurDate.contains(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DayNameEnum {
|
public enum DayNameEnum {
|
||||||
@@ -585,10 +582,9 @@ public final class CalendarUtils {
|
|||||||
if (isValidRecurringDate(recur, seedDate, oldRepaymentDate, isSkipRepaymentOnFirstDayOfMonth, numberOfDays)) {
|
if (isValidRecurringDate(recur, seedDate, oldRepaymentDate, isSkipRepaymentOnFirstDayOfMonth, numberOfDays)) {
|
||||||
return oldRepaymentDate;
|
return oldRepaymentDate;
|
||||||
}
|
}
|
||||||
LocalDate nextRepaymentDate = getNextRepaymentMeetingDate(recurringRule, seedDate, oldRepaymentDate, loanRepaymentInterval,
|
|
||||||
frequency, workingDays, isSkipRepaymentOnFirstDayOfMonth, numberOfDays);
|
|
||||||
|
|
||||||
return nextRepaymentDate;
|
return getNextRepaymentMeetingDate(recurringRule, seedDate, oldRepaymentDate, loanRepaymentInterval, frequency, workingDays,
|
||||||
|
isSkipRepaymentOnFirstDayOfMonth, numberOfDays);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LocalDate getNextRepaymentMeetingDate(final String recurringRule, final LocalDate seedDate, final LocalDate repaymentDate,
|
public static LocalDate getNextRepaymentMeetingDate(final String recurringRule, final LocalDate seedDate, final LocalDate repaymentDate,
|
||||||
@@ -701,10 +697,10 @@ public final class CalendarUtils {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
for (int i = 0; i < calendarTypeOptions.size() - 1; i++) {
|
for (int i = 0; i < calendarTypeOptions.size() - 1; i++) {
|
||||||
sb.append(calendarTypeOptions.get(i).toString() + ",");
|
sb.append(calendarTypeOptions.get(i).toString()).append(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append(calendarTypeOptions.get(calendarTypeOptions.size() - 1).toString());
|
sb.append(calendarTypeOptions.getLast().toString());
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-23
@@ -18,9 +18,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.portfolio.client.domain;
|
package org.apache.fineract.portfolio.client.domain;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum representation of client identifier status states.
|
* Enum representation of client identifier status states.
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
public enum ClientIdentifierStatus {
|
public enum ClientIdentifierStatus {
|
||||||
|
|
||||||
INACTIVE(100, "clientIdentifierStatusType.inactive"), //
|
INACTIVE(100, "clientIdentifierStatusType.inactive"), //
|
||||||
@@ -31,17 +34,11 @@ public enum ClientIdentifierStatus {
|
|||||||
private final String code;
|
private final String code;
|
||||||
|
|
||||||
public static ClientIdentifierStatus fromInt(final Integer statusValue) {
|
public static ClientIdentifierStatus fromInt(final Integer statusValue) {
|
||||||
|
return switch (statusValue) {
|
||||||
ClientIdentifierStatus enumeration = ClientIdentifierStatus.INVALID;
|
case 100 -> ClientIdentifierStatus.INACTIVE;
|
||||||
switch (statusValue) {
|
case 200 -> ClientIdentifierStatus.ACTIVE;
|
||||||
case 100:
|
default -> ClientIdentifierStatus.INVALID;
|
||||||
enumeration = ClientIdentifierStatus.INACTIVE;
|
};
|
||||||
break;
|
|
||||||
case 200:
|
|
||||||
enumeration = ClientIdentifierStatus.ACTIVE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return enumeration;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientIdentifierStatus(final Integer value, final String code) {
|
ClientIdentifierStatus(final Integer value, final String code) {
|
||||||
@@ -49,18 +46,6 @@ public enum ClientIdentifierStatus {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public boolean hasStateOf(final ClientIdentifierStatus state) {
|
|
||||||
// return this.value.equals(state.getValue());
|
|
||||||
// }
|
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInactive() {
|
public boolean isInactive() {
|
||||||
return this.value.equals(ClientIdentifierStatus.INACTIVE.getValue());
|
return this.value.equals(ClientIdentifierStatus.INACTIVE.getValue());
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ public enum ConditionType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString().replace("_", " ");
|
return name().replace("_", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getValue() {
|
public Integer getValue() {
|
||||||
|
|||||||
+4
-5
@@ -18,6 +18,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.portfolio.collateralmanagement.api;
|
package org.apache.fineract.portfolio.collateralmanagement.api;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum CollateralManagementJsonInputParams {
|
public enum CollateralManagementJsonInputParams {
|
||||||
|
|
||||||
NAME("name"), //
|
NAME("name"), //
|
||||||
@@ -39,11 +42,7 @@ public enum CollateralManagementJsonInputParams {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().replaceAll("_", " ");
|
return name().replace("_", " ");
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -141,12 +141,10 @@ public class DelinquencyReadPlatformServiceImpl implements DelinquencyReadPlatfo
|
|||||||
|
|
||||||
// If the Loan is not Active yet or is cancelled (rejected or withdrawn), return template data
|
// If the Loan is not Active yet or is cancelled (rejected or withdrawn), return template data
|
||||||
if (loan.isSubmittedAndPendingApproval() || loan.isApproved() || loan.isCancelled()) {
|
if (loan.isSubmittedAndPendingApproval() || loan.isApproved() || loan.isCancelled()) {
|
||||||
if (loan.getLoanProduct() != null && !loan.getLoanProduct().isAllowApprovedDisbursedAmountsOverApplied()) {
|
if (loan.getLoanProduct() == null || loan.getLoanProduct().isAllowApprovedDisbursedAmountsOverApplied()) {
|
||||||
return collectionData;
|
|
||||||
} else {
|
|
||||||
collectionData.setAvailableDisbursementAmountWithOverApplied(calculateAvailableDisbursementAmountWithOverApplied(loan));
|
collectionData.setAvailableDisbursementAmountWithOverApplied(calculateAvailableDisbursementAmountWithOverApplied(loan));
|
||||||
return collectionData;
|
|
||||||
}
|
}
|
||||||
|
return collectionData;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<LoanDelinquencyAction> savedDelinquencyList = retrieveLoanDelinquencyActions(loanId);
|
final List<LoanDelinquencyAction> savedDelinquencyList = retrieveLoanDelinquencyActions(loanId);
|
||||||
|
|||||||
+5
-7
@@ -42,7 +42,7 @@ import org.mockito.MockitoAnnotations;
|
|||||||
/**
|
/**
|
||||||
* Test class for {@link CreateChargeByLoanExternalIdCommandStrategy}.
|
* Test class for {@link CreateChargeByLoanExternalIdCommandStrategy}.
|
||||||
*/
|
*/
|
||||||
public class CreateChargeByLoanExternalIdCommandStrategyTest {
|
class CreateChargeByLoanExternalIdCommandStrategyTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command arguments provider.
|
* Command arguments provider.
|
||||||
@@ -50,7 +50,7 @@ public class CreateChargeByLoanExternalIdCommandStrategyTest {
|
|||||||
* @return command argument
|
* @return command argument
|
||||||
*/
|
*/
|
||||||
private static Stream<Arguments> provideCommandParameters() {
|
private static Stream<Arguments> provideCommandParameters() {
|
||||||
return Stream.of(Arguments.of(null, 0), Arguments.of("adjustment", 1));
|
return Stream.of(Arguments.of((Object) null), Arguments.of("adjustment"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,12 +58,10 @@ public class CreateChargeByLoanExternalIdCommandStrategyTest {
|
|||||||
*
|
*
|
||||||
* @param command
|
* @param command
|
||||||
* the command to pass
|
* the command to pass
|
||||||
* @param noOfArguments
|
|
||||||
* the number of arguments
|
|
||||||
*/
|
*/
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("provideCommandParameters")
|
@MethodSource("provideCommandParameters")
|
||||||
public void testExecuteSuccessScenario(final String command, final int noOfArguments) {
|
void testExecuteSuccessScenario(final String command) {
|
||||||
final TestContext testContext = new TestContext();
|
final TestContext testContext = new TestContext();
|
||||||
final String loanExternalId = UUID.randomUUID().toString();
|
final String loanExternalId = UUID.randomUUID().toString();
|
||||||
final BatchRequest batchRequest = getBatchRequest(loanExternalId, command);
|
final BatchRequest batchRequest = getBatchRequest(loanExternalId, command);
|
||||||
@@ -98,10 +96,10 @@ public class CreateChargeByLoanExternalIdCommandStrategyTest {
|
|||||||
if (StringUtils.isNotBlank(command)) {
|
if (StringUtils.isNotBlank(command)) {
|
||||||
relativeUrl = relativeUrl + String.format("?command=%s", command);
|
relativeUrl = relativeUrl + String.format("?command=%s", command);
|
||||||
}
|
}
|
||||||
br.setRequestId(Long.valueOf(RandomStringUtils.randomNumeric(5)));
|
br.setRequestId(Long.valueOf(RandomStringUtils.secure().nextNumeric(5)));
|
||||||
br.setRelativeUrl(relativeUrl);
|
br.setRelativeUrl(relativeUrl);
|
||||||
br.setMethod(HttpMethod.POST);
|
br.setMethod(HttpMethod.POST);
|
||||||
br.setReference(Long.valueOf(RandomStringUtils.randomNumeric(5)));
|
br.setReference(Long.valueOf(RandomStringUtils.secure().nextNumeric(5)));
|
||||||
br.setBody("{}");
|
br.setBody("{}");
|
||||||
|
|
||||||
return br;
|
return br;
|
||||||
|
|||||||
Reference in New Issue
Block a user