public Collection<NodeInstance> getNodeInstances(boolean recursive) { Collection<NodeInstance> result = nodeInstances; if (recursive) { result = new ArrayList<NodeInstance>(result); for (Iterator<NodeInstance> iterator = nodeInstances.iterator(); iterator.hasNext(); ) { NodeInstance nodeInstance = iterator.next(); if (nodeInstance instanceof NodeInstanceContainer) { result.addAll(((NodeInstanceContainer) nodeInstance).getNodeInstances(true)); } } } return Collections.unmodifiableCollection(result); }
public Collection<NodeInstance> getNodeInstances(boolean recursive) { Collection<NodeInstance> result = nodeInstances; if (recursive) { result = new ArrayList<NodeInstance>(result); for (Iterator<NodeInstance> iterator = nodeInstances.iterator(); iterator .hasNext();) { NodeInstance nodeInstance = iterator.next(); if (nodeInstance instanceof NodeInstanceContainer) { result .addAll(((org.jbpm.workflow.instance.NodeInstanceContainer) nodeInstance) .getNodeInstances(true)); } } } return Collections.unmodifiableCollection(result); }
private 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(); } ((NodeInstanceImpl) nodeInstance).setNodeId(newNodeId); if (nodeInstance instanceof NodeInstanceContainer) { updateNodeInstances((NodeInstanceContainer) nodeInstance, nodeMapping); } } }
@SuppressWarnings("unchecked") private void updateNodeInstances(NodeInstanceContainer nodeInstanceContainer, Map<String, String> nodeMapping, NodeContainer nodeContainer, EntityManager em) { for (NodeInstance nodeInstance : nodeInstanceContainer.getNodeInstances()) { if (nodeInstance.getNode() == null) { continue;
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); } } }
@Override public void signalEvent(String type, Object event) { BoundaryEventNode boundaryNode = (BoundaryEventNode) getEventNode(); String attachedTo = boundaryNode.getAttachedToNodeId(); Collection<NodeInstance> nodeInstances = ((NodeInstanceContainer) getNodeInstanceContainer()).getNodeInstances(); if( type != null && type.startsWith("Compensation") ) { // if not active && completed, signal if( ! isAttachedToNodeActive(nodeInstances, attachedTo, type, event) && isAttachedToNodeCompleted(attachedTo)) { super.signalEvent(type, event); } else { cancel(); } } else { if (isAttachedToNodeActive(nodeInstances, attachedTo, type, event)) { super.signalEvent(type, event); } else { cancel(); } } }
public Collection<NodeInstance> getNodeInstances(boolean recursive) { Collection<NodeInstance> result = nodeInstances; if (recursive) { result = new ArrayList<NodeInstance>(result); for (Iterator<NodeInstance> iterator = nodeInstances.iterator(); iterator.hasNext(); ) { NodeInstance nodeInstance = iterator.next(); if (nodeInstance instanceof NodeInstanceContainer) { result.addAll(((NodeInstanceContainer) nodeInstance).getNodeInstances(true)); } } } return Collections.unmodifiableCollection(result); }
public Collection<NodeInstance> getNodeInstances(boolean recursive) { Collection<NodeInstance> result = nodeInstances; if (recursive) { result = new ArrayList<NodeInstance>(result); for (Iterator<NodeInstance> iterator = nodeInstances.iterator(); iterator .hasNext();) { NodeInstance nodeInstance = iterator.next(); if (nodeInstance instanceof NodeInstanceContainer) { result .addAll(((org.jbpm.workflow.instance.NodeInstanceContainer) nodeInstance) .getNodeInstances(true)); } } } return Collections.unmodifiableCollection(result); }
protected NodeInstance getNodeInstance(WorkItem workItem, Collection<NodeInstance> nodeInstances) { for (NodeInstance nodeInstance : nodeInstances) { if (nodeInstance instanceof WorkItemNodeInstance) { if (((WorkItemNodeInstance) nodeInstance).getWorkItemId() == workItem.getId()) { return nodeInstance; } } else if (nodeInstance instanceof NodeInstanceContainer) { NodeInstance found = getNodeInstance(workItem, ((NodeInstanceContainer) nodeInstance).getNodeInstances()); if (found != null) { return found; } } } return null; }
private 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(); } ((NodeInstanceImpl) nodeInstance).setNodeId(newNodeId); if (nodeInstance instanceof NodeInstanceContainer) { updateNodeInstances((NodeInstanceContainer) nodeInstance, nodeMapping); } } }
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); } } }
@SuppressWarnings("unchecked") private void updateNodeInstances(NodeInstanceContainer nodeInstanceContainer, Map<String, String> nodeMapping, NodeContainer nodeContainer, EntityManager em) { for (NodeInstance nodeInstance : nodeInstanceContainer.getNodeInstances()) { if (nodeInstance.getNode() == null) { continue;
@Override public void signalEvent(String type, Object event) { BoundaryEventNode boundaryNode = (BoundaryEventNode) getEventNode(); String attachedTo = boundaryNode.getAttachedToNodeId(); Collection<NodeInstance> nodeInstances = ((NodeInstanceContainer) getNodeInstanceContainer()).getNodeInstances(); if( type != null && type.startsWith("Compensation") ) { // if not active && completed, signal if( ! isAttachedToNodeActive(nodeInstances, attachedTo, type, event) && isAttachedToNodeCompleted(attachedTo)) { super.signalEvent(type, event); } else { cancel(); } } else { if (isAttachedToNodeActive(nodeInstances, attachedTo, type, event)) { super.signalEvent(type, event); } else { cancel(); } } }