Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jbpm.context.exe
Class ContextInstance

    java.lang.Object
      org.jbpm.module.exe.ModuleInstance
          org.jbpm.context.exe.ContextInstance

All Implemented Interfaces:
  java.io.Serializable

    public class ContextInstance

extends ModuleInstance

maintains all the key-variable pairs for a process instance. You can obtain a ContextInstance from a processInstance from a process instance like this :

     ProcessInstance processInstance = ...;
     ContextInstance contextInstance = processInstance.getContextInstance();

More information on context and process variableInstances can be found in the userguide, section context

See Also:
  Serialized Form

Field Summary
`protected java.util.Map` | `tokenVariableMaps`
`protected java.util.Map` | `transientVariables`
`protected java.util.List` | `updatedVariableContainers`

Fields inherited from class org.jbpm.module.exe.ModuleInstance
`processInstance`

Constructor Summary
`ContextInstance()`

Method Summary
`void` | `addVariables(java.util.Map variables)` adds all the variableInstances on the root-token (= process-instance scope).
`void` | `addVariables(java.util.Map variables, Token token)` adds all the variableInstances to the scope of the given token.
`void` | `createVariable(java.lang.String name, java.lang.Object value)` creates a variable on the root-token (= process-instance scope) and calculates the actual VariableInstance-type from the value.
`void` | `createVariable(java.lang.String name, java.lang.Object value, Token token)` creates a variable in the scope of the given token and calculates the actual VariableInstance-type from the value.
`void` | `deleteTransientVariable(java.lang.String name)` removes the transient variable.
`void` | `deleteVariable(java.lang.String name)` deletes the given variable on the root-token (=process-instance scope).
`void` | `deleteVariable(java.lang.String name, Token token)` deletes a variable from the given token.
`java.lang.Object` | `getLocalVariable(java.lang.String name, Token token)` retrieves a variable which is local to the token.
`TokenVariableMap` | `getOrCreateTokenVariableMap(Token token)` searches for the first token-variable-map for the given token and creates it on the root token if it doesn't exist.
`TokenVariableMap` | `getTokenVariableMap(Token token)` looks for the first token-variable-map that is found up the token-parent hirarchy.
`java.util.Map` | `getTokenVariableMaps()`
`java.lang.Object` | `getTransientVariable(java.lang.String name)` retrieves the transient variable for the given name.
`java.util.Map` | `getTransientVariables()` retrieves all the transient variableInstances map. note that no deep copy is performed, changing the map leads to changes in the transient variableInstances of this context instance.
`java.lang.Object` | `getVariable(java.lang.String name)` gets the variable with the given name on the root-token (= process-instance scope).
`java.lang.Object` | `getVariable(java.lang.String name, Token token)` retrieves a variable in the scope of the token.
`VariableInstance` | `getVariableInstance(java.lang.String name, Token token)`
`java.lang.Object` | `getVariableLocally(java.lang.String name, Token token)` retrieves a variable which is local to the token.
`java.util.Map` | `getVariables()` gets all the variableInstances on the root-token (= process-instance scope).
`java.util.Map` | `getVariables(Token token)` retrieves all the variableInstances in scope of the given token.
`boolean` | `hasTransientVariable(java.lang.String name)` tells if a transient variable with the given name is present.
`boolean` | `hasVariable(java.lang.String name)` checks if a variable is present with the given name on the root-token (= process-instance scope).
`boolean` | `hasVariable(java.lang.String name, Token token)` checks if a variable is present with the given name in the scope of the token.
`void` | `setTransientVariable(java.lang.String name, java.lang.Object value)` sets the transient variable for the given name to the given value.
`void` | `setTransientVariables(java.util.Map transientVariables)` replaces the transient variableInstances with the given map.
`void` | `setVariable(java.lang.String name, java.lang.Object value)` sets a variable on the process instance scope.
`void` | `setVariable(java.lang.String name, java.lang.Object value, Token token)` sets a variable.
`void` | `setVariableLocally(java.lang.String name, java.lang.Object value)` sets the variable on the root token, creates the variable if necessary and calculates the actual VariableInstance-type from the value.
`void` | `setVariableLocally(java.lang.String name, java.lang.Object value, Token token)` creates a variable in the scope of the given token and calculates the actual VariableInstance-type from the value.
`void` | `setVariables(java.util.Map variables)` The method setVariables is the same as the `addVariables(Map, Token)`, but it was added for more consistency.
`void` | `setVariables(java.util.Map variables, Token token)` adds all the variableInstances to the scope of the given token.

Methods inherited from class org.jbpm.module.exe.ModuleInstance
`equals, getId, getProcessInstance, getService, setProcessInstance`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### tokenVariableMaps

    protected java.util.Map tokenVariableMaps

### transientVariables

    protected transient java.util.Map transientVariables

### updatedVariableContainers

    protected transient java.util.List updatedVariableContainers

Constructor Detail

### ContextInstance

    public ContextInstance()

Method Detail

### createVariable

    public void createVariable(java.lang.String name,
                               java.lang.Object value)

  creates a variable on the root-token (= process-instance scope) and calculates the actual VariableInstance-type from the value.

### setVariableLocally

    public void setVariableLocally(java.lang.String name,
                                   java.lang.Object value)

  sets the variable on the root token, creates the variable if necessary and calculates the actual VariableInstance-type from the value.

### createVariable

    public void createVariable(java.lang.String name,
                               java.lang.Object value,
                               Token token)

  creates a variable in the scope of the given token and calculates the actual VariableInstance-type from the value.

### setVariableLocally

    public void setVariableLocally(java.lang.String name,
                                   java.lang.Object value,
                                   Token token)

  creates a variable in the scope of the given token and calculates the actual VariableInstance-type from the value.

### getVariables

    public java.util.Map getVariables()

  gets all the variableInstances on the root-token (= process-instance scope).

### getVariables

    public java.util.Map getVariables(Token token)

  retrieves all the variableInstances in scope of the given token.

### addVariables

    public void addVariables(java.util.Map variables)

  adds all the variableInstances on the root-token (= process-instance scope).

### setVariables

    public void setVariables(java.util.Map variables)

  The method setVariables is the same as the `addVariables(Map, Token)`, but it was added for more consistency.

### addVariables

    public void addVariables(java.util.Map variables,
                             Token token)

  adds all the variableInstances to the scope of the given token. This method delegates to `setVariables(Map, Token)`. The method setVariables was added for more consistency.

### setVariables

    public void setVariables(java.util.Map variables,
                             Token token)

  adds all the variableInstances to the scope of the given token. The method setVariables is the same as the `addVariables(Map, Token)`, but it was added for more consistency.

### getVariable

    public java.lang.Object getVariable(java.lang.String name)

  gets the variable with the given name on the root-token (= process-instance scope).

### getVariable

    public java.lang.Object getVariable(java.lang.String name,
                                        Token token)

  retrieves a variable in the scope of the token. If the given token does not have a variable for the given name, the variable is searched for up the token hierarchy.

### getLocalVariable

    public java.lang.Object getLocalVariable(java.lang.String name,
                                             Token token)

  retrieves a variable which is local to the token. Method `getVariableLocally(String, Token)` is the same as this method and it was added for naming consistency.

### getVariableLocally

    public java.lang.Object getVariableLocally(java.lang.String name,
                                               Token token)

  retrieves a variable which is local to the token. this method was added for naming consistency. it is the same as `getLocalVariable(String, Token)`.

### setVariable

    public void setVariable(java.lang.String name,
                            java.lang.Object value)

  sets a variable on the process instance scope.

### setVariable

    public void setVariable(java.lang.String name,
                            java.lang.Object value,
                            Token token)

  sets a variable. If a variable exists in the scope given by the token, that variable is updated. Otherwise, the variable is created on the root token (=process instance scope).

### hasVariable

    public boolean hasVariable(java.lang.String name)

  checks if a variable is present with the given name on the root-token (= process-instance scope).

### hasVariable

    public boolean hasVariable(java.lang.String name,
                               Token token)

  checks if a variable is present with the given name in the scope of the token.

### deleteVariable

    public void deleteVariable(java.lang.String name)

  deletes the given variable on the root-token (=process-instance scope).

### deleteVariable

    public void deleteVariable(java.lang.String name,
                               Token token)

  deletes a variable from the given token. For safety reasons, this method does not propagate the deletion to parent tokens in case the given token does not contain the variable.

### getTransientVariable

    public java.lang.Object getTransientVariable(java.lang.String name)

  retrieves the transient variable for the given name.

### setTransientVariable

    public void setTransientVariable(java.lang.String name,
                                     java.lang.Object value)

  sets the transient variable for the given name to the given value.

### hasTransientVariable

    public boolean hasTransientVariable(java.lang.String name)

  tells if a transient variable with the given name is present.

### getTransientVariables

    public java.util.Map getTransientVariables()

  retrieves all the transient variableInstances map. note that no deep copy is performed, changing the map leads to changes in the transient variableInstances of this context instance.

### setTransientVariables

    public void setTransientVariables(java.util.Map transientVariables)

  replaces the transient variableInstances with the given map.

### deleteTransientVariable

    public void deleteTransientVariable(java.lang.String name)

  removes the transient variable.

### getOrCreateTokenVariableMap

    public TokenVariableMap getOrCreateTokenVariableMap(Token token)

  searches for the first token-variable-map for the given token and creates it on the root token if it doesn't exist.

### getTokenVariableMap

    public TokenVariableMap getTokenVariableMap(Token token)

  looks for the first token-variable-map that is found up the token-parent hirarchy.

### getVariableInstance

    public VariableInstance getVariableInstance(java.lang.String name,
                                                Token token)

### getTokenVariableMaps

    public java.util.Map getTokenVariableMaps()

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD