Search in sources :

Example 51 with ActionMessage

use of org.apache.struts.action.ActionMessage in project head by mifos.

the class ViewGlTransactionsActionForm method toTrxnDateValidate.

private ActionErrors toTrxnDateValidate(ActionErrors errors, Locale locale) {
    if (StringUtils.isNotBlank(getToTrxnDate()) && !DateUtils.isValidDate(getToTrxnDate())) {
        ResourceBundle resources = ResourceBundle.getBundle(FilePaths.SIMPLE_ACCOUNTING_RESOURCE, locale);
        String trxnDate = resources.getString(SimpleAccountingConstants.TO_TRXNDATE);
        errors.add(SimpleAccountingConstants.INVALID_TRXN_DATE, new ActionMessage(SimpleAccountingConstants.INVALID_TRXN_DATE, trxnDate));
    }
    return errors;
}
Also used : ActionMessage(org.apache.struts.action.ActionMessage) ResourceBundle(java.util.ResourceBundle)

Example 52 with ActionMessage

use of org.apache.struts.action.ActionMessage in project head by mifos.

the class ViewStageTransactionActionForm method trxnDateValidate.

private ActionErrors trxnDateValidate(ActionErrors errors, Locale locale) {
    if (StringUtils.isNotBlank(getStageTrxnDate()) && !DateUtils.isValidDate(getStageTrxnDate())) {
        ResourceBundle resources = ResourceBundle.getBundle(FilePaths.SIMPLE_ACCOUNTING_RESOURCE, locale);
        String trxnDate = resources.getString(SimpleAccountingConstants.TRXNDATE);
        errors.add(SimpleAccountingConstants.INVALID_TRXN_DATE, new ActionMessage(SimpleAccountingConstants.INVALID_TRXN_DATE, trxnDate));
    }
    return errors;
}
Also used : ActionMessage(org.apache.struts.action.ActionMessage) ResourceBundle(java.util.ResourceBundle)

Example 53 with ActionMessage

use of org.apache.struts.action.ActionMessage in project head by mifos.

the class InterOfficeTransferActionForm method trxnDateValidate.

private ActionErrors trxnDateValidate(ActionErrors errors, Locale locale) {
    if (StringUtils.isNotBlank(getTrxnDate()) && !DateUtils.isValidDate(getTrxnDate())) {
        ResourceBundle resources = ResourceBundle.getBundle(FilePaths.SIMPLE_ACCOUNTING_RESOURCE, locale);
        String trxnDate = resources.getString(SimpleAccountingConstants.TRXNDATE);
        errors.add(SimpleAccountingConstants.INVALID_TRXN_DATE, new ActionMessage(SimpleAccountingConstants.INVALID_TRXN_DATE, trxnDate));
    }
    return errors;
}
Also used : ActionMessage(org.apache.struts.action.ActionMessage) ResourceBundle(java.util.ResourceBundle)

Example 54 with ActionMessage

use of org.apache.struts.action.ActionMessage in project head by mifos.

the class GroupTransferActionForm method validate.

@Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    String method = request.getParameter(Methods.method.toString());
    if (method.equals(Methods.removeGroupMemberShip.toString())) {
        errors.add(super.validate(mapping, request));
        if (StringUtils.isBlank(getAssignedLoanOfficerId())) {
            if (isActive == Constants.YES) {
                errors.add(GroupConstants.ASSIGNED_LOAN_OFFICER_REQUIRED, new ActionMessage(GroupConstants.ASSIGNED_LOAN_OFFICER_REQUIRED));
            }
        }
    }
    if (!method.equals(Methods.validate.toString())) {
        request.setAttribute(GroupConstants.METHODCALLED, method);
    }
    return errors;
}
Also used : ActionMessage(org.apache.struts.action.ActionMessage) ActionErrors(org.apache.struts.action.ActionErrors)

Example 55 with ActionMessage

use of org.apache.struts.action.ActionMessage in project head by mifos.

the class CustomerActionForm method validateForDuplicatePeriodicFee.

@SuppressWarnings("unchecked")
protected void validateForDuplicatePeriodicFee(HttpServletRequest request, ActionErrors errors) throws ApplicationException {
    List<ApplicableAccountFeeDto> additionalFeeList = (List<ApplicableAccountFeeDto>) SessionUtils.getAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, request);
    if (additionalFeeList == null) {
        additionalFeeList = new ArrayList<ApplicableAccountFeeDto>();
    }
    Set<Integer> additionalFeeIds = new HashSet<Integer>();
    for (ApplicableAccountFeeDto additionalFee : additionalFeeList) {
        additionalFeeIds.add(additionalFee.getFeeId());
    }
    Set<Integer> periodicFeeIds = new HashSet<Integer>();
    for (ApplicableAccountFeeDto additionalFee : getAdditionalFees()) {
        if (additionalFeeIds.contains(additionalFee.getFeeId())) {
            ApplicableAccountFeeDto originalFee = find(additionalFeeList, additionalFee);
            if (originalFee.isPeriodic()) {
                boolean added = periodicFeeIds.add(additionalFee.getFeeId());
                if (!added) {
                    errors.add(CustomerConstants.FEE, new ActionMessage(CustomerConstants.ERRORS_DUPLICATE_PERIODIC_FEE));
                    break;
                }
            }
        }
    }
}
Also used : ActionMessage(org.apache.struts.action.ActionMessage) ArrayList(java.util.ArrayList) List(java.util.List) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) HashSet(java.util.HashSet)

Aggregations

ActionMessage (org.apache.struts.action.ActionMessage)146 ActionErrors (org.apache.struts.action.ActionErrors)68 ActionMessages (org.apache.struts.action.ActionMessages)31 ResourceBundle (java.util.ResourceBundle)29 InvalidDateException (org.mifos.application.admin.servicefacade.InvalidDateException)22 Locale (java.util.Locale)18 JspException (javax.servlet.jsp.JspException)11 Iterator (java.util.Iterator)10 ActionForward (org.apache.struts.action.ActionForward)9 AbstractContest (cn.edu.zju.acm.onlinejudge.bean.AbstractContest)8 List (java.util.List)8 Problem (cn.edu.zju.acm.onlinejudge.bean.Problem)7 ArrayList (java.util.ArrayList)7 DoubleConversionResult (org.mifos.framework.util.helpers.DoubleConversionResult)7 UserProfile (cn.edu.zju.acm.onlinejudge.bean.UserProfile)6 Date (java.sql.Date)6 PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)6 ApplicationException (org.mifos.framework.exceptions.ApplicationException)5 UserPersistence (cn.edu.zju.acm.onlinejudge.persistence.UserPersistence)4 UserSecurity (cn.edu.zju.acm.onlinejudge.security.UserSecurity)4