com.ibm.openpages.api.trigger.ext

## Class DefaultEventHandler

- java.lang.Object
- - com.ibm.openpages.api.trigger.AbstractEventHandler
  - - com.ibm.openpages.api.trigger.ext.DefaultEventHandler

- Direct Known Subclasses:
    DateValidationHandler, DefaultLifecycleEventHandler, RabbitMQObjectChangeEventHandler, SendEmailEventHandler, SetCurrentDateHandler, SetEnumFieldHandler

      public class DefaultEventHandler
      extends AbstractEventHandler

  Default EventHandler that returns false for all event types. Override the specific handleEvent() methods for events associated with your trigger rule.
  Example:

       public boolean handleEvent(UpdateResourceEvent event) {
           IGRCObject object = (IGRCObject) event.getResource();
           //example: in addition to other updates, set a field to current date
           setCurrentDate(object);
           return true;
       }

  Custom EventHandlers should extend this class rather than directly extending from `AbstractEventHandler`. To throw a validation message or error from a handleEvent method, use `AbstractEventHandler.throwException(String, java.util.List, Throwable, com.ibm.openpages.api.Context)`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultEventHandler()` Default constructor
    `DefaultEventHandler(java.util.HashMap<java.lang.String,java.lang.String> attributes)` Constructor with the Map of all attributes of the event handler.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `handleEvent(AbstractEvent event)` Abstract method to handle an event.
    `boolean` | `handleEvent(AssociateResourceEvent event)` HandleEvent() method for AssociateResourceEvent type.
    `boolean` | `handleEvent(CopyResourceEvent event)` HandleEvent() method for CopyResourceEvent type.
    `boolean` | `handleEvent(CreateResourceEvent event)` HandleEvent() method for CreateResourceEvent type.
    `boolean` | `handleEvent(CreateResourceWithRelationsEvent event)` HandleEvent() method for CreateResourceWithRelationsEvent type.
    `boolean` | `handleEvent(DeleteResourceEvent event)` HandleEvent() method for DeleteResourceEvent type.
    `boolean` | `handleEvent(DisassociateResourceEvent event)` HandleEvent() method for DissassociateResourceEvent type.
    `boolean` | `handleEvent(MoveResourceEvent event)` HandleEvent() method for MoveResourceEvent type.
    `boolean` | `handleEvent(QueryEvent event)` HandleEvent() method for QueryEvent type.
    `boolean` | `handleEvent(ReassignPrimaryParentEvent event)` HandleEvent() method for ReassignPrimaryParentEvent type.
    `boolean` | `handleEvent(RenameResourceEvent event)` HandleEvent() method for RenameResourceEvent type.
    `boolean` | `handleEvent(SearchEvent event)` HandleEvent() method for SearchEvent type.
    `boolean` | `handleEvent(UpdateResourceEvent event)` HandleEvent() method for UpdateResourceEvent type.

    - ### Methods inherited from class com.ibm.openpages.api.trigger.AbstractEventHandler

      `getAttributes, getRuleAttributes, setAttributes, setRuleAttributes, throwException`

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

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

- - ### Constructor Detail

    - #### DefaultEventHandler

          public DefaultEventHandler()

      Default constructor

    - #### DefaultEventHandler

          public DefaultEventHandler(java.util.HashMap<java.lang.String,java.lang.String> attributes)

      Constructor with the Map of all attributes of the event handler.
      Parameters:
        `attributes` - a Map of attributes that provide configuration to the Event Handler

  - ### Method Detail

    - #### handleEvent

          public final boolean handleEvent(AbstractEvent event)
                                    throws java.lang.Exception

      Description copied from class: `AbstractEventHandler`
      Abstract method to handle an event. Definition of this method is specific to the event handler implementations.
      Specified by:
        `handleEvent` in class `AbstractEventHandler`
      Parameters:
        `event` - the event for the event handler to handle
      Returns:
        true if the event was handled successfully
      Throws:
        `java.lang.Exception`

    - #### handleEvent

          public boolean handleEvent(CreateResourceEvent event)

      HandleEvent() method for CreateResourceEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if CreateResourceEvent type is associated with the trigger rule. In a create event handler, the values of the object being saved is modified. Calling IResourceService.saveResource() is not required for `TriggerPositionType.PRE`.
      Parameters:
        `event` - a create resource event to be handled

    - #### handleEvent

          public boolean handleEvent(CreateResourceWithRelationsEvent event)

      HandleEvent() method for CreateResourceWithRelationsEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if CreateResourceWithRelationsEvent type is associated with the trigger rule. In a create event handler, the values of the object being saved is modified. Calling IResourceService.saveResource() is not required for `TriggerPositionType.PRE`.
      Parameters:
        `event` - a create resource with relations event to be handled

    - #### handleEvent

          public boolean handleEvent(UpdateResourceEvent event)

      HandleEvent() method for UpdateResourceEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if UpdateResourceEvent type is associated with the trigger rule. In an update event handler, the values of the object being saved is modified. Calling IResourceService.saveResource() is not required.
      Parameters:
        `event` - an update resource event to be handled

    - #### handleEvent

          public boolean handleEvent(AssociateResourceEvent event)

      HandleEvent() method for AssociateResourceEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if AssociateResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - an associate resource event to be handled

    - #### handleEvent

          public boolean handleEvent(DisassociateResourceEvent event)

      HandleEvent() method for DissassociateResourceEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if DissassociateResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - a disassociate resource event to be handled

    - #### handleEvent

          public boolean handleEvent(ReassignPrimaryParentEvent event)

      HandleEvent() method for ReassignPrimaryParentEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if ReassignPrimaryParentEvent type is associated with the trigger rule.
      Parameters:
        `event` - a reassigning primary parent event to be handled

    - #### handleEvent

          public boolean handleEvent(CopyResourceEvent event)

      HandleEvent() method for CopyResourceEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if CopyResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - a copy resource event to be handled

    - #### handleEvent

          public boolean handleEvent(MoveResourceEvent event)

      HandleEvent() method for MoveResourceEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if MoveResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - a move resource event to be handled

    - #### handleEvent

          public boolean handleEvent(RenameResourceEvent event)

      HandleEvent() method for RenameResourceEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if RenameResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - a rename resource event to be handled

    - #### handleEvent

          public boolean handleEvent(DeleteResourceEvent event)

      HandleEvent() method for DeleteResourceEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if DeleteResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - a delete resource event to be handled

    - #### handleEvent

          public boolean handleEvent(QueryEvent event)

      HandleEvent() method for QueryEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if QueryEvent type is associated with the trigger rule.
      Parameters:
        `event` - a query event to be handled

    - #### handleEvent

          public boolean handleEvent(SearchEvent event)

      HandleEvent() method for SearchEvent type. The DefaultEventHandler always returns false. Override this handleEvent() methods if SearchEvent type is associated with the trigger rule.
      Parameters:
        `event` - a search event to be handled

Licensed Materials - Property of IBM
OpenPages with Watson (PID: 5725-D51)
© Copyright IBM Corporation 2013, 2022. All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.