protected boolean hasLoop(Node startAt, final Node lookFor) { Set<Long> vistedNodes = new HashSet<Long>(); return checkNodes(startAt, lookFor, vistedNodes); }
public void internalTrigger(final NodeInstance from, String type) { if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "A Split only accepts default incoming connections!"); } final Split split = getSplit(); try { executeStrategy(split, type); } catch(WorkflowRuntimeException wre) { throw wre; } catch(Exception e) { throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Split: " + e.getMessage(), e); } }
protected Split getSplit() { return (Split) getNode(); }
triggerCompleted(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, true); break; case Split.TYPE_XOR : ((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this); if ( selected == null ) { for ( final Iterator<Connection> iterator = outgoing.iterator(); iterator.hasNext(); ) { throw new IllegalArgumentException( "XOR split could not find at least one valid outgoing connection for split " + getSplit().getName() ); if (!hasLoop(selected.getTo(), split)) { setLevel(1); ((NodeInstanceContainer)getNodeInstanceContainer()).setCurrentLevel(1); triggerConnection(selected); break; case Split.TYPE_OR : ((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this); outgoing = split.getDefaultOutgoingConnections(); boolean found = false; selectedConnection, selectedConstraint ) ) { nodeInstances.add(new NodeInstanceTrigger(followConnection(selectedConnection), selectedConnection.getToType())); found = true; if (getProcessInstance().getState() != ProcessInstance.STATE_ACTIVE) { return;
processInstance.setKnowledgeRuntime( (InternalKnowledgeRuntime) ksession ); SplitInstance splitInstance = new SplitInstance(); splitInstance.setProcessInstance( processInstance );
triggerCompleted(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, true); break; case Split.TYPE_XOR : ((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this); if ( selected == null ) { for ( final Iterator<Connection> iterator = outgoing.iterator(); iterator.hasNext(); ) { throw new IllegalArgumentException( "XOR split could not find at least one valid outgoing connection for split " + getSplit().getName() ); if (!hasLoop(selected.getTo(), split)) { setLevel(1); ((NodeInstanceContainer)getNodeInstanceContainer()).setCurrentLevel(1); triggerConnection(selected); break; case Split.TYPE_OR : ((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this); outgoing = split.getDefaultOutgoingConnections(); boolean found = false; selectedConnection, selectedConstraint ) ) { nodeInstances.add(new NodeInstanceTrigger(followConnection(selectedConnection), selectedConnection.getToType())); found = true; if (getProcessInstance().getState() != ProcessInstance.STATE_ACTIVE) { return;
processInstance.setKnowledgeRuntime( (InternalKnowledgeRuntime) ksession ); SplitInstance splitInstance = new SplitInstance(); splitInstance.setProcessInstance( processInstance );
public void internalTrigger(final NodeInstance from, String type) { if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "A Split only accepts default incoming connections!"); } final Split split = getSplit(); try { executeStrategy(split, type); } catch(WorkflowRuntimeException wre) { throw wre; } catch(Exception e) { throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Split: " + e.getMessage(), e); } }
processInstance.setKnowledgeRuntime((InternalKnowledgeRuntime) ksession); SplitInstance splitInstance = new SplitInstance(); splitInstance.setProcessInstance(processInstance);
protected boolean checkNodes(Node currentNode, final Node lookFor, Set<Long> vistedNodes) { List<Connection> connections = currentNode.getOutgoingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); for (Connection conn : connections) { Node nextNode = conn.getTo(); if (nextNode == null) { continue; } else if (vistedNodes.contains(nextNode.getId())) { continue; } else { vistedNodes.add(nextNode.getId()); if (nextNode.getId() == lookFor.getId()) { return true; } boolean nestedCheck = checkNodes(nextNode, lookFor, vistedNodes); if (nestedCheck) { return true; } } } return false; }
protected Split getSplit() { return (Split) getNode(); }
protected boolean hasLoop(Node startAt, final Node lookFor) { Set<Long> vistedNodes = new HashSet<Long>(); return checkNodes(startAt, lookFor, vistedNodes); }
protected boolean checkNodes(Node currentNode, final Node lookFor, Set<Long> vistedNodes) { List<Connection> connections = currentNode.getOutgoingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); for (Connection conn : connections) { Node nextNode = conn.getTo(); if (nextNode == null) { continue; } else if (vistedNodes.contains(nextNode.getId())) { continue; } else { vistedNodes.add(nextNode.getId()); if (nextNode.getId() == lookFor.getId()) { return true; } boolean nestedCheck = checkNodes(nextNode, lookFor, vistedNodes); if (nestedCheck) { return true; } } } return false; }