Search in sources :

Example 6 with Node

use of org.kie.api.definition.process.Node in project jbpm by kiegroup.

the class CaseRuntimeDataServiceImpl method collectCaseStages.

private Collection<CaseStage> collectCaseStages(String deploymentId, String processId, NodeContainer process) {
    Collection<CaseStage> result = new ArrayList<CaseStage>();
    for (Node node : process.getNodes()) {
        if (node instanceof DynamicNode) {
            DynamicNode dynamicNode = (DynamicNode) node;
            Collection<AdHocFragment> adHocFragments = collectAdHocFragments(dynamicNode);
            result.add(new CaseStageImpl((String) ((DynamicNode) node).getMetaData("UniqueId"), node.getName(), adHocFragments));
        }
    }
    return result;
}
Also used : CaseStageImpl(org.jbpm.casemgmt.impl.model.CaseStageImpl) CaseStage(org.jbpm.casemgmt.api.model.CaseStage) BoundaryEventNode(org.jbpm.workflow.core.node.BoundaryEventNode) DynamicNode(org.jbpm.workflow.core.node.DynamicNode) StartNode(org.jbpm.workflow.core.node.StartNode) MilestoneNode(org.jbpm.workflow.core.node.MilestoneNode) Node(org.kie.api.definition.process.Node) ArrayList(java.util.ArrayList) DynamicNode(org.jbpm.workflow.core.node.DynamicNode) AdHocFragment(org.jbpm.casemgmt.api.model.AdHocFragment)

Example 7 with Node

use of org.kie.api.definition.process.Node in project jbpm by kiegroup.

the class JbpmBpmn2TestCase method assertNumOfOutgoingConnections.

public void assertNumOfOutgoingConnections(ProcessInstance process, String nodeName, int num) {
    assertNodeExists(process, nodeName);
    WorkflowProcessInstanceImpl instance = (WorkflowProcessInstanceImpl) process;
    for (Node node : instance.getNodeContainer().getNodes()) {
        if (node.getName().equals(nodeName)) {
            if (node.getOutgoingConnections().size() != num) {
                fail("Expected outgoing connections: " + num + " - found " + node.getOutgoingConnections().size());
            } else {
                break;
            }
        }
    }
}
Also used : Node(org.kie.api.definition.process.Node) WorkflowProcessInstanceImpl(org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl)

Example 8 with Node

use of org.kie.api.definition.process.Node in project jbpm by kiegroup.

the class XmlBPMNProcessDumper method visitConnections.

private void visitConnections(Node[] nodes, StringBuilder xmlDump, int metaDataType) {
    xmlDump.append("    <!-- connections -->" + EOL);
    List<Connection> connections = new ArrayList<Connection>();
    for (Node node : nodes) {
        for (List<Connection> connectionList : node.getIncomingConnections().values()) {
            connections.addAll(connectionList);
        }
    }
    for (Connection connection : connections) {
        visitConnection(connection, xmlDump, metaDataType);
    }
    xmlDump.append(EOL);
}
Also used : 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 9 with Node

use of org.kie.api.definition.process.Node 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 10 with Node

use of org.kie.api.definition.process.Node in project jbpm by kiegroup.

the class BPMNPlaneHandler method processNodeInfo.

private boolean processNodeInfo(NodeInfo nodeInfo, Node[] nodes) {
    if (nodeInfo == null || nodeInfo.getNodeRef() == null) {
        return false;
    }
    for (Node node : nodes) {
        String id = (String) node.getMetaData().get("UniqueId");
        if (nodeInfo.getNodeRef().equals(id)) {
            ((org.jbpm.workflow.core.Node) node).setMetaData("x", nodeInfo.getX());
            ((org.jbpm.workflow.core.Node) node).setMetaData("y", nodeInfo.getY());
            ((org.jbpm.workflow.core.Node) node).setMetaData("width", nodeInfo.getWidth());
            ((org.jbpm.workflow.core.Node) node).setMetaData("height", nodeInfo.getHeight());
            return true;
        }
        if (node instanceof NodeContainer) {
            boolean found = processNodeInfo(nodeInfo, ((NodeContainer) node).getNodes());
            if (found) {
                return true;
            }
        }
    }
    return false;
}
Also used : Node(org.kie.api.definition.process.Node) NodeContainer(org.kie.api.definition.process.NodeContainer)

Aggregations

Node (org.kie.api.definition.process.Node)70 StartNode (org.jbpm.workflow.core.node.StartNode)27 EventNode (org.jbpm.workflow.core.node.EventNode)26 ActionNode (org.jbpm.workflow.core.node.ActionNode)25 EndNode (org.jbpm.workflow.core.node.EndNode)25 CompositeNode (org.jbpm.workflow.core.node.CompositeNode)22 ArrayList (java.util.ArrayList)20 EventSubProcessNode (org.jbpm.workflow.core.node.EventSubProcessNode)20 WorkItemNode (org.jbpm.workflow.core.node.WorkItemNode)19 FaultNode (org.jbpm.workflow.core.node.FaultNode)17 HumanTaskNode (org.jbpm.workflow.core.node.HumanTaskNode)17 StateBasedNode (org.jbpm.workflow.core.node.StateBasedNode)15 BoundaryEventNode (org.jbpm.workflow.core.node.BoundaryEventNode)13 NodeContainer (org.kie.api.definition.process.NodeContainer)13 DynamicNode (org.jbpm.workflow.core.node.DynamicNode)11 ForEachNode (org.jbpm.workflow.core.node.ForEachNode)11 StateNode (org.jbpm.workflow.core.node.StateNode)11 RuleSetNode (org.jbpm.workflow.core.node.RuleSetNode)10 SubProcessNode (org.jbpm.workflow.core.node.SubProcessNode)10 WorkflowProcessInstanceImpl (org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl)10