private void processNode(final Node node, final Map<Node, Boolean> nodes) { if (!nodes.containsKey(node) && !((node instanceof CompositeNodeEnd) || (node instanceof ForEachSplitNode) || (node instanceof ForEachJoinNode))) { throw new IllegalStateException("A process node is connected with a node that does not belong to the process: " + node.getName()); } final Boolean prevValue = (Boolean) nodes.put(node, Boolean.TRUE); if (prevValue == Boolean.FALSE || prevValue == null) { for (final Iterator<List<Connection>> it = node.getOutgoingConnections().values().iterator(); it.hasNext(); ) { final List<Connection> list = it.next(); for (final Iterator<Connection> it2 = list.iterator(); it2.hasNext(); ) { processNode(it2.next().getTo(), nodes); } } } }
private boolean processConnectionInfo(ConnectionInfo connectionInfo, Node[] nodes) { for (Node node: nodes) { for (List<Connection> connections: node.getOutgoingConnections().values()) { for (Connection connection: connections) { String id = (String) connection.getMetaData().get("UniqueId"); if (id != null && id.equals(connectionInfo.getElementRef())) { ((ConnectionImpl) connection).setMetaData( "bendpoints", connectionInfo.getBendpoints()); return true; } } } if (node instanceof NodeContainer) { boolean found = processConnectionInfo(connectionInfo, ((NodeContainer) node).getNodes()); if (found) { return true; } } } return false; }
protected boolean checkNodes(Node currentNode, final Node lookFor, Set<Long> vistedNodes) { List<Connection> connections = currentNode.getOutgoingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); for (Connection conn : connections) { Node nextNode = conn.getTo(); if (nextNode == null) { continue; } else if (vistedNodes.contains(nextNode.getId())) { continue; } else { vistedNodes.add(nextNode.getId()); if (nextNode.getId() == lookFor.getId()) { return true; } boolean nestedCheck = checkNodes(nextNode, lookFor, vistedNodes); if (nestedCheck) { return true; } } } return false; }
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; } } } }
public void validateRemoveOutgoingConnection(final String type, final Connection connection) { CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type); if (nodeAndType != null) { for (Connection outConnection: nodeAndType.getNode().getOutgoingConnections(nodeAndType.getType())) { if (((CompositeNodeEnd) outConnection.getTo()).getOutNodeId() == connection.getTo().getId()) { ((NodeImpl) nodeAndType.getNode()).validateRemoveOutgoingConnection(nodeAndType.getType(), outConnection); return; } } throw new IllegalArgumentException( "Could not find internal outgoing connection for node"); } }
currentNode = ((AsyncEventNode) currentNode).getActualNode(); List<Connection> connections = currentNode.getOutgoingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
public void removeOutgoingConnection(String type, Connection connection) { super.removeOutgoingConnection(type, connection); CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type); if (nodeAndType != null) { for (Connection outConnection: nodeAndType.getNode().getOutgoingConnections(nodeAndType.getType())) { if (((CompositeNodeEnd) outConnection.getTo()).getOutNodeId() == connection.getTo().getId()) { Node compositeNodeEnd = outConnection.getTo(); ((ConnectionImpl) outConnection).terminate(); internalRemoveNode(compositeNodeEnd); return; } } throw new IllegalArgumentException( "Could not find internal outgoing connection for node"); } }
protected void triggerNodeInstance(org.jbpm.workflow.instance.NodeInstance nodeInstance, String type, boolean fireEvents) { boolean hidden = false; if (getNode().getMetaData().get("hidden") != null) { hidden = true; } InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime(); if (!hidden && fireEvents) { ((InternalProcessRuntime) kruntime.getProcessRuntime()) .getProcessEventSupport().fireBeforeNodeLeft(this, kruntime); } // trigger next node nodeInstance.trigger(this, type); Collection<Connection> outgoing = getNode().getOutgoingConnections(type); for (Connection conn : outgoing) { if (conn.getTo().getId() == nodeInstance.getNodeId()) { this.metaData.put("OutgoingConnection", conn.getMetaData().get("UniqueId")); break; } } if (!hidden && fireEvents) { ((InternalProcessRuntime) kruntime.getProcessRuntime()) .getProcessEventSupport().fireAfterNodeLeft(this, kruntime); } }
oldNodeAndType.getNode().getOutgoingConnections(oldNodeAndType.getType()); for (Connection connection: new ArrayList<Connection>(oldOutConnections)) { if (connection.getTo() instanceof CompositeNodeEnd) {
connections = node.getOutgoingConnections(type);
List<Connection> connections = null; if (node != null) { connections = node.getOutgoingConnections(type);
public void activationCreated(MatchCreatedEvent event) { Connection selected = null; for (Connection connection: getNode().getOutgoingConnections(NodeImpl.CONNECTION_DEFAULT_TYPE)) { Constraint constraint = getStateNode().getConstraint(connection); if (constraint != null) { String constraintName = getActivationEventType() + "-" + connection.getTo().getId() + "-" + connection.getToType(); if (constraintName.equals(event.getMatch().getRule().getName()) && checkProcessInstance((Activation) event.getMatch())) { selected = connection; } } } if (selected != null) { removeEventListeners(); ((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this); triggerConnection(selected); } }
public List<Connection> getOutgoingConnections(String type) { return adaptConnectionList(delegate.getOutgoingConnections(type)); }
public Map<String, List<Connection>> getOutgoingConnections() { return adaptConnectionMap(delegate.getOutgoingConnections()); }
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; } } } }
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; } } } }
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; } } } }
@Override public void internalTrigger(NodeInstance from, String type) { SimulationContext context = SimulationContext.getContext(); ActivitySimulator simulator = context.getRegistry().getSimulator(getNode()); SimulationEvent event = simulator.simulate(this, context); context.getRepository().storeEvent(event); List<Connection> outgoing = getNode().getOutgoingConnections().get(Node.CONNECTION_DEFAULT_TYPE); for (Connection conn : outgoing) { if (context.getCurrentPath().getSequenceFlowsIds().contains(conn.getMetaData().get("UniqueId"))) { triggerConnection(conn); } } } }
@Override public void internalTrigger(NodeInstance from, String type) { SimulationContext context = SimulationContext.getContext(); ActivitySimulator simulator = context.getRegistry().getSimulator(getNode()); SimulationEvent event = simulator.simulate(this, context); context.getRepository().storeEvent(event); List<Connection> outgoing = getNode().getOutgoingConnections().get(Node.CONNECTION_DEFAULT_TYPE); for (Connection conn : outgoing) { if (context.getCurrentPath().getSequenceFlowsIds().contains(conn.getMetaData().get("UniqueId"))) { triggerConnection(conn); } } } }
public void validateRemoveOutgoingConnection(final String type, final Connection connection) { CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type); if (nodeAndType != null) { for (Connection outConnection: nodeAndType.getNode().getOutgoingConnections(nodeAndType.getType())) { if (((CompositeNodeEnd) outConnection.getTo()).getOutNodeId() == connection.getTo().getId()) { ((NodeImpl) nodeAndType.getNode()).validateRemoveOutgoingConnection(nodeAndType.getType(), outConnection); return; } } throw new IllegalArgumentException( "Could not find internal outgoing connection for node"); } }