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); }
private void visitConnections(Node[] nodes, StringBuilder xmlDump, boolean includeMeta) { List<Connection> connections = new ArrayList<Connection>(); for (Node node: nodes) { for (List<Connection> connectionList: node.getIncomingConnections().values()) { connections.addAll(connectionList); } } xmlDump.append(" <connections>" + EOL); for (Connection connection: connections) { visitConnection(connection, xmlDump, includeMeta); } xmlDump.append(" </connections>" + EOL + EOL); }
public List<Node> getAutoStartNodes() { List<Node> nodes = Arrays.stream(getNodes()) .filter(n -> n.getIncomingConnections().isEmpty() && "true".equalsIgnoreCase((String)n.getMetaData().get("customAutoStart"))) .collect(Collectors.toList()); return nodes; }
public List<Node> getAutoStartNodes() { if (!isDynamic()) { return Collections.emptyList(); } List<Node> nodes = Arrays.stream(getNodes()) .filter(n -> n.getIncomingConnections().isEmpty() && "true".equalsIgnoreCase((String)n.getMetaData().get("customAutoStart"))) .collect(Collectors.toList()); return nodes; }
protected List<Connection> getSubConnections(CompositeNode compositeNode) { List<Connection> connections = new ArrayList<Connection>(); for (org.kie.api.definition.process.Node subNode: compositeNode.getNodes()) { // filter out composite start and end nodes as they can be regenerated if (!(subNode instanceof CompositeNode.CompositeNodeEnd)) { for (Connection connection: subNode.getIncomingConnections(Node.CONNECTION_DEFAULT_TYPE)) { if (!(connection.getFrom() instanceof CompositeNode.CompositeNodeStart)) { connections.add(connection); } } } } return connections; }
protected List<Connection> getSubConnections(CompositeNode compositeNode) { List<Connection> connections = new ArrayList<Connection>(); for (org.kie.api.definition.process.Node subNode: compositeNode.getNodes()) { // filter out composite start and end nodes as they can be regenerated if (!(subNode instanceof CompositeNode.CompositeNodeEnd)) { for (Connection connection: subNode.getIncomingConnections(Node.CONNECTION_DEFAULT_TYPE)) { if (!(connection.getFrom() instanceof CompositeNode.CompositeNodeStart)) { connections.add(connection); } } } } return connections; } }
@Override public boolean acceptsEvent(String type, Object event, Function<String, String> resolver) { if (type.equals(getActivationEventName())) { return true; } for (Node node : getNodes()) { if (resolver.apply(node.getName()).contains(type) && node.getIncomingConnections().isEmpty()) { return true; } } return super.acceptsEvent(type, event); }
public boolean acceptsEvent(String type, Object event) { if (type.equals(getActivationEventName())) { return true; } for (Node node : getNodes()) { if (type.equals(node.getName()) && node.getIncomingConnections().isEmpty()) { return true; } } return super.acceptsEvent(type, event); }
protected void applyAsync(Node node, boolean isAsync) { for (org.kie.api.definition.process.Node subNode: ((CompositeContextNode) node).getNodes()) { if (isAsync) { List<Connection> incoming = subNode.getIncomingConnections(NodeImpl.CONNECTION_DEFAULT_TYPE); if (incoming != null) { for (Connection con : incoming) { if (con.getFrom() instanceof StartNode) { ((Node)subNode).setMetaData("customAsync", Boolean.toString(isAsync)); return; } } } } } }
if (node.getIncomingConnections(NodeImpl.CONNECTION_DEFAULT_TYPE).isEmpty()) { processNode(node, processNodes);
@Override public void signalEvent(String type, Object event) { if (type.startsWith("RuleFlow-AdHocActivate")) { if (event instanceof MatchCreatedEvent) { Match match = ((MatchCreatedEvent) event).getMatch(); match.getDeclarationIds().forEach(s -> this.setVariable(s.replaceFirst("\\$", ""), match.getDeclarationValue(s))); } trigger(null, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); } else if (getActivationEventType().equals(type)) { if (event instanceof MatchCreatedEvent) { matchCreated((MatchCreatedEvent) event); } } else { super.signalEvent(type, event); for (Node node: getCompositeNode().getNodes()) { if (type.equals(resolveVariable(node.getName())) && node.getIncomingConnections().isEmpty()) { triggerSelectedNode(node, event); } } } }
public void assertNumOfIncommingConnections(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.getIncomingConnections().size() != num) { fail("Expected incomming connections: " + num + " - found " + node.getIncomingConnections().size()); } else { break; } } } }
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);
public void validateRemoveIncomingConnection(final String type, final Connection connection) { CompositeNode.NodeAndType nodeAndType = internalGetLinkedIncomingNode(type); if (nodeAndType != null) { for (Connection inConnection: nodeAndType.getNode().getIncomingConnections(nodeAndType.getType())) { if (((CompositeNodeStart) inConnection.getFrom()).getInNodeId() == connection.getFrom().getId()) { ((NodeImpl) nodeAndType.getNode()).validateRemoveIncomingConnection(nodeAndType.getType(), inConnection); return; } } throw new IllegalArgumentException( "Could not find internal incoming connection for node"); } }
public void removeIncomingConnection(String type, Connection connection) { super.removeIncomingConnection(type, connection); CompositeNode.NodeAndType nodeAndType = internalGetLinkedIncomingNode(type); if (nodeAndType != null) { for (Connection inConnection: nodeAndType.getNode().getIncomingConnections(nodeAndType.getType())) { if (((CompositeNodeStart) inConnection.getFrom()).getInNodeId() == connection.getFrom().getId()) { Node compositeNodeStart = inConnection.getFrom(); ((ConnectionImpl) inConnection).terminate(); internalRemoveNode(compositeNodeStart); return; } } throw new IllegalArgumentException( "Could not find internal incoming connection for node"); } }
if (type.equals(node.getName()) && node.getIncomingConnections().isEmpty()) { NodeInstance nodeInstance = getNodeInstance(node); if (event != null) {
oldNodeAndType.getNode().getIncomingConnections(oldNodeAndType.getType()); if (oldInConnections != null) { for (Connection connection: new ArrayList<Connection>(oldInConnections)) {
int level = ((org.jbpm.workflow.instance.NodeInstance)from).getLevel(); ((org.jbpm.workflow.instance.NodeInstanceContainer)getNodeInstanceContainer()).setCurrentLevel(level); Collection<Connection> incoming = getNode().getIncomingConnections(type); for (Connection conn : incoming) { if (conn.getFrom().getId() == from.getNodeId()) {
List<Connection> connections = nodeAndType.getNode().getIncomingConnections(nodeAndType.getType()); for (Iterator<Connection> iterator = connections.iterator(); iterator.hasNext(); ) { Connection connection = iterator.next();
public boolean acceptsEvent(String type, Object event) { if (type.equals(getActivationEventName())) { return true; } for (Node node : getNodes()) { if (type.equals(node.getName()) && node.getIncomingConnections().isEmpty()) { return true; } } return super.acceptsEvent(type, event); }