Package org.kie.api.runtime.process

# Interface ProcessContext

All Superinterfaces:
  `KieContext`

public interface ProcessContext extends KieContext
Represents the context when executing a process.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `NodeInstance`
  `getNodeInstance()`
  Returns the node instance that is currently being executed in this context, or `null` if no node instance is currently being executed.
  `ProcessInstance`
  `getProcessInstance()`
  Returns the process instance that is currently being executed in this context.
  `Object`
  `getVariable(String variableName)`
  Returns the value of the variable with the given name.
  `void`
  `setVariable(String variableName, Object value)`
  Sets the value of the variable with the given name.

  ### Methods inherited from interface org.kie.api.runtime.KieContext

  `getKieBase, getKieRuntime, getKnowledgeRuntime`

- ## Method Details

  - ### getProcessInstance

    ProcessInstance getProcessInstance()
    Returns the process instance that is currently being executed in this context.
    Returns:
      the process instance that is currently being executed in this context

  - ### getNodeInstance

    NodeInstance getNodeInstance()
    Returns the node instance that is currently being executed in this context, or `null` if no node instance is currently being executed.
    Returns:
      the node instance that is currently being executed in this context

  - ### getVariable

    Object getVariable(String variableName)
    Returns the value of the variable with the given name. Based on the current node instance, it will try to resolve the given variable, taking nested variable scopes into account. Returns `null` if the variable could not be found.
    Parameters:
      `variableName` - the name of the variable
    Returns:
      the value of the variable

  - ### setVariable

    void setVariable(String variableName, Object value)
    Sets the value of the variable with the given name. Based on the current node instance, it will try to resolve the given variable, taking nested variable scopes into account. If the variable cannot be resolved, it will set the value as a process-level variable. It is however recommended to only use this with caution, as it is always recommended to define the variables that are used inside a process.
    Parameters:
      `variableName` - the name of the variable
      `value` - the value of the variable