use of org.mifos.platform.validations.ErrorEntry in project head by mifos.
the class CashFlowSummaryFormBean 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 LoanScheduleFormBean 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 InstallmentFormatValidatorImpl method processConversionErrors.
private void processConversionErrors(RepaymentScheduleInstallment installment, String identifier, List<ConversionError> conversionErrors, List<ErrorEntry> errorEntries) {
for (ConversionError error : conversionErrors) {
String errorText = error.toLocalizedMessage(installment.getCurrency());
errorEntries.add(new ErrorEntry(INSTALLMENT_TOTAL_AMOUNT_INVALID, identifier, errorText));
}
}
use of org.mifos.platform.validations.ErrorEntry in project head by mifos.
the class InstallmentRulesValidatorImpl method validateForHolidays.
@Override
public List<ErrorEntry> validateForHolidays(List<RepaymentScheduleInstallment> installments, HolidayServiceFacade holidayServiceFacade, Short officeId) {
List<ErrorEntry> errorEntries = new ArrayList<ErrorEntry>();
for (RepaymentScheduleInstallment installment : installments) {
Calendar dueDate = installment.getDueDateValueAsCalendar();
if (dueDate != null && holidayServiceFacade.isFutureRepaymentHoliday(officeId, dueDate)) {
String identifier = installment.getInstallmentNumberAsString();
ErrorEntry entry = new ErrorEntry(AccountConstants.INSTALLMENT_DUEDATE_IS_HOLIDAY, identifier);
entry.setArgs(Arrays.asList(identifier));
errorEntries.add(entry);
}
}
return errorEntries;
}
use of org.mifos.platform.validations.ErrorEntry in project head by mifos.
the class InstallmentRulesValidatorImpl method validateForDifferenceInDays.
private void validateForDifferenceInDays(RepaymentScheduleInstallment installment, Date previousDueDate, VariableInstallmentDetailsBO variableInstallmentDetailsBO, List<ErrorEntry> errorEntries) {
Date dueDateValue = installment.getDueDateValue();
if (previousDueDate != null && dueDateValue != null) {
String identifier = installment.getInstallmentNumberAsString();
long diffInDays = DateUtils.getNumberOfDaysBetweenTwoDates(dueDateValue, previousDueDate);
Integer minGapInDays = variableInstallmentDetailsBO.getMinGapInDays();
if (minGapInDays != null && diffInDays < minGapInDays) {
ErrorEntry entry = new ErrorEntry(INSTALLMENT_DUEDATE_LESS_THAN_MIN_GAP, identifier);
entry.setArgs(Arrays.asList(identifier));
errorEntries.add(entry);
} else {
Integer maxGapInDays = variableInstallmentDetailsBO.getMaxGapInDays();
if (maxGapInDays != null && diffInDays > maxGapInDays) {
ErrorEntry entry = new ErrorEntry(INSTALLMENT_DUEDATE_MORE_THAN_MAX_GAP, identifier);
entry.setArgs(Arrays.asList(identifier));
errorEntries.add(entry);
}
}
}
}
Aggregations