supress warnings on data fields.
This commit is contained in:
+12
-13
@@ -81,7 +81,6 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
@Column(name = "max_cap", scale = 6, precision = 19, nullable = true)
|
||||
private BigDecimal maxCap;
|
||||
|
||||
|
||||
public static Charge fromJson(final JsonCommand command) {
|
||||
|
||||
final String name = command.stringValueOfParameterNamed("name");
|
||||
@@ -94,7 +93,7 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
.integerValueOfParameterNamed("chargeCalculationType"));
|
||||
final Integer chargePaymentMode = command.integerValueOfParameterNamed("chargePaymentMode");
|
||||
|
||||
final ChargePaymentMode paymentMode = (chargePaymentMode == null) ? null : ChargePaymentMode.fromInt(chargePaymentMode);
|
||||
final ChargePaymentMode paymentMode = chargePaymentMode == null ? null : ChargePaymentMode.fromInt(chargePaymentMode);
|
||||
|
||||
final boolean penalty = command.booleanPrimitiveValueOfParameterNamed("penalty");
|
||||
final boolean active = command.booleanPrimitiveValueOfParameterNamed("active");
|
||||
@@ -123,7 +122,7 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
this.chargeCalculation = chargeCalculationType.getValue();
|
||||
this.penalty = penalty;
|
||||
this.active = active;
|
||||
this.chargePaymentMode = (paymentMode == null) ? null : paymentMode.getValue();
|
||||
this.chargePaymentMode = paymentMode == null ? null : paymentMode.getValue();
|
||||
this.minCap = minCap;
|
||||
this.maxCap = maxCap;
|
||||
|
||||
@@ -148,7 +147,8 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
.failWithCodeNoParameterAddedToErrorCode("not.allowed.charge.calculation.type.for.savings");
|
||||
}
|
||||
|
||||
if (!ChargeTimeType.fromInt(getChargeTime()).isWithdrawalFee() && ChargeCalculationType.fromInt(getChargeCalculation()).isPercentageOfAmount()) {
|
||||
if (!ChargeTimeType.fromInt(getChargeTime()).isWithdrawalFee()
|
||||
&& ChargeCalculationType.fromInt(getChargeCalculation()).isPercentageOfAmount()) {
|
||||
baseDataValidator.reset().parameter("chargeCalculationType").value(this.chargeCalculation)
|
||||
.failWithCodeNoParameterAddedToErrorCode("savings.charge.calculation.type.percentage.allowed.only.for.withdrawal");
|
||||
}
|
||||
@@ -244,7 +244,6 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
return this.minCap;
|
||||
}
|
||||
|
||||
|
||||
public BigDecimal getMaxCap() {
|
||||
return this.maxCap;
|
||||
}
|
||||
@@ -292,7 +291,8 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
baseDataValidator.reset().parameter("chargeTimeType").value(this.chargeTime)
|
||||
.failWithCodeNoParameterAddedToErrorCode("not.allowed.charge.time.for.savings");
|
||||
}
|
||||
//if charge time is changed to monthly then validate for feeOnMonthDay and feeInterval
|
||||
// if charge time is changed to monthly then validate for
|
||||
// feeOnMonthDay and feeInterval
|
||||
if (isMonthlyFee()) {
|
||||
final MonthDay monthDay = command.extractMonthDayNamed("feeOnMonthDay");
|
||||
baseDataValidator.reset().parameter("feeOnMonthDay").value(monthDay).notNull();
|
||||
@@ -336,14 +336,15 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
.failWithCodeNoParameterAddedToErrorCode("not.allowed.charge.calculation.type.for.savings");
|
||||
}
|
||||
|
||||
if (!ChargeTimeType.fromInt(getChargeTime()).isWithdrawalFee() && ChargeCalculationType.fromInt(getChargeCalculation()).isPercentageOfAmount()) {
|
||||
if (!ChargeTimeType.fromInt(getChargeTime()).isWithdrawalFee()
|
||||
&& ChargeCalculationType.fromInt(getChargeCalculation()).isPercentageOfAmount()) {
|
||||
baseDataValidator.reset().parameter("chargeCalculationType").value(this.chargeCalculation)
|
||||
.failWithCodeNoParameterAddedToErrorCode("charge.calculation.type.percentage.allowed.only.for.withdrawal");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isLoanCharge()) {// validate only for loan charge
|
||||
if (isLoanCharge()) {// validate only for loan charge
|
||||
final String paymentModeParamName = "chargePaymentMode";
|
||||
if (command.isChangeInIntegerParameterNamed(paymentModeParamName, this.chargePaymentMode)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(paymentModeParamName);
|
||||
@@ -410,8 +411,6 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (this.penalty && ChargeTimeType.fromInt(this.chargeTime).isTimeOfDisbursement()) { throw new ChargeDueAtDisbursementCannotBePenaltyException(
|
||||
this.name); }
|
||||
|
||||
@@ -439,7 +438,7 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
final EnumOptionData chargePaymentmode = ChargeEnumerations.chargePaymentMode(this.chargePaymentMode);
|
||||
final CurrencyData currency = new CurrencyData(this.currencyCode, null, 0, 0, null, null);
|
||||
return ChargeData.instance(getId(), this.name, this.amount, currency, chargeTimeType, chargeAppliesTo, chargeCalculationType,
|
||||
chargePaymentmode, this.getFeeOnMonthDay(), this.feeInterval, this.penalty, this.active,this.minCap,this.maxCap);
|
||||
chargePaymentmode, getFeeOnMonthDay(), this.feeInterval, this.penalty, this.active, this.minCap, this.maxCap);
|
||||
}
|
||||
|
||||
public Integer getChargePaymentMode() {
|
||||
@@ -456,8 +455,8 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
|
||||
public MonthDay getFeeOnMonthDay() {
|
||||
MonthDay feeOnMonthDay = null;
|
||||
if (feeOnDay != null && feeOnMonth != null) {
|
||||
feeOnMonthDay = new MonthDay(feeOnMonth, feeOnDay);
|
||||
if (this.feeOnDay != null && this.feeOnMonth != null) {
|
||||
feeOnMonthDay = new MonthDay(this.feeOnMonth, this.feeOnDay);
|
||||
}
|
||||
return feeOnMonthDay;
|
||||
}
|
||||
|
||||
+6
-4
@@ -72,12 +72,15 @@ public class LoanChargeData {
|
||||
|
||||
private final Long loanId;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final BigDecimal minCap;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final BigDecimal maxCap;
|
||||
|
||||
public static LoanChargeData template(final Collection<ChargeData> chargeOptions) {
|
||||
return new LoanChargeData(null, null, null, null, null, null, null, null, chargeOptions, false, null, false, false, null,null,null);
|
||||
return new LoanChargeData(null, null, null, null, null, null, null, null, chargeOptions, false, null, false, false, null, null,
|
||||
null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +89,8 @@ public class LoanChargeData {
|
||||
*/
|
||||
public static LoanChargeData newLoanChargeDetails(final Long chargeId, final String name, final CurrencyData currency,
|
||||
final BigDecimal amount, final BigDecimal percentage, final EnumOptionData chargeTimeType,
|
||||
final EnumOptionData chargeCalculationType, final boolean penalty, final EnumOptionData chargePaymentMode,final BigDecimal minCap,final BigDecimal maxCap) {
|
||||
final EnumOptionData chargeCalculationType, final boolean penalty, final EnumOptionData chargePaymentMode,
|
||||
final BigDecimal minCap, final BigDecimal maxCap) {
|
||||
return new LoanChargeData(null, chargeId, name, currency, amount, percentage, chargeTimeType, chargeCalculationType, null, penalty,
|
||||
chargePaymentMode, false, false, null, minCap, maxCap);
|
||||
}
|
||||
@@ -152,8 +156,6 @@ public class LoanChargeData {
|
||||
this.paid = paid;
|
||||
this.waived = waived;
|
||||
|
||||
|
||||
|
||||
if (chargeCalculationType != null && chargeCalculationType.getId().intValue() > 1) {
|
||||
this.amountOrPercentage = this.percentage;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user