@Override public Object getMetaData(String name) { return ((NodeImpl)node).getMetaData(name); }
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); }
nodeParent = (NodeContainer) ((NodeImpl) nodeParent).getNodeContainer(); parentId = ((RuleFlowProcess) nodeParent).getId(); } else { parentId = (String) ((NodeImpl) nodeParent).getMetaData("UniqueId");
public void setId(final long id) { this.id = id; String uniqueId = (String) getMetaData("UniqueId"); if( uniqueId == null ) { setMetaData("UniqueId", "_jbpm-unique-" + uniqueIdGen.getAndIncrement() ); } }
private static void updateNodeInstances(NodeInstanceContainer nodeInstanceContainer, Map<String, Long> nodeMapping) { for (NodeInstance nodeInstance : nodeInstanceContainer.getNodeInstances()) { String oldNodeId = ((NodeImpl) ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).getNode()).getUniqueId(); Long newNodeId = nodeMapping.get(oldNodeId); if (newNodeId == null) { newNodeId = nodeInstance.getNodeId(); } // clean up iteration levels for removed (old) nodes Map<String, Integer> iterLevels = ((WorkflowProcessInstanceImpl) nodeInstance.getProcessInstance()).getIterationLevels(); String uniqueId = (String) ((NodeImpl) nodeInstance.getNode()).getMetaData("UniqueId"); iterLevels.remove(uniqueId); // and now set to new node id ((NodeInstanceImpl) nodeInstance).setNodeId(newNodeId); if (nodeInstance instanceof NodeInstanceContainer) { updateNodeInstances((NodeInstanceContainer) nodeInstance, nodeMapping); } } }
String uniqueId = (String) node.getMetaData().get("UniqueId"); if( uniqueId == null ) { uniqueId = ((NodeImpl) node).getUniqueId(); if ("true".equals(System.getProperty("jbpm.enable.multi.con")) && ((NodeImpl) node).getConstraints().size() > 0) { int priority = Integer.MAX_VALUE; connections = ((NodeImpl)node).getDefaultOutgoingConnections(); boolean found = false; List<NodeInstanceTrigger> nodeInstances = for ( final Iterator<Connection> iterator = outgoingCopy.iterator(); iterator.hasNext(); ) { final Connection connection = (Connection) iterator.next(); ConstraintEvaluator constraint = (ConstraintEvaluator) ((NodeImpl)node).getConstraint( connection ); for ( final Iterator<Connection> iterator = connections.iterator(); iterator.hasNext(); ) { final Connection connection = (Connection) iterator.next(); ConstraintEvaluator constraint = (ConstraintEvaluator) ((NodeImpl)node).getConstraint( connection ); if ( constraint.isDefault() ) { triggerConnection(connection);
+ ((String) ((NodeImpl)target).getMetaData("UniqueId")) + "] associated with a Boundary Compensation Event must be a Task or a (non-Event) Sub-Process"); Map<String, List<org.kie.api.definition.process.Connection>> connectionsMap = targetNode.getOutgoingConnections(); ConnectionImpl outgoingConnection = null; for( String connectionType : connectionsMap.keySet() ) { + ((String) targetNode.getMetaData("UniqueId")) + "] may not have any outgoing connection [" + (String) outgoingConnection.getMetaData("UniqueId") + "]");
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { Map<ConnectionRef, Constraint> constraints = ((NodeImpl) node).getConstraints(); ConstraintImpl constraint = (ConstraintImpl) entry.getValue(); Connection outgoingConnection = null; for (Connection out: ((NodeImpl) node).getDefaultOutgoingConnections()) { if (out.getToType().equals(connection.getToType()) && out.getTo().getId() == connection.getNodeId()) { ruleConstraint.setPriority( constraint.getPriority() ); ruleConstraint.setDefault( constraint.isDefault() ); ((NodeImpl) node).setConstraint( outgoingConnection, ruleConstraint ); } else if ( "code".equals( constraint.getType() ) ) { ReturnValueConstraintEvaluator returnValueConstraint = new ReturnValueConstraintEvaluator(); returnValueConstraint.setPriority( constraint.getPriority() ); returnValueConstraint.setDefault( constraint.isDefault() ); ((NodeImpl) node).setConstraint( outgoingConnection, returnValueConstraint );
Constraint constraint = buildConstraint(connection, nodeImpl); if (constraint != null) { nodeImpl.addConstraint(new ConnectionRef(connection.getId(), target.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE), constraint);
private void addActiveNodeIds(NodeInstanceContainer container, List<String> result) { for (org.kie.api.runtime.process.NodeInstance nodeInstance: container.getNodeInstances()) { result.add(((NodeImpl) ((NodeInstanceImpl) nodeInstance).getNode()).getUniqueId()); if (nodeInstance instanceof NodeInstanceContainer) { addActiveNodeIds((NodeInstanceContainer) nodeInstance, result); } } }
public String getUniqueId() { String result = id + ""; NodeContainer nodeContainer = getNodeContainer(); while (nodeContainer instanceof CompositeNode) { CompositeNode composite = (CompositeNode) nodeContainer; result = composite.getId() + ":" + result; nodeContainer = composite.getNodeContainer(); } return result; }
private static void insertNodeInBetween(RuleFlowProcess process, long startNodeId, long endNodeId, NodeImpl node) { if (process == null) { throw new IllegalArgumentException("Process may not be null"); } NodeImpl selectedNode = (NodeImpl) process.getNode(startNodeId); if (selectedNode == null) { throw new IllegalArgumentException("Node " + startNodeId + " not found in process " + process.getId()); } for (Connection connection: selectedNode.getDefaultOutgoingConnections()) { if (connection.getTo().getId() == endNodeId) { process.addNode(node); NodeImpl endNode = (NodeImpl) connection.getTo(); ((ConnectionImpl) connection).terminate(); new ConnectionImpl(selectedNode, NodeImpl.CONNECTION_DEFAULT_TYPE, node, NodeImpl.CONNECTION_DEFAULT_TYPE); new ConnectionImpl(node, NodeImpl.CONNECTION_DEFAULT_TYPE, endNode, NodeImpl.CONNECTION_DEFAULT_TYPE); return; } } throw new IllegalArgumentException("Connection to node " + endNodeId + " not found in process " + process.getId()); }
/** Helper method for nodes that have multiple default outgoing connections */ public List<Connection> getDefaultOutgoingConnections() { return getOutgoingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); }
private void assignLanes(NodeContainer nodeContainer, Map<String, String> laneMapping) { for (Node node: nodeContainer.getNodes()) { String lane = null; String uniqueId = (String) node.getMetaData().get("UniqueId"); if (uniqueId != null) { lane = laneMapping.get(uniqueId); } else { lane = laneMapping.get(XmlBPMNProcessDumper.getUniqueNodeId(node)); } if (lane != null) { ((NodeImpl) node).setMetaData("Lane", lane); if (node instanceof HumanTaskNode) { ((HumanTaskNode) node).setSwimlane(lane); } } if (node instanceof NodeContainer) { assignLanes((NodeContainer) node, laneMapping); } } }
Object compensationObject = targetNodeImpl.getMetaData(isForCompensation); if( compensationObject == null ) { targetNodeImpl.setMetaData(isForCompensation, true); logger.warn("Setting {} attribute to true for node {}", isForCompensation, targetRef ); } else if( ! Boolean.parseBoolean(compensationObject.toString()) ) {
String uniqueId = (String) node.getMetaData().get("UniqueId"); if( uniqueId == null ) { uniqueId = ((NodeImpl) node).getUniqueId(); if ("true".equals(System.getProperty("jbpm.enable.multi.con")) && ((NodeImpl) node).getConstraints().size() > 0) { int priority = Integer.MAX_VALUE; connections = ((NodeImpl)node).getDefaultOutgoingConnections(); boolean found = false; List<NodeInstanceTrigger> nodeInstances = for ( final Iterator<Connection> iterator = outgoingCopy.iterator(); iterator.hasNext(); ) { final Connection connection = (Connection) iterator.next(); ConstraintEvaluator constraint = (ConstraintEvaluator) ((NodeImpl)node).getConstraint( connection ); for ( final Iterator<Connection> iterator = connections.iterator(); iterator.hasNext(); ) { final Connection connection = (Connection) iterator.next(); ConstraintEvaluator constraint = (ConstraintEvaluator) ((NodeImpl)node).getConstraint( connection ); if ( constraint.isDefault() ) { triggerConnection(connection);
private static void updateNodeInstances(NodeInstanceContainer nodeInstanceContainer, Map<String, Long> nodeMapping) { for (NodeInstance nodeInstance : nodeInstanceContainer.getNodeInstances()) { String oldNodeId = ((NodeImpl) ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).getNode()).getUniqueId(); Long newNodeId = nodeMapping.get(oldNodeId); if (newNodeId == null) { newNodeId = nodeInstance.getNodeId(); } // clean up iteration levels for removed (old) nodes Map<String, Integer> iterLevels = ((WorkflowProcessInstanceImpl) nodeInstance.getProcessInstance()).getIterationLevels(); String uniqueId = (String) ((NodeImpl) nodeInstance.getNode()).getMetaData("UniqueId"); iterLevels.remove(uniqueId); // and now set to new node id ((NodeInstanceImpl) nodeInstance).setNodeId(newNodeId); if (nodeInstance instanceof NodeInstanceContainer) { updateNodeInstances((NodeInstanceContainer) nodeInstance, nodeMapping); } } }
+ ((String) ((NodeImpl)target).getMetaData("UniqueId")) + "] associated with a Boundary Compensation Event must be a Task or a (non-Event) Sub-Process"); Map<String, List<org.kie.api.definition.process.Connection>> connectionsMap = targetNode.getOutgoingConnections(); ConnectionImpl outgoingConnection = null; for( String connectionType : connectionsMap.keySet() ) { + ((String) targetNode.getMetaData("UniqueId")) + "] may not have any outgoing connection [" + (String) outgoingConnection.getMetaData("UniqueId") + "]");
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { Map<ConnectionRef, Constraint> constraints = ((NodeImpl) node).getConstraints(); ConstraintImpl constraint = (ConstraintImpl) entry.getValue(); Connection outgoingConnection = null; for (Connection out: ((NodeImpl) node).getDefaultOutgoingConnections()) { if (out.getToType().equals(connection.getToType()) && out.getTo().getId() == connection.getNodeId()) { ruleConstraint.setPriority( constraint.getPriority() ); ruleConstraint.setDefault( constraint.isDefault() ); ((NodeImpl) node).setConstraint( outgoingConnection, ruleConstraint ); } else if ( "code".equals( constraint.getType() ) ) { ReturnValueConstraintEvaluator returnValueConstraint = new ReturnValueConstraintEvaluator(); returnValueConstraint.setPriority( constraint.getPriority() ); returnValueConstraint.setDefault( constraint.isDefault() ); ((NodeImpl) node).setConstraint( outgoingConnection, returnValueConstraint );
Constraint constraint = buildConstraint(connection, nodeImpl); if (constraint != null) { nodeImpl.addConstraint(new ConnectionRef(connection.getId(), target.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE), constraint);