FINERACT-2437: Decrease the number of compilation warnings
This commit is contained in:
+5
-5
@@ -56,7 +56,7 @@ public class RetryConfigurationAssembler {
|
||||
|
||||
public Retry getRetryConfigurationForExecuteCommand() {
|
||||
Class<? extends Throwable>[] exceptionList = fineractProperties.getRetry().getInstances().getExecuteCommand().getRetryExceptions();
|
||||
RetryConfig.Builder configBuilder = buildCommonExecuteCommandConfiguration();
|
||||
RetryConfig.Builder<Throwable> configBuilder = buildCommonExecuteCommandConfiguration();
|
||||
|
||||
if (exceptionList != null) {
|
||||
configBuilder.retryOnException(ex -> {
|
||||
@@ -71,7 +71,7 @@ public class RetryConfigurationAssembler {
|
||||
|
||||
public Retry getRetryConfigurationForBatchApiWithEnclosingTransaction() {
|
||||
Class<? extends Throwable>[] exceptionList = fineractProperties.getRetry().getInstances().getExecuteCommand().getRetryExceptions();
|
||||
RetryConfig.Builder configBuilder = buildCommonExecuteCommandConfiguration();
|
||||
RetryConfig.Builder<Throwable> configBuilder = buildCommonExecuteCommandConfiguration();
|
||||
|
||||
if (exceptionList != null) {
|
||||
configBuilder.retryOnException(ex -> {
|
||||
@@ -89,10 +89,10 @@ public class RetryConfigurationAssembler {
|
||||
return registry.retry(BATCH_RETRY, config);
|
||||
}
|
||||
|
||||
private RetryConfig.Builder buildCommonExecuteCommandConfiguration() {
|
||||
private RetryConfig.Builder<Throwable> buildCommonExecuteCommandConfiguration() {
|
||||
var props = fineractProperties.getRetry().getInstances().getExecuteCommand();
|
||||
|
||||
RetryConfig.Builder configBuilder = RetryConfig.custom().maxAttempts(props.getMaxAttempts());
|
||||
RetryConfig.Builder<Throwable> configBuilder = RetryConfig.<Throwable>custom().maxAttempts(props.getMaxAttempts());
|
||||
|
||||
if (props.getWaitDuration() != null && props.getWaitDuration().toMillis() >= 0) {
|
||||
if (Boolean.TRUE.equals(props.getEnableExponentialBackoff())) {
|
||||
@@ -111,7 +111,7 @@ public class RetryConfigurationAssembler {
|
||||
}
|
||||
|
||||
public Retry getRetryConfigurationForCommandResultPersistence() {
|
||||
RetryConfig.Builder configBuilder = buildCommonExecuteCommandConfiguration();
|
||||
RetryConfig.Builder<Throwable> configBuilder = buildCommonExecuteCommandConfiguration();
|
||||
|
||||
configBuilder.retryOnException(e -> e instanceof RuntimeException && !(e instanceof CommandResultPersistenceException));
|
||||
|
||||
|
||||
+3
-1
@@ -34,10 +34,12 @@ public interface ApiFacingEnum<T extends Enum<T> & ApiFacingEnum<T>> {
|
||||
}
|
||||
|
||||
default StringEnumOptionData getValueAsStringEnumOptionData() {
|
||||
return new StringEnumOptionData(((Enum<T>) this).name(), getCode(), getHumanReadableName());
|
||||
return new StringEnumOptionData(this.name(), getCode(), getHumanReadableName());
|
||||
}
|
||||
|
||||
String getCode();
|
||||
|
||||
String getHumanReadableName();
|
||||
|
||||
String name();
|
||||
}
|
||||
|
||||
+1
-1
@@ -540,7 +540,7 @@ public final class JsonCommand {
|
||||
*/
|
||||
public boolean booleanPrimitiveValueOfParameterNamed(final String parameterName) {
|
||||
final Boolean value = this.fromApiJsonHelper.extractBooleanNamed(parameterName, this.parsedCommand);
|
||||
return ObjectUtils.defaultIfNull(value, Boolean.FALSE);
|
||||
return ObjectUtils.getIfNull(value, Boolean.FALSE);
|
||||
}
|
||||
|
||||
public boolean isChangeInArrayParameterNamed(final String parameterName, final String[] existingValue) {
|
||||
|
||||
+9
-5
@@ -28,6 +28,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import lombok.Getter;
|
||||
import net.fortuna.ical4j.model.property.RRule;
|
||||
import net.fortuna.ical4j.validate.ValidationException;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -40,6 +41,7 @@ import org.springframework.util.ObjectUtils;
|
||||
public class DataValidatorBuilder {
|
||||
|
||||
public static final String VALID_INPUT_SEPARATOR = "_";
|
||||
@Getter
|
||||
private final List<ApiParameterError> dataValidationErrors;
|
||||
private String resource;
|
||||
private String parameter;
|
||||
@@ -78,10 +80,6 @@ public class DataValidatorBuilder {
|
||||
return !dataValidationErrors.isEmpty();
|
||||
}
|
||||
|
||||
public List<ApiParameterError> getDataValidationErrors() {
|
||||
return dataValidationErrors;
|
||||
}
|
||||
|
||||
public DataValidatorBuilder resource(final String resource) {
|
||||
this.resource = resource;
|
||||
return this;
|
||||
@@ -629,7 +627,13 @@ public class DataValidatorBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
final List<Object> list = (List<Object>) this.value;
|
||||
if (!(this.value instanceof List<?> list)) {
|
||||
String validationErrorCode = "validation.msg." + this.resource + "." + this.parameter + ".is.not.list";
|
||||
String defaultEnglishMessage = "The parameter `" + this.parameter + "` should be a list.";
|
||||
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode, defaultEnglishMessage, this.parameter);
|
||||
this.dataValidationErrors.add(error);
|
||||
return this;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
String validationErrorCode = "validation.msg." + this.resource + "." + this.parameter + ".cannot.be.empty";
|
||||
String defaultEnglishMessage = "The parameter `" + this.parameter + "` cannot be empty. You must select at least one.";
|
||||
|
||||
+2
-5
@@ -20,6 +20,7 @@ package org.apache.fineract.infrastructure.core.domain;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Auditable;
|
||||
@@ -32,15 +33,11 @@ import org.springframework.data.jpa.domain.AbstractAuditable;
|
||||
* instead of LocalDateTime for created and modified.
|
||||
*
|
||||
* Abstract base class for auditable entities. Stores the audit values in persistent fields.
|
||||
*
|
||||
* @param <U>
|
||||
* the auditing type. Typically some kind of user.
|
||||
* @param <PK>
|
||||
* the type of the auditing type's identifier
|
||||
*/
|
||||
@MappedSuperclass
|
||||
public abstract class AbstractAuditableCustom extends AbstractPersistableCustom<Long> implements Auditable<Long, Long, LocalDateTime> {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 141481953116476081L;
|
||||
|
||||
@Column(name = "createdby_id")
|
||||
|
||||
+1
-4
@@ -116,6 +116,7 @@ public final class ErrorHandler {
|
||||
private final DefaultExceptionMapper defaultExceptionMapper;
|
||||
|
||||
@NotNull
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends RuntimeException> ExceptionMapper<T> findMostSpecificExceptionHandler(T exception) {
|
||||
Class<?> clazz = exception.getClass();
|
||||
do {
|
||||
@@ -123,23 +124,19 @@ public final class ErrorHandler {
|
||||
Set<String> fineractErrorMappers = createSet(ctx.getBeanNamesForType(FineractExceptionMapper.class));
|
||||
SetUtils.SetView<String> intersection = SetUtils.intersection(exceptionMappers, fineractErrorMappers);
|
||||
if (!intersection.isEmpty()) {
|
||||
// noinspection unchecked
|
||||
return (ExceptionMapper<T>) ctx.getBean(intersection.iterator().next());
|
||||
}
|
||||
if (!exceptionMappers.isEmpty()) {
|
||||
// noinspection unchecked
|
||||
return (ExceptionMapper<T>) ctx.getBean(exceptionMappers.iterator().next());
|
||||
}
|
||||
clazz = clazz.getSuperclass();
|
||||
} while (!clazz.equals(Exception.class));
|
||||
// noinspection unchecked
|
||||
return (ExceptionMapper<T>) defaultExceptionMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object of ErrorInfo type containing the information regarding the raised error.
|
||||
*
|
||||
* @param exception
|
||||
* @return ErrorInfo
|
||||
*/
|
||||
public ErrorInfo handle(@NotNull RuntimeException exception) {
|
||||
|
||||
+1
-3
@@ -28,9 +28,7 @@ public interface ExternalEventProducer {
|
||||
* Sends the created ExternalEvents
|
||||
*
|
||||
* @param partitions
|
||||
* is a Map<Long, List<byte[]>> partitions, the key here the id of the aggregated root. The value is list
|
||||
* of external events belong to the same key, serialized into byte array
|
||||
* @throws AcknowledgementTimeoutException
|
||||
* The value is list of external events belong to the same key, serialized into byte array
|
||||
*/
|
||||
void sendEvents(Map<Long, List<byte[]>> partitions) throws AcknowledgementTimeoutException;
|
||||
}
|
||||
|
||||
+9
-14
@@ -27,11 +27,9 @@ import java.util.regex.Pattern;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Utility to assemble the WHERE clause of an SQL query without the risk of SQL injection.
|
||||
*
|
||||
* <p>
|
||||
* When using this utility instead of manually assembling SQL queries, then {@link SqlValidator} should not be required
|
||||
* anymore. (Correctly using this means only ever passing completely fixed String literals to .)
|
||||
* Utility to assemble the WHERE clause of an SQL query without the risk of SQL injection. When using this utility
|
||||
* instead of manually assembling SQL queries, then SqlValidator should not be required anymore. (Correctly using this
|
||||
* means only ever passing completely fixed String literals to .)
|
||||
*
|
||||
* @author Michael Vorburger <mike@vorburger.ch>
|
||||
*/
|
||||
@@ -67,9 +65,6 @@ public class SQLBuilder {
|
||||
throw new IllegalArgumentException("criteria cannot be null");
|
||||
}
|
||||
String trimmedCriteria = criteria.trim();
|
||||
if (trimmedCriteria.isEmpty()) {
|
||||
throw new IllegalArgumentException("criteria cannot be null");
|
||||
}
|
||||
if (trimmedCriteria.contains("?")) {
|
||||
throw new IllegalArgumentException(
|
||||
"criteria cannot contain a '?' (that is automatically added at the end): " + trimmedCriteria);
|
||||
@@ -89,7 +84,7 @@ public class SQLBuilder {
|
||||
"criteria cannot contain more than 1 space (between column name and operator): " + trimmedCriteria);
|
||||
}
|
||||
if (!operator.equals("=") && !operator.equals("<") && !operator.equals(">") && !operator.equals("<=") && !operator.equals(">=")
|
||||
&& !operator.equals("<>") && !operator.equals("LIKE") && !operator.equals("like") && !operator.toLowerCase().equals("is")) {
|
||||
&& !operator.equals("<>") && !operator.equalsIgnoreCase("like") && !operator.equalsIgnoreCase("is")) {
|
||||
// add support for SQL's BETWEEN and IN, if/when ever needed.. (it's
|
||||
// a little more than just adding above, as it can have multiple
|
||||
// arguments)
|
||||
@@ -97,7 +92,7 @@ public class SQLBuilder {
|
||||
}
|
||||
|
||||
// TODO: Would be better to use SqlOperator functionality to handle
|
||||
if (sb.length() > 0) {
|
||||
if (!sb.isEmpty()) {
|
||||
sb.append(whereLogicalOperator.getSqlStr());
|
||||
}
|
||||
sb.append(trimmedCriteria);
|
||||
@@ -124,7 +119,7 @@ public class SQLBuilder {
|
||||
}
|
||||
|
||||
public void addSubOperation(Consumer<SQLBuilder> subOperation) {
|
||||
if (sb.length() > 0) {
|
||||
if (!sb.isEmpty()) {
|
||||
sb.append(WhereLogicalOperator.AND.getSqlStr());
|
||||
}
|
||||
sb.append(" ( ");
|
||||
@@ -138,8 +133,8 @@ public class SQLBuilder {
|
||||
* @return SQL WHERE clause, almost always starting with " WHERE ..." (unless no criteria, then empty)
|
||||
*/
|
||||
public String getSQLTemplate() {
|
||||
if (sb.length() > 0) {
|
||||
return " WHERE " + sb.toString();
|
||||
if (!sb.isEmpty()) {
|
||||
return " WHERE " + sb;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -178,7 +173,7 @@ public class SQLBuilder {
|
||||
} else if (currentArg == null) {
|
||||
whereClause.append("null");
|
||||
} else {
|
||||
whereClause.append(String.valueOf(currentArg));
|
||||
whereClause.append(currentArg);
|
||||
}
|
||||
whereClause.append("]");
|
||||
}
|
||||
|
||||
+10
-22
@@ -19,11 +19,12 @@
|
||||
package org.apache.fineract.portfolio.savings;
|
||||
|
||||
import java.util.Arrays;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* An enumeration of different options available on account closure {@link FixedDepositAccount} &
|
||||
* {@link RecurringDepositAccount}.
|
||||
* An enumeration of different options available on account closure
|
||||
*/
|
||||
@Getter
|
||||
public enum DepositAccountOnClosureType {
|
||||
|
||||
INVALID(0, "depositAccountClosureType.invalid"), //
|
||||
@@ -40,31 +41,18 @@ public enum DepositAccountOnClosureType {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public static DepositAccountOnClosureType fromInt(final Integer v) {
|
||||
if (v == null) {
|
||||
return INVALID;
|
||||
}
|
||||
|
||||
switch (v) {
|
||||
case 100:
|
||||
return WITHDRAW_DEPOSIT;
|
||||
case 200:
|
||||
return TRANSFER_TO_SAVINGS;
|
||||
case 300:
|
||||
return REINVEST_PRINCIPAL_AND_INTEREST;
|
||||
case 400:
|
||||
return REINVEST_PRINCIPAL_ONLY;
|
||||
default:
|
||||
return INVALID;
|
||||
}
|
||||
return switch (v) {
|
||||
case 100 -> WITHDRAW_DEPOSIT;
|
||||
case 200 -> TRANSFER_TO_SAVINGS;
|
||||
case 300 -> REINVEST_PRINCIPAL_AND_INTEREST;
|
||||
case 400 -> REINVEST_PRINCIPAL_ONLY;
|
||||
default -> INVALID;
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: why not just use the enum values... just more boilerplate code here!!
|
||||
|
||||
+9
-17
@@ -18,9 +18,12 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.savings;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* An enumeration of on hold transactions that can occur on a {@link SavingsAccount}.
|
||||
* An enumeration of on hold transactions that can occur on SavingsAccount.
|
||||
*/
|
||||
@Getter
|
||||
public enum DepositAccountOnHoldTransactionType {
|
||||
|
||||
INVALID(0, "deposutAccountOnHoldTransactionType.invalid"), //
|
||||
@@ -35,27 +38,16 @@ public enum DepositAccountOnHoldTransactionType {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public static DepositAccountOnHoldTransactionType fromInt(final Integer v) {
|
||||
if (v == null) {
|
||||
return INVALID;
|
||||
}
|
||||
|
||||
switch (v) {
|
||||
case 1:
|
||||
return HOLD;
|
||||
case 2:
|
||||
return RELEASE;
|
||||
default:
|
||||
return INVALID;
|
||||
}
|
||||
return switch (v) {
|
||||
case 1 -> HOLD;
|
||||
case 2 -> RELEASE;
|
||||
default -> INVALID;
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: why not just use the enum values... just more boilerplate code here!!
|
||||
|
||||
+18
-33
@@ -18,11 +18,13 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.savings;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
|
||||
/**
|
||||
* An enumeration of different transactions that can occur on a {@link SavingsAccount}.
|
||||
* An enumeration of different transactions that can occur on a SavingsAccount.
|
||||
*/
|
||||
@Getter
|
||||
public enum DepositAccountType {
|
||||
|
||||
INVALID(0, "depositAccountType.invalid"), //
|
||||
@@ -40,31 +42,18 @@ public enum DepositAccountType {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public static DepositAccountType fromInt(final Integer v) {
|
||||
if (v == null) {
|
||||
return INVALID;
|
||||
}
|
||||
|
||||
switch (v) {
|
||||
case 100:
|
||||
return SAVINGS_DEPOSIT;
|
||||
case 200:
|
||||
return FIXED_DEPOSIT;
|
||||
case 300:
|
||||
return RECURRING_DEPOSIT;
|
||||
case 400:
|
||||
return CURRENT_DEPOSIT;
|
||||
default:
|
||||
return INVALID;
|
||||
}
|
||||
return switch (v) {
|
||||
case 100 -> SAVINGS_DEPOSIT;
|
||||
case 200 -> FIXED_DEPOSIT;
|
||||
case 300 -> RECURRING_DEPOSIT;
|
||||
case 400 -> CURRENT_DEPOSIT;
|
||||
default -> INVALID;
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: why not just use the enum values... just more boilerplate code here!!
|
||||
@@ -94,19 +83,15 @@ public enum DepositAccountType {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return StringUtils.replace(code, "_", SPACE);
|
||||
return Strings.CS.replace(code, "_", SPACE);
|
||||
}
|
||||
|
||||
public String resourceName() {
|
||||
switch (this) {
|
||||
case FIXED_DEPOSIT:
|
||||
return DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME;
|
||||
case RECURRING_DEPOSIT:
|
||||
return DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME;
|
||||
case SAVINGS_DEPOSIT:
|
||||
return DepositsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME;
|
||||
default:
|
||||
return "INVALID";
|
||||
}
|
||||
return switch (this) {
|
||||
case FIXED_DEPOSIT -> DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME;
|
||||
case RECURRING_DEPOSIT -> DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME;
|
||||
case SAVINGS_DEPOSIT -> DepositsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME;
|
||||
default -> "INVALID";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+4
-9
@@ -24,10 +24,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.Getter;
|
||||
import org.apache.fineract.portfolio.TransactionEntryType;
|
||||
|
||||
/**
|
||||
* An enumeration of different transactions that can occur on a {@link SavingsAccount}.
|
||||
* An enumeration of different transactions that can occur on a SavingsAccount.
|
||||
*/
|
||||
public enum SavingsAccountTransactionType {
|
||||
|
||||
@@ -56,7 +57,9 @@ public enum SavingsAccountTransactionType {
|
||||
.collect(Collectors.toMap(SavingsAccountTransactionType::getValue, v -> v));
|
||||
|
||||
private final int value;
|
||||
@Getter
|
||||
private final String code;
|
||||
@Getter
|
||||
private final TransactionEntryType entryType;
|
||||
|
||||
SavingsAccountTransactionType(final Integer value, final String code, TransactionEntryType entryType) {
|
||||
@@ -77,14 +80,6 @@ public enum SavingsAccountTransactionType {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public TransactionEntryType getEntryType() {
|
||||
return entryType;
|
||||
}
|
||||
|
||||
public boolean isCreditEntryType() {
|
||||
return entryType != null && entryType.isCredit();
|
||||
}
|
||||
|
||||
+21
-79
@@ -23,6 +23,8 @@ import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper;
|
||||
@@ -38,24 +40,40 @@ import org.apache.fineract.portfolio.tax.data.TaxGroupData;
|
||||
*/
|
||||
public final class SavingsProductData implements Serializable {
|
||||
|
||||
@Getter
|
||||
private final Long id;
|
||||
@Getter
|
||||
private final String name;
|
||||
private final String shortName;
|
||||
private final String description;
|
||||
@Getter
|
||||
private final CurrencyData currency;
|
||||
@Getter
|
||||
private final BigDecimal nominalAnnualInterestRate;
|
||||
@Getter
|
||||
private final EnumOptionData interestCompoundingPeriodType;
|
||||
@Getter
|
||||
private final EnumOptionData interestPostingPeriodType;
|
||||
@Getter
|
||||
private final EnumOptionData interestCalculationType;
|
||||
@Getter
|
||||
private final EnumOptionData interestCalculationDaysInYearType;
|
||||
@Getter
|
||||
private final BigDecimal minRequiredOpeningBalance;
|
||||
@Getter
|
||||
private final Integer lockinPeriodFrequency;
|
||||
@Getter
|
||||
private final EnumOptionData lockinPeriodFrequencyType;
|
||||
@Getter
|
||||
private final boolean withdrawalFeeForTransfers;
|
||||
@Getter
|
||||
private final boolean allowOverdraft;
|
||||
@Getter
|
||||
private final BigDecimal overdraftLimit;
|
||||
@Getter
|
||||
private final BigDecimal minRequiredBalance;
|
||||
private final boolean enforceMinRequiredBalance;
|
||||
@Getter
|
||||
private final BigDecimal maxAllowedLienLimit;
|
||||
private final boolean lienAllowed;
|
||||
private final BigDecimal minBalanceForInterestCalculation;
|
||||
@@ -63,6 +81,8 @@ public final class SavingsProductData implements Serializable {
|
||||
private final BigDecimal minOverdraftForInterestCalculation;
|
||||
private final boolean withHoldTax;
|
||||
private final TaxGroupData taxGroup;
|
||||
@Setter
|
||||
@Getter
|
||||
private String depositAccountType = null;
|
||||
private final String accountMappingForPayment;
|
||||
|
||||
@@ -171,10 +191,6 @@ public final class SavingsProductData implements Serializable {
|
||||
/**
|
||||
* Returns a {@link SavingsProductData} that contains and exist {@link SavingsProductData} data with further
|
||||
* template data for dropdowns.
|
||||
*
|
||||
* @param taxGroupOptions
|
||||
* TODO
|
||||
* @param accountMapping
|
||||
*/
|
||||
public static SavingsProductData withTemplate(final SavingsProductData existingProduct, final Collection<CurrencyData> currencyOptions,
|
||||
final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions,
|
||||
@@ -220,7 +236,6 @@ public final class SavingsProductData implements Serializable {
|
||||
final Map<String, List<GLAccountData>> accountingMappingOptions = null;
|
||||
final Collection<ChargeData> chargeOptions = null;
|
||||
final Collection<ChargeData> penaltyOptions = null;
|
||||
final String accountMappingForPayment = null;
|
||||
|
||||
return new SavingsProductData(existingProduct.id, existingProduct.name, existingProduct.shortName, existingProduct.description,
|
||||
existingProduct.currency, existingProduct.nominalAnnualInterestRate, existingProduct.interestCompoundingPeriodType,
|
||||
@@ -505,10 +520,9 @@ public final class SavingsProductData implements Serializable {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (!(obj instanceof SavingsProductData)) {
|
||||
if (!(obj instanceof SavingsProductData productData)) {
|
||||
return false;
|
||||
}
|
||||
final SavingsProductData productData = (SavingsProductData) obj;
|
||||
return productData.id.compareTo(this.id) == 0;
|
||||
}
|
||||
|
||||
@@ -517,78 +531,6 @@ public final class SavingsProductData implements Serializable {
|
||||
return this.id.hashCode();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getDepositAccountType() {
|
||||
return depositAccountType;
|
||||
}
|
||||
|
||||
public void setDepositAccountType(String depositAccountType) {
|
||||
this.depositAccountType = depositAccountType;
|
||||
}
|
||||
|
||||
public BigDecimal getNominalAnnualInterestRate() {
|
||||
return nominalAnnualInterestRate;
|
||||
}
|
||||
|
||||
public CurrencyData getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
public Integer getLockinPeriodFrequency() {
|
||||
return lockinPeriodFrequency;
|
||||
}
|
||||
|
||||
public EnumOptionData getLockinPeriodFrequencyType() {
|
||||
return lockinPeriodFrequencyType;
|
||||
}
|
||||
|
||||
public BigDecimal getOverdraftLimit() {
|
||||
return overdraftLimit;
|
||||
}
|
||||
|
||||
public BigDecimal getMinRequiredOpeningBalance() {
|
||||
return minRequiredOpeningBalance;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestCompoundingPeriodType() {
|
||||
return interestCompoundingPeriodType;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestPostingPeriodType() {
|
||||
return interestPostingPeriodType;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestCalculationType() {
|
||||
return interestCalculationType;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestCalculationDaysInYearType() {
|
||||
return interestCalculationDaysInYearType;
|
||||
}
|
||||
|
||||
public boolean isAllowOverdraft() {
|
||||
return allowOverdraft;
|
||||
}
|
||||
|
||||
public BigDecimal getMinRequiredBalance() {
|
||||
return minRequiredBalance;
|
||||
}
|
||||
|
||||
public BigDecimal getMaxAllowedLienLimit() {
|
||||
return maxAllowedLienLimit;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean isWithdrawalFeeForTransfers() {
|
||||
return withdrawalFeeForTransfers;
|
||||
}
|
||||
|
||||
public boolean isCashBasedAccountingEnabled() {
|
||||
return AccountingRuleType.CASH_BASED.getValue().toString().equals(this.accountingRule.getValue());
|
||||
}
|
||||
|
||||
+17
-44
@@ -18,9 +18,12 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.savings.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Enum representation of {@link SavingsAccount} status states.
|
||||
* Enum representation of SavingsAccount status states.
|
||||
*/
|
||||
@Getter
|
||||
public enum SavingsAccountStatusType {
|
||||
|
||||
INVALID(0, "savingsAccountStatusType.invalid"), //
|
||||
@@ -39,41 +42,19 @@ public enum SavingsAccountStatusType {
|
||||
private final String code;
|
||||
|
||||
public static SavingsAccountStatusType fromInt(final Integer type) {
|
||||
|
||||
SavingsAccountStatusType enumeration = SavingsAccountStatusType.INVALID;
|
||||
switch (type) {
|
||||
case 100:
|
||||
enumeration = SavingsAccountStatusType.SUBMITTED_AND_PENDING_APPROVAL;
|
||||
break;
|
||||
case 200:
|
||||
enumeration = SavingsAccountStatusType.APPROVED;
|
||||
break;
|
||||
case 300:
|
||||
enumeration = SavingsAccountStatusType.ACTIVE;
|
||||
break;
|
||||
case 303:
|
||||
enumeration = SavingsAccountStatusType.TRANSFER_IN_PROGRESS;
|
||||
break;
|
||||
case 304:
|
||||
enumeration = SavingsAccountStatusType.TRANSFER_ON_HOLD;
|
||||
break;
|
||||
case 400:
|
||||
enumeration = SavingsAccountStatusType.WITHDRAWN_BY_APPLICANT;
|
||||
break;
|
||||
case 500:
|
||||
enumeration = SavingsAccountStatusType.REJECTED;
|
||||
break;
|
||||
case 600:
|
||||
enumeration = SavingsAccountStatusType.CLOSED;
|
||||
break;
|
||||
case 700:
|
||||
enumeration = SavingsAccountStatusType.PRE_MATURE_CLOSURE;
|
||||
break;
|
||||
case 800:
|
||||
enumeration = SavingsAccountStatusType.MATURED;
|
||||
break;
|
||||
}
|
||||
return enumeration;
|
||||
return switch (type) {
|
||||
case 100 -> SavingsAccountStatusType.SUBMITTED_AND_PENDING_APPROVAL;
|
||||
case 200 -> SavingsAccountStatusType.APPROVED;
|
||||
case 300 -> SavingsAccountStatusType.ACTIVE;
|
||||
case 303 -> SavingsAccountStatusType.TRANSFER_IN_PROGRESS;
|
||||
case 304 -> SavingsAccountStatusType.TRANSFER_ON_HOLD;
|
||||
case 400 -> SavingsAccountStatusType.WITHDRAWN_BY_APPLICANT;
|
||||
case 500 -> SavingsAccountStatusType.REJECTED;
|
||||
case 600 -> SavingsAccountStatusType.CLOSED;
|
||||
case 700 -> SavingsAccountStatusType.PRE_MATURE_CLOSURE;
|
||||
case 800 -> SavingsAccountStatusType.MATURED;
|
||||
default -> SavingsAccountStatusType.INVALID;
|
||||
};
|
||||
}
|
||||
|
||||
SavingsAccountStatusType(final Integer value, final String code) {
|
||||
@@ -85,14 +66,6 @@ public enum SavingsAccountStatusType {
|
||||
return this.value.equals(state.getValue());
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public boolean isSubmittedAndPendingApproval() {
|
||||
return this.value.equals(SavingsAccountStatusType.SUBMITTED_AND_PENDING_APPROVAL.getValue());
|
||||
}
|
||||
|
||||
+13
-29
@@ -18,9 +18,12 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.savings.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Enum representation of {@link SavingsAccount} sub-status states.
|
||||
* Enum representation of SavingsAccount sub-status states.
|
||||
*/
|
||||
@Getter
|
||||
public enum SavingsAccountSubStatusEnum {
|
||||
|
||||
NONE(0, "SavingsAccountSubStatusEnum.none"), //
|
||||
@@ -38,26 +41,15 @@ public enum SavingsAccountSubStatusEnum {
|
||||
|
||||
SavingsAccountSubStatusEnum enumeration = SavingsAccountSubStatusEnum.NONE;
|
||||
if (null != type) {
|
||||
switch (type) {
|
||||
case 100:
|
||||
enumeration = SavingsAccountSubStatusEnum.INACTIVE;
|
||||
break;
|
||||
case 200:
|
||||
enumeration = SavingsAccountSubStatusEnum.DORMANT;
|
||||
break;
|
||||
case 300:
|
||||
enumeration = SavingsAccountSubStatusEnum.ESCHEAT;
|
||||
break;
|
||||
case 400:
|
||||
enumeration = SavingsAccountSubStatusEnum.BLOCK;
|
||||
break;
|
||||
case 500:
|
||||
enumeration = SavingsAccountSubStatusEnum.BLOCK_CREDIT;
|
||||
break;
|
||||
case 600:
|
||||
enumeration = SavingsAccountSubStatusEnum.BLOCK_DEBIT;
|
||||
break;
|
||||
}
|
||||
enumeration = switch (type) {
|
||||
case 100 -> SavingsAccountSubStatusEnum.INACTIVE;
|
||||
case 200 -> SavingsAccountSubStatusEnum.DORMANT;
|
||||
case 300 -> SavingsAccountSubStatusEnum.ESCHEAT;
|
||||
case 400 -> SavingsAccountSubStatusEnum.BLOCK;
|
||||
case 500 -> SavingsAccountSubStatusEnum.BLOCK_CREDIT;
|
||||
case 600 -> SavingsAccountSubStatusEnum.BLOCK_DEBIT;
|
||||
default -> enumeration;
|
||||
};
|
||||
}
|
||||
return enumeration;
|
||||
}
|
||||
@@ -71,14 +63,6 @@ public enum SavingsAccountSubStatusEnum {
|
||||
return this.value.equals(state.getValue());
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public boolean isSubStatusInactive() {
|
||||
return this.value.equals(SavingsAccountSubStatusEnum.INACTIVE.getValue());
|
||||
}
|
||||
|
||||
+1
-2
@@ -26,8 +26,7 @@ import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* A wrapper for dealing with side-effect free functionality related to a {@link SavingsAccount}'s
|
||||
* {@link SavingsAccountTransaction}'s.
|
||||
* A wrapper for dealing with side-effect free functionality related to a SavingsAccountTransaction.
|
||||
*/
|
||||
@Component
|
||||
public final class SavingsAccountTransactionDataSummaryWrapper {
|
||||
|
||||
Reference in New Issue
Block a user