Java Code Examples for org.flowable.engine.delegate.DelegateExecution#getVariableLocal()

The following examples show how to use org.flowable.engine.delegate.DelegateExecution#getVariableLocal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiInstanceActivityBehavior.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected Integer getLocalLoopVariable(DelegateExecution execution, String variableName) {
    Map<String, Object> localVariables = execution.getVariablesLocal();
    if (localVariables.containsKey(variableName)) {
        return (Integer) execution.getVariableLocal(variableName);
        
    } else if (!execution.isMultiInstanceRoot()) {
        DelegateExecution parentExecution = execution.getParent();
        localVariables = parentExecution.getVariablesLocal();
        if (localVariables.containsKey(variableName)) {
            return (Integer) parentExecution.getVariableLocal(variableName);
            
        } else if (!parentExecution.isMultiInstanceRoot()) {
            DelegateExecution superExecution = parentExecution.getParent();
            return (Integer) superExecution.getVariableLocal(variableName);
            
        } else {
            return null;
        }
        
    } else {
        return null;
    }
}
 
Example 2
Source File: MultiInstanceActivityBehavior.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
public Integer getLoopVariable(DelegateExecution execution, String variableName) {
    Object value = execution.getVariableLocal(variableName);
    DelegateExecution parent = execution.getParent();
    while (value == null && parent != null) {
        value = parent.getVariableLocal(variableName);
        parent = parent.getParent();
    }
    return (Integer) (value != null ? value : 0);
}
 
Example 3
Source File: VariablesTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
public void execute(DelegateExecution execution) {
    String value = (String) execution.getVariable("testVar2");
    String localVarValue = (String) execution.getVariableLocal("localValue");
    execution.setVariableLocal("testVar2", value + localVarValue);
}
 
Example 4
Source File: SetVariablesDelegate.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
public void execute(DelegateExecution execution) {
    Object nrOfCompletedInstances = execution.getVariableLocal("nrOfCompletedInstances");
    variablesMap.put(nrOfCompletedInstances, lastInt);
    execution.setVariableLocal("variable", lastInt);
    lastInt++;
}
 
Example 5
Source File: VariablesTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Override
public void execute(DelegateExecution execution) {
    String value = (String) execution.getVariable("testVar2");
    String localVarValue = (String) execution.getVariableLocal("localValue");
    execution.setVariableLocal("testVar2", value + localVarValue);
}