Class NoExecutionVariableScope

  • All Implemented Interfaces:
    VariableScope

    public class NoExecutionVariableScope
    extends java.lang.Object
    implements VariableScope
    Variable-scope only used to resolve variables when NO execution is active but expression-resolving is needed. This occurs eg. when start-form properties have default's defined. Even though variables are not available yet, expressions should be resolved anyway.
    • Constructor Detail

      • NoExecutionVariableScope

        public NoExecutionVariableScope()
    • Method Detail

      • getVariables

        public java.util.Map<java.lang.String,​java.lang.Object> getVariables()
        Description copied from interface: VariableScope
        Returns all variables. This will include all variables of parent scopes too.
        Specified by:
        getVariables in interface VariableScope
      • getVariablesLocal

        public java.util.Map<java.lang.String,​java.lang.Object> getVariablesLocal()
        Description copied from interface: VariableScope
        Returns the variable local to this scope only. So, in contrary to VariableScope.getVariables(), the variables from the parent scope won't be returned.
        Specified by:
        getVariablesLocal in interface VariableScope
      • getVariables

        public java.util.Map<java.lang.String,​java.lang.Object> getVariables​(java.util.Collection<java.lang.String> variableNames)
        Description copied from interface: VariableScope
        Similar to VariableScope.getVariables(), but limited to only the variables with the provided names.
        Specified by:
        getVariables in interface VariableScope
      • getVariables

        public java.util.Map<java.lang.String,​java.lang.Object> getVariables​(java.util.Collection<java.lang.String> variableNames,
                                                                                   boolean fetchAllVariables)
        Description copied from interface: VariableScope
        Similar to {@link #getVariables(Collection))}, but with a flag that indicates that all variables should be fetched when fetching the specific variables. If set to false, only the specific variables will be fetched. Dependening on the use case, this can be better for performance, as it avoids fetching and processing the other variables. However, if the other variables are needed further on, getting them in one go is probably better (and the variables are cached during one Command execution).
        Specified by:
        getVariables in interface VariableScope
      • getVariable

        public java.lang.Object getVariable​(java.lang.String variableName)
        Description copied from interface: VariableScope
        Returns the variable value for one specific variable. Will look in parent scopes when the variable does not exist on this particular scope.
        Specified by:
        getVariable in interface VariableScope
      • getVariable

        public java.lang.Object getVariable​(java.lang.String variableName,
                                            boolean fetchAllVariables)
        Description copied from interface: VariableScope
        Similar to VariableScope.getVariable(String), but has an extra flag that indicates whether or not all variables need to be fetched when getting one variable. By default true (for backwards compatibility reasons), which means that calling VariableScope.getVariable(String) will fetch all variables, of the current scope and all parent scopes. Setting this flag to false can thus be better for performance. However, variables are cached, and if other variables are used later on, setting this true might actually be better for performance.
        Specified by:
        getVariable in interface VariableScope
      • getVariableLocal

        public java.lang.Object getVariableLocal​(java.lang.String variableName)
        Description copied from interface: VariableScope
        Returns the value for the specific variable and only checks this scope and not any parent scope.
        Specified by:
        getVariableLocal in interface VariableScope
      • getVariableLocal

        public java.lang.Object getVariableLocal​(java.lang.String variableName,
                                                 boolean fetchAllVariables)
        Description copied from interface: VariableScope
        Similar to VariableScope.getVariableLocal(String), but has an extra flag that indicates whether or not all variables need to be fetched when getting one variable. By default true (for backwards compatibility reasons), which means that calling VariableScope.getVariableLocal(String) will fetch all variables, of the current scope. Setting this flag to false can thus be better for performance. However, variables are cached, and if other variables are used later on, setting this true might actually be better for performance.
        Specified by:
        getVariableLocal in interface VariableScope
      • getVariableNames

        public java.util.Set<java.lang.String> getVariableNames()
        Description copied from interface: VariableScope
        Returns all the names of the variables for this scope and all parent scopes.
        Specified by:
        getVariableNames in interface VariableScope
      • getVariableNamesLocal

        public java.util.Set<java.lang.String> getVariableNamesLocal()
        Description copied from interface: VariableScope
        Returns all the names of the variables for this scope (no parent scopes).
        Specified by:
        getVariableNamesLocal in interface VariableScope
      • setVariable

        public void setVariable​(java.lang.String variableName,
                                java.lang.Object value)
        Description copied from interface: VariableScope
        Sets the variable with the provided name to the provided value.

        A variable is set according to the following algorithm:

      • If this scope already contains a variable by the provided name as a local variable, its value is overwritten to the provided value.
      • If this scope does not contain a variable by the provided name as a local variable, the variable is set to this scope's parent scope, if there is one. If there is no parent scope (meaning this scope is the root scope of the hierarchy it belongs to), this scope is used. This applies recursively up the parent scope chain until, if no scope contains a local variable by the provided name, ultimately the root scope is reached and the variable value is set on that scope.
      • In practice for most cases, this algorithm will set variables to the scope of the execution at the process instance’s root level, if there is no execution-local variable by the provided name.

Specified by:
setVariable in interface VariableScope
Parameters:
variableName - the name of the variable to be set
value - the value of the variable to be set