Package org.jbpm.workflow.core.node

Examples of org.jbpm.workflow.core.node.WorkItemNode


import org.xml.sax.Attributes;

public class ManualTaskHandler extends TaskHandler {
   
    protected Node createNode(Attributes attrs) {
        return new WorkItemNode();
    }
View Full Code Here


   
  private Map<String, String> dataInputs = new HashMap<String, String>();
  private Map<String, String> dataOutputs = new HashMap<String, String>();

    protected Node createNode(Attributes attrs) {
        return new WorkItemNode();
    }
View Full Code Here

    }

    protected void handleNode(final Node node, final Element element, final String uri,
            final String localName, final ExtensibleXmlParser parser) throws SAXException {
      super.handleNode(node, element, uri, localName, parser);
      WorkItemNode workItemNode = (WorkItemNode) node;
        String name = getTaskName(element);
        Work work = new WorkImpl();
        work.setName(name);
      workItemNode.setWork(work);
      org.w3c.dom.Node xmlNode = element.getFirstChild();
        while (xmlNode != null) {
          String nodeName = xmlNode.getNodeName();
          if ("ioSpecification".equals(nodeName)) {
            readIoSpecification(xmlNode, dataInputs, dataOutputs);
View Full Code Here

import org.xml.sax.SAXException;

public class ReceiveTaskHandler extends TaskHandler {
   
    protected Node createNode(Attributes attrs) {
        return new WorkItemNode();
    }
View Full Code Here

   
    @SuppressWarnings("unchecked")
    protected void handleNode(final Node node, final Element element, final String uri,
            final String localName, final ExtensibleXmlParser parser) throws SAXException {
        super.handleNode(node, element, uri, localName, parser);
        WorkItemNode workItemNode = (WorkItemNode) node;
        String messageRef = element.getAttribute("messageRef");
        Map<String, Message> messages = (Map<String, Message>)
            ((ProcessBuildData) parser.getData()).getMetaData("Messages");
        if (messages == null) {
            throw new IllegalArgumentException("No messages found");
        }
        Message message = messages.get(messageRef);
        if (message == null) {
            throw new IllegalArgumentException("Could not find message " + messageRef);
        }
        workItemNode.getWork().setParameter("MessageId", message.getId());
        workItemNode.getWork().setParameter("MessageType", message.getType());
    }
View Full Code Here

  public Class generateNodeFor() {
        return WorkItemNode.class;
    }

  public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) {
    WorkItemNode workItemNode = (WorkItemNode) node;
    String type = workItemNode.getWork().getName();
    if ("Manual Task".equals(type)) {
        writeNode("manualTask", workItemNode, xmlDump, metaDataType);
        xmlDump.append(">" + EOL);
      writeScripts(workItemNode, xmlDump);
          endNode("manualTask", xmlDump);
          return;
    }
        if ("Service Task".equals(type)) {
            writeNode("serviceTask", workItemNode, xmlDump, metaDataType);
            xmlDump.append("operationRef=\"" +
                XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_ServiceOperation\" implementation=\"Other\" >" + EOL);
        writeScripts(workItemNode, xmlDump);
        xmlDump.append(
                "      <ioSpecification>" + EOL +
                "        <dataInput id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_param\" name=\"Parameter\" />" + EOL +
                "        <dataOutput id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_result\" name=\"Result\" />" + EOL +
                "        <inputSet>" + EOL +
                "          <dataInputRefs>" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_param</dataInputRefs>" + EOL +
                "        </inputSet>" + EOL +
                "        <outputSet>" + EOL +
                "          <dataOutputRefs>" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_result</dataOutputRefs>" + EOL +
                "        </outputSet>" + EOL +
                "      </ioSpecification>" + EOL);
            String inMapping = workItemNode.getInMapping("Parameter");
            if (inMapping != null) {
                xmlDump.append(
                    "      <dataInputAssociation>" + EOL +
                    "        <sourceRef>" + XmlDumper.replaceIllegalChars(inMapping) + "</sourceRef>" + EOL +
                    "        <targetRef>" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_param</targetRef>" + EOL +
                    "      </dataInputAssociation>" + EOL);
            }
            String outMapping = workItemNode.getOutMapping("Result");
            if (outMapping != null) {
                xmlDump.append(
                    "      <dataOutputAssociation>" + EOL +
                    "        <sourceRef>" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_result</sourceRef>" + EOL +
                    "        <targetRef>" + XmlDumper.replaceIllegalChars(outMapping) + "</targetRef>" + EOL +
                    "      </dataOutputAssociation>" + EOL);
            }
            endNode("serviceTask", xmlDump);
            return;
        }
        if ("Send Task".equals(type)) {
            writeNode("sendTask", workItemNode, xmlDump, metaDataType);
            xmlDump.append("messageRef=\"" +
                XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_Message\" implementation=\"Other\" >" + EOL);
        writeScripts(workItemNode, xmlDump);
        xmlDump.append(
                "      <ioSpecification>" + EOL +
                "        <dataInput id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_param\" name=\"Message\" />" + EOL +
                "        <inputSet>" + EOL +
                "          <dataInputRefs>" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_param</dataInputRefs>" + EOL +
                "        </inputSet>" + EOL +
                "        <outputSet/>" + EOL +
                "      </ioSpecification>" + EOL);
            String inMapping = workItemNode.getInMapping("Message");
            if (inMapping != null) {
                xmlDump.append(
                    "      <dataInputAssociation>" + EOL +
                    "        <sourceRef>" + XmlDumper.replaceIllegalChars(inMapping) + "</sourceRef>" + EOL +
                    "        <targetRef>" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_param</targetRef>" + EOL +
                    "      </dataInputAssociation>" + EOL);
            }
            endNode("sendTask", xmlDump);
            return;
        }
        if ("Receive Task".equals(type)) {
            writeNode("receiveTask", workItemNode, xmlDump, metaDataType);
            String messageId = (String) workItemNode.getWork().getParameter("MessageId");
            xmlDump.append("messageRef=\"" +
                messageId + "\" implementation=\"Other\" >" + EOL);
        writeScripts(workItemNode, xmlDump);
        xmlDump.append(
                "      <ioSpecification>" + EOL +
                "        <dataOutput id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_result\" name=\"Message\" />" + EOL +
                "        <inputSet/>" + EOL +
                "        <outputSet>" + EOL +
                "          <dataOutputRefs>" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_result</dataOutputRefs>" + EOL +
                "        </outputSet>" + EOL +
                "      </ioSpecification>" + EOL);
            String outMapping = workItemNode.getOutMapping("Message");
            if (outMapping != null) {
                xmlDump.append(
                    "      <dataOutputAssociation>" + EOL +
                    "        <sourceRef>" + XmlBPMNProcessDumper.getUniqueNodeId(workItemNode) + "_result</sourceRef>" + EOL +
                    "        <targetRef>" + XmlDumper.replaceIllegalChars(outMapping) + "</targetRef>" + EOL +
View Full Code Here

import org.xml.sax.SAXException;

public class SendTaskHandler extends TaskHandler {
   
    protected Node createNode(Attributes attrs) {
        return new WorkItemNode();
    }
View Full Code Here

   
    @SuppressWarnings("unchecked")
    protected void handleNode(final Node node, final Element element, final String uri,
            final String localName, final ExtensibleXmlParser parser) throws SAXException {
        super.handleNode(node, element, uri, localName, parser);
        WorkItemNode workItemNode = (WorkItemNode) node;
        String messageRef = element.getAttribute("messageRef");
        Map<String, Message> messages = (Map<String, Message>)
            ((ProcessBuildData) parser.getData()).getMetaData("Messages");
        if (messages == null) {
            throw new IllegalArgumentException("No messages found");
        }
        Message message = messages.get(messageRef);
        if (message == null) {
            throw new IllegalArgumentException("Could not find message " + messageRef);
        }
        workItemNode.getWork().setParameter("MessageType", message.getType());
    }
View Full Code Here

    public WorkItemNodeFactory(RuleFlowNodeContainerFactory nodeContainerFactory, NodeContainer nodeContainer, long id) {
        super(nodeContainerFactory, nodeContainer, id);
    }

    protected Node createNode() {
        return new WorkItemNode();
    }
View Full Code Here

                            }
                        }
                    }
                }
            } else if (node instanceof WorkItemNode) {
                final WorkItemNode workItemNode = (WorkItemNode) node;
                if (workItemNode.getFrom() == null && !acceptsNoIncomingConnections(node)) {
                    errors.add(new ProcessValidationErrorImpl(process,
                        "WorkItem node '" + node.getName() + "' [" + node.getId() + "] has no incoming connection."));
                }
                if (workItemNode.getTo() == null && !acceptsNoOutgoingConnections(node)) {
                    errors.add(new ProcessValidationErrorImpl(process,
                        "WorkItem node '" + node.getName() + "' [" + node.getId() + "] has no outgoing connection."));
                }
                if (workItemNode.getWork() == null) {
                    errors.add(new ProcessValidationErrorImpl(process,
                        "WorkItem node '" + node.getName() + "' [" + node.getId() + "] has no work specified."));
                } else {
                    Work work = workItemNode.getWork();
                    if (work.getName() == null) {
                        errors.add(new ProcessValidationErrorImpl(process,
                            "WorkItem node '" + node.getName() + "' [" + node.getId() + "] has no work name."));
                    }
                }
                if (workItemNode.getTimers() != null) {
                  for (Timer timer: workItemNode.getTimers().keySet()) {
                    validateTimer(timer, node, process, errors);
                  }
                }
            } else if (node instanceof ForEachNode) {
                final ForEachNode forEachNode = (ForEachNode) node;
View Full Code Here

TOP

Related Classes of org.jbpm.workflow.core.node.WorkItemNode

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.