public interface Event extends Serializable
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:
Modifier and Type | Field and Description |
---|---|
static int |
FLAG_BUBBLE_EXCEPTION |
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 |
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 |
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 |
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.
|
void |
setLocal(boolean isLocal)
Sets the local flag.
|
void |
setPublic(boolean isPublic)
Set the public flag.
|
static final int FLAG_NONE
static final int FLAG_CANCEL
static final int FLAG_ROLLBACK
static final int FLAG_COMMIT
static final int FLAG_LOCAL
static final int FLAG_INLINE
static final int FLAG_IMMEDIATE
static final int FLAG_BUBBLE_EXCEPTION
String getName()
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.
long getTime()
System.currentTimeMillis()
EventContext getContext()
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.
int getFlags()
void cancel()
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.
boolean isCanceled()
void markBubbleException()
This will exit the event listeners loop. The transaction won't be rollbacked, but the Exception will be thrown by
the EventService
.
boolean isBubbleException()
true
if the event was marked to bubble the Exception, false
otherwise.void markRollBack()
This will exit the event listeners loop and throw a RuntimeException In JTA container, this will make the global transaction rollback.
void markRollBack(String message, Exception exception)
This will exit the event listeners loop and throw a RuntimeException In JTA container, this will make the global transaction rollback.
message
- message that explains the reason of the Rollbackexception
- associated Exception that explains the Rollback if anyboolean isMarkedForRollBack()
Exception getRollbackException()
String getRollbackMessage()
boolean isInline()
void setInline(boolean isInline)
isInline
- true if the event must not be recorded as part of the transactionisInline()
boolean isCommitEvent()
void setIsCommitEvent(boolean isCommit)
isCommit
- isCommitEvent()
boolean isLocal()
Local events events are of interest only on the local machine.
void setLocal(boolean isLocal)
isLocal
- isLocal()
boolean isPublic()
Public events are of interest to everyone.
void setPublic(boolean isPublic)
isPublic
- isPublic()
boolean isImmediate()
Immediate events are sent in bundle without waiting for a commit
void setImmediate(boolean immediate)
Copyright © 2018 Nuxeo. All rights reserved.