supress warnings on data fields.
This commit is contained in:
+20
-21
@@ -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,17 +93,17 @@ 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");
|
||||
final MonthDay feeOnMonthDay = command.extractMonthDayNamed("feeOnMonthDay");
|
||||
final Integer feeInterval = command.integerValueOfParameterNamed("feeInterval");
|
||||
final BigDecimal minCap = command.bigDecimalValueOfParameterNamed("minCap");
|
||||
final BigDecimal maxCap = command.bigDecimalValueOfParameterNamed("maxCap");
|
||||
final BigDecimal maxCap = command.bigDecimalValueOfParameterNamed("maxCap");
|
||||
|
||||
return new Charge(name, amount, currencyCode, chargeAppliesTo, chargeTimeType, chargeCalculationType, penalty, active, paymentMode,
|
||||
feeOnMonthDay, feeInterval,minCap,maxCap);
|
||||
feeOnMonthDay, feeInterval, minCap, maxCap);
|
||||
}
|
||||
|
||||
protected Charge() {
|
||||
@@ -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");
|
||||
}
|
||||
@@ -236,7 +236,7 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
return ChargeCalculationType.fromInt(this.chargeCalculation).isAllowedSavingsChargeCalculationType();
|
||||
}
|
||||
|
||||
public boolean isPercentageOfAmount(){
|
||||
public boolean isPercentageOfAmount() {
|
||||
return ChargeCalculationType.fromInt(this.chargeCalculation).isPercentageOfAmount();
|
||||
}
|
||||
|
||||
@@ -244,7 +244,6 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
return this.minCap;
|
||||
}
|
||||
|
||||
|
||||
public BigDecimal getMaxCap() {
|
||||
return this.maxCap;
|
||||
}
|
||||
@@ -292,8 +291,9 @@ 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(isMonthlyFee()){
|
||||
// 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);
|
||||
@@ -392,8 +393,8 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
actualChanges.put(activeParamName, newValue);
|
||||
this.active = newValue;
|
||||
}
|
||||
//allow min and max cap to be only added to PERCENT_OF_AMOUNT for now
|
||||
if(isPercentageOfAmount()){
|
||||
// allow min and max cap to be only added to PERCENT_OF_AMOUNT for now
|
||||
if (isPercentageOfAmount()) {
|
||||
final String minCapParamName = "minCap";
|
||||
if (command.isChangeInBigDecimalParameterNamed(minCapParamName, this.minCap)) {
|
||||
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(minCapParamName);
|
||||
@@ -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() {
|
||||
@@ -454,15 +453,15 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
return ChargeTimeType.fromInt(this.chargeTime).isAnnualFee();
|
||||
}
|
||||
|
||||
public MonthDay getFeeOnMonthDay(){
|
||||
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;
|
||||
}
|
||||
|
||||
public Integer feeInterval(){
|
||||
public Integer feeInterval() {
|
||||
return this.feeInterval;
|
||||
}
|
||||
}
|
||||
+8
-6
@@ -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,9 +89,10 @@ 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);
|
||||
chargePaymentMode, false, false, null, minCap, maxCap);
|
||||
}
|
||||
|
||||
public LoanChargeData(final Long id, final Long chargeId, final String name, final CurrencyData currency, final BigDecimal amount,
|
||||
@@ -132,7 +136,7 @@ public class LoanChargeData {
|
||||
private LoanChargeData(final Long id, final Long chargeId, final String name, final CurrencyData currency, final BigDecimal amount,
|
||||
final BigDecimal percentage, final EnumOptionData chargeTimeType, final EnumOptionData chargeCalculationType,
|
||||
final Collection<ChargeData> chargeOptions, final boolean penalty, final EnumOptionData chargePaymentMode, final boolean paid,
|
||||
final boolean waived, final Long loanId,final BigDecimal minCap, final BigDecimal maxCap) {
|
||||
final boolean waived, final Long loanId, final BigDecimal minCap, final BigDecimal maxCap) {
|
||||
this.id = id;
|
||||
this.chargeId = chargeId;
|
||||
this.name = name;
|
||||
@@ -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