Search in sources :

Example 1 with Node

use of org.jbpm.workflow.core.Node in project jbpm by kiegroup.

the class MetaDataHandler method start.

public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
    parser.startElementBuilder(localName, attrs);
    Node node = (Node) parser.getParent();
    final String name = attrs.getValue("name");
    emptyAttributeCheck(localName, "name", name, parser);
    return new MetaDataWrapper(node, name);
}
Also used : Node(org.jbpm.workflow.core.Node)

Example 2 with Node

use of org.jbpm.workflow.core.Node in project jbpm by kiegroup.

the class ProcessNodeInstanceFactoryTest method testDefaultEntries.

@Test
public void testDefaultEntries() throws Exception {
    Node node = new ActionNode();
    assertEquals(CreateNewNodeFactory.class, NodeInstanceFactoryRegistry.getInstance(null).getProcessNodeInstanceFactory(node).getClass());
}
Also used : ActionNode(org.jbpm.workflow.core.node.ActionNode) Node(org.jbpm.workflow.core.Node) ActionNode(org.jbpm.workflow.core.node.ActionNode) Test(org.junit.Test) AbstractBaseTest(org.jbpm.test.util.AbstractBaseTest)

Example 3 with Node

use of org.jbpm.workflow.core.Node in project jbpm by kiegroup.

the class AdHocSubProcessHandler method writeNode.

public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) {
    DynamicNode dynamicNode = (DynamicNode) node;
    writeNode("adHocSubProcess", dynamicNode, xmlDump, metaDataType);
    if (!dynamicNode.isCancelRemainingInstances()) {
        xmlDump.append(" cancelRemainingInstances=\"false\"");
    }
    xmlDump.append(" ordering=\"Parallel\" >" + EOL);
    writeExtensionElements(dynamicNode, xmlDump);
    // nodes
    List<Node> subNodes = getSubNodes(dynamicNode);
    XmlBPMNProcessDumper.INSTANCE.visitNodes(subNodes, xmlDump, metaDataType);
    // connections
    visitConnectionsAndAssociations(dynamicNode, xmlDump, metaDataType);
    if (dynamicNode.isAutoComplete()) {
        xmlDump.append("    <completionCondition xsi:type=\"tFormalExpression\">" + AUTOCOMPLETE_COMPLETION_CONDITION + "</completionCondition>" + EOL);
    }
    endNode("adHocSubProcess", xmlDump);
}
Also used : Node(org.jbpm.workflow.core.Node) DynamicNode(org.jbpm.workflow.core.node.DynamicNode) DynamicNode(org.jbpm.workflow.core.node.DynamicNode)

Example 4 with Node

use of org.jbpm.workflow.core.Node in project jbpm by kiegroup.

the class BoundaryEventHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    Node node = (Node) parser.getCurrent();
    String attachedTo = element.getAttribute("attachedToRef");
    Attr cancelActivityAttr = element.getAttributeNode("cancelActivity");
    boolean cancelActivity = Boolean.parseBoolean(cancelActivityAttr.getValue());
    // determine type of event definition, so the correct type of node can be generated
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if ("escalationEventDefinition".equals(nodeName)) {
            // reuse already created EventNode
            handleEscalationNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            break;
        } else if ("errorEventDefinition".equals(nodeName)) {
            // reuse already created EventNode
            handleErrorNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            break;
        } else if ("timerEventDefinition".equals(nodeName)) {
            // reuse already created EventNode
            handleTimerNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            break;
        } else if ("compensateEventDefinition".equals(nodeName)) {
            // reuse already created EventNode
            handleCompensationNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            break;
        } else if ("signalEventDefinition".equals(nodeName)) {
            // reuse already created EventNode
            handleSignalNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            break;
        } else if ("conditionalEventDefinition".equals(nodeName)) {
            handleConditionNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            break;
        } else if ("messageEventDefinition".equals(nodeName)) {
            handleMessageNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
            break;
        }
        xmlNode = xmlNode.getNextSibling();
    }
    NodeContainer nodeContainer = (NodeContainer) parser.getParent();
    nodeContainer.addNode(node);
    ((ProcessBuildData) parser.getData()).addNode(node);
    return node;
}
Also used : ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) Element(org.w3c.dom.Element) BoundaryEventNode(org.jbpm.workflow.core.node.BoundaryEventNode) EventNode(org.jbpm.workflow.core.node.EventNode) Node(org.jbpm.workflow.core.Node) NodeContainer(org.jbpm.workflow.core.NodeContainer) Attr(org.w3c.dom.Attr)

Example 5 with Node

use of org.jbpm.workflow.core.Node in project jbpm by kiegroup.

the class CallActivityHandler method end.

@SuppressWarnings("unchecked")
@Override
public Object end(String uri, String localName, ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    Node node = (Node) parser.getCurrent();
    handleNode(node, element, uri, localName, parser);
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    int uniqueIdGen = 1;
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if ("multiInstanceLoopCharacteristics".equals(nodeName)) {
            // create new timerNode
            ForEachNode forEachNode = new ForEachNode();
            forEachNode.setId(node.getId());
            String uniqueId = (String) node.getMetaData().get("UniqueId");
            forEachNode.setMetaData("UniqueId", uniqueId);
            node.setMetaData("UniqueId", uniqueId + ":" + uniqueIdGen++);
            node.setMetaData("hidden", true);
            forEachNode.addNode(node);
            forEachNode.linkIncomingConnections(NodeImpl.CONNECTION_DEFAULT_TYPE, node.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE);
            forEachNode.linkOutgoingConnections(node.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE, NodeImpl.CONNECTION_DEFAULT_TYPE);
            Node orignalNode = node;
            node = forEachNode;
            handleForEachNode(node, element, uri, localName, parser);
            // remove output collection data output of for each to avoid problems when running in variable strict mode
            if (orignalNode instanceof SubProcessNode) {
                ((SubProcessNode) orignalNode).adjustOutMapping(forEachNode.getOutputCollectionExpression());
            }
            Map<String, String> dataInputs = (Map<String, String>) orignalNode.getMetaData().remove("DataInputs");
            Map<String, String> dataOutputs = (Map<String, String>) orignalNode.getMetaData().remove("DataOutputs");
            orignalNode.setMetaData("MICollectionOutput", dataOutputs.get(((ForEachNode) node).getMetaData("MICollectionOutput")));
            orignalNode.setMetaData("MICollectionInput", dataInputs.get(((ForEachNode) node).getMetaData("MICollectionInput")));
            break;
        }
        xmlNode = xmlNode.getNextSibling();
    }
    NodeContainer nodeContainer = (NodeContainer) parser.getParent();
    nodeContainer.addNode(node);
    ((ProcessBuildData) parser.getData()).addNode(node);
    return node;
}
Also used : Element(org.w3c.dom.Element) ForEachNode(org.jbpm.workflow.core.node.ForEachNode) Node(org.jbpm.workflow.core.Node) SubProcessNode(org.jbpm.workflow.core.node.SubProcessNode) WorkItemNode(org.jbpm.workflow.core.node.WorkItemNode) NodeContainer(org.jbpm.workflow.core.NodeContainer) ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) SubProcessNode(org.jbpm.workflow.core.node.SubProcessNode) ForEachNode(org.jbpm.workflow.core.node.ForEachNode) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

Node (org.jbpm.workflow.core.Node)30 ActionNode (org.jbpm.workflow.core.node.ActionNode)16 EndNode (org.jbpm.workflow.core.node.EndNode)16 CompositeContextNode (org.jbpm.workflow.core.node.CompositeContextNode)14 CompositeNode (org.jbpm.workflow.core.node.CompositeNode)13 StartNode (org.jbpm.workflow.core.node.StartNode)13 WorkItemNode (org.jbpm.workflow.core.node.WorkItemNode)13 EventSubProcessNode (org.jbpm.workflow.core.node.EventSubProcessNode)12 RuleFlowProcess (org.jbpm.ruleflow.core.RuleFlowProcess)11 ArrayList (java.util.ArrayList)10 BoundaryEventNode (org.jbpm.workflow.core.node.BoundaryEventNode)10 Test (org.junit.Test)10 NodeContainer (org.jbpm.workflow.core.NodeContainer)9 ForEachNode (org.jbpm.workflow.core.node.ForEachNode)9 Element (org.w3c.dom.Element)9 ProcessBuildData (org.jbpm.compiler.xml.ProcessBuildData)8 AbstractBaseTest (org.jbpm.test.util.AbstractBaseTest)8 EventNode (org.jbpm.workflow.core.node.EventNode)7 Variable (org.jbpm.process.core.context.variable.Variable)4 Map (java.util.Map)3