Package com.dotcms.repackage.org.apache.struts.action

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


      } else

//        Save / Update registeruser
        if ("save_register_user".equals(cmd)) {
          UserManagerForm userForm = (UserManagerForm) form;
          ActionErrors ae = new ActionErrors ();

          Logger.debug(this, "Saving UserInfo");
         
          if(!_isNewUser(userForm.getUserID())){
            ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.userExists",""));
            req.setAttribute(Globals.ERROR_KEY,ae);
            setForward(req, "portlet.ext.usermanager.register_user");
            HibernateUtil.commitTransaction();
            return;
          }

          ///Validate Form
          if (!Validator.validate(req, form, mapping)) {
            Logger.debug(this, "Form Validation Failed");
            req.setAttribute(WebKeys.USERMANAGER_EDIT_FORM, form);
           
            setForward(req, "portlet.ext.usermanager.register_user");
            return;
          } else {
            try {
              userForm = (UserManagerForm) form;
              ae = new ActionErrors ();
              if(!UtilMethods.isSet(userForm.getUserID()))
              {
                if(!validateUniqueEmail(userForm.getEmailAddress()))
                {
                  ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.forgotPasswordClickHere","javascript:forgotPassword();"));
                }
              }

              String userId = null;

              if ((ae != null) && (ae.size() > 0)) {
                req.setAttribute(Globals.ERROR_KEY,ae);
              } else {

                userId = _save(form, req, res);
View Full Code Here


  private void _forgotPassword(ActionForm form, ActionRequest request, ActionResponse res) throws Exception
  {
    UserManagerForm userForm = (UserManagerForm) form;
    //if we have some errors
    ActionErrors aes = new ActionErrors();

    User user = APILocator.getUserAPI().loadByUserByEmail(userForm.getEmailAddress(), APILocator.getUserAPI().getSystemUser(), false);
    if(user.isNew())
    {
      aes = new ActionErrors();
      aes.add(Globals.ERROR_KEY, new ActionMessage("error.forgotPasswordUserNotFound"));
      request.setAttribute(Globals.ERROR_KEY,aes);
      return;
    }
    String pass = PublicEncryptionFactory.getRandomPassword();
    user.setPassword(PublicEncryptionFactory.digestString(pass));
    APILocator.getUserAPI().save(user,APILocator.getUserAPI().getSystemUser(),false);
    Host host = WebAPILocator.getHostWebAPI().getCurrentHost(request);
    EmailFactory.sendForgotPassword(user, pass, host.getIdentifier());

    aes = new ActionErrors();
    aes.add(Globals.ERROR_KEY, new ActionMessage("error.forgotPasswordMailSend"));
    request.setAttribute(Globals.ERROR_KEY,aes);
    return;
  }
View Full Code Here

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        if(request.getParameter("cmd")!=null && request.getParameter("cmd").equals(Constants.ADD)) {
            return super.validate(mapping, request);
        } else  if(request.getParameter("cmd")!=null && request.getParameter("cmd").equals(Constants.UPDATE)) {
            ActionErrors errors = new ActionErrors ();
            if (email.equals("")) {
              ActionMessage error = new ActionMessage ("prompt.mailingListEmailRequired");
                errors.add("email", error);
            }
            if (firstName.equals("")) {
              ActionMessage error = new ActionMessage ("prompt.mailingListFirstName");
                errors.add("firstName", error);
            }
            if (lastName.equals("")) {
              ActionMessage error = new ActionMessage ("prompt.mailingListLastName");
                errors.add("lastName", error);
            }
            if (errors.size() == 0)
                return super.validate(mapping, request);
            return errors;
        }
        return null;
    }
View Full Code Here

      Logger.debug(this, "Calling Edit Recurrent Event Method");
      editEvent(mapping, form, config, req, res, user);
    }

    if ((cmd != null) && cmd.equals(Constants.ADD)) {
      ActionErrors errors = (ActionErrors) req.getAttribute(Globals.ERROR_KEY);

      if(errors == null || errors.size() == 0)
        saveEvent(mapping, form, config, req, res, user);

    }

  }
View Full Code Here

  }

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        if(request.getParameter("cmd")!=null && request.getParameter("cmd").equals(Constants.ADD)) {
            //return super.validate(mapping, request);
          ActionErrors ae = super.validate(mapping, request);

            Logger.debug(this, "action errors: " + ae);
            if(communicationType.equals("email")){
              if(!UtilMethods.isSet(title)){
                ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.communicationsTitle"));
               
               }
              if(!UtilMethods.isSet(fromName)){
                ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.communicationsFromName"));
               
               }
              if(!UtilMethods.isSet(fromEmail)){
                ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.communicationsFromEmail"));
               
               }
              if(!UtilMethods.isSet(emailSubject)){
                ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.communicationsSubject"));
               
               }
              if(!InodeUtils.isSet(htmlPage) && !UtilMethods.isSet(textMessage)){
                ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.communicationsTextMessage"));
               
               }
               
              return ae;
             
            }
            else if (communicationType.equals("alert")){
              if(!UtilMethods.isSet(title)){
                  ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.communicationsTitle"));
                 
                }
              if(!UtilMethods.isSet(textMessage)){
                ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.communicationsTextMessage"));
                }
              if(UtilMethods.isSet(textMessage) && (textMessage.length() > 2000)) {
                  ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.communicationsTextAlert.maximumLength"));
              }
             
              return ae;
            }
            else {
              if(!UtilMethods.isSet(title)){
                  ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.communicationsTitle"));
                 
                }
              if(!InodeUtils.isSet(trackBackLinkInode)){
                ae.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.communicationsTrackBackLinkInode"));
               
               }
             
              return ae;
            }
View Full Code Here

    public void setReviewContent(boolean reviewContent) {
        this.reviewContent = reviewContent;
    }
   
    public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) {
        ActionErrors errors =  super.validate(arg0,arg1);
        if (errors == null) errors = new ActionErrors ();
        if (isReviewContent() && ! InodeUtils.isSet(reviewerRole)) {
            errors.add("reviewerRole", new ActionMessage ("structure.reviewerRole.required"));
        }
        if(!UtilMethods.isSet(host) && (!UtilMethods.isSet(folder) || folder.equals("SYSTEM_FOLDER"))){
            errors.add("host", new ActionMessage ("Host-or-folder-is-required"));
    }
       
        if(!UtilMethods.isSet(publishDateVar)) {
            publishDateVar=null;
        }
        else if(UtilMethods.isSet(inode)) {
            boolean found=false;
            for(Field f : FieldsCache.getFieldsByStructureInode(inode))
                found=found || f.getVelocityVarName().equals(publishDateVar);
            if(!found)
                errors.add("publishDateVar", new ActionMessage("publish-date-invalid"));
        }
       
        if(!UtilMethods.isSet(expireDateVar)) {
            expireDateVar=null;
        }
        else if(UtilMethods.isSet(inode)) {
            boolean found=false;
            for(Field f : FieldsCache.getFieldsByStructureInode(inode))
                found=found || f.getVelocityVarName().equals(expireDateVar);
            if(!found)
                errors.add("expireDateVar", new ActionMessage("expire-date-invalid"));
        }      
        return errors;
  }
View Full Code Here

    public void setParentRequired(boolean parentRequired) {
        this.parentRequired = parentRequired;
    }
  @Override
  public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) {
    ActionErrors errors = super.validate(arg0, arg1);
    if(errors == null)
      errors = new ActionErrors();
    if(UtilMethods.isSet(getChildRelationName()) && UtilMethods.isSet(getParentRelationName()) &&
        getChildRelationName().equals(getParentRelationName())) {
      errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.relationship.same.parent.child.name"));
    }
    return errors;
  }
View Full Code Here

    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) {
        ActionErrors ae = new ActionErrors();  
        ae = super.validate(arg0,arg1);
        return ae;
    }
View Full Code Here

    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) {
        ActionErrors ae = new ActionErrors();  
        ae = super.validate(arg0,arg1);
        return ae;
    }
View Full Code Here

                        return;

          }
        }
        if(note.length()>255){
          ActionErrors ae = new ActionErrors();
          ae.add(Globals.ERROR_KEY, new ActionMessage("Note field Contains more than 255 characters"));
          req.setAttribute(Globals.ERROR_KEY, ae);
        }
        _editWebAsset(req, res, config, form, user);

      } catch (Exception ae) {
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.apache.struts.action.ActionErrors

Copyright © 2018 www.massapicom. 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.