@Override public ContextContainer getContextContainer() { return (ContextContainer) getForEachNode().getCompositeNode(); }
Map<String, Object> tempVariables = new HashMap<String, Object>(); VariableScopeInstance subprocessVariableScopeInstance = null; if (getForEachNode().getOutputVariableName() != null) { subprocessVariableScopeInstance = (VariableScopeInstance) getContextInstance(VariableScope.VARIABLE_SCOPE); ((NodeInstanceImpl)from).resolveContextInstance(VariableScope.VARIABLE_SCOPE, getForEachNode().getOutputVariableName()); Object outputVariable = null; if (variableScopeInstance != null) { outputVariable = variableScopeInstance.getVariable(getForEachNode().getOutputVariableName()); tempVariables.put(getForEachNode().getOutputVariableName(), outputVariable); String outputCollectionName = getForEachNode().getOutputCollectionExpression(); if (outputCollection != null) { tempVariables.put(outputCollectionName, outputCollection); boolean isCompletionConditionMet = evaluateCompletionCondition(getForEachNode().getCompletionConditionExpression(), tempVariables); if (getNodeInstanceContainer().getNodeInstances().size() == 1 || isCompletionConditionMet) { String outputCollection = getForEachNode().getOutputCollectionExpression(); if (outputCollection != null) { VariableScopeInstance variableScopeInstance = (VariableScopeInstance) resolveContextInstance(VariableScope.VARIABLE_SCOPE, outputCollection); if (getForEachNode().isWaitForCompletion()) {
public void internalTrigger(org.kie.api.runtime.process.NodeInstance fromm, String type) { String collectionExpression = getForEachNode().getCollectionExpression(); Collection<?> collection = evaluateCollectionExpression(collectionExpression); ((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this); if (collection.isEmpty()) { ForEachNodeInstance.this.triggerCompleted(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, true); } else { List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>(); for (Object o: collection) { String variableName = getForEachNode().getVariableName(); NodeInstance nodeInstance = (NodeInstance) ((NodeInstanceContainer) getNodeInstanceContainer()).getNodeInstance(getForEachSplitNode().getTo().getTo()); VariableScopeInstance variableScopeInstance = (VariableScopeInstance) nodeInstance.resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName); variableScopeInstance.setVariable(variableName, o); nodeInstances.add(nodeInstance); } for (NodeInstance nodeInstance: nodeInstances) { logger.debug( "Triggering [{}] in multi-instance loop.", ((NodeInstanceImpl) nodeInstance).getNodeId() ); ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).trigger(this, getForEachSplitNode().getTo().getToType()); } if (!getForEachNode().isWaitForCompletion()) { ForEachNodeInstance.this.triggerCompleted(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, false); } } }
@Override public ContextContainer getContextContainer() { return (ContextContainer) getForEachNode().getCompositeNode(); }
Map<String, Object> tempVariables = new HashMap<String, Object>(); VariableScopeInstance subprocessVariableScopeInstance = null; if (getForEachNode().getOutputVariableName() != null) { subprocessVariableScopeInstance = (VariableScopeInstance) getContextInstance(VariableScope.VARIABLE_SCOPE); ((NodeInstanceImpl)from).resolveContextInstance(VariableScope.VARIABLE_SCOPE, getForEachNode().getOutputVariableName()); Object outputVariable = null; if (variableScopeInstance != null) { outputVariable = variableScopeInstance.getVariable(getForEachNode().getOutputVariableName()); tempVariables.put(getForEachNode().getOutputVariableName(), outputVariable); String outputCollectionName = getForEachNode().getOutputCollectionExpression(); if (outputCollection != null) { tempVariables.put(outputCollectionName, outputCollection); boolean isCompletionConditionMet = evaluateCompletionCondition(getForEachNode().getCompletionConditionExpression(), tempVariables); if (getNodeInstanceContainer().getNodeInstances().size() == 1 || isCompletionConditionMet) { String outputCollection = getForEachNode().getOutputCollectionExpression(); if (outputCollection != null) { VariableScopeInstance variableScopeInstance = (VariableScopeInstance) resolveContextInstance(VariableScope.VARIABLE_SCOPE, outputCollection); if (getForEachNode().isWaitForCompletion()) {
public void internalTrigger(org.kie.api.runtime.process.NodeInstance fromm, String type) { String collectionExpression = getForEachNode().getCollectionExpression(); Collection<?> collection = evaluateCollectionExpression(collectionExpression); ((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this); if (collection.isEmpty()) { ForEachNodeInstance.this.triggerCompleted(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, true); } else { List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>(); for (Object o: collection) { String variableName = getForEachNode().getVariableName(); NodeInstance nodeInstance = (NodeInstance) ((NodeInstanceContainer) getNodeInstanceContainer()).getNodeInstance(getForEachSplitNode().getTo().getTo()); VariableScopeInstance variableScopeInstance = (VariableScopeInstance) nodeInstance.resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName); variableScopeInstance.setVariable(variableName, o); nodeInstances.add(nodeInstance); } for (NodeInstance nodeInstance: nodeInstances) { logger.debug( "Triggering [{}] in multi-instance loop.", ((NodeInstanceImpl) nodeInstance).getNodeId() ); ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).trigger(this, getForEachSplitNode().getTo().getToType()); } if (!getForEachNode().isWaitForCompletion()) { ForEachNodeInstance.this.triggerCompleted(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, false); } } }