Package org.flowable.engine.delegate

# Class DelegateHelper

java.lang.Object
org.flowable.engine.delegate.DelegateHelper

public class DelegateHelper extends Object
Class that provides helper operations for use in the `JavaDelegate`, `ActivityBehavior`, `ExecutionListener` and `TaskListener` interfaces.

Author:
  Joram Barrez

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DelegateHelper()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Expression`
  `createExpressionForField(FieldExtension fieldExtension)`
  Creates an `Expression` for the `FieldExtension`.
  `static BpmnModel`
  `getBpmnModel(DelegateExecution execution)`
  Returns the `BpmnModel` matching the process definition bpmn model for the process definition of the passed `DelegateExecution`.
  `static Map<String,List<ExtensionElement>>`
  `getExtensionElements(DelegateExecution execution)`
  Returns for the activityId of the passed `DelegateExecution` the `Map` of `ExtensionElement` instances.
  `static FieldExtension`
  `getField(DelegateExecution execution, String fieldName)`
  Returns the `FieldExtension` matching the provided 'fieldName' which is defined for the current activity of the provided `DelegateExecution`.
  `static Expression`
  `getFieldExpression(DelegateExecution execution, String fieldName)`
  Returns the `Expression` for the field defined for the current activity of the provided `DelegateExecution`.
  `static Expression`
  `getFieldExpression(org.flowable.task.service.delegate.DelegateTask task, String fieldName)`
  Similar to `getFieldExpression(DelegateExecution, String)`, but for use within a `TaskListener`.
  `static List<FieldExtension>`
  `getFields(DelegateExecution execution)`
  Returns the list of field extensions, represented as instances of `FieldExtension`, for the current activity of the passed `DelegateExecution`.
  `static FlowElement`
  `getFlowElement(DelegateExecution execution)`
  Returns the current `FlowElement` where the `DelegateExecution` is currently at.
  `static Map<String,List<ExtensionElement>>`
  `getFlowElementExtensionElements(DelegateExecution execution)`
  `static FieldExtension`
  `getFlowElementField(DelegateExecution execution, String fieldName)`
  `static Expression`
  `getFlowElementFieldExpression(DelegateExecution execution, String fieldName)`
  `static List<FieldExtension>`
  `getFlowElementFields(DelegateExecution execution)`
  `static Map<String,List<ExtensionElement>>`
  `getListenerExtensionElements(DelegateExecution execution)`
  `static FieldExtension`
  `getListenerField(DelegateExecution execution, String fieldName)`
  `static Expression`
  `getListenerFieldExpression(DelegateExecution execution, String fieldName)`
  `static List<FieldExtension>`
  `getListenerFields(DelegateExecution execution)`
  `static boolean`
  `isExecutingExecutionListener(DelegateExecution execution)`
  Returns whether or not the provided execution is being use for executing an `ExecutionListener`.
  `static void`
  `leaveDelegate(DelegateExecution delegateExecution)`
  To be used in an `ActivityBehavior` or `JavaDelegate`: leaves according to the default BPMN 2.0 rules: all sequenceflow with a condition that evaluates to true are followed.
  `static void`
  `leaveDelegate(DelegateExecution delegateExecution, String sequenceFlowId)`
  To be used in an `ActivityBehavior` or `JavaDelegate`: leaves the current activity via one specific sequenceflow.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DelegateHelper

    public DelegateHelper()

- ## Method Details

  - ### leaveDelegate

    public static void leaveDelegate(DelegateExecution delegateExecution)
    To be used in an `ActivityBehavior` or `JavaDelegate`: leaves according to the default BPMN 2.0 rules: all sequenceflow with a condition that evaluates to true are followed.

  - ### leaveDelegate

    public static void leaveDelegate(DelegateExecution delegateExecution, String sequenceFlowId)
    To be used in an `ActivityBehavior` or `JavaDelegate`: leaves the current activity via one specific sequenceflow.

  - ### getBpmnModel

    public static BpmnModel getBpmnModel(DelegateExecution execution)
    Returns the `BpmnModel` matching the process definition bpmn model for the process definition of the passed `DelegateExecution`.

  - ### getFlowElement

    public static FlowElement getFlowElement(DelegateExecution execution)
    Returns the current `FlowElement` where the `DelegateExecution` is currently at.

  - ### isExecutingExecutionListener

    public static boolean isExecutingExecutionListener(DelegateExecution execution)
    Returns whether or not the provided execution is being use for executing an `ExecutionListener`.

  - ### getExtensionElements

    public static Map<String,List<ExtensionElement>> getExtensionElements(DelegateExecution execution)
    Returns for the activityId of the passed `DelegateExecution` the `Map` of `ExtensionElement` instances. These represent the extension elements defined in the BPMN 2.0 XML as part of that particular activity. If the execution is currently being used for executing an `ExecutionListener`, the extension elements of the listener will be used. Use the `getFlowElementExtensionElements(DelegateExecution)` or `getListenerExtensionElements(DelegateExecution)` instead to specifically get the extension elements of either the flow element or the listener.

  - ### getFlowElementExtensionElements

    public static Map<String,List<ExtensionElement>> getFlowElementExtensionElements(DelegateExecution execution)

  - ### getListenerExtensionElements

    public static Map<String,List<ExtensionElement>> getListenerExtensionElements(DelegateExecution execution)

  - ### getFields

    public static List<FieldExtension> getFields(DelegateExecution execution)
    Returns the list of field extensions, represented as instances of `FieldExtension`, for the current activity of the passed `DelegateExecution`. If the execution is currently being used for executing an `ExecutionListener`, the fields of the listener will be returned. Use `getFlowElementFields(DelegateExecution)` or `getListenerFields(DelegateExecution)` if needing the flow element of listener fields specifically.

  - ### getFlowElementFields

    public static List<FieldExtension> getFlowElementFields(DelegateExecution execution)

  - ### getListenerFields

    public static List<FieldExtension> getListenerFields(DelegateExecution execution)

  - ### getField

    public static FieldExtension getField(DelegateExecution execution, String fieldName)
    Returns the `FieldExtension` matching the provided 'fieldName' which is defined for the current activity of the provided `DelegateExecution`. Returns null if no such `FieldExtension` can be found. If the execution is currently being used for executing an `ExecutionListener`, the field of the listener will be returned. Use `getFlowElementField(DelegateExecution, String)` or `getListenerField(DelegateExecution, String)` for specifically getting the field from either the flow element or the listener.

  - ### getFlowElementField

    public static FieldExtension getFlowElementField(DelegateExecution execution, String fieldName)

  - ### getListenerField

    public static FieldExtension getListenerField(DelegateExecution execution, String fieldName)

  - ### createExpressionForField

    public static Expression createExpressionForField(FieldExtension fieldExtension)
    Creates an `Expression` for the `FieldExtension`.

  - ### getFieldExpression

    public static Expression getFieldExpression(DelegateExecution execution, String fieldName)
    Returns the `Expression` for the field defined for the current activity of the provided `DelegateExecution`. Returns null if no such field was found in the process definition xml. If the execution is currently being used for executing an `ExecutionListener`, it will return the field expression for the listener. Use `getFlowElementFieldExpression(DelegateExecution, String)` or `getListenerFieldExpression(DelegateExecution, String)` for specifically getting the flow element or listener field expression.

  - ### getFieldExpression

    public static Expression getFieldExpression(org.flowable.task.service.delegate.DelegateTask task, String fieldName)
    Similar to `getFieldExpression(DelegateExecution, String)`, but for use within a `TaskListener`.

  - ### getFlowElementFieldExpression

    public static Expression getFlowElementFieldExpression(DelegateExecution execution, String fieldName)

  - ### getListenerFieldExpression

    public static Expression getListenerFieldExpression(DelegateExecution execution, String fieldName)