Package de.danet.an.workflow.api

Examples of de.danet.an.workflow.api.PrioritizedMessage


            filter.parse(toParse);
            doc = sh.getDocument();
            Element root = doc.getRootElement();
            if (root == null || !root.getName().equals ("Package")
          || !root.getNamespaceURI().equals (XPDLUtil.XPDL_NS)) {
          eh.add (new PrioritizedMessage
            (PrioritizedMessage.Priority.ERROR,
             "ImportMessages#package.missing"));
            } else if (eh.getErrors().size() == 0
                 && eh.getFatalErrors().size() == 0) {
          ProcDefValidator procDefValidator = new ProcDefValidator();
          procDefValidator.validate(doc, eh);
          processDefs = AbstractProcessDefinitionDirectory
              .getProcessDefinitionsFromXPDL(doc);
            }
        } catch (JDOMException e) {
            eh.add (new PrioritizedMessage (PrioritizedMessage.Priority.ERROR,
                    e.getMessage()));
        } catch (IOException e) {
            eh.add (new PrioritizedMessage (PrioritizedMessage.Priority.ERROR,
                    e.getMessage()));
        } catch (IllegalArgumentException e) {
            eh.add (new PrioritizedMessage (PrioritizedMessage.Priority.ERROR,
                    e.getMessage()));
        } catch (JaxenException e) {
            DefaultProcessDefinition.logger.error (e.getMessage(), e);
            throw new IllegalArgumentException
          ("Cannot traverse XPDL-JDOM: " + e.getMessage());
        } catch (SAXException e) {
            eh.add (new PrioritizedMessage (PrioritizedMessage.Priority.ERROR,
                    e.getMessage()));
        } catch (ParserConfigurationException e) {
            eh.add (new PrioritizedMessage (PrioritizedMessage.Priority.ERROR,
                    e.getMessage()));
        }
        List pms = eh.getMessages();
       
        if (eh.getErrors().size() > 0 || eh.getFatalErrors().size() > 0) {
View Full Code Here


            spf.setFeature (feature, true);
        } catch (SAXNotRecognizedException e) {
            logger.warn
                ("Feature " + feature + " not recognized, result may be "
                 + "inacurate: " + e.getMessage(), e);
            eh.add (new PrioritizedMessage (PrioritizedMessage.Priority.WARN,
                    e.getMessage()));
        } catch (SAXNotSupportedException e) {
            logger.warn
                ("Feature " + feature + " not recognized, result may be " +
                 "inacurate: " + e.getMessage(), e);
            eh.add (new PrioritizedMessage (PrioritizedMessage.Priority.WARN,
                    e.getMessage()));
        }
    }
View Full Code Here

     * priority.
     * @param pms the given prioritized messages
     */
    public void addMessages (List pms) {
        for (Iterator i = pms.iterator(); i.hasNext();) {
            PrioritizedMessage s = (PrioritizedMessage)i.next();
            FacesMessage.Severity severity = null;
            if (s.priority() == PrioritizedMessage.Priority.DEBUG) {
                severity = FacesMessage.SEVERITY_INFO;
            } else if (s.priority() == PrioritizedMessage.Priority.INFO) {
                severity = FacesMessage.SEVERITY_INFO;
            } else if (s.priority() == PrioritizedMessage.Priority.WARN) {
                severity = FacesMessage.SEVERITY_WARN;
            } else if (s.priority() == PrioritizedMessage.Priority.ERROR) {
                severity = FacesMessage.SEVERITY_ERROR;
            } else if (s.priority() == PrioritizedMessage.Priority.FATAL) {
                severity = FacesMessage.SEVERITY_FATAL;
            }
            String text = s.message(JSFUtil.activeLocale());
            FacesMessage msg = new FacesMessage (severity, text, text);
            FacesContext.getCurrentInstance().addMessage(null, msg);
        }
    }
View Full Code Here

    /**
     * Handles parser warnings.
     * @param exc Parser exception
     */
    public void warning(SAXParseException exc) {
  PrioritizedMessage pm = new PrioritizedMessage
      (PrioritizedMessage.Priority.WARN, layoutMessage (exc));
  warnings.add (pm);
  messages.add (pm);
    }
View Full Code Here

     * Handles parser errors.
     * @param exc Parser exception
     * @throws SAXException Propagation of given SAXParseException
     */
    public void error(SAXParseException exc) throws SAXException {
  PrioritizedMessage pm = new PrioritizedMessage
      (PrioritizedMessage.Priority.ERROR, layoutMessage (exc));
  errors.add (pm);
  messages.add (pm);
    }
View Full Code Here

     * Handles fatal parser errors.
     * @param exc Parser exception
     * @throws SAXException Propagation of given SAXParseException
     */
    public void fatalError(SAXParseException exc) throws SAXException {
  PrioritizedMessage pm = new PrioritizedMessage
      (PrioritizedMessage.Priority.FATAL, layoutMessage (exc));
  fatals.add (pm);
  messages.add (pm);
    }
View Full Code Here

      pms = pe.messages();
  }
  List unmappedPms = new ArrayList();
  StringBuffer mb = new StringBuffer ();
  for (Iterator i = pms.iterator(); i.hasNext(); ) {
      PrioritizedMessage pm = (PrioritizedMessage)i.next();
      unmappedPms.add(pm.unmappedMessage());
      mb.append (" " + pm.unmappedMessage());
  }
  if (errorMessage != null) {
      assertTrue("Expected " + errorMessage + ", got" + mb.toString(),
           unmappedPms.contains(errorMessage));
  }
View Full Code Here

  }
  List transRefList = tranrefsPath.selectNodes(splitElement);
  String[] errdatas = {actId, toBeSelectedNodeId};
  if (transRefList.size() == 0) {
      eh.add
    (new PrioritizedMessage
     (PrioritizedMessage.Priority.ERROR,
      bundleBase + "#procdef.activity.split.transition.notdefined",
      new Object[]{actId, toBeSelectedNodeId}));
      return;
  }
  Iterator transRefIterator = transRefList.iterator();
  while(transRefIterator.hasNext()) {
      Element transRef = (Element)transRefIterator.next();
      transRefIds.add(transRef.getAttributeValue("Id"));
  }
  // find out all transitions with the fromAct same as the actId.
  String notCompleteErrKey = isIncludedInActivitySet
      ? "#procdef.activityset.split.transition.notcomplete"
      : "#procdef.activity.split.transition.notcomplete";
  List transList = transPath.selectNodes(toBeSelectedNode);
  Iterator transIterator = transList.iterator();
  while (transIterator.hasNext()) {
      Element transElem = (Element)transIterator.next();
      String fromId = transElem.getAttributeValue("From");
      String transId = transElem.getAttributeValue("Id");
      if (fromId.equals(actId) && !transRefIds.contains(transId)) {
    eh.add
        (new PrioritizedMessage
         (PrioritizedMessage.Priority.ERROR,
          bundleBase + notCompleteErrKey,
          new Object[]{actId, transId, toBeSelectedNodeId}));
      }
  }
View Full Code Here

  }
  if (!foundIt || (index == transRefList.size() -1)) {
      return;
  }
  eh.add
      (new PrioritizedMessage
       (PrioritizedMessage.Priority.WARN,
        bundleBase + "#procdef.transition.otherwise.notatend"));
    }
View Full Code Here

    // Validate existence of the referenced ToolId
    if (!applicationIds.contains(toolId)
        && !(applicationIds.contains
       (new PSK(processId, toolId)))) {
        faultless = false;
        eh.add (new PrioritizedMessage
          (PrioritizedMessage.Priority.ERROR,
           bundleBase + "#procdef.tool.notfound",
           new Object[]{toolId, activityId, processId}));
    }
      }
  }
 
  Iterator toolsIterator = tools.keySet().iterator();
  while (toolsIterator.hasNext()) {
      String tid = (String)toolsIterator.next();
      String[] actualParams = ((ToolInfo)tools.get(tid)).actualParams;
      // reference to process local tool?
      ApplicationDefinition applDef
    = (ApplicationDefinition)applicationDefs
    .get (new PSK(processId, tid));
      // reference to package level tool?
      if (applDef == null) {
    applDef = (ApplicationDefinition)applicationDefs.get(tid);
      }
      // the referenced tool is invalid.
      if (applDef == null) {
    return false;
      }
      FormalParameter[] formalParams = applDef.formalParameters();
      // check the match of formal parameters and actual parameters
      if (actualParams.length != formalParams.length) {
    eh.add (new PrioritizedMessage
      (PrioritizedMessage.Priority.ERROR,
       bundleBase + "#procdef.toolimpl.params.notmatched",
       new Object[]{tid, activityId, processId}));
    return false;
      }
      // verify the actual parameters have been defined in data fields.
      for (int i = 0; i < actualParams.length; i++) {
    String actParam = actualParams[i];
    if (procdataMap.containsKey(actParam)) {
                    boolean compat = true;
                    if (formalParams[i].mode().equals(FormalParameter.Mode.IN)
                        || formalParams[i].mode()
                           .equals(FormalParameter.Mode.INOUT)) {
                        compat = typeCompatible
                            (formalParams[i].type(), XPDLUtil.extractDataType
                             (((ProcData)procdataMap.get(actParam)).dataType));
                    }
                    if (formalParams[i].mode().equals(FormalParameter.Mode.OUT)
                        || formalParams[i].mode()
                           .equals(FormalParameter.Mode.INOUT)) {
                        compat = typeCompatible
                            (XPDLUtil.extractDataType
                             (((ProcData)procdataMap.get(actParam)).dataType),
                             formalParams[i].type());
                    }
        if (!compat) {
      eh.add
          (new PrioritizedMessage
           (PrioritizedMessage.Priority.ERROR, bundleBase
            + "#procdef.toolimpl.paramsdatatype.notmatched",
            new Object[]{tid, activityId, processId,
             actParam}));
      return false;
        }
    } else {
        if (formalParams[i].mode() != FormalParameter.Mode.IN) {
      eh.add (new PrioritizedMessage
        (PrioritizedMessage.Priority.ERROR, bundleBase
         + "#procdef.toolimpl.params.datanotfound",
         new Object[]{actParam, tid, activityId,
                processId}));
      return false;
        }
        if (XPDLUtil.isXMLType (formalParams[i].type())) {
      String res = notXMLOrValid (actParam);
      if (res != null) {
          eh.add
        (new PrioritizedMessage
         (PrioritizedMessage.Priority.ERROR, bundleBase
          + "#procdef.toolimpl.params.invalidXML",
          new Object[]{actParam, tid, activityId,
                 processId, res}));
          return false;
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.api.PrioritizedMessage

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.