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

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

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

Node.getIncomingConnections介绍

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

代码示例

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

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);
}

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

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);
}

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

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;
}

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

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;
}

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

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;
}

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

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;
  }
}

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

@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);
}

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

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);
}

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

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;
          }
        }
      }
      
    }            
  }
}

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

if (node.getIncomingConnections(NodeImpl.CONNECTION_DEFAULT_TYPE).isEmpty()) {
  processNode(node,
        processNodes);

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

@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);
      }
    }
  }
}

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

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;
      }
    }
  }
}

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

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);

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

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");
  }
}

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

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");
  }
}

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

if (type.equals(node.getName()) && node.getIncomingConnections().isEmpty()) {
  NodeInstance nodeInstance = getNodeInstance(node);
  if (event != null) {

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

oldNodeAndType.getNode().getIncomingConnections(oldNodeAndType.getType());
if (oldInConnections != null) {
  for (Connection connection: new ArrayList<Connection>(oldInConnections)) {

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

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()) {

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

List<Connection> connections = nodeAndType.getNode().getIncomingConnections(nodeAndType.getType());
for (Iterator<Connection> iterator = connections.iterator(); iterator.hasNext(); ) {
  Connection connection = iterator.next();

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

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);
}

相关文章