Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.event.impl
Class EventImpl

java.lang.Object
  extended by org.nuxeo.ecm.core.event.impl.EventImpl
All Implemented Interfaces:
Serializable, Event
Direct Known Subclasses:
ShallowEvent

public class EventImpl
extends Object
implements Event

Event implementation.

Author:
Bogdan Stefanescu
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.nuxeo.ecm.core.event.Event
FLAG_CANCEL, FLAG_COMMIT, FLAG_IMMEDIATE, FLAG_INLINE, FLAG_LOCAL, FLAG_NONE, FLAG_ROLLBACK
 
Constructor Summary
EventImpl(String name, EventContext ctx)
           
EventImpl(String name, EventContext ctx, int flags)
           
EventImpl(String name, EventContext ctx, int flags, long creationTime)
           
 
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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventImpl

public EventImpl(String name,
                 EventContext ctx,
                 int flags,
                 long creationTime)

EventImpl

public EventImpl(String name,
                 EventContext ctx,
                 int flags)

EventImpl

public EventImpl(String name,
                 EventContext ctx)
Method Detail

getFlags

public int getFlags()
Description copied from interface: Event
Gets the set of event flags

Specified by:
getFlags in interface Event
Returns:
the event flags

getContext

public EventContext getContext()
Description copied from interface: Event
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.

Specified by:
getContext in interface Event
Returns:
the event context

getName

public String getName()
Description copied from interface: Event
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.

Specified by:
getName in interface Event

getTime

public long getTime()
Description copied from interface: Event
The time stamp when the event was raised.

Specified by:
getTime in interface Event
Returns:
the time stamp as returned by System.currentTimeMillis()

cancel

public void cancel()
Description copied from interface: Event
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.

Specified by:
cancel in interface Event

markRollBack

public void markRollBack()
Description copied from interface: Event
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.

Specified by:
markRollBack in interface Event

isMarkedForRollBack

public boolean isMarkedForRollBack()
Description copied from interface: Event
Checks whether the event was marked for RollBack

Specified by:
isMarkedForRollBack in interface Event
Returns:
true if rolled back, false otherwise.

isCanceled

public boolean isCanceled()
Description copied from interface: Event
Checks whether the event was canceled.

Specified by:
isCanceled in interface Event
Returns:
true if canceled, false otherwise.

isInline

public boolean isInline()
Description copied from interface: Event
Whether this event must not be added to a bundle. An event is not inline by default.

Specified by:
isInline in interface Event
Returns:
true if the event must be omitted from event bundles, false otherwise.

setInline

public void setInline(boolean isInline)
Description copied from interface: Event
Set the inline flag.

Specified by:
setInline in interface Event
Parameters:
isInline - true if the event must not be recorded as part of the transaction
See Also:
Event.isInline()

isCommitEvent

public boolean isCommitEvent()
Description copied from interface: Event
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.

Specified by:
isCommitEvent in interface Event
Returns:
true if a commit event false otherwise

setIsCommitEvent

public void setIsCommitEvent(boolean isCommit)
Description copied from interface: Event
Set the commit flag.

Specified by:
setIsCommitEvent in interface Event
See Also:
Event.isCommitEvent()

isLocal

public boolean isLocal()
Description copied from interface: Event
Tests if this event is local.

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

Specified by:
isLocal in interface Event
Returns:
true if private false otherwise

setLocal

public void setLocal(boolean isLocal)
Description copied from interface: Event
Sets the local flag.

Specified by:
setLocal in interface Event
See Also:
Event.isLocal()

isPublic

public boolean isPublic()
Description copied from interface: Event
Tests if this event is public.

Public events are of interest to everyone.

Specified by:
isPublic in interface Event
Returns:
true if public, false otherwise

setPublic

public void setPublic(boolean isPublic)
Description copied from interface: Event
Set the public flag.

Specified by:
setPublic in interface Event
See Also:
Event.isPublic()

isImmediate

public boolean isImmediate()
Description copied from interface: Event
Tests if event is Immediate

Immediate events are sent in bundle without waiting for a commit

Specified by:
isImmediate in interface Event
Returns:
true if event is immediate, false otherwise

setImmediate

public void setImmediate(boolean immediate)
Description copied from interface: Event
Sets the immediate flag.

Specified by:
setImmediate in interface Event

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.