use of org.apache.struts.action.ActionErrors in project head by mifos.
the class EditStatusActionForm method validateDate.
protected ActionErrors validateDate(String date, String fieldName) {
ActionErrors errors = null;
java.sql.Date sqlDate = null;
if (date != null && !date.equals("")) {
try {
sqlDate = getDateAsSentFromBrowser(date);
if (DateUtils.whichDirection(sqlDate) > 0) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_FUTUREDATE, new ActionMessage(AccountConstants.ERROR_FUTUREDATE, fieldName));
}
} catch (InvalidDateException ide) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_INVALIDDATE, new ActionMessage(AccountConstants.ERROR_INVALIDDATE, fieldName));
}
} else {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_MANDATORY, new ActionMessage(AccountConstants.ERROR_MANDATORY, fieldName));
}
return errors;
}
use of org.apache.struts.action.ActionErrors in project head by mifos.
the class EditStatusActionForm method validate.
@Override
public ActionErrors validate(@SuppressWarnings("unused") ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
String methodCalled = request.getParameter(Methods.method.toString());
if (null != methodCalled) {
if ((Methods.preview.toString()).equals(methodCalled)) {
errors.add(super.validate(mapping, request));
handleStatusPreviewValidations(request, errors);
} else if ((Methods.update.toString()).equals(methodCalled)) {
handleUpdateStatus(request, errors);
}
}
if (!errors.isEmpty()) {
request.setAttribute(Globals.ERROR_KEY, errors);
request.setAttribute("methodCalled", methodCalled);
}
return errors;
}
use of org.apache.struts.action.ActionErrors in project head by mifos.
the class AccountApplyPaymentActionForm method validateTransactionDate.
private void validateTransactionDate(ActionErrors errors) {
String fieldName = "accounts.date_of_trxn";
ActionErrors validationErrors = validateDate(getTransactionDate(), getLocalizedMessage(fieldName));
if (null != validationErrors && !validationErrors.isEmpty()) {
errors.add(validationErrors);
}
if (null != getTransactionDate()) {
validationErrors = validatePaymentDate(getTransactionDate(), getLocalizedMessage(fieldName));
if (validationErrors != null && !validationErrors.isEmpty()) {
errors.add(validationErrors);
}
}
}
use of org.apache.struts.action.ActionErrors in project head by mifos.
the class AccountApplyPaymentActionForm method validateDate.
protected ActionErrors validateDate(String date, String fieldName) {
ActionErrors errors = null;
java.sql.Date sqlDate = null;
if (date != null && !date.equals("")) {
try {
sqlDate = getDateAsSentFromBrowser(date);
if (DateUtils.whichDirection(sqlDate) > 0) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_FUTUREDATE, new ActionMessage(AccountConstants.ERROR_FUTUREDATE, fieldName));
}
} catch (InvalidDateException ide) {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_INVALIDDATE, new ActionMessage(AccountConstants.ERROR_INVALIDDATE, fieldName));
}
} else {
errors = new ActionErrors();
errors.add(AccountConstants.ERROR_MANDATORY, new ActionMessage(AccountConstants.ERROR_MANDATORY, fieldName));
}
return errors;
}
use of org.apache.struts.action.ActionErrors in project head by mifos.
the class ApplyAdjustmentActionForm method validateTransactionDate.
private void validateTransactionDate(ActionErrors errors) {
String fieldName = "accounts.date_of_trxn";
ActionErrors validationErrors = validateDate(getTransactionDate(), getLocalizedMessage(fieldName));
if (null != validationErrors && !validationErrors.isEmpty()) {
errors.add(validationErrors);
}
}
Aggregations