Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.event
Interface Event

All Superinterfaces:
Serializable
All Known Implementing Classes:
EventImpl, ShallowEvent

public interface Event
extends Serializable

A lightweight object used by core components to notify interested components about events in core.

These events should be used by all core components not only by the repository.

The events may specify a set of control flags that can be used to control the visibility and the way post commit events are handled. There are 3 types of visibility:

There are 2 post commit control flags: More flags may be added in the future.

Author:
Bogdan Stefanescu

Field Summary
static int FLAG_CANCEL
           
static int FLAG_COMMIT
           
static int FLAG_IMMEDIATE
           
static int FLAG_INLINE
           
static int FLAG_LOCAL
           
static int FLAG_NONE
           
static int FLAG_ROLLBACK
           
 
Method Summary
 void cancel()
          Cancels this event.
 EventContext getContext()
          Gets the event context.
 int getFlags()
          Gets the set of event flags
 String getName()
          Gets the event name.
 long getTime()
          The time stamp when the event was raised.
 boolean isCanceled()
          Checks whether the event was canceled.
 boolean isCommitEvent()
          Tests whether or not this is a commit event.
 boolean isImmediate()
          Tests if event is Immediate
 boolean isInline()
          Whether this event must not be added to a bundle.
 boolean isLocal()
          Tests if this event is local.
 boolean isMarkedForRollBack()
          Checks whether the event was marked for RollBack
 boolean isPublic()
          Tests if this event is public.
 void markRollBack()
          Marks transaction for RollBack
 void setImmediate(boolean immediate)
          Sets the immediate flag.
 void setInline(boolean isInline)
          Set the inline flag.
 void setIsCommitEvent(boolean isCommit)
          Set the commit flag.
 void setLocal(boolean isLocal)
          Sets the local flag.
 void setPublic(boolean isPublic)
          Set the public flag.
 

Field Detail

FLAG_NONE

static final int FLAG_NONE
See Also:
Constant Field Values

FLAG_CANCEL

static final int FLAG_CANCEL
See Also:
Constant Field Values

FLAG_ROLLBACK

static final int FLAG_ROLLBACK
See Also:
Constant Field Values

FLAG_COMMIT

static final int FLAG_COMMIT
See Also:
Constant Field Values

FLAG_LOCAL

static final int FLAG_LOCAL
See Also:
Constant Field Values

FLAG_INLINE

static final int FLAG_INLINE
See Also:
Constant Field Values

FLAG_IMMEDIATE

static final int FLAG_IMMEDIATE
See Also:
Constant Field Values
Method Detail

getName

String getName()
Gets the event name.

The name must be unique. It is recommended to use prefixes in the style of java package names to differentiate between similar events that are sent by different components.


getTime

long getTime()
The time stamp when the event was raised.

Returns:
the time stamp as returned by System.currentTimeMillis()

getContext

EventContext getContext()
Gets the event context.

Event contexts give access to the context in which the the event was raised. Event contexts are usually identifying the operation that raised the event. The context is exposing data objects linked to the event like documents and also may give access to the operation that raised the event allowing thus to canceling the operation, to record time spent to set the result status etc.

Returns:
the event context

getFlags

int getFlags()
Gets the set of event flags

Returns:
the event flags

cancel

void cancel()
Cancels this event.

This can be used by event listeners to exit the event notification. Remaining event listeners will no more be notified. Note that this is not canceling the underlying operation if any.


isCanceled

boolean isCanceled()
Checks whether the event was canceled.

Returns:
true if canceled, false otherwise.

markRollBack

void markRollBack()
Marks transaction for RollBack

This will exit the event listeners loop and throw a RuntimeException In JTA container, this will make the global transaction rollback.


isMarkedForRollBack

boolean isMarkedForRollBack()
Checks whether the event was marked for RollBack

Returns:
true if rolled back, false otherwise.

isInline

boolean isInline()
Whether this event must not be added to a bundle. An event is not inline by default.

Returns:
true if the event must be omitted from event bundles, false otherwise.

setInline

void setInline(boolean isInline)
Set the inline flag.

Parameters:
isInline - true if the event must not be recorded as part of the transaction
See Also:
isInline()

isCommitEvent

boolean isCommitEvent()
Tests whether or not this is a commit event. A commit event is triggering the post commit notification and then is reseting the recorded events.

Returns:
true if a commit event false otherwise

setIsCommitEvent

void setIsCommitEvent(boolean isCommit)
Set the commit flag.

Parameters:
isCommit -
See Also:
isCommitEvent()

isLocal

boolean isLocal()
Tests if this event is local.

Local events events are of interest only on the local machine.

Returns:
true if private false otherwise

setLocal

void setLocal(boolean isLocal)
Sets the local flag.

Parameters:
isLocal -
See Also:
isLocal()

isPublic

boolean isPublic()
Tests if this event is public.

Public events are of interest to everyone.

Returns:
true if public, false otherwise

setPublic

void setPublic(boolean isPublic)
Set the public flag.

Parameters:
isPublic -
See Also:
isPublic()

isImmediate

boolean isImmediate()
Tests if event is Immediate

Immediate events are sent in bundle without waiting for a commit

Returns:
true if event is immediate, false otherwise

setImmediate

void setImmediate(boolean immediate)
Sets the immediate flag.


Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.