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

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

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

Node.getId介绍

[英]The id of the node. This is unique within its NodeContainer.
[中]节点的id。这在其NodeContainer中是独一无二的。

代码示例

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

@Override
public long getId() {
  return node.getId();
}

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

public NodeAndType(Node node, String type) {
  if (node == null || type == null) {
    throw new IllegalArgumentException(
      "Node or type may not be null!");
  }
  this.nodeId = node.getId();
  this.node = node;
  this.type = type;
}

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

protected void validateRemoveNode(Node node) {
  if (node == null) {
    throw new IllegalArgumentException("Node is null");
  }
  if (this.nodes.get(node.getId()) == null) {
    throw new IllegalArgumentException("Unknown node: " + node);
  }
}

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

public void addNode(final Node node) {
  validateAddNode(node);
  if (!this.nodes.containsValue(node)) {
    this.nodes.put(new Long(node.getId()), node);
  }
}

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

@Override
  public int compare(NodeInstance o1, NodeInstance o2) {
    if (o1.getNodeId() == lookFor.getId()) {
      return 1;
    } else if (o2.getNodeId() == lookFor.getId()) {
      return -1;
    }
    return 0;
  }
});

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

public void removeNode(final Node node) {
  validateRemoveNode(node);
  this.nodes.remove(new Long(node.getId()));
}

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

private void decreaseAllTriggers() {
  // decrease trigger count for all incoming connections
  for (final Connection connection: getJoin().getDefaultIncomingConnections()) {
    final Integer count = (Integer) this.triggers.get( connection.getFrom().getId() );
    if ( count.intValue() == 1 ) {
      this.triggers.remove( connection.getFrom().getId() );
    } else {
      this.triggers.put( connection.getFrom().getId(),
                count.intValue() - 1 );
    }
  }
}

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

protected void addErrorMessage(RuleFlowProcess process,
                  Node node,
                  List<ProcessValidationError> errors,
                  String message) {
    String error = String.format("Node '%s' [%d] " + message,
                   node.getName(),
                   node.getId());
    errors.add(new ProcessValidationErrorImpl(process,
                         error));
  }
}

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

public CompositeNodeEnd(CompositeNode parentNode, Node outNode, String outType) {
  setName("Composite node end");
  this.outNodeId = outNode.getId();
  this.outNode = outNode;
  this.outType = outType;
  this.parentNode = parentNode;
  setMetaData("hidden", true);
}

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

public CompositeNodeStart(CompositeNode parentNode, Node outNode, String outType) {
  setName("Composite node start");
  this.inNodeId = outNode.getId();
  this.inNode = outNode;
  this.inType = outType;
  this.parentNode = parentNode;
  setMetaData("hidden", true);
}

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

public Constraint getConstraint(final Connection connection) {
  if (connection == null) {
    throw new IllegalArgumentException("connection is null");
  }
  ConnectionRef ref = new ConnectionRef((String)connection.getMetaData().get("UniqueId"), connection.getTo().getId(), connection.getToType());
  return this.constraints.get(ref);
}

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

public Constraint getConstraint(final Connection connection) {
  if ( connection == null ) {
    throw new IllegalArgumentException( "connection is null" );
  }
  
  ConnectionRef ref = new ConnectionRef((String)connection.getMetaData().get("UniqueId"), connection.getTo().getId(), connection.getToType());
  return this.constraints.get(ref);
  }

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

public Constraint getConstraint(final Connection connection) {
  if ( connection == null ) {
    throw new IllegalArgumentException( "connection is null" );
  }
  if ( this.type == TYPE_OR || this.type == TYPE_XOR ) {
    ConnectionRef ref = new ConnectionRef((String)connection.getMetaData().get("UniqueId"), connection.getTo().getId(), connection.getToType());
    return this.constraints.get(ref);
  }
  throw new UnsupportedOperationException( "Constraints are " + 
    "only supported with XOR or OR split types, not with: " + getType() );
}

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

private boolean checkAllActivated() {
  // check whether all parent nodes have been triggered 
  for (final Connection connection: getJoin().getDefaultIncomingConnections()) {
    if ( this.triggers.get( connection.getFrom().getId() ) == null ) {
      return false;
    }
  }
  return true;
}

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

public void setConstraint(final Connection connection, final Constraint constraint) {
  if (connection == null) {
    throw new IllegalArgumentException("connection is null");
  }
  if (!getDefaultOutgoingConnections().contains(connection)) {
    throw new IllegalArgumentException("connection is unknown:"	+ connection);
  }
  addConstraint(new ConnectionRef((String)connection.getMetaData().get("UniqueId"), 
    connection.getTo().getId(), connection.getToType()), constraint);
}

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

public void setConstraint(final Connection connection,
             final Constraint constraint) {
  if ( connection == null ) {
    throw new IllegalArgumentException( "connection is null" );
  }
  if (!getDefaultOutgoingConnections().contains(connection)) {
    throw new IllegalArgumentException("connection is unknown:" + connection);
  }
  addConstraint(
    new ConnectionRef((String)connection.getMetaData().get("UniqueId"), connection.getTo().getId(), connection.getToType()),
    constraint);
}

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

public static String getUniqueNodeId(Node node) {
  String result = (String) node.getMetaData().get("UniqueId");
  if (result != null) {
    return result;
  }
  result = node.getId() + "";
  NodeContainer nodeContainer = node.getNodeContainer();
  while (nodeContainer instanceof CompositeNode) {
    CompositeNode composite = (CompositeNode) nodeContainer;
    result = composite.getId() + "-" + result;
    nodeContainer = composite.getNodeContainer();
  }
  return "_" + result;
}

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

public void removeConstraint(Connection connection) {
  ConnectionRef ref = new ConnectionRef((String)connection.getMetaData().get("UniqueId"), connection.getTo().getId(), connection.getToType());
  internalRemoveConstraint(ref);
}

代码示例来源: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 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");
  }
}

相关文章