Search in sources :

Example 6 with VariableScope

use of org.activiti.engine.delegate.VariableScope in project Activiti by Activiti.

the class VariableScopeImpl method getVariableInstance.

public VariableInstance getVariableInstance(String variableName, boolean fetchAllVariables) {
    if (fetchAllVariables == true) {
        // Check the local single-fetch cache
        if (usedVariablesCache.containsKey(variableName)) {
            return usedVariablesCache.get(variableName);
        }
        ensureVariableInstancesInitialized();
        VariableInstanceEntity variableInstance = variableInstances.get(variableName);
        if (variableInstance != null) {
            return variableInstance;
        }
        // Go up the hierarchy
        VariableScope parentScope = getParentVariableScope();
        if (parentScope != null) {
            return parentScope.getVariableInstance(variableName, true);
        }
        return null;
    } else {
        if (usedVariablesCache.containsKey(variableName)) {
            return usedVariablesCache.get(variableName);
        }
        if (variableInstances != null && variableInstances.containsKey(variableName)) {
            return variableInstances.get(variableName);
        }
        VariableInstanceEntity variable = getSpecificVariable(variableName);
        if (variable != null) {
            usedVariablesCache.put(variableName, variable);
            return variable;
        }
        // Go up the hierarchy
        VariableScope parentScope = getParentVariableScope();
        if (parentScope != null) {
            return parentScope.getVariableInstance(variableName, false);
        }
        return null;
    }
}
Also used : VariableScope(org.activiti.engine.delegate.VariableScope)

Example 7 with VariableScope

use of org.activiti.engine.delegate.VariableScope in project Activiti by Activiti.

the class VariableScopeImpl method hasVariables.

public boolean hasVariables() {
    ensureVariableInstancesInitialized();
    if (!variableInstances.isEmpty()) {
        return true;
    }
    VariableScope parentScope = getParentVariableScope();
    if (parentScope != null) {
        return parentScope.hasVariables();
    }
    return false;
}
Also used : VariableScope(org.activiti.engine.delegate.VariableScope)

Aggregations

VariableScope (org.activiti.engine.delegate.VariableScope)7 ActivitiException (org.activiti.engine.ActivitiException)3 NoExecutionVariableScope (org.activiti.engine.impl.el.NoExecutionVariableScope)3 Date (java.util.Date)2 BusinessCalendar (org.activiti.engine.impl.calendar.BusinessCalendar)2 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)1 Expression (org.activiti.engine.delegate.Expression)1 CycleBusinessCalendar (org.activiti.engine.impl.calendar.CycleBusinessCalendar)1 TimerEntity (org.activiti.engine.impl.persistence.entity.TimerEntity)1 ScriptingEngines (org.activiti.engine.impl.scripting.ScriptingEngines)1 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)1 DateTime (org.joda.time.DateTime)1