use of org.mifos.platform.validations.ErrorEntry in project head by mifos.
the class LoanScheduleFormBean method prevalidateDueDateIsNonNull.
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = { "DLS_DEAD_LOCAL_STORE" }, justification = "")
private void prevalidateDueDateIsNonNull(MessageContext messageContext) {
Integer installmentIndex = 1;
for (DateTime dueDate : this.installments) {
if (dueDate == null) {
String defaultMessage = "The due date field for installment {0} is blank.";
ErrorEntry fieldError = new ErrorEntry("installment.duedate.blank.and.invalid", "installmentAmounts", defaultMessage);
fieldError.setArgs(Arrays.asList(installmentIndex.toString()));
addErrorMessageToContext(messageContext, fieldError);
}
installmentIndex++;
}
}
use of org.mifos.platform.validations.ErrorEntry in project head by mifos.
the class CashFlowSummaryFormBean method prevalidateAmountPaidIsNonNull.
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = { "DLS_DEAD_LOCAL_STORE" }, justification = "")
private void prevalidateAmountPaidIsNonNull(MessageContext messageContext) {
Integer installmentIndex = 1;
for (Number amountPaid : this.actualPaymentAmounts) {
if (amountPaid == null) {
String defaultMessage = "The amount paid field for installment {0} was blank and has been defaulted to zero.";
ErrorEntry fieldError = new ErrorEntry("installment.amount.paid.blank.and.invalid", "actualPaymentAmounts", defaultMessage);
fieldError.setArgs(Arrays.asList(installmentIndex.toString()));
this.actualPaymentAmounts.set(installmentIndex - 1, Integer.valueOf(0));
addErrorMessageToContext(messageContext, fieldError);
}
installmentIndex++;
}
}
use of org.mifos.platform.validations.ErrorEntry in project head by mifos.
the class CashFlowSummaryFormBean method prevalidateActualPaymentDateIsNonNull.
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = { "DLS_DEAD_LOCAL_STORE" }, justification = "")
private void prevalidateActualPaymentDateIsNonNull(MessageContext messageContext) {
Integer installmentIndex = 1;
for (DateTime dueDate : this.actualPaymentDates) {
if (dueDate == null) {
String defaultMessage = "The actual payment date field for installment {0} is blank.";
ErrorEntry fieldError = new ErrorEntry("installment.actualpaymentdate.blank.and.invalid", "installmentAmounts", defaultMessage);
fieldError.setArgs(Arrays.asList(installmentIndex.toString()));
addErrorMessageToContext(messageContext, fieldError);
}
installmentIndex++;
}
}
use of org.mifos.platform.validations.ErrorEntry in project head by mifos.
the class ListOfInstallmentsValidatorImpl method validateOrderingOfDueDates.
@Override
public List<ErrorEntry> validateOrderingOfDueDates(List<RepaymentScheduleInstallment> installments) {
List<ErrorEntry> errorEntries = new ArrayList<ErrorEntry>();
if (CollectionUtils.isNotEmpty(installments)) {
List<Date> dueDates = CollectionUtils.collect(installments, getDueDateTransformer());
int index = CollectionUtils.itemIndexOutOfAscendingOrder(dueDates);
if (index >= 0) {
ErrorEntry error = new ErrorEntry(INSTALLMENT_DUEDATE_INVALID_ORDER, "installmentNumber");
error.setArgs(Arrays.asList(installments.get(index).getInstallmentNumberAsString()));
errorEntries.add(error);
}
}
return errorEntries;
}
use of org.mifos.platform.validations.ErrorEntry in project head by mifos.
the class InstallmentRulesValidatorImpl method validateForMinimumInstallmentAmount.
@Override
public List<ErrorEntry> validateForMinimumInstallmentAmount(List<RepaymentScheduleInstallment> installments, BigDecimal minInstallmentAmount) {
List<ErrorEntry> errorEntries = new ArrayList<ErrorEntry>();
for (RepaymentScheduleInstallment installment : installments) {
String identifier = installment.getInstallmentNumberAsString();
if (installment.isTotalAmountInValid()) {
ErrorEntry entry = new ErrorEntry(AccountConstants.INSTALLMENT_AMOUNT_LESS_THAN_INTEREST_FEE, identifier);
entry.setArgs(Arrays.asList(identifier));
errorEntries.add(entry);
} else if (installment.isTotalAmountLessThan(minInstallmentAmount)) {
ErrorEntry entry = new ErrorEntry(INSTALLMENT_AMOUNT_LESS_THAN_MIN_AMOUNT, identifier);
entry.setArgs(Arrays.asList(identifier));
errorEntries.add(entry);
}
}
return errorEntries;
}
Aggregations