Package org.flowable.engine.delegate.event

# Class BaseEntityEventListener

java.lang.Object
org.flowable.common.engine.api.delegate.event.AbstractFlowableEventListener
org.flowable.engine.delegate.event.BaseEntityEventListener

All Implemented Interfaces:
  `FlowableEventListener`

Direct Known Subclasses:
  `DebugInfoEntityEventListener`

public class BaseEntityEventListener extends AbstractFlowableEventListener
Base event listener that can be used when implementing an `FlowableEventListener` to get notified when an entity is created, updated, deleted or if another entity-related event occurs. Override the `onXX(..)` methods to respond to entity changes accordingly.

Author:
  Frederik Heremans

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Class<?>`
  `entityClass`
  `protected boolean`
  `failOnException`

  ### Fields inherited from class org.flowable.common.engine.api.delegate.event.AbstractFlowableEventListener

  `onTransaction`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BaseEntityEventListener()`
  Create a new BaseEntityEventListener, notified when an event that targets any type of entity is received.
  `BaseEntityEventListener(boolean failOnException)`
  Create a new BaseEntityEventListener.
  `BaseEntityEventListener(boolean failOnException, Class<?> entityClass)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isFailOnException()`
  `protected boolean`
  `isValidEvent(FlowableEvent event)`
  `protected void`
  `onCreate(FlowableEvent event)`
  Called when an entity create event is received.
  `protected void`
  `onDelete(FlowableEvent event)`
  Called when an entity delete event is received.
  `protected void`
  `onEntityEvent(FlowableEvent event)`
  Called when an event is received, which is not a create, an update or delete.
  `final void`
  `onEvent(FlowableEvent event)`
  Called when an event has been fired
  `protected void`
  `onInitialized(FlowableEvent event)`
  Called when an entity initialized event is received.
  `protected void`
  `onUpdate(FlowableEvent event)`
  Called when an entity update event is received.

  ### Methods inherited from class org.flowable.common.engine.api.delegate.event.AbstractFlowableEventListener

  `getOnTransaction, isFireOnTransactionLifecycleEvent, setOnTransaction`

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

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

  ### Methods inherited from interface org.flowable.common.engine.api.delegate.event.FlowableEventListener

  `getTypes`

- ## Field Details

  - ### failOnException

    protected boolean failOnException

  - ### entityClass

    protected Class<?> entityClass

- ## Constructor Details

  - ### BaseEntityEventListener

    public BaseEntityEventListener()
    Create a new BaseEntityEventListener, notified when an event that targets any type of entity is received. Returning true when `isFailOnException()` is called.

  - ### BaseEntityEventListener

    public BaseEntityEventListener(boolean failOnException)
    Create a new BaseEntityEventListener.
    Parameters:
      `failOnException` - return value for `isFailOnException()`.

  - ### BaseEntityEventListener

    public BaseEntityEventListener(boolean failOnException, Class<?> entityClass)

- ## Method Details

  - ### onEvent

    public final void onEvent(FlowableEvent event)
    Description copied from interface: `FlowableEventListener`
    Called when an event has been fired
    Parameters:
      `event` - the event

  - ### isFailOnException

    public boolean isFailOnException()
    Returns:
      whether or not the current operation should fail when this listeners execution throws an exception.

  - ### isValidEvent

    protected boolean isValidEvent(FlowableEvent event)
    Returns:
      true, if the event is an `FlowableEntityEvent` and (if needed) the entityClass set in this instance, is assignable from the entity class in the event.

  - ### onCreate

    protected void onCreate(FlowableEvent event)
    Called when an entity create event is received.

  - ### onInitialized

    protected void onInitialized(FlowableEvent event)
    Called when an entity initialized event is received.

  - ### onDelete

    protected void onDelete(FlowableEvent event)
    Called when an entity delete event is received.

  - ### onUpdate

    protected void onUpdate(FlowableEvent event)
    Called when an entity update event is received.

  - ### onEntityEvent

    protected void onEntityEvent(FlowableEvent event)
    Called when an event is received, which is not a create, an update or delete.