org.kie.api.definition.process.Node.getOutgoingConnections()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(170)

本文整理了Java中org.kie.api.definition.process.Node.getOutgoingConnections()方法的一些代码示例,展示了Node.getOutgoingConnections()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getOutgoingConnections()方法的具体详情如下:
包路径:org.kie.api.definition.process.Node
类名称:Node
方法名:getOutgoingConnections

Node.getOutgoingConnections介绍

[英]The outgoing connections for this Node. A Node could have multiple exit-points. This map contains the list of outgoing connections for each exit-point.
[中]此节点的传出连接。一个节点可以有多个出口点。此映射包含每个出口点的传出连接列表。

代码示例

代码示例来源:origin: kiegroup/jbpm

  1. private void processNode(final Node node,
  2. final Map<Node, Boolean> nodes) {
  3. if (!nodes.containsKey(node) && !((node instanceof CompositeNodeEnd) || (node instanceof ForEachSplitNode) || (node instanceof ForEachJoinNode))) {
  4. throw new IllegalStateException("A process node is connected with a node that does not belong to the process: " + node.getName());
  5. }
  6. final Boolean prevValue = (Boolean) nodes.put(node,
  7. Boolean.TRUE);
  8. if (prevValue == Boolean.FALSE || prevValue == null) {
  9. for (final Iterator<List<Connection>> it = node.getOutgoingConnections().values().iterator(); it.hasNext(); ) {
  10. final List<Connection> list = it.next();
  11. for (final Iterator<Connection> it2 = list.iterator(); it2.hasNext(); ) {
  12. processNode(it2.next().getTo(),
  13. nodes);
  14. }
  15. }
  16. }
  17. }

代码示例来源:origin: kiegroup/jbpm

  1. private boolean processConnectionInfo(ConnectionInfo connectionInfo, Node[] nodes) {
  2. for (Node node: nodes) {
  3. for (List<Connection> connections: node.getOutgoingConnections().values()) {
  4. for (Connection connection: connections) {
  5. String id = (String) connection.getMetaData().get("UniqueId");
  6. if (id != null && id.equals(connectionInfo.getElementRef())) {
  7. ((ConnectionImpl) connection).setMetaData(
  8. "bendpoints", connectionInfo.getBendpoints());
  9. return true;
  10. }
  11. }
  12. }
  13. if (node instanceof NodeContainer) {
  14. boolean found = processConnectionInfo(connectionInfo, ((NodeContainer) node).getNodes());
  15. if (found) {
  16. return true;
  17. }
  18. }
  19. }
  20. return false;
  21. }

代码示例来源:origin: kiegroup/jbpm

  1. protected boolean checkNodes(Node currentNode, final Node lookFor, Set<Long> vistedNodes) {
  2. List<Connection> connections = currentNode.getOutgoingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
  3. for (Connection conn : connections) {
  4. Node nextNode = conn.getTo();
  5. if (nextNode == null) {
  6. continue;
  7. } else if (vistedNodes.contains(nextNode.getId())) {
  8. continue;
  9. } else {
  10. vistedNodes.add(nextNode.getId());
  11. if (nextNode.getId() == lookFor.getId()) {
  12. return true;
  13. }
  14. boolean nestedCheck = checkNodes(nextNode, lookFor, vistedNodes);
  15. if (nestedCheck) {
  16. return true;
  17. }
  18. }
  19. }
  20. return false;
  21. }

代码示例来源:origin: kiegroup/jbpm

  1. public void assertNumOfOutgoingConnections(ProcessInstance process,
  2. String nodeName, int num) {
  3. assertNodeExists(process, nodeName);
  4. WorkflowProcessInstanceImpl instance = (WorkflowProcessInstanceImpl) process;
  5. for (Node node : instance.getNodeContainer().getNodes()) {
  6. if (node.getName().equals(nodeName)) {
  7. if (node.getOutgoingConnections().size() != num) {
  8. fail("Expected outgoing connections: " + num + " - found "
  9. + node.getOutgoingConnections().size());
  10. } else {
  11. break;
  12. }
  13. }
  14. }
  15. }

代码示例来源:origin: kiegroup/jbpm

  1. public void validateRemoveOutgoingConnection(final String type, final Connection connection) {
  2. CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type);
  3. if (nodeAndType != null) {
  4. for (Connection outConnection: nodeAndType.getNode().getOutgoingConnections(nodeAndType.getType())) {
  5. if (((CompositeNodeEnd) outConnection.getTo()).getOutNodeId() == connection.getTo().getId()) {
  6. ((NodeImpl) nodeAndType.getNode()).validateRemoveOutgoingConnection(nodeAndType.getType(), outConnection);
  7. return;
  8. }
  9. }
  10. throw new IllegalArgumentException(
  11. "Could not find internal outgoing connection for node");
  12. }
  13. }

代码示例来源:origin: kiegroup/jbpm

  1. currentNode = ((AsyncEventNode) currentNode).getActualNode();
  2. List<Connection> connections = currentNode.getOutgoingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);

代码示例来源:origin: kiegroup/jbpm

  1. public void removeOutgoingConnection(String type, Connection connection) {
  2. super.removeOutgoingConnection(type, connection);
  3. CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type);
  4. if (nodeAndType != null) {
  5. for (Connection outConnection: nodeAndType.getNode().getOutgoingConnections(nodeAndType.getType())) {
  6. if (((CompositeNodeEnd) outConnection.getTo()).getOutNodeId() == connection.getTo().getId()) {
  7. Node compositeNodeEnd = outConnection.getTo();
  8. ((ConnectionImpl) outConnection).terminate();
  9. internalRemoveNode(compositeNodeEnd);
  10. return;
  11. }
  12. }
  13. throw new IllegalArgumentException(
  14. "Could not find internal outgoing connection for node");
  15. }
  16. }

代码示例来源:origin: kiegroup/jbpm

  1. protected void triggerNodeInstance(org.jbpm.workflow.instance.NodeInstance nodeInstance, String type, boolean fireEvents) {
  2. boolean hidden = false;
  3. if (getNode().getMetaData().get("hidden") != null) {
  4. hidden = true;
  5. }
  6. InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime();
  7. if (!hidden && fireEvents) {
  8. ((InternalProcessRuntime) kruntime.getProcessRuntime())
  9. .getProcessEventSupport().fireBeforeNodeLeft(this, kruntime);
  10. }
  11. // trigger next node
  12. nodeInstance.trigger(this, type);
  13. Collection<Connection> outgoing = getNode().getOutgoingConnections(type);
  14. for (Connection conn : outgoing) {
  15. if (conn.getTo().getId() == nodeInstance.getNodeId()) {
  16. this.metaData.put("OutgoingConnection", conn.getMetaData().get("UniqueId"));
  17. break;
  18. }
  19. }
  20. if (!hidden && fireEvents) {
  21. ((InternalProcessRuntime) kruntime.getProcessRuntime())
  22. .getProcessEventSupport().fireAfterNodeLeft(this, kruntime);
  23. }
  24. }

代码示例来源:origin: kiegroup/jbpm

  1. oldNodeAndType.getNode().getOutgoingConnections(oldNodeAndType.getType());
  2. for (Connection connection: new ArrayList<Connection>(oldOutConnections)) {
  3. if (connection.getTo() instanceof CompositeNodeEnd) {

代码示例来源:origin: kiegroup/jbpm

  1. connections = node.getOutgoingConnections(type);

代码示例来源:origin: kiegroup/jbpm

  1. List<Connection> connections = null;
  2. if (node != null) {
  3. connections = node.getOutgoingConnections(type);

代码示例来源:origin: kiegroup/jbpm

  1. public void activationCreated(MatchCreatedEvent event) {
  2. Connection selected = null;
  3. for (Connection connection: getNode().getOutgoingConnections(NodeImpl.CONNECTION_DEFAULT_TYPE)) {
  4. Constraint constraint = getStateNode().getConstraint(connection);
  5. if (constraint != null) {
  6. String constraintName = getActivationEventType() + "-"
  7. + connection.getTo().getId() + "-" + connection.getToType();
  8. if (constraintName.equals(event.getMatch().getRule().getName())
  9. && checkProcessInstance((Activation) event.getMatch())) {
  10. selected = connection;
  11. }
  12. }
  13. }
  14. if (selected != null) {
  15. removeEventListeners();
  16. ((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this);
  17. triggerConnection(selected);
  18. }
  19. }

代码示例来源:origin: org.drools/knowledge-api

  1. public List<Connection> getOutgoingConnections(String type) {
  2. return adaptConnectionList(delegate.getOutgoingConnections(type));
  3. }

代码示例来源:origin: org.drools/knowledge-api

  1. public Map<String, List<Connection>> getOutgoingConnections() {
  2. return adaptConnectionMap(delegate.getOutgoingConnections());
  3. }

代码示例来源:origin: org.jbpm/jbpm-test

  1. public void assertNumOfOutgoingConnections(ProcessInstance process, String nodeName, int num) {
  2. assertNodeExists(process, nodeName);
  3. WorkflowProcessInstanceImpl instance = (WorkflowProcessInstanceImpl) process;
  4. for (Node node : instance.getNodeContainer().getNodes()) {
  5. if (node.getName().equals(nodeName)) {
  6. if (node.getOutgoingConnections().size() != num) {
  7. fail("Expected outgoing connections: " + num + " - found " + node.getOutgoingConnections().size());
  8. } else {
  9. break;
  10. }
  11. }
  12. }
  13. }

代码示例来源:origin: org.jbpm/jbpm-test

  1. public void assertNumOfOutgoingConnections(ProcessInstance process, String nodeName, int num) {
  2. assertNodeExists(process, nodeName);
  3. WorkflowProcessInstanceImpl instance = (WorkflowProcessInstanceImpl) process;
  4. for (Node node : instance.getNodeContainer().getNodes()) {
  5. if (node.getName().equals(nodeName)) {
  6. if (node.getOutgoingConnections().size() != num) {
  7. fail("Expected outgoing connections: " + num + " - found " + node.getOutgoingConnections().size());
  8. } else {
  9. break;
  10. }
  11. }
  12. }
  13. }

代码示例来源:origin: org.jbpm/jbpm-bpmn2

  1. public void assertNumOfOutgoingConnections(ProcessInstance process,
  2. String nodeName, int num) {
  3. assertNodeExists(process, nodeName);
  4. WorkflowProcessInstanceImpl instance = (WorkflowProcessInstanceImpl) process;
  5. for (Node node : instance.getNodeContainer().getNodes()) {
  6. if (node.getName().equals(nodeName)) {
  7. if (node.getOutgoingConnections().size() != num) {
  8. fail("Expected outgoing connections: " + num + " - found "
  9. + node.getOutgoingConnections().size());
  10. } else {
  11. break;
  12. }
  13. }
  14. }
  15. }

代码示例来源:origin: org.drools/jbpm-simulation

  1. @Override
  2. public void internalTrigger(NodeInstance from, String type) {
  3. SimulationContext context = SimulationContext.getContext();
  4. ActivitySimulator simulator = context.getRegistry().getSimulator(getNode());
  5. SimulationEvent event = simulator.simulate(this, context);
  6. context.getRepository().storeEvent(event);
  7. List<Connection> outgoing = getNode().getOutgoingConnections().get(Node.CONNECTION_DEFAULT_TYPE);
  8. for (Connection conn : outgoing) {
  9. if (context.getCurrentPath().getSequenceFlowsIds().contains(conn.getMetaData().get("UniqueId"))) {
  10. triggerConnection(conn);
  11. }
  12. }
  13. }
  14. }

代码示例来源:origin: kiegroup/droolsjbpm-integration

  1. @Override
  2. public void internalTrigger(NodeInstance from, String type) {
  3. SimulationContext context = SimulationContext.getContext();
  4. ActivitySimulator simulator = context.getRegistry().getSimulator(getNode());
  5. SimulationEvent event = simulator.simulate(this, context);
  6. context.getRepository().storeEvent(event);
  7. List<Connection> outgoing = getNode().getOutgoingConnections().get(Node.CONNECTION_DEFAULT_TYPE);
  8. for (Connection conn : outgoing) {
  9. if (context.getCurrentPath().getSequenceFlowsIds().contains(conn.getMetaData().get("UniqueId"))) {
  10. triggerConnection(conn);
  11. }
  12. }
  13. }
  14. }

代码示例来源:origin: org.jbpm/jbpm-flow

  1. public void validateRemoveOutgoingConnection(final String type, final Connection connection) {
  2. CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type);
  3. if (nodeAndType != null) {
  4. for (Connection outConnection: nodeAndType.getNode().getOutgoingConnections(nodeAndType.getType())) {
  5. if (((CompositeNodeEnd) outConnection.getTo()).getOutNodeId() == connection.getTo().getId()) {
  6. ((NodeImpl) nodeAndType.getNode()).validateRemoveOutgoingConnection(nodeAndType.getType(), outConnection);
  7. return;
  8. }
  9. }
  10. throw new IllegalArgumentException(
  11. "Could not find internal outgoing connection for node");
  12. }
  13. }

相关文章