org.activiti.engine.delegate.event

## Class BaseEntityEventListener

- java.lang.Object
- - org.activiti.engine.delegate.event.BaseEntityEventListener

- All Implemented Interfaces:
    ActivitiEventListener

      public class BaseEntityEventListener
      extends Object
      implements ActivitiEventListener

  Base event listener that can be used when implementing an `ActivitiEventListener` 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 and Description
    --- | ---
    `protected Class<?>` | `entityClass`
    `protected boolean` | `failOnException`

  - ### Constructor Summary

    Constructors
    Constructor and 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

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

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

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

- - ### Field Detail

    - #### failOnException

          protected boolean failOnException

    - #### entityClass

          protected Class<?> entityClass

  - ### Constructor Detail

    - #### 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 Detail

    - #### onEvent

          public final void onEvent(ActivitiEvent event)

      Description copied from interface: `ActivitiEventListener`
      Called when an event has been fired
      Specified by:
        `onEvent` in interface `ActivitiEventListener`
      Parameters:
        `event` - the event

    - #### isFailOnException

          public boolean isFailOnException()

      Specified by:
        `isFailOnException` in interface `ActivitiEventListener`
      Returns:
        whether or not the current operation should fail when this listeners execution throws an exception.

    - #### isValidEvent

          protected boolean isValidEvent(ActivitiEvent event)

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

    - #### onCreate

          protected void onCreate(ActivitiEvent event)

      Called when an entity create event is received.

    - #### onInitialized

          protected void onInitialized(ActivitiEvent event)

      Called when an entity initialized event is received.

    - #### onDelete

          protected void onDelete(ActivitiEvent event)

      Called when an entity delete event is received.

    - #### onUpdate

          protected void onUpdate(ActivitiEvent event)

      Called when an entity update event is received.

    - #### onEntityEvent

          protected void onEntityEvent(ActivitiEvent event)

      Called when an event is received, which is not a create, an update or delete.

Copyright © 2016 Alfresco. All rights reserved.