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); } } }
public void internalTrigger(final NodeInstance from, String type) { super.internalTrigger(from, type); ExecutorService executorService = (ExecutorService) getProcessInstance().getKnowledgeRuntime().getEnvironment().get("ExecutorService"); if (executorService != null) { RuntimeManager runtimeManager = ((RuntimeManager)getProcessInstance().getKnowledgeRuntime().getEnvironment().get("RuntimeManager")); CommandContext ctx = new CommandContext(); ctx.setData("deploymentId", runtimeManager.getIdentifier()); ctx.setData("processInstanceId", getProcessInstance().getId()); ctx.setData("Signal", getEventType()); ctx.setData("Event", null); executorService.scheduleRequest(AsyncSignalEventCommand.class.getName(), ctx); Node node = getNode(); if (node != null) { String uniqueId = (String) node.getMetaData().get("UniqueId"); if( uniqueId == null ) { uniqueId = ((NodeImpl) node).getUniqueId(); } ((WorkflowProcessInstanceImpl) getProcessInstance()).getIterationLevels().remove(getNode().getMetaData().get("UniqueId")); } } else { logger.warn("No async executor service found continuing as sync operation..."); // if there is no executor service available move as sync node triggerCompleted(); } }
((WorkflowProcessInstanceImpl) processInstance).getIterationLevels().remove(uniqueId);
List<Map.Entry<String, Integer>> iterationlevels = new ArrayList<Map.Entry<String, Integer>>( workFlow.getIterationLevels().entrySet() ); Collections.sort( iterationlevels, new Comparator<Map.Entry<String, Integer>>() {
processInstance.getIterationLevels().put(_level.getId(), _level.getLevel());
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); } } }
((WorkflowProcessInstanceImpl) processInstance).getIterationLevels().remove(uniqueId);
public void internalTrigger(final NodeInstance from, String type) { super.internalTrigger(from, type); ExecutorService executorService = (ExecutorService) getProcessInstance().getKnowledgeRuntime().getEnvironment().get("ExecutorService"); if (executorService != null) { RuntimeManager runtimeManager = ((RuntimeManager)getProcessInstance().getKnowledgeRuntime().getEnvironment().get("RuntimeManager")); CommandContext ctx = new CommandContext(); ctx.setData("deploymentId", runtimeManager.getIdentifier()); ctx.setData("processInstanceId", getProcessInstance().getId()); ctx.setData("Signal", getEventType()); ctx.setData("Event", null); executorService.scheduleRequest(AsyncSignalEventCommand.class.getName(), ctx); Node node = getNode(); if (node != null) { String uniqueId = (String) node.getMetaData().get("UniqueId"); if( uniqueId == null ) { uniqueId = ((NodeImpl) node).getUniqueId(); } ((WorkflowProcessInstanceImpl) getProcessInstance()).getIterationLevels().remove(getNode().getMetaData().get("UniqueId")); } } else { logger.warn("No async executor service found continuing as sync operation..."); // if there is no executor service available move as sync node triggerCompleted(); } }
List<Map.Entry<String, Integer>> iterationlevels = new ArrayList<Map.Entry<String, Integer>>( workFlow.getIterationLevels().entrySet() ); Collections.sort( iterationlevels, new Comparator<Map.Entry<String, Integer>>() {
processInstance.getIterationLevels().put(_level.getId(), _level.getLevel());