Examples of ActionError


Examples of com.dotcms.repackage.org.apache.struts.action.ActionError

    }catch (DotSecurityException dse) {
      Logger.error(this, "Unable to look up contentlet with inode " + contentInode + " because of security issue", dse);
    }
   
    if(parentContentlet==null || !InodeUtils.isSet(parentContentlet.getInode())){
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.contentlet.required","Contentlet Inode"));       
      return errors;
    }
    if (!UtilMethods.isSet(name))
    {
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.contentlet.required","Name"));       
    }
    if (!UtilMethods.isSet(email) || ! UtilMethods.isValidEmail(email))
    {       
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.contentlet.required","Email"));       
    }
    /*  Try to find a title if we don't have one.  */
    if (!UtilMethods.isSet(commentTitle))
      {
      Structure s = StructureCache.getStructureByInode(parentContentlet.getStructureInode());
      List<Field> lf = s.getFields();
      for(Field f : lf){
        if("text".equals(f.getFieldType()) && f.isIndexed() && f.isListed()){
          try{
            commentTitle = "re: " + conAPI.getFieldValue(parentContentlet, f);
          }catch (Exception e) {
            Logger.error(CommentsForm.class, "Unable to set comment title", e);
          }
          break;
        }
      }
      }
    if (!UtilMethods.isSet(comment))
    {
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.contentlet.required","Comment"));
    }
    if (UtilMethods.isSet(accept) && accept == false)
    {
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.contentlet.required","Accept"));
    }

        if ( commentUseCaptcha ) {
            if ( !UtilMethods.isSet( captcha ) || !UtilMethods.isSet( captchaSession ) || !captcha.equals( captchaSession.getAnswer() ) ) {
                errors.add( ActionErrors.GLOBAL_ERROR, new ActionError( "message.contentlet.required", "Validation Image" ) );
            }
        }

        if(commentUseAudioCaptcha && !UtilMethods.isSet(captchaSession)){
        
      Boolean isResponseCorrect =Boolean.FALSE;
      String captchaId = request.getSession().getId()
      if(UtilMethods.isSet(audioCaptcha) && UtilMethods.isSet(captchaId)){
        try {
//          isResponseCorrect = CaptchaServiceSingleton.getInstance().validateResponseForID(captchaId,
//              audioCaptcha);
         
          isResponseCorrect = CaptchaUtil.isValidAudioCaptcha(request);
        } catch (CaptchaServiceException e) {
          Logger.error(CommentsForm.class, "An error ocurred trying to validate audio captcha", e);
        }
       }
   
      if(!isResponseCorrect){
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.contentlet.required","Validation Sound"));
      }

    }
    return errors;
  }
View Full Code Here

Examples of org.apache.empire.struts2.actionsupport.ActionError

     * The method is called from the ActionBasicsInterceptor
     */
    public String handleException(Throwable exception, String method)
    {
        // Uncaught exception
        ActionError excetionError = new ActionError(exception);
        // Check if there already is an error
        if (actionError!=null && actionError.hasError())
        {   // War replace
            log.warn("An uncaught exception occurred after an error has already been set!");
            log.warn("Replacing error of " + actionError.getErrorMessage() + " with " + excetionError.getErrorMessage());
        }
        else
        {   log.warn("An uncaught exception occurred. Message is " + excetionError.getErrorMessage());
        }
        // uncaught exception
        setActionError(excetionError);
        // retrun error mapping
        return null; // Default Exception Handling
View Full Code Here

Examples of org.apache.empire.struts2.actionsupport.ActionError

            actionError = null;
            return;
        }
        if (error.hasError()==false)
        {   log.warn("setActionError: No error information supplied.");
            error = new ActionError(Errors.Internal, "No error information available!");
        }
        // We have an error
        if (error instanceof ActionError)
            actionError = ((ActionError)error);
        else
            actionError = new ActionError(error);
        // put Error on session
        ActionContext context = ActionContext.getContext();
        context.getSession().put(LAST_ACTION_ERROR_ATTRIBUTE, actionError);
    }
View Full Code Here

Examples of org.apache.empire.struts2.actionsupport.ActionError

        context.getSession().put(LAST_ACTION_ERROR_ATTRIBUTE, actionError);
    }

    protected final void setActionError(ErrorType errType)
    {
        setActionError(new ActionError(errType));
    }
View Full Code Here

Examples of org.apache.empire.struts2.actionsupport.ActionError

        setActionError(new ActionError(errType));
    }

    protected final void setActionError(ErrorType errType, Object param)
    {
        setActionError(new ActionError(errType, param));
    }
View Full Code Here

Examples of org.apache.empire.struts2.actionsupport.ActionError

        setActionError(new ActionError(errType, param));
    }

    protected final void setActionError(Exception exception)
    {
        setActionError(new ActionError(exception));
    }
View Full Code Here

Examples of org.apache.empire.struts2.actionsupport.ActionError

        // Get Message
        String msgKey = error.getErrorType().getKey();
        String[] args = ObjectUtils.toStringArray(error.getErrorParams(), "Null");
        String msg = getText(msgKey, args);
        // Get full Message
        addItemError(item, new ActionError(errorType, new String[] { title, msg }));
    }
View Full Code Here

Examples of org.apache.empire.struts2.actionsupport.ActionError

     * The method is called from the ActionBasicsInterceptor
     */
    public String handleException(Throwable exception, String method)
    {
        // Uncaught exception
        ActionError excetionError = new ActionError(exception);
        // Check if there already is an error
        if (actionError!=null && actionError.hasError())
        {   // War replace
            log.warn("An uncaught exception occurred after an error has already been set!");
            log.warn("Replacing error of " + actionError.getErrorMessage() + " with " + excetionError.getErrorMessage());
        }
        else
        {   log.warn("An uncaught exception occurred. Message is " + excetionError.getErrorMessage());
        }
        // uncaught exception
        setActionError(excetionError);
        // retrun error mapping
        return null; // Default Exception Handling
View Full Code Here

Examples of org.apache.empire.struts2.actionsupport.ActionError

        */
        // We have an error
        if (error instanceof ActionError)
            actionError = ((ActionError)error);
        else
            actionError = new ActionError(error);
        // put Error on session
        ActionContext context = ActionContext.getContext();
        context.getSession().put(LAST_ACTION_ERROR_ATTRIBUTE, actionError);
    }
View Full Code Here

Examples of org.apache.empire.struts2.actionsupport.ActionError

        context.getSession().put(LAST_ACTION_ERROR_ATTRIBUTE, actionError);
    }

    protected final void setActionError(ErrorType errType)
    {
        setActionError(new ActionError(errType));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.