Search in sources :

Example 61 with ActionErrors

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;
}
Also used : ActionErrors(org.apache.struts.action.ActionErrors)

Example 62 with ActionErrors

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;
}
Also used : ApplicationException(org.mifos.framework.exceptions.ApplicationException) ActionMessage(org.apache.struts.action.ActionMessage) ActionErrors(org.apache.struts.action.ActionErrors)

Example 63 with ActionErrors

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);
}
Also used : ActionErrors(org.apache.struts.action.ActionErrors) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 64 with ActionErrors

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;
}
Also used : ActionErrors(org.apache.struts.action.ActionErrors)

Example 65 with ActionErrors

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();
}
Also used : ConfigurationPersistence(org.mifos.config.persistence.ConfigurationPersistence) ConfigurationKeyValue(org.mifos.config.business.ConfigurationKeyValue) ActionErrors(org.apache.struts.action.ActionErrors)

Aggregations

ActionErrors (org.apache.struts.action.ActionErrors)144 ActionMessage (org.apache.struts.action.ActionMessage)68 InvalidDateException (org.mifos.application.admin.servicefacade.InvalidDateException)20 Locale (java.util.Locale)19 ResourceBundle (java.util.ResourceBundle)13 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)12 Test (org.junit.Test)9 DoubleConversionResult (org.mifos.framework.util.helpers.DoubleConversionResult)7 Date (java.sql.Date)5 ApplicationException (org.mifos.framework.exceptions.ApplicationException)5 PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)4 ReportsPersistence (org.mifos.reports.persistence.ReportsPersistence)4 DateTime (org.joda.time.DateTime)3 PaymentDataHtmlBean (org.mifos.accounts.loan.struts.uihelpers.PaymentDataHtmlBean)3 ReportsCategoryBO (org.mifos.reports.business.ReportsCategoryBO)3 Problem (cn.edu.zju.acm.onlinejudge.bean.Problem)2 ArrayList (java.util.ArrayList)2 ServletContext (javax.servlet.ServletContext)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpSession (javax.servlet.http.HttpSession)2