Search in sources :

Example 1 with CompositeNode

use of org.jbpm.workflow.core.node.CompositeNode in project jbpm by kiegroup.

the class OutPortHandler method start.

public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
    parser.startElementBuilder(localName, attrs);
    CompositeNode compositeNode = (CompositeNode) parser.getParent();
    final String type = attrs.getValue("type");
    emptyAttributeCheck(localName, "type", type, parser);
    final String nodeId = attrs.getValue("nodeId");
    emptyAttributeCheck(localName, "nodeId", nodeId, parser);
    final String nodeOutType = attrs.getValue("nodeOutType");
    emptyAttributeCheck(localName, "nodeOutType", nodeOutType, parser);
    compositeNode.linkOutgoingConnections(new Long(nodeId), nodeOutType, type);
    return null;
}
Also used : CompositeNode(org.jbpm.workflow.core.node.CompositeNode)

Example 2 with CompositeNode

use of org.jbpm.workflow.core.node.CompositeNode in project jbpm by kiegroup.

the class InPortHandler method start.

public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
    parser.startElementBuilder(localName, attrs);
    CompositeNode compositeNode = (CompositeNode) parser.getParent();
    final String type = attrs.getValue("type");
    emptyAttributeCheck(localName, "type", type, parser);
    final String nodeId = attrs.getValue("nodeId");
    emptyAttributeCheck(localName, "nodeId", nodeId, parser);
    final String nodeInType = attrs.getValue("nodeInType");
    emptyAttributeCheck(localName, "nodeInType", nodeInType, parser);
    compositeNode.linkIncomingConnections(type, new Long(nodeId), nodeInType);
    return null;
}
Also used : CompositeNode(org.jbpm.workflow.core.node.CompositeNode)

Example 3 with CompositeNode

use of org.jbpm.workflow.core.node.CompositeNode in project jbpm by kiegroup.

the class XmlBPMNProcessDumper method getUniqueNodeId.

public static String getUniqueNodeId(Node node) {
    String result = (String) node.getMetaData().get("UniqueId");
    if (result != null) {
        return result;
    }
    result = node.getId() + "";
    NodeContainer nodeContainer = node.getNodeContainer();
    while (nodeContainer instanceof CompositeNode) {
        CompositeNode composite = (CompositeNode) nodeContainer;
        result = composite.getId() + "-" + result;
        nodeContainer = composite.getNodeContainer();
    }
    return "_" + result;
}
Also used : CompositeNode(org.jbpm.workflow.core.node.CompositeNode) NodeContainer(org.kie.api.definition.process.NodeContainer)

Example 4 with CompositeNode

use of org.jbpm.workflow.core.node.CompositeNode in project jbpm by kiegroup.

the class XmlBPMNProcessDumper method visitConnectionsDi.

private void visitConnectionsDi(Node[] nodes, StringBuilder xmlDump) {
    List<Connection> connections = new ArrayList<Connection>();
    for (Node node : nodes) {
        for (List<Connection> connectionList : node.getIncomingConnections().values()) {
            connections.addAll(connectionList);
        }
        if (node instanceof CompositeNode) {
            visitConnectionsDi(((CompositeNode) node).getNodes(), xmlDump);
        }
    }
    for (Connection connection : connections) {
        String bendpoints = (String) connection.getMetaData().get("bendpoints");
        xmlDump.append("      <bpmndi:BPMNEdge bpmnElement=\"" + getUniqueNodeId(connection.getFrom()) + "-" + getUniqueNodeId(connection.getTo()) + "\" >" + EOL);
        Integer x = (Integer) connection.getFrom().getMetaData().get("x");
        if (x == null) {
            x = 0;
        }
        Integer y = (Integer) connection.getFrom().getMetaData().get("y");
        if (y == null) {
            y = 0;
        }
        Integer width = (Integer) connection.getFrom().getMetaData().get("width");
        if (width == null) {
            width = 40;
        }
        Integer height = (Integer) connection.getFrom().getMetaData().get("height");
        if (height == null) {
            height = 40;
        }
        xmlDump.append("        <di:waypoint x=\"" + (x + width / 2) + "\" y=\"" + (y + height / 2) + "\" />" + EOL);
        if (bendpoints != null) {
            bendpoints = bendpoints.substring(1, bendpoints.length() - 1);
            String[] points = bendpoints.split(";");
            for (String point : points) {
                String[] coords = point.split(",");
                if (coords.length == 2) {
                    xmlDump.append("        <di:waypoint x=\"" + coords[0] + "\" y=\"" + coords[1] + "\" />" + EOL);
                }
            }
        }
        x = (Integer) connection.getTo().getMetaData().get("x");
        if (x == null) {
            x = 0;
        }
        y = (Integer) connection.getTo().getMetaData().get("y");
        if (y == null) {
            y = 0;
        }
        width = (Integer) connection.getTo().getMetaData().get("width");
        if (width == null) {
            width = 40;
        }
        height = (Integer) connection.getTo().getMetaData().get("height");
        if (height == null) {
            height = 40;
        }
        xmlDump.append("        <di:waypoint x=\"" + (x + width / 2) + "\" y=\"" + (y + height / 2) + "\" />" + EOL);
        xmlDump.append("      </bpmndi:BPMNEdge>" + EOL);
    }
}
Also used : CompositeNode(org.jbpm.workflow.core.node.CompositeNode) HumanTaskNode(org.jbpm.workflow.core.node.HumanTaskNode) ForEachNode(org.jbpm.workflow.core.node.ForEachNode) StartNode(org.jbpm.workflow.core.node.StartNode) CompositeNode(org.jbpm.workflow.core.node.CompositeNode) FaultNode(org.jbpm.workflow.core.node.FaultNode) WorkItemNode(org.jbpm.workflow.core.node.WorkItemNode) ActionNode(org.jbpm.workflow.core.node.ActionNode) EndNode(org.jbpm.workflow.core.node.EndNode) EventNode(org.jbpm.workflow.core.node.EventNode) Node(org.kie.api.definition.process.Node) Connection(org.kie.api.definition.process.Connection) ArrayList(java.util.ArrayList)

Example 5 with CompositeNode

use of org.jbpm.workflow.core.node.CompositeNode in project jbpm by kiegroup.

the class SequenceFlowHandler method start.

@SuppressWarnings("unchecked")
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
    parser.startElementBuilder(localName, attrs);
    final String id = attrs.getValue("id");
    final String sourceRef = attrs.getValue("sourceRef");
    final String targetRef = attrs.getValue("targetRef");
    final String bendpoints = attrs.getValue("g:bendpoints");
    final String name = attrs.getValue("name");
    final String priority = attrs.getValue("http://www.jboss.org/drools", "priority");
    NodeContainer nodeContainer = (NodeContainer) parser.getParent();
    List<SequenceFlow> connections = null;
    if (nodeContainer instanceof RuleFlowProcess) {
        RuleFlowProcess process = (RuleFlowProcess) nodeContainer;
        connections = (List<SequenceFlow>) process.getMetaData(ProcessHandler.CONNECTIONS);
        if (connections == null) {
            connections = new ArrayList<SequenceFlow>();
            process.setMetaData(ProcessHandler.CONNECTIONS, connections);
        }
    } else if (nodeContainer instanceof CompositeNode) {
        CompositeNode compositeNode = (CompositeNode) nodeContainer;
        connections = (List<SequenceFlow>) compositeNode.getMetaData(ProcessHandler.CONNECTIONS);
        if (connections == null) {
            connections = new ArrayList<SequenceFlow>();
            compositeNode.setMetaData(ProcessHandler.CONNECTIONS, connections);
        }
    }
    SequenceFlow connection = new SequenceFlow(id, sourceRef, targetRef);
    connection.setBendpoints(bendpoints);
    connection.setName(name);
    if (priority != null) {
        connection.setPriority(Integer.parseInt(priority));
    }
    connections.add(connection);
    return connection;
}
Also used : RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) CompositeNode(org.jbpm.workflow.core.node.CompositeNode) SequenceFlow(org.jbpm.bpmn2.core.SequenceFlow) ArrayList(java.util.ArrayList) NodeContainer(org.jbpm.workflow.core.NodeContainer) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

CompositeNode (org.jbpm.workflow.core.node.CompositeNode)22 ArrayList (java.util.ArrayList)13 ActionNode (org.jbpm.workflow.core.node.ActionNode)12 EndNode (org.jbpm.workflow.core.node.EndNode)12 StartNode (org.jbpm.workflow.core.node.StartNode)12 WorkItemNode (org.jbpm.workflow.core.node.WorkItemNode)11 RuleFlowProcess (org.jbpm.ruleflow.core.RuleFlowProcess)9 EventNode (org.jbpm.workflow.core.node.EventNode)9 List (java.util.List)8 FaultNode (org.jbpm.workflow.core.node.FaultNode)8 Node (org.kie.api.definition.process.Node)8 EventTypeFilter (org.jbpm.process.core.event.EventTypeFilter)7 CompositeContextNode (org.jbpm.workflow.core.node.CompositeContextNode)7 EventSubProcessNode (org.jbpm.workflow.core.node.EventSubProcessNode)7 DroolsConsequenceAction (org.jbpm.workflow.core.impl.DroolsConsequenceAction)6 ForEachNode (org.jbpm.workflow.core.node.ForEachNode)6 Variable (org.jbpm.process.core.context.variable.Variable)5 BoundaryEventNode (org.jbpm.workflow.core.node.BoundaryEventNode)5 HumanTaskNode (org.jbpm.workflow.core.node.HumanTaskNode)5 ObjectDataType (org.jbpm.process.core.datatype.impl.type.ObjectDataType)4