com.ibm.openpages.api.trigger.events

## Class AssociateResourceEvent

- java.lang.Object
- - com.ibm.openpages.api.trigger.events.AbstractEvent
  - - com.ibm.openpages.api.trigger.events.AbstractResourceOperationEvent
    - - com.ibm.openpages.api.trigger.events.AssociateResourceEvent

-     public class AssociateResourceEvent
      extends AbstractResourceOperationEvent

  Represents the event type to associate resource objects. Associate events can be represented as a single parent associated with multiple children, or multiple parents associated with a single child. The parents and children are represented by their Ids and can be retrieved inside the rule or event handlers.

  To determine whether an associate event is single parent versus multiple parent, use the isSingleParent() flag. For example if isSingleParent() returns true, then you might choose to use getParent() which returns a single Id to represent the parent GRC object in this event and getChildren() to return the list of child Ids representing the children GRC Objects.

  See Also:
    `TriggerEventType.ASSOCIATE_OBJECTS`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AssociateResourceEvent(Id parentId, java.util.List<Id> childIds, TriggerPositionType position, Context context)` Constructor for single parent.
    `AssociateResourceEvent(java.util.List<Id> parentIds, Id childId, TriggerPositionType position, Context context)` Constructor for multiple parents.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Id` | `getChild()` Returns the single child Id for the child object of this event.
    `java.util.List<Id>` | `getChildren()` Returns the list of Ids of the children objects of this event.
    `Id` | `getParent()` Returns the single parent Id for the parent object of this event.
    `java.util.List<Id>` | `getParents()` Returns the list of Ids of the parent objects of this event.
    `boolean` | `isSingleParent()` Represents which flavor of associate the event is.

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

      `getContext, getPosition, getTriggerEventType, hasOuterCreateWithRelationsEvent`

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

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

- - ### Constructor Detail

    - #### AssociateResourceEvent

          public AssociateResourceEvent(Id parentId,
                                        java.util.List<Id> childIds,
                                        TriggerPositionType position,
                                        Context context)

      Constructor for single parent.
      Parameters:
        `parentId` - single parent Id
        `childIds` - List of multiple children Ids
        `position` - either pre or post
        `context` - the Context for the API

    - #### AssociateResourceEvent

          public AssociateResourceEvent(java.util.List<Id> parentIds,
                                        Id childId,
                                        TriggerPositionType position,
                                        Context context)

      Constructor for multiple parents.
      Parameters:
        `parentIds` - List of multiple parent Ids
        `childId` - single child Id
        `position` - either pre or post
        `context` - the Context for the API

  - ### Method Detail

    - #### getParent

          public Id getParent()

      Returns the single parent Id for the parent object of this event. If the isSingleParent() returns false, then this will return the first Id from the list of parents.
      Returns:
        the single parent's Id or in case the event is not a single parent then the first parent Id from the list of parents.

    - #### getParents

          public java.util.List<Id> getParents()

      Returns the list of Ids of the parent objects of this event. If the isSingleParent() returns true, then the list will contain only the single parent's Id.
      Returns:
        List of parent Ids

    - #### getChild

          public Id getChild()

      Returns the single child Id for the child object of this event. If the isSingleParent() returns false, then this will return the first Id from the list of children.
      Returns:
        the single child Id or in case the event is a single parent then the first child Id from the list of children.

    - #### getChildren

          public java.util.List<Id> getChildren()

      Returns the list of Ids of the children objects of this event. If the isSingleParent() returns false, then the list will contain only the single child Id.
      Returns:
        List of children Ids

    - #### isSingleParent

          public boolean isSingleParent()

      Represents which flavor of associate the event is. Single parent and multiple children or multiple parents and single child.
      Returns:
        true if the association is from a single parent to one or more children, false if the association is from a single child to one or more parents

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