Package org.apache.struts.action

Examples of org.apache.struts.action.ActionMessage


      logger.error("[execute] Exception thrown.", re);
    }

    if (! deleteLog.isEmpty()) {
      ActionErrors allErrors = new ActionErrors();
      allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", "You do not have permission to delete one or more of the records you selected."));
      session.setAttribute("listErrorMessage", allErrors);
    }

    // When deleteing a message we are either on the detail page
    // or on the list page.  On the list we forward back to the list
View Full Code Here


      // now, check the message ID on the form...
      if (messageID == null || messageID.intValue() <= 0) {
        // if Message ID is not set on the form, then there is
        // no point in continuing forward. Show user the door. :-)
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Message ID"));
        return (mapping.findForward(errorForward));
      }

      Mail remote = home.create();
      remote.setDataSource(dataSource);
View Full Code Here

        }
        catch(KBException e){
          ActionErrors allErrors = new ActionErrors();
          String errorMessage = e.getExceptionDescription();
          if (errorMessage != null && !errorMessage.equals("")){
            allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", errorMessage));
            saveErrors(request, allErrors);
            FORWARD_final = "newkb";
            return (mapping.findForward(FORWARD_final));
          }// end of if (startOfError >= 0 && endOfError >= 0)
View Full Code Here

      if (formKbID == null)
      {
        // if kb ID is not set on the form, then there is
        // no point in continuing forward. Show the user an
        // error and quit.
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Knowledgebase ID"));
        return(mapping.findForward(forward));
      }else{
        // if kb ID is set on the form properly, then set
        // the int representation for use in the code below
        kbID = formKbID.intValue();
View Full Code Here

      logger.error("[execute] Exception thrown.", e);
      throw new CommunicationException(e.getMessage());
    }
    if (!deleteLog.isEmpty()) {
      ActionErrors allErrors = new ActionErrors();
      allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", "You do not have permission to delete one or more of the records you selected."));
      session.setAttribute("listErrorMessage", allErrors);
    }
    return new ActionForward(request.getParameter("currentPage"), true);
  }
View Full Code Here

      RuleVO ruleVO = new RuleVO();

      // name - required field
      String ruleName = (String)ruleForm.get("name");
      if (ruleName == null || ruleName.length() <= 0) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Name"));
      }else{
        ruleVO.setRuleName(ruleName);
      }

      // description - required field
      String description = (String)ruleForm.get("description");
      if (description == null || description.length() <= 0) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Description"));
      }else{
        ruleVO.setDescription(description);
      }

      // enabled - required field, but default to true if it's not given (shouldn't ever happen)
      Boolean enabled = (Boolean)ruleForm.get("enabled");
      if (enabled == null) {
        enabled = new Boolean(true);
      }else{
        ruleVO.setEnabled(enabled.booleanValue());
      }

      // accountID - required field. But user can't fix the error if it's not supplied :-(
      accountID = (Integer)ruleForm.get("accountID");
      if (accountID == null || accountID.intValue() <= 0) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Account ID"));
      }else{
        ruleVO.setAccountID(accountID.intValue());
      }

      // moveMessage - if true, then folderID is required. Default to false.
      Boolean moveMessage = (Boolean)ruleForm.get("moveMessage");
      if (moveMessage == null) {
        moveMessage = new Boolean(false);
      }else{
        ruleVO.setMoveMessage(moveMessage.booleanValue());
      }

      // folderID = required only if moveMessage == true
      Integer folderID = (Integer)ruleForm.get("folderID");
      if (moveMessage.booleanValue() == true) {
        if (folderID == null || folderID.intValue() <= 0) {
          allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", "You must choose a destination when moving a message."));
        }else{
          ruleVO.setFolderID(folderID.intValue());
        }
      }

      // markMessageRead - Default to false.
      Boolean markMessageRead = (Boolean)ruleForm.get("markMessageRead");
      if (markMessageRead == null) {
        markMessageRead = new Boolean(false);
      }else{
        ruleVO.setMarkMessageRead(markMessageRead.booleanValue());
      }

      // deleteMessage - Default to false.
      Boolean deleteMessage = (Boolean)ruleForm.get("deleteMessage");
      if (deleteMessage == null) {
        deleteMessage = new Boolean(false);
      }else{
        ruleVO.setDeleteMessage(deleteMessage.booleanValue());
      }

      // At least one of moveMessage OR deleteMessage OR markMessageRead MUST be selected
      if (deleteMessage.booleanValue() == false && moveMessage.booleanValue() == false && markMessageRead.booleanValue() == false) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", "You must select at least one Action."));
      }

      // search criteria - get the List of SearchCriteriaVO's from the form
      // and check to see if there is at least ONE valid criteria. If not,
      // throw an error.
      List searchCriteria = Arrays.asList((SearchCriteriaVO[])ruleForm.get("searchCriteria"));
      if (searchCriteria == null || searchCriteria.isEmpty()) {
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", "You must supply at least one Criteria,"));
      }else{
        Iterator iter = searchCriteria.iterator();
        int count = 1;
        while (iter.hasNext()) {
          SearchCriteriaVO criteria = (SearchCriteriaVO)iter.next();
          if (criteria == null || criteria.getValue() == null || (criteria.getValue()).length() <= 0) {
            allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", "The Criteria field cannot be blank. (line " + count + ")"));
          }else{
            RuleCriteriaVO ruleCriteriaVO = new RuleCriteriaVO();
            ruleCriteriaVO.setOrderID(count);
            ruleCriteriaVO.setExpressionType(criteria.getExpressionType());
View Full Code Here

      ValueListDisplay displayParameters = new ValueListDisplay(buttonList, false, false, true, true, true, true);
      listObject.setDisplay(displayParameters);
      request.setAttribute("valueList", listObject);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      allErrors.add("error.unknownError", new ActionMessage("error.unknownError"));
    }
    if (!allErrors.isEmpty()) {
      saveErrors(request, allErrors);
    }
    return (mapping.findForward(forward));
View Full Code Here

      ValueListDisplay displayParameters = new ValueListDisplay(new ArrayList(), false, false, true, true, true, true);
      listObject.setDisplay(displayParameters);
      request.setAttribute("valueList", listObject);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      allErrors.add("error.unknownError", new ActionMessage("error.unknownError"));
    }
    if (!allErrors.isEmpty()) {
      saveErrors(request, allErrors);
    }
    return (mapping.findForward(forward));
View Full Code Here

      // get the Entity record of the logged-in user's Entity
      EntityVO entityVO = (EntityVO)remote.getEntity(entityID);
     
      if (entityVO == null) {
        // let the user know something bad happened
        allErrors.add("error.general.databaseError", new ActionMessage("error.general.databaseError"));
        entityVO = new EntityVO();
      }
     
      IndividualVO primaryContactVO = entityVO.getIndividualVO();
      if (primaryContactVO == null) {
View Full Code Here

      // now, check the faq ID on the form...
      if (formFaqID == null) {
        // if faq ID is not set on the form, then there is
        // no point in continuing forward. Show the user an
        // error and quit.
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "FAQ ID"));
        return(mapping.findForward(forward));
      }else{
        // if faq ID is set on the form properly, then set
        // the int representation for use in the code below
        faqID = formFaqID.intValue();
View Full Code Here

TOP

Related Classes of org.apache.struts.action.ActionMessage

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.