com.ibm.openpages.api.trigger.events

## Class CreateResourceEvent

- java.lang.Object
- - com.ibm.openpages.api.trigger.events.AbstractEvent
  - - com.ibm.openpages.api.trigger.events.AbstractResourceEvent
    - - com.ibm.openpages.api.trigger.events.CreateResourceEvent

- Direct Known Subclasses:
    CreateResourceWithRelationsEvent

      public class CreateResourceEvent
      extends AbstractResourceEvent

  Represents the event type for creating a resource object. The resource being created is provided by the `AbstractResourceEvent.getResource()`. In the POST TriggerPositionType, the object that was created is available. To access the newly created object, use the getCreatedResource() method. This is useful if the event handler requires the Id for the newly created resource.

  For an event handler which handles the CreateResourceEvent, the values of the resource object being saved can be modified directly. A separate call to IResourceService.saveResource() is not required.

  See Also:
    `TriggerEventType.CREATE_OBJECT`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CreateResourceEvent(IResource resource, TriggerPositionType position, Context context)` Constructor with the resource to be created.
    `CreateResourceEvent(TriggerEventType triggerEventType, IResource resource, TriggerPositionType position, Context context)`
    `CreateResourceEvent(TriggerPositionType position, Context context)` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `IResource` | `getCreatedResource()` If available, as in a POST event, Returns the created resource object that was the result of this create event i.e.

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

      `getResource`

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

    - #### CreateResourceEvent

          public CreateResourceEvent(TriggerPositionType position,
                                     Context context)

      Default constructor.
      Parameters:
        `position` - either pre or post
        `context` - the Context for the API

    - #### CreateResourceEvent

          public CreateResourceEvent(IResource resource,
                                     TriggerPositionType position,
                                     Context context)

      Constructor with the resource to be created.
      Parameters:
        `resource` - the folder or GRC object that is the focus of the event
        `position` - either pre or post
        `context` - the Context for the API

    - #### CreateResourceEvent

          public CreateResourceEvent(TriggerEventType triggerEventType,
                                     IResource resource,
                                     TriggerPositionType position,
                                     Context context)

  - ### Method Detail

    - #### getCreatedResource

          public IResource getCreatedResource()

      If available, as in a POST event, Returns the created resource object that was the result of this create event i.e. the resource that was created.
      Returns:
        created resource if available, or null

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.