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

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

本文整理了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

  1. protected String getNodeContainerId(NodeContainer nodeContainer) {
  2. if (nodeContainer instanceof Node) {
  3. return (String) ((Node) nodeContainer).getMetaData().get("UniqueId");
  4. }
  5. return null;
  6. }

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

  1. private String createActivationRule(Process process, Node node) {
  2. return
  3. "rule \"RuleFlow-Activate-" + process.getId() + "-" + node.getMetaData().get("UniqueId") + "\" \n" +
  4. " \n" +
  5. " when \n" +
  6. " org.kie.api.runtime.process.CaseData(definitionId == \"" + process.getId() + "\") \n" +
  7. " " + node.getMetaData().get("customActivationExpression") + "\n" +
  8. " then \n" +
  9. " 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" +
  10. " caseService.triggerAdHocFragment(org.jbpm.casemgmt.api.CaseUtils.getCaseId(kcontext.getKieRuntime()), \"" + node.getMetaData().get("customActivationFragmentName") +"\", null); \n" +
  11. "end \n\n";
  12. }

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

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

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

  1. private static Node findNodeByIdOrUniqueIdInMetadata(NodeContainer nodeContainer, final String nodeRef, String errorMsg) {
  2. Node node = null;
  3. // try looking for a node with same "UniqueId" (in metadata)
  4. for (Node containerNode : nodeContainer.getNodes()) {
  5. if (nodeRef.equals(containerNode.getMetaData().get("UniqueId"))) {
  6. node = containerNode;
  7. break;
  8. }
  9. }
  10. if (node == null) {
  11. throw new IllegalArgumentException(errorMsg);
  12. }
  13. return node;
  14. }

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

  1. private static Node findNodeByIdOrUniqueIdInMetadata(NodeContainer nodeContainer, final String nodeRef, String errorMsg) {
  2. Node node = null;
  3. // try looking for a node with same "UniqueId" (in metadata)
  4. for (Node containerNode: nodeContainer.getNodes()) {
  5. if (nodeRef.equals(containerNode.getMetaData().get("UniqueId"))) {
  6. node = containerNode;
  7. break;
  8. }
  9. }
  10. if (node == null) {
  11. throw new IllegalArgumentException(errorMsg);
  12. }
  13. return node;
  14. }

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

  1. public List<Node> getAutoStartNodes() {
  2. List<Node> nodes = Arrays.stream(getNodes())
  3. .filter(n -> n.getIncomingConnections().isEmpty() && "true".equalsIgnoreCase((String)n.getMetaData().get("customAutoStart")))
  4. .collect(Collectors.toList());
  5. return nodes;
  6. }

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

  1. public List<Node> getAutoStartNodes() {
  2. if (!isDynamic()) {
  3. return Collections.emptyList();
  4. }
  5. List<Node> nodes = Arrays.stream(getNodes())
  6. .filter(n -> n.getIncomingConnections().isEmpty() && "true".equalsIgnoreCase((String)n.getMetaData().get("customAutoStart")))
  7. .collect(Collectors.toList());
  8. return nodes;
  9. }

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

  1. private Node findNodeByUniqueId(String uniqueId, NodeContainer nodeContainer) {
  2. Node result = null;
  3. for (Node node : nodeContainer.getNodes()) {
  4. if (uniqueId.equals(node.getMetaData().get("UniqueId"))) {
  5. return node;
  6. }
  7. if (node instanceof NodeContainer) {
  8. result = findNodeByUniqueId(uniqueId, (NodeContainer) node);
  9. if (result != null) {
  10. return result;
  11. }
  12. }
  13. }
  14. return result;
  15. }

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

  1. protected boolean useAsync(final Node node) {
  2. if (!(node instanceof EventSubProcessNode) && (node instanceof ActionNode || node instanceof StateBasedNode || node instanceof EndNode)) {
  3. boolean asyncMode = Boolean.parseBoolean((String)node.getMetaData().get("customAsync"));
  4. if (asyncMode) {
  5. return asyncMode;
  6. }
  7. return Boolean.parseBoolean((String)getKnowledgeRuntime().getEnvironment().get("AsyncMode"));
  8. }
  9. return false;
  10. }

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

  1. private void postProcessNodeOffset(Node[] nodes, int xOffset, int yOffset) {
  2. for (Node node: nodes) {
  3. Integer x = (Integer) node.getMetaData().get("x");
  4. if (x != null) {
  5. ((org.jbpm.workflow.core.Node) node).setMetaData("x", x - xOffset);
  6. }
  7. Integer y = (Integer) node.getMetaData().get("y");
  8. if (y != null) {
  9. ((org.jbpm.workflow.core.Node) node).setMetaData("y", y - yOffset);
  10. }
  11. if (node instanceof NodeContainer) {
  12. postProcessNodeOffset(((NodeContainer) node).getNodes(), xOffset + (x == null ? 0 : x), yOffset + (y == null ? 0 : y));
  13. }
  14. }
  15. }

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

  1. protected boolean useAsync(final Node node) {
  2. if (!(node instanceof EventSubProcessNode) && (node instanceof ActionNode || node instanceof StateBasedNode || node instanceof EndNode)) {
  3. boolean asyncMode = Boolean.parseBoolean((String)node.getMetaData().get("customAsync"));
  4. if (asyncMode) {
  5. return asyncMode;
  6. }
  7. return Boolean.parseBoolean((String)getProcessInstance().getKnowledgeRuntime().getEnvironment().get("AsyncMode"));
  8. }
  9. return false;
  10. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

相关文章