use of org.apache.struts.action.ActionErrors in project head by mifos.
the class CustHistoricalDataActionForm method validate.
@Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
String methodCalled = request.getParameter(Methods.method.toString());
ActionErrors errors = new ActionErrors();
if (null != methodCalled) {
if (Methods.previewHistoricalData.toString().equals(methodCalled)) {
checkPreviewValidations(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 CustomerActionForm method validate.
@Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
String method = request.getParameter("method");
if (null == request.getAttribute(Constants.CURRENTFLOWKEY)) {
request.setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
}
ActionErrors errors = null;
try {
errors = validateFields(request, method);
} catch (ApplicationException ae) {
errors = new ActionErrors();
errors.add(ae.getKey(), new ActionMessage(ae.getKey(), ae.getValues()));
}
if (null != errors && !errors.isEmpty()) {
request.setAttribute(Globals.ERROR_KEY, errors);
request.setAttribute("methodCalled", method);
}
errors.add(super.validate(mapping, request));
return errors;
}
use of org.apache.struts.action.ActionErrors in project head by mifos.
the class PersonAction method captureQuestionResponses.
@TransactionDemarcate(joinToken = true)
public ActionForward captureQuestionResponses(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
request.setAttribute(METHODCALLED, "captureQuestionResponses");
ActionErrors errors = createGroupQuestionnaire.validateResponses(request, (PersonActionForm) form);
if (errors != null && !errors.isEmpty()) {
addErrors(request, errors);
return mapping.findForward(ActionForwards.captureQuestionResponses.toString());
}
return createGroupQuestionnaire.rejoinFlow(mapping);
}
use of org.apache.struts.action.ActionErrors in project head by mifos.
the class ReportsCategoryActionForm method validate.
@Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
request.setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
request.getSession().setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
String method = request.getParameter("method");
validateMethod(errors, Methods.preview.toString(), method);
validateMethod(errors, Methods.editPreview.toString(), method);
if (!errors.isEmpty()) {
request.setAttribute(Globals.ERROR_KEY, errors);
request.setAttribute("methodCalled", method);
}
return errors;
}
use of org.apache.struts.action.ActionErrors in project head by mifos.
the class ClientCustActionFormTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
form = new ClientCustActionForm();
errors = new ActionErrors();
ConfigurationKeyValue groupCanApplyLoansKey = new ConfigurationKeyValue(ClientRules.GroupCanApplyLoansKey, 1);
ConfigurationKeyValue clientCanExistOutsideGroupKey = new ConfigurationKeyValue(ClientRules.ClientCanExistOutsideGroupKey, 1);
ConfigurationPersistence configPersistence = mock(ConfigurationPersistence.class);
when(configPersistence.getConfigurationKeyValue(ClientRules.GroupCanApplyLoansKey)).thenReturn(groupCanApplyLoansKey);
when(configPersistence.getConfigurationKeyValue(ClientRules.ClientCanExistOutsideGroupKey)).thenReturn(clientCanExistOutsideGroupKey);
ClientRules.setConfigPersistence(configPersistence);
minimumAgeForNewClientBeforeTestRun = ClientRules.getMinimumAgeForNewClient();
maximumAgeForNewClientBeforeTestRun = ClientRules.getMaximumAgeForNewClient();
ageCheckSettingBeforeTestRun = ClientRules.isAgeCheckEnabled();
}
Aggregations