Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor
event_overview_table
event_overview_table

Object TypePagePage VersionMediaItemMediaItemVersionElementWebsite
RETRIEVE

 

   X1 
COPYXXXXX 
DELETEXXXXXX
MOVEXXXXX 
CREATEX1X1X1X1XX
UPDATEX2X2X2X2X 
CHANGEDX1X1X1X1X1 
PublicationStatus X1 X1  

 

1 Only a POST event is published.

...

The nl.gx.webmanager.services.event package contains the following interfaces:

 

InterfaceDescription
EntityEvent

Contains the events specific to CRUD operations. This class is implemented by the ElementEvent, MediaItemEvent, MediaItemVersionEvent, PageEvent, PageVersionEvent, and WebsiteEvent interfaces.

Event

Contains methods for retrieving information about the event that occurred.

EventHandler

Contains a method for reacting to event notifications.

EventManagerService

Contains methods for publishing, subscribing, and unsubscribing to events.

 

In addition to the standard actions (create, copy, update, move, retrieve, and delete), you can also create custom actions that perform other functions. These custom actions can also be published and subscribed to. If you want to publish custom events, you will need to implement a custom event and publish this event using the Event Manager service.

...

To subscribe the event handler to particular events, the handler must be subscribed by the publisher (the Event Manager service). The EventManagerService interface contains the following methods:

 

MethodDescription
publish

Publishes an event to the framework.

Code Block
themeEclipse
void publish(Event event)

where event is the event to be published.

subscribe

Subscribes to a particular event handler.

Code Block
themeEclipse
void subscribe(EventHandler handler, Event.Type eventType, java.lang.Class<?> desiredScope)

where handler specifies the name of the handler to subscribe to, eventType specifies the type of event you are subscribing to, and desiredScope specifies the scope class of the event.

unsubscribe

Unsubscribes from a particular event handler.

Code Block
void unsubscribe(EventHandler handler, Event.Type eventType, java.lang.Class<?> desiredScope)

where handler specifies the name of the handler to unsubscribe from, eventType specifies the type of event you are unsubscribing from, and desiredScope specifies the scope class of the event you are unsubscribing from.

 

To subscribe the event handler, the subscribe method on the Event Manager service must be invoked. The subscribe method takes, in addition to the event handler, an event type and a desired scope as input arguments. The event type may be PRE or POST. The scope indicates the object type on which the event applies. For the basic events the appropriate scopes are mentioned in the event overview table. It is also possible to provide a superclass or interface as scope. For example, to receive all PageVersion events, you can subscribe to events with either scope PageEvent.class, or any class it extends or interface it implements.

...