added validation for borrower cycle to start with equal

This commit is contained in:
Pramod Nuthakki
2013-11-29 18:49:39 +05:30
parent fe0a519247
commit 9ffbef4994
2 changed files with 4 additions and 2 deletions
@@ -47,5 +47,6 @@ public interface LoanProductConstants {
public static final String minNumberOfRepayments = "minNumberOfRepayments";
public static final String maxNumberOfRepayments = "maxNumberOfRepayments";
public static final String VALUE_CONDITION_TYPE_ERROR = "condition.type.must.end.with.greterthan";
public static final String VALUE_CONDITION_END_WITH_ERROR = "condition.type.must.end.with.greterthan";
public static final String VALUE_CONDITION_START_WITH_ERROR = "condition.type.must.start.with.equal";
}
@@ -1008,6 +1008,7 @@ public final class LoanProductDataValidator {
if (lastConditionType.equals(LoanProductValueConditionType.EQUAL)
&& conditionType.equals(LoanProductValueConditionType.GRETERTHAN)) {
if(lastCycleNumber == 0){
baseDataValidator.reset().parameter(cycleNumbersParamName).failWithCode(LoanProductConstants.VALUE_CONDITION_START_WITH_ERROR);
lastCycleNumber = 1;
}
baseDataValidator.reset().parameter(cycleNumbersParamName).value(cycleNumber).notNull()
@@ -1028,7 +1029,7 @@ public final class LoanProductDataValidator {
i++;
} while (i < variationArray.size());
if(!lastConditionType.equals(LoanProductValueConditionType.GRETERTHAN)){
baseDataValidator.reset().parameter(cycleNumbersParamName).failWithCode(LoanProductConstants.VALUE_CONDITION_TYPE_ERROR);
baseDataValidator.reset().parameter(cycleNumbersParamName).failWithCode(LoanProductConstants.VALUE_CONDITION_END_WITH_ERROR);
}
}