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

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

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

Node.getMetaData介绍

[英]Meta data associated with this Node.
[中]与此节点关联的元数据。

代码示例

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

protected String getNodeContainerId(NodeContainer nodeContainer) {
  if (nodeContainer instanceof Node) {
    return (String) ((Node) nodeContainer).getMetaData().get("UniqueId");
  }
  return null;
}

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

private String createActivationRule(Process process, Node node) {
  return
  "rule \"RuleFlow-Activate-" + process.getId() + "-" + node.getMetaData().get("UniqueId") + "\"  \n" +
  "       \n" +
  "    when \n" +
  "    org.kie.api.runtime.process.CaseData(definitionId == \""  + process.getId() + "\") \n" +
  "      " + node.getMetaData().get("customActivationExpression") + "\n" +
  "    then \n" +
  "       org.jbpm.casemgmt.api.CaseService caseService = (org.jbpm.casemgmt.api.CaseService) org.jbpm.services.api.service.ServiceRegistry.get().service(org.jbpm.services.api.service.ServiceRegistry.CASE_SERVICE); \n" +
  "       caseService.triggerAdHocFragment(org.jbpm.casemgmt.api.CaseUtils.getCaseId(kcontext.getKieRuntime()), \"" + node.getMetaData().get("customActivationFragmentName") +"\", null); \n" +
  "end \n\n";
}

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

public String toString() {
  return "Compensation Handler [" + this.node.getName() + ", " + this.node.getMetaData().get("UniqueId") + "]";
}

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

private static Node findNodeByIdOrUniqueIdInMetadata(NodeContainer nodeContainer, final String nodeRef, String errorMsg) {
  Node node = null;
  // try looking for a node with same "UniqueId" (in metadata)
  for (Node containerNode : nodeContainer.getNodes()) {
    if (nodeRef.equals(containerNode.getMetaData().get("UniqueId"))) {
      node = containerNode;
      break;
    }
  }
  if (node == null) {
    throw new IllegalArgumentException(errorMsg);
  }
  return node;
}

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

private static Node findNodeByIdOrUniqueIdInMetadata(NodeContainer nodeContainer, final String nodeRef, String errorMsg) { 
  Node node = null;
  // try looking for a node with same "UniqueId" (in metadata)
  for (Node containerNode: nodeContainer.getNodes()) {
    if (nodeRef.equals(containerNode.getMetaData().get("UniqueId"))) {
      node = containerNode;
      break;
    }
  }
  if (node == null) {
    throw new IllegalArgumentException(errorMsg);
  }
  return node;
}

代码示例来源: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

private Node findNodeByUniqueId(String uniqueId, NodeContainer nodeContainer) {
  Node result = null;
  for (Node node : nodeContainer.getNodes()) {
    if (uniqueId.equals(node.getMetaData().get("UniqueId"))) {
      return node;
    }
    if (node instanceof NodeContainer) {
      result = findNodeByUniqueId(uniqueId, (NodeContainer) node);
      if (result != null) {
        return result;
      }
    }
  }
  return result;
}

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

protected boolean useAsync(final Node node) {
  if (!(node instanceof EventSubProcessNode) && (node instanceof ActionNode || node instanceof StateBasedNode || node instanceof EndNode)) {              
    boolean asyncMode = Boolean.parseBoolean((String)node.getMetaData().get("customAsync"));
    if (asyncMode) {
      return asyncMode;
    }
    
    return Boolean.parseBoolean((String)getKnowledgeRuntime().getEnvironment().get("AsyncMode"));
  }
  
  return false;
}

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

private void postProcessNodeOffset(Node[] nodes, int xOffset, int yOffset) {
  for (Node node: nodes) {
    Integer x = (Integer) node.getMetaData().get("x");
    if (x != null) {
      ((org.jbpm.workflow.core.Node) node).setMetaData("x", x - xOffset);
    }
    Integer y = (Integer) node.getMetaData().get("y");
    if (y != null) {
      ((org.jbpm.workflow.core.Node) node).setMetaData("y", y - yOffset);
    }
    if (node instanceof NodeContainer) {
      postProcessNodeOffset(((NodeContainer) node).getNodes(), xOffset + (x == null ? 0 : x), yOffset + (y == null ? 0 : y));
    }
  }
}

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

protected boolean useAsync(final Node node) {
  if (!(node instanceof EventSubProcessNode) && (node instanceof ActionNode || node instanceof StateBasedNode || node instanceof EndNode)) {  
    boolean asyncMode = Boolean.parseBoolean((String)node.getMetaData().get("customAsync"));
    if (asyncMode) {
      return asyncMode;
    }
    
    return Boolean.parseBoolean((String)getProcessInstance().getKnowledgeRuntime().getEnvironment().get("AsyncMode"));
  }
  
  return false;
}

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

public void validateAddOutgoingConnection(final String type, final Connection connection) {
  super.validateAddOutgoingConnection(type, connection);
  if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() 
        + "] only accepts default outgoing connection type!");
  }
}

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

public void validateAddIncomingConnection(final String type, final Connection connection) {
  super.validateAddIncomingConnection(type, connection);
  if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() 
        + "] only accepts default incoming connection type!");
  }
  if (getFrom() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() 
        + "] cannot have more than one incoming connection!");
  }
}

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

public void validateAddOutgoingConnection(final String type, final Connection connection) {
  super.validateAddOutgoingConnection(type, connection);
  if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() 
        + "] only accepts default outgoing connection type!");
  }
  if (getTo() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() 
        + "] cannot have more than one outgoing connection!");
  }
}

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

public void validateAddIncomingConnection(final String type, final Connection connection) {
  super.validateAddIncomingConnection(type, connection);
  if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() 
        + "] only accepts default incoming connection type!");
  }
  if (getFrom() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() 
        + "] cannot have more than one incoming connection!");
  }
}

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

public void validateAddOutgoingConnection(final String type, final Connection connection) {
  super.validateAddOutgoingConnection(type, connection);
  if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
    throw new IllegalArgumentException(
      "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() 
      + "] only accepts default outgoing connection type!");
  }
  if (getTo() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) {
    throw new IllegalArgumentException(
      "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() 
      + "] cannot have more than one outgoing connection!");
  }
}

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

public void validateAddOutgoingConnection(final String type, final Connection connection) {
  super.validateAddOutgoingConnection(type, connection);
  if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() 
        + "] only accepts default outgoing connection type!");
  }
  if (getTo() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getFrom().getMetaData().get("UniqueId") + ", " + connection.getFrom().getName() 
        + "] cannot have more than one outgoing connection!");
  }
}

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

public void validateAddIncomingConnection(final String type, final Connection connection) {
  super.validateAddIncomingConnection(type, connection);
  if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() 
        + "] only accepts default incoming connection type!");
  }
  if (getFrom() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() 
        + "] cannot have more than one incoming connection!");
  }
}

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

public void validateAddIncomingConnection(final String type, final Connection connection) {
  super.validateAddIncomingConnection(type, connection);
  if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() 
        + "] only accepts default incoming connection type!");
  }
}

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

public void validateAddIncomingConnection(final String type, final Connection connection) {
  super.validateAddIncomingConnection(type, connection);
  if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() 
        + "] only accepts default incoming connection type!");
  }
  if (getFrom() != null && !"true".equals(System.getProperty("jbpm.enable.multi.con"))) {
    throw new IllegalArgumentException(
        "This type of node [" + connection.getTo().getMetaData().get("UniqueId") + ", " + connection.getTo().getName() 
        + "] cannot have more than one incoming connection!");
  }
}

相关文章