Search in sources :

Example 81 with ActionMessage

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

the class LoanPrdActionForm method vaildateDecliningInterestSvcChargeDeductedAtDisbursement.

private void vaildateDecliningInterestSvcChargeDeductedAtDisbursement(ActionErrors errors, HttpServletRequest request) {
    logger.debug("start Loan prd Action Form vaildateDecliningInterestSvcChargeDeductedAtDisbursement :" + getInterestTypes() + "---" + getIntDedDisbursementFlag());
    if (getInterestTypes() != null && (getInterestTypes().equals(InterestType.DECLINING.getValue().toString()) || getInterestTypes().equals(InterestType.DECLINING_EPI.getValue().toString()))) {
        if (null != getIntDedDisbursementFlag() && getIntDedDisbursementFlag().equals("1")) {
            errors.add(ProductDefinitionConstants.DECLINEINTERESTDISBURSEMENTDEDUCTION, new ActionMessage(ProductDefinitionConstants.DECLINEINTERESTDISBURSEMENTDEDUCTION));
        }
    }
    logger.debug("Loan prd Action Form vaildateDecliningInterestSvcChargeDeductedAtDisbursement called ");
}
Also used : ActionMessage(org.apache.struts.action.ActionMessage)

Example 82 with ActionMessage

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

the class LoanAccountAction method getActionErrors.

private ActionErrors getActionErrors(Errors errors) {
    ActionErrors actionErrors = new ActionErrors();
    if (errors.hasErrors()) {
        for (ErrorEntry errorEntry : errors.getErrorEntries()) {
            ActionMessage actionMessage;
            if (errorEntry.hasErrorArgs()) {
                actionMessage = new ActionMessage(errorEntry.getErrorCode(), errorEntry.getArgs().toArray());
            } else {
                actionMessage = new ActionMessage(errorEntry.getErrorCode(), errorEntry.getFieldName());
            }
            actionErrors.add(errorEntry.getErrorCode(), actionMessage);
        }
    }
    return actionErrors;
}
Also used : ActionMessage(org.apache.struts.action.ActionMessage) ErrorEntry(org.mifos.platform.validations.ErrorEntry) ActionErrors(org.apache.struts.action.ActionErrors)

Example 83 with ActionMessage

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

the class SavingsClosureActionForm method validateDate.

private ActionErrors validateDate(String date, String fieldName) {
    ActionErrors errors = new ActionErrors();
    java.sql.Date sqlDate = null;
    if (date != null && !date.equals("")) {
        try {
            sqlDate = DateUtils.getDateAsSentFromBrowser(date);
            if (DateUtils.whichDirection(sqlDate) > 0) {
                errors = new ActionErrors();
                errors.add(AccountConstants.ERROR_FUTUREDATE, new ActionMessage(AccountConstants.ERROR_FUTUREDATE, fieldName));
            }
        } catch (InvalidDateException e) {
            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;
}
Also used : InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) ActionMessage(org.apache.struts.action.ActionMessage) ActionErrors(org.apache.struts.action.ActionErrors)

Example 84 with ActionMessage

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

the class SavingsDepositWithdrawalActionForm method validateTrxnDate.

private ActionErrors validateTrxnDate(String date, String fieldName) {
    ActionErrors errors = new ActionErrors();
    try {
        if (lastTrxnDate != null && dateFallsBeforeDate(getDateAsSentFromBrowser(date), lastTrxnDate)) {
            errors = new ActionErrors();
            errors.add(AccountConstants.ERROR_PAYMENT_DATE_BEFORE_LAST_PAYMENT, new ActionMessage(AccountConstants.ERROR_PAYMENT_DATE_BEFORE_LAST_PAYMENT, fieldName));
        }
    } catch (InvalidDateException e) {
    //date format was already validated
    }
    return errors;
}
Also used : InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) ActionMessage(org.apache.struts.action.ActionMessage) ActionErrors(org.apache.struts.action.ActionErrors)

Example 85 with ActionMessage

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

the class LoanAccountActionForm method validateRedoLoanPayments.

private void validateRedoLoanPayments(HttpServletRequest request, ActionErrors errors, MifosCurrency currency) {
    Locale locale = getUserContext(request).getPreferredLocale();
    try {
        CustomerBO customer = getCustomer(request);
        List<PaymentDataHtmlBean> validPaymentBeans = getValidatablePaymentBeans();
        for (PaymentDataHtmlBean bean : validPaymentBeans) {
            validatePaymentDataHtmlBean(errors, currency, locale, customer, bean);
        }
        validatePaymentDatesOrdering(validPaymentBeans, errors);
        validateMaxPayableAmount(request, errors);
    } catch (InvalidDateException invalidDate) {
        errors.add(LoanExceptionConstants.INVALIDTRANSACTIONDATE, new ActionMessage(LoanExceptionConstants.INVALIDTRANSACTIONDATE));
    } catch (FrameworkRuntimeException invalidDate) {
        errors.add(LoanExceptionConstants.INVALIDTRANSACTIONDATE, new ActionMessage(LoanExceptionConstants.INVALIDTRANSACTIONDATE));
    } catch (MeetingException e) {
        errors.add(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION, new ActionMessage(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION));
    } catch (PageExpiredException e) {
        errors.add(ExceptionConstants.PAGEEXPIREDEXCEPTION, new ActionMessage(ExceptionConstants.PAGEEXPIREDEXCEPTION));
    } catch (PersistenceException e) {
        errors.add(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION, new ActionMessage(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION));
    }
}
Also used : Locale(java.util.Locale) FrameworkRuntimeException(org.mifos.framework.exceptions.FrameworkRuntimeException) MeetingException(org.mifos.application.meeting.exceptions.MeetingException) PaymentDataHtmlBean(org.mifos.accounts.loan.struts.uihelpers.PaymentDataHtmlBean) InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) ActionMessage(org.apache.struts.action.ActionMessage) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) CustomerBO(org.mifos.customers.business.CustomerBO)

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