FINERACT-822 add MissingCasesInEnumSwitch
This commit is contained in:
committed by
Awasum Yannick
parent
b3fb7984f3
commit
bbb3aad506
+8
-1
@@ -23,6 +23,7 @@ import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -37,6 +38,8 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -45,6 +48,8 @@ public class AccountNumberFormatDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AccountNumberFormatDataValidator.class);
|
||||
|
||||
private static final Set<String> ACCOUNT_NUMBER_FORMAT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(AccountNumberFormatConstants.accountTypeParamName, AccountNumberFormatConstants.prefixTypeParamName));
|
||||
|
||||
@@ -125,7 +130,9 @@ public class AccountNumberFormatDataValidator {
|
||||
case GROUP:
|
||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForGroups;
|
||||
break;
|
||||
default:
|
||||
case SHARES:
|
||||
validAccountNumberPrefixes = Collections.emptySet();
|
||||
break;
|
||||
}
|
||||
|
||||
Set<Integer> validAccountNumberPrefixValues = new HashSet<>();
|
||||
|
||||
+7
-1
@@ -34,6 +34,8 @@ import org.apache.fineract.infrastructure.accountnumberformat.exception.AccountN
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@@ -43,6 +45,8 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class AccountNumberFormatReadPlatformServiceImpl implements AccountNumberFormatReadPlatformService {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AccountNumberFormatReadPlatformServiceImpl.class);
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
// data mapper
|
||||
@@ -144,7 +148,9 @@ public class AccountNumberFormatReadPlatformServiceImpl implements AccountNumber
|
||||
case GROUP:
|
||||
accountNumberPrefixTypesSet = AccountNumberFormatEnumerations.accountNumberPrefixesForGroups;
|
||||
break;
|
||||
default:
|
||||
case SHARES:
|
||||
// SHARES has no prefix
|
||||
break;
|
||||
}
|
||||
|
||||
Object[] array = accountNumberPrefixTypesSet.toArray();
|
||||
|
||||
+4
-1
@@ -52,7 +52,10 @@ public class WorkingDaysEnumerations {
|
||||
optionData = new EnumOptionData(RepaymentRescheduleType.MOVE_TO_PREVIOUS_WORKING_DAY.getValue().longValue(),
|
||||
RepaymentRescheduleType.MOVE_TO_PREVIOUS_WORKING_DAY.getCode(), "move to previous working day");
|
||||
break;
|
||||
default:
|
||||
case MOVE_TO_NEXT_MEETING_DAY:
|
||||
optionData = new EnumOptionData(RepaymentRescheduleType.MOVE_TO_NEXT_MEETING_DAY.getValue().longValue(),
|
||||
RepaymentRescheduleType.MOVE_TO_NEXT_MEETING_DAY.getCode(), "move to next meeting day");
|
||||
break;
|
||||
}
|
||||
|
||||
return optionData;
|
||||
|
||||
+3
-1
@@ -51,7 +51,9 @@ public class AccountEnumerations {
|
||||
case GLIM:
|
||||
optionData = new EnumOptionData(AccountType.GLIM.getValue().longValue(), AccountType.GLIM.getCode(), "GLIM");
|
||||
break;
|
||||
default:
|
||||
case GSIM:
|
||||
optionData = new EnumOptionData(AccountType.GSIM.getValue().longValue(), AccountType.GSIM.getCode(), "GSIM");
|
||||
break;
|
||||
}
|
||||
|
||||
return optionData;
|
||||
|
||||
+8
-1
@@ -22,9 +22,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class InterestRateChartEnumerations {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(InterestRateChartEnumerations.class);
|
||||
|
||||
public static EnumOptionData periodType(final Integer type) {
|
||||
return periodType(PeriodFrequencyType.fromInt(type));
|
||||
}
|
||||
@@ -52,7 +56,10 @@ public class InterestRateChartEnumerations {
|
||||
optionData = new EnumOptionData(PeriodFrequencyType.YEARS.getValue().longValue(), PeriodFrequencyType.YEARS.getCode(),
|
||||
"Years");
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
optionData = new EnumOptionData(PeriodFrequencyType.WHOLE_TERM.getValue().longValue(),
|
||||
PeriodFrequencyType.WHOLE_TERM.getCode(), "Whole Term");
|
||||
break;
|
||||
}
|
||||
|
||||
return optionData;
|
||||
|
||||
+6
-1
@@ -142,6 +142,8 @@ import org.joda.time.LocalDate;
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Entity
|
||||
@@ -150,6 +152,8 @@ import org.springframework.stereotype.Component;
|
||||
@UniqueConstraint(columnNames = { "external_id" }, name = "loan_externalid_UNIQUE") })
|
||||
public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Loan.class);
|
||||
|
||||
/** Disable optimistic locking till batch jobs failures can be fixed **/
|
||||
@Version
|
||||
int version;
|
||||
@@ -4478,7 +4482,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
break;
|
||||
case INVALID:
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
break;
|
||||
}
|
||||
return dueRepaymentPeriodDate.minusDays(1);// get 2n-1 range date from
|
||||
// startDate
|
||||
|
||||
+4
-1
@@ -59,7 +59,10 @@ public class AprCalculator {
|
||||
case YEARS:
|
||||
defaultAnnualNominalInterestRate = ratePerPeriod.multiply(BigDecimal.valueOf(1));
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
break;
|
||||
case INVALID:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case INVALID:
|
||||
|
||||
+10
-2
@@ -22,9 +22,13 @@ import org.apache.fineract.infrastructure.core.domain.LocalDateInterval;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
import org.joda.time.Days;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class DefaultPaymentPeriodsInOneYearCalculator implements PaymentPeriodsInOneYearCalculator {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DefaultPaymentPeriodsInOneYearCalculator.class);
|
||||
|
||||
@Override
|
||||
public Integer calculate(final PeriodFrequencyType repaymentFrequencyType) {
|
||||
|
||||
@@ -45,7 +49,9 @@ public class DefaultPaymentPeriodsInOneYearCalculator implements PaymentPeriodsI
|
||||
case INVALID:
|
||||
paymentPeriodsInOneYear = Integer.valueOf(0);
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
LOG.error("TODO Implement repaymentFrequencyType for WHOLE_TERM");
|
||||
break;
|
||||
}
|
||||
return paymentPeriodsInOneYear;
|
||||
}
|
||||
@@ -92,7 +98,9 @@ public class DefaultPaymentPeriodsInOneYearCalculator implements PaymentPeriodsI
|
||||
case INVALID:
|
||||
fraction = Double.valueOf("0");
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
LOG.error("TODO Implement repaymentPeriodFrequencyType for WHOLE_TERM");
|
||||
break;
|
||||
}
|
||||
return fraction;
|
||||
}
|
||||
|
||||
+13
-3
@@ -33,9 +33,13 @@ import org.joda.time.LocalDate;
|
||||
import org.joda.time.Months;
|
||||
import org.joda.time.Weeks;
|
||||
import org.joda.time.Years;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class DefaultScheduledDateGenerator implements ScheduledDateGenerator {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DefaultScheduledDateGenerator.class);
|
||||
|
||||
@Override
|
||||
public LocalDate getLastRepaymentDate(final LoanApplicationTerms loanApplicationTerms, final HolidayDetailDTO holidayDetailDTO) {
|
||||
|
||||
@@ -225,7 +229,9 @@ public class DefaultScheduledDateGenerator implements ScheduledDateGenerator {
|
||||
break;
|
||||
case INVALID:
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
LOG.error("TODO Implement getRepaymentPeriodDate for WHOLE_TERM");
|
||||
break;
|
||||
}
|
||||
return dueRepaymentPeriodDate;
|
||||
}
|
||||
@@ -265,7 +271,9 @@ public class DefaultScheduledDateGenerator implements ScheduledDateGenerator {
|
||||
break;
|
||||
case INVALID:
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
LOG.error("TODO Implement isDateFallsInSchedule for WHOLE_TERM");
|
||||
break;
|
||||
}
|
||||
return isScheduledDate;
|
||||
}
|
||||
@@ -300,7 +308,9 @@ public class DefaultScheduledDateGenerator implements ScheduledDateGenerator {
|
||||
break;
|
||||
case INVALID:
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
LOG.error("TODO Implement repaymentPeriodFrequencyType for WHOLE_TERM");
|
||||
break;
|
||||
}
|
||||
|
||||
return idealDisbursementDate;
|
||||
|
||||
+10
-2
@@ -57,9 +57,13 @@ import org.joda.time.Period;
|
||||
import org.joda.time.PeriodType;
|
||||
import org.joda.time.Weeks;
|
||||
import org.joda.time.Years;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public final class LoanApplicationTerms {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(LoanApplicationTerms.class);
|
||||
|
||||
private final ApplicationCurrency currency;
|
||||
|
||||
private final Calendar loanCalendar;
|
||||
@@ -648,7 +652,9 @@ public final class LoanApplicationTerms {
|
||||
break;
|
||||
case INVALID:
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
LOG.error("TODO Implement getPeriodEndDate for WHOLE_TERM");
|
||||
break;
|
||||
}
|
||||
return dueRepaymentPeriodDate;
|
||||
}
|
||||
@@ -1038,7 +1044,9 @@ public final class LoanApplicationTerms {
|
||||
}
|
||||
periodicInterestRate = oneDayOfYearInterestRate.multiply(numberOfDaysInPeriod, mc);
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
LOG.error("TODO Implement periodicInterestRate for WHOLE_TERM");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SAME_AS_REPAYMENT_PERIOD:
|
||||
|
||||
+5
@@ -54,6 +54,8 @@ import org.apache.fineract.portfolio.note.data.NoteData;
|
||||
import org.apache.fineract.portfolio.note.domain.NoteType;
|
||||
import org.apache.fineract.portfolio.note.exception.NoteResourceNotSupportedException;
|
||||
import org.apache.fineract.portfolio.note.service.NoteReadPlatformService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -69,6 +71,7 @@ public class NotesApiResource {
|
||||
Arrays.asList("id", "clientId", "groupId", "loanId", "loanTransactionId", "depositAccountId", "savingAccountId", "noteType",
|
||||
"note", "createdById", "createdByUsername", "createdOn", "updatedById", "updatedByUsername", "updatedOn"));
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(NotesApiResource.class);
|
||||
private final PlatformSecurityContext context;
|
||||
private final NoteReadPlatformService readPlatformService;
|
||||
private final DefaultToApiJsonSerializer<NoteData> toApiJsonSerializer;
|
||||
@@ -254,6 +257,8 @@ public class NotesApiResource {
|
||||
resourceDetails.withGroupId(resourceId);
|
||||
break;
|
||||
default:
|
||||
resourceNameForPermissions = "INVALIDNOTE";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -40,12 +40,15 @@ import org.apache.fineract.portfolio.note.domain.NoteType;
|
||||
import org.apache.fineract.portfolio.note.exception.NoteNotFoundException;
|
||||
import org.apache.fineract.portfolio.note.exception.NoteResourceNotSupportedException;
|
||||
import org.apache.fineract.portfolio.note.serialization.NoteCommandFromApiJsonDeserializer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatformService {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(NoteWritePlatformServiceJpaRepositoryImpl.class);
|
||||
private final NoteRepository noteRepository;
|
||||
private final ClientRepositoryWrapper clientRepository;
|
||||
private final GroupRepository groupRepository;
|
||||
@@ -446,7 +449,12 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
|
||||
// break;
|
||||
case SAVING_ACCOUNT:
|
||||
break;
|
||||
default:
|
||||
case SHARE_ACCOUNT:
|
||||
LOG.error("TODO Implement getNoteForDelete for SHARE_ACCOUNT");
|
||||
break;
|
||||
case SAVINGS_TRANSACTION:
|
||||
LOG.error("TODO Implement getNoteForDelete for SAVINGS_TRANSACTION");
|
||||
break;
|
||||
}
|
||||
if (noteForUpdate == null) {
|
||||
throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase());
|
||||
|
||||
+7
-1
@@ -22,9 +22,13 @@ import org.apache.fineract.portfolio.calendar.domain.CalendarFrequencyType;
|
||||
import org.apache.fineract.portfolio.calendar.service.CalendarUtils;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class DepositAccountUtils {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DepositAccountUtils.class);
|
||||
|
||||
public static final int GENERATE_MINIMUM_NUMBER_OF_FUTURE_INSTALMENTS = 5;
|
||||
|
||||
public static LocalDate calculateNextDepositDate(final LocalDate lastDepositDate, final PeriodFrequencyType frequency,
|
||||
@@ -46,7 +50,9 @@ public class DepositAccountUtils {
|
||||
break;
|
||||
case INVALID:
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
LOG.error("TODO Implement calculateNextDepositDate for WHOLE_TERM");
|
||||
break;
|
||||
}
|
||||
return nextDepositDate;
|
||||
}
|
||||
|
||||
+7
-1
@@ -117,6 +117,8 @@ import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@Entity
|
||||
@@ -127,6 +129,8 @@ import org.springframework.util.CollectionUtils;
|
||||
@DiscriminatorValue("100")
|
||||
public class SavingsAccount extends AbstractPersistableCustom {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SavingsAccount.class);
|
||||
|
||||
@Version
|
||||
int version;
|
||||
|
||||
@@ -2383,7 +2387,9 @@ public class SavingsAccount extends AbstractPersistableCustom {
|
||||
case YEARS:
|
||||
lockedInUntilLocalDate = activationLocalDate.plusYears(this.lockinPeriodFrequency).toDate();
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM:
|
||||
LOG.error("TODO Implement calculateDateAccountIsLockedUntil for WHOLE_TERM");
|
||||
break;
|
||||
}
|
||||
|
||||
return lockedInUntilLocalDate;
|
||||
|
||||
+19
-3
@@ -51,6 +51,8 @@ import org.apache.fineract.portfolio.charge.domain.ChargeTimeType;
|
||||
import org.apache.fineract.portfolio.charge.exception.SavingsAccountChargeWithoutMandatoryFieldException;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.MonthDay;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author dv6
|
||||
@@ -60,6 +62,8 @@ import org.joda.time.MonthDay;
|
||||
@Table(name = "m_savings_account_charge")
|
||||
public class SavingsAccountCharge extends AbstractPersistableCustom {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SavingsAccountCharge.class);
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "savings_account_id", referencedColumnName = "id", nullable = false)
|
||||
private SavingsAccount savingsAccount;
|
||||
@@ -290,7 +294,15 @@ public class SavingsAccountCharge extends AbstractPersistableCustom {
|
||||
this.amountWaived = null;
|
||||
this.amountWrittenOff = null;
|
||||
break;
|
||||
default:
|
||||
case PERCENT_OF_DISBURSEMENT_AMOUNT:
|
||||
this.percentage = null;
|
||||
this.amount = null;
|
||||
this.amountPercentageAppliedTo = null;
|
||||
this.amountPaid = null;
|
||||
this.amountOutstanding = BigDecimal.ZERO;
|
||||
this.amountWaived = null;
|
||||
this.amountWrittenOff = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,7 +431,9 @@ public class SavingsAccountCharge extends AbstractPersistableCustom {
|
||||
this.amountPercentageAppliedTo = null;
|
||||
this.amountOutstanding = null;
|
||||
break;
|
||||
default:
|
||||
case PERCENT_OF_DISBURSEMENT_AMOUNT:
|
||||
LOG.error("TODO Implement update ChargeCalculationType for PERCENT_OF_DISBURSEMENT_AMOUNT");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -493,7 +507,9 @@ public class SavingsAccountCharge extends AbstractPersistableCustom {
|
||||
this.amountPercentageAppliedTo = null;
|
||||
this.amountOutstanding = null;
|
||||
break;
|
||||
default:
|
||||
case PERCENT_OF_DISBURSEMENT_AMOUNT:
|
||||
LOG.error("TODO Implement update ChargeCalculationType for PERCENT_OF_DISBURSEMENT_AMOUNT");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -69,12 +69,16 @@ import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ShareAccountDataSerializer {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ShareAccountDataSerializer.class);
|
||||
|
||||
private final PlatformSecurityContext platformSecurityContext;
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
@@ -967,7 +971,8 @@ public class ShareAccountDataSerializer {
|
||||
case YEARS:
|
||||
lockinDate = purchaseDate.plusYears(lockinPeriod);
|
||||
break;
|
||||
default:
|
||||
case WHOLE_TERM: // Never comes in to this state.
|
||||
break;
|
||||
}
|
||||
}
|
||||
return lockinDate;
|
||||
|
||||
Reference in New Issue
Block a user