com.ibm.openpages.api.trigger.ext

## Class DefaultRule

- java.lang.Object
- - com.ibm.openpages.api.trigger.AbstractRule
  - - com.ibm.openpages.api.trigger.ext.DefaultRule

- Direct Known Subclasses:
    ContentTypeMatchRule, DefaultLifecycleRule, DetectPropertyChangeRule, DetectPropertyChangeTrigger, FieldsMatchRule, FolderMatchRule

      public class DefaultRule
      extends AbstractRule

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

       public boolean isApplicable(CreateResourceEvent event) {
           IResource resource = event.getResource();
           if (resource.isFolder()) {
               //do not apply to folders in this case
               return false;
           } else {
               //do business logic to evaluate if resource applies or not
               return evaluate((IGRCObject) resource);
           }
       }

  Custom rules should extend this class rather than directly extending from `AbstractRule`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultRule()` Default constructor
    `DefaultRule(java.util.Map<java.lang.String,java.lang.String> ruleAttributes)` Constructor with the Map of all attributes of the rule from the _trigger_config_.xml configuration file.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isApplicable(AbstractEvent event)` Determines whether or not the current operation satisfies the rule.
    `boolean` | `isApplicable(AssociateResourceEvent event)` Default isApplicable() method for AssociateResourceEvent type.
    `boolean` | `isApplicable(CopyResourceEvent event)` Default isApplicable() method for CopyResourceEvent type.
    `boolean` | `isApplicable(CreateResourceEvent event)` Default isApplicable() method for CreateResourceEvent type.
    `boolean` | `isApplicable(CreateResourceWithRelationsEvent event)` Default isApplicable() method for CreateResourceWithRelationsEvent type.
    `boolean` | `isApplicable(DeleteResourceEvent event)` Default isApplicable() method for DeleteResourceEvent type.
    `boolean` | `isApplicable(DisassociateResourceEvent event)` Default isApplicable() method for DisassociateResourceEvent type.
    `boolean` | `isApplicable(MoveResourceEvent event)` Default isApplicable() method for MoveResourceEvent type.
    `boolean` | `isApplicable(QueryEvent event)` Default isApplicable() method for QueryEvent type.
    `boolean` | `isApplicable(ReassignPrimaryParentEvent event)` Default isApplicable() method for ReassignPrimaryParentEvent type.
    `boolean` | `isApplicable(RenameResourceEvent event)` Default isApplicable() method for RenameResourceEvent type.
    `boolean` | `isApplicable(SearchEvent event)` Default isApplicable() method for SearchEvent type.
    `boolean` | `isApplicable(UpdateResourceEvent event)` Default isApplicable() method for UpdateResourceEvent type.

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

      `getAttributes, setAttributes`

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

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

- - ### Constructor Detail

    - #### DefaultRule

          public DefaultRule()

      Default constructor

    - #### DefaultRule

          public DefaultRule(java.util.Map<java.lang.String,java.lang.String> ruleAttributes)

      Constructor with the Map of all attributes of the rule from the _trigger_config_.xml configuration file.
      Parameters:
        `ruleAttributes` - a Map of attributes that provide configuration to the rule

  - ### Method Detail

    - #### isApplicable

          public boolean isApplicable(AbstractEvent event)

      Description copied from class: `AbstractRule`
      Determines whether or not the current operation satisfies the rule. If the event is applicable to the rule, the event will be passed to each of the trigger's event handlers' handleEvent. Definition of what is applicable is specific to the event handler implementations.
      Specified by:
        `isApplicable` in class `AbstractRule`
      Parameters:
        `event` - the current operation to check
      Returns:
        true if the event satisfies the criteria for rule implementation.

    - #### isApplicable

          public boolean isApplicable(CreateResourceEvent event)

      Default isApplicable() method for CreateResourceEvent type. It always return false. Override this methods if CreateResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - a create resource event to be handled

    - #### isApplicable

          public boolean isApplicable(CreateResourceWithRelationsEvent event)

      Default isApplicable() method for CreateResourceWithRelationsEvent type. It always return false. Override this methods if CreateResourceWithRelationsEvent type is associated with the trigger rule.
      Parameters:
        `event` - a create resource event to be handled

    - #### isApplicable

          public boolean isApplicable(UpdateResourceEvent event)

      Default isApplicable() method for UpdateResourceEvent type. It always return false. Override this methods if UpdateResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - an update resource event to be handled

    - #### isApplicable

          public boolean isApplicable(AssociateResourceEvent event)

      Default isApplicable() method for AssociateResourceEvent type. It always return false. Override this methods if AssociateResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - an associate resource event to be handled

    - #### isApplicable

          public boolean isApplicable(DisassociateResourceEvent event)

      Default isApplicable() method for DisassociateResourceEvent type. It always return false. Override this methods if DisassociateResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - a disassociate resource event to be handled

    - #### isApplicable

          public boolean isApplicable(ReassignPrimaryParentEvent event)

      Default isApplicable() method for ReassignPrimaryParentEvent type. It always return false. Override this methods if ReassignPrimaryParentEvent type is associated with the trigger rule.
      Parameters:
        `event` - a reassigning primary parent event to be handled

    - #### isApplicable

          public boolean isApplicable(CopyResourceEvent event)

      Default isApplicable() method for CopyResourceEvent type. It always return false. Override this methods if CopyResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - a copy resource event to be handled

    - #### isApplicable

          public boolean isApplicable(MoveResourceEvent event)

      Default isApplicable() method for MoveResourceEvent type. It always return false. Override this methods if MoveResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - a move resource event to be handled

    - #### isApplicable

          public boolean isApplicable(RenameResourceEvent event)

      Default isApplicable() method for RenameResourceEvent type. It always return false. Override this methods if RenameResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - a rename resource event to be handled

    - #### isApplicable

          public boolean isApplicable(DeleteResourceEvent event)

      Default isApplicable() method for DeleteResourceEvent type. It always return false. Override this methods if DeleteResourceEvent type is associated with the trigger rule.
      Parameters:
        `event` - a delete resource event to be handled

    - #### isApplicable

          public boolean isApplicable(QueryEvent event)

      Default isApplicable() method for QueryEvent type. It always return false. Override this methods if QueryEvent type is associated with the trigger rule.
      Parameters:
        `event` - a query event to be handled

    - #### isApplicable

          public boolean isApplicable(SearchEvent event)

      Default isApplicable() method for SearchEvent type. It always return false. Override this 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, 2020. All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.