public class EventImpl extends Object implements Event
| Modifier and Type | Field and Description | 
|---|---|
protected EventContext | 
ctx  | 
protected int | 
flags  | 
protected String | 
name  | 
protected Exception | 
rollbackException  | 
protected String | 
rollbackMessage  | 
protected long | 
time  | 
FLAG_BUBBLE_EXCEPTION, FLAG_CANCEL, FLAG_COMMIT, FLAG_IMMEDIATE, FLAG_INLINE, FLAG_NONE, FLAG_ROLLBACK| Constructor and Description | 
|---|
EventImpl(String name,
         EventContext ctx)  | 
EventImpl(String name,
         EventContext ctx,
         int flags)  | 
EventImpl(String name,
         EventContext ctx,
         int flags,
         long creationTime)  | 
| Modifier and Type | Method and Description | 
|---|---|
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. 
 | 
Exception | 
getRollbackException()
Returns the Exception associated the RollBack if any 
 | 
String | 
getRollbackMessage()
Returns the message associated to the RollBack if any 
 | 
long | 
getTime()
The time stamp when the event was raised. 
 | 
boolean | 
isBubbleException()
Returns  
true if the event was marked to bubble the Exception, false otherwise. | 
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 | 
isMarkedForRollBack()
Checks whether the event was marked for RollBack 
 | 
void | 
markBubbleException()
Marks the event to bubble the Exception thrown by a listener. 
 | 
void | 
markRollBack()
Marks transaction for RollBack 
 | 
void | 
markRollBack(String message,
            Exception exception)
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. 
 | 
protected final long time
protected final EventContext ctx
protected int flags
protected Exception rollbackException
protected String rollbackMessage
public EventImpl(String name, EventContext ctx, int flags, long creationTime)
public EventImpl(String name, EventContext ctx, int flags)
public EventImpl(String name, EventContext ctx)
public EventContext getContext()
EventEvent 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.
getContext in interface Eventpublic String getName()
EventThe 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.
public long getTime()
EventgetTime in interface EventSystem.currentTimeMillis()public void cancel()
EventThis 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.
public void markRollBack()
EventThis will exit the event listeners loop and throw a RuntimeException In JTA container, this will make the global transaction rollback.
markRollBack in interface Eventpublic void markRollBack(String message, Exception exception)
EventThis will exit the event listeners loop and throw a RuntimeException In JTA container, this will make the global transaction rollback.
markRollBack in interface Eventmessage - message that explains the reason of the Rollbackexception - associated Exception that explains the Rollback if anypublic void markBubbleException()
Event
 This will exit the event listeners loop. The transaction won't be rollbacked, but the Exception will be thrown by
 the EventService.
markBubbleException in interface Eventpublic boolean isBubbleException()
Eventtrue if the event was marked to bubble the Exception, false otherwise.isBubbleException in interface Eventpublic boolean isMarkedForRollBack()
EventisMarkedForRollBack in interface Eventpublic boolean isCanceled()
EventisCanceled in interface Eventpublic boolean isInline()
Eventpublic void setInline(boolean isInline)
EventsetInline in interface EventisInline - true if the event must not be recorded as part of the transactionEvent.isInline()public boolean isCommitEvent()
EventisCommitEvent in interface Eventpublic void setIsCommitEvent(boolean isCommit)
EventsetIsCommitEvent in interface EventEvent.isCommitEvent()public boolean isImmediate()
EventImmediate events are sent in bundle without waiting for a commit
isImmediate in interface Eventpublic void setImmediate(boolean immediate)
EventsetImmediate in interface Eventpublic Exception getRollbackException()
EventgetRollbackException in interface Eventpublic String getRollbackMessage()
EventgetRollbackMessage in interface EventCopyright © 2019 Nuxeo. All rights reserved.