@Override protected void doExecute( KaleoNode currentKaleoNode, ExecutionContext executionContext, List<PathElement> remainingPathElements) throws PortalException, SystemException { KaleoInstanceToken kaleoInstanceToken = executionContext.getKaleoInstanceToken(); KaleoInstanceToken parentKaleoInstanceToken = kaleoInstanceToken.getParentKaleoInstanceToken(); if (parentKaleoInstanceToken.hasIncompleteChildrenKaleoInstanceToken()) { return; } parentKaleoInstanceToken = kaleoInstanceTokenLocalService.updateKaleoInstanceToken( parentKaleoInstanceToken.getKaleoInstanceTokenId(), currentKaleoNode.getKaleoNodeId()); KaleoTransition kaleoTransition = currentKaleoNode.getDefaultKaleoTransition(); ExecutionContext newExecutionContext = new ExecutionContext( parentKaleoInstanceToken, executionContext.getWorkflowContext(), executionContext.getServiceContext()); PathElement pathElement = new PathElement( currentKaleoNode, kaleoTransition.getTargetKaleoNode(), newExecutionContext); remainingPathElements.add(pathElement); }
protected void doExecute( KaleoNode currentKaleoNode, ExecutionContext executionContext, List<PathElement> remainingPathElements) throws PortalException, SystemException { List<KaleoTransition> kaleoTransitions = currentKaleoNode.getKaleoTransitions(); Map<String, KaleoInstanceToken> childKaleoInstanceTokens = new HashMap<String, KaleoInstanceToken>(); for (KaleoTransition kaleoTransition : kaleoTransitions) { KaleoInstanceToken parentKaleoInstanceToken = executionContext.getKaleoInstanceToken(); KaleoInstanceToken childKaleoInstanceToken = kaleoInstanceTokenLocalService.addKaleoInstanceToken( parentKaleoInstanceToken.getKaleoInstanceTokenId(), executionContext.getWorkflowContext(), executionContext.getServiceContext()); childKaleoInstanceTokens.put(kaleoTransition.getName(), childKaleoInstanceToken); } for (KaleoTransition kaleoTransition : kaleoTransitions) { KaleoInstanceToken childKaleoInstanceToken = childKaleoInstanceTokens.get(kaleoTransition.getName()); ExecutionContext forkedExecutionContext = new ExecutionContext( childKaleoInstanceToken, executionContext.getWorkflowContext(), executionContext.getServiceContext()); PathElement pathElement = new PathElement( currentKaleoNode, kaleoTransition.getTargetKaleoNode(), forkedExecutionContext); remainingPathElements.add(pathElement); } }