Class EventImpl
- All Implemented Interfaces:
Serializable,Event
- Direct Known Subclasses:
ShallowEvent
- Author:
- Bogdan Stefanescu
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EventContextprotected intprotected final Stringprotected Exceptionprotected Stringprotected final longFields inherited from interface org.nuxeo.ecm.core.event.Event
FLAG_BUBBLE_EXCEPTION, FLAG_CANCEL, FLAG_COMMIT, FLAG_IMMEDIATE, FLAG_INLINE, FLAG_NONE, FLAG_ROLLBACK -
Constructor Summary
ConstructorsConstructorDescriptionEventImpl(String name, EventContext ctx) EventImpl(String name, EventContext ctx, int flags) EventImpl(String name, EventContext ctx, int flags, long creationTime) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels this event.Gets the event context.intgetFlags()Gets the set of event flagsgetName()Gets the event name.Returns the Exception associated the RollBack if anyReturns the message associated to the RollBack if anylonggetTime()The time stamp when the event was raised.booleanReturnstrueif the event was marked to bubble the Exception,falseotherwise.booleanChecks whether the event was canceled.booleanTests whether or not this is a commit event.booleanTests if event is ImmediatebooleanisInline()Whether this event must not be added to a bundle.booleanChecks whether the event was marked for RollBackvoidMarks the event to bubble the Exception thrown by a listener.voidMarks transaction for RollBackvoidmarkRollBack(String message, Exception exception) Marks transaction for RollBackvoidsetImmediate(boolean immediate) Sets the immediate flag.voidsetInline(boolean isInline) Set the inline flag.voidsetIsCommitEvent(boolean isCommit) Set the commit flag.
-
Field Details
-
name
-
time
protected final long time -
ctx
-
flags
protected int flags -
rollbackException
-
rollbackMessage
-
-
Constructor Details
-
EventImpl
-
EventImpl
-
EventImpl
-
-
Method Details
-
getFlags
public int getFlags()Description copied from interface:EventGets the set of event flags -
getContext
Description copied from interface:EventGets 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:
getContextin interfaceEvent- Returns:
- the event context
-
getName
Description copied from interface:EventGets 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
public long getTime()Description copied from interface:EventThe time stamp when the event was raised.- Specified by:
getTimein interfaceEvent- Returns:
- the time stamp as returned by
System.currentTimeMillis()
-
cancel
public void cancel()Description copied from interface:EventCancels 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.
-
markRollBack
public void markRollBack()Description copied from interface:EventMarks transaction for RollBackThis will exit the event listeners loop and throw a RuntimeException In JTA container, this will make the global transaction rollback.
- Specified by:
markRollBackin interfaceEvent
-
markRollBack
Description copied from interface:EventMarks transaction for RollBackThis will exit the event listeners loop and throw a RuntimeException In JTA container, this will make the global transaction rollback.
- Specified by:
markRollBackin interfaceEvent- Parameters:
message- message that explains the reason of the Rollbackexception- associated Exception that explains the Rollback if any
-
markBubbleException
public void markBubbleException()Description copied from interface:EventMarks the event to bubble the Exception thrown by a listener.This will exit the event listeners loop. The transaction won't be rollbacked, but the Exception will be thrown by the
EventService.- Specified by:
markBubbleExceptionin interfaceEvent
-
isBubbleException
public boolean isBubbleException()Description copied from interface:EventReturnstrueif the event was marked to bubble the Exception,falseotherwise.- Specified by:
isBubbleExceptionin interfaceEvent
-
isMarkedForRollBack
public boolean isMarkedForRollBack()Description copied from interface:EventChecks whether the event was marked for RollBack- Specified by:
isMarkedForRollBackin interfaceEvent- Returns:
- true if rolled back, false otherwise.
-
isCanceled
public boolean isCanceled()Description copied from interface:EventChecks whether the event was canceled.- Specified by:
isCanceledin interfaceEvent- Returns:
- true if canceled, false otherwise.
-
isInline
public boolean isInline()Description copied from interface:EventWhether this event must not be added to a bundle. An event is not inline by default. -
setInline
public void setInline(boolean isInline) Description copied from interface:EventSet the inline flag. -
isCommitEvent
public boolean isCommitEvent()Description copied from interface:EventTests 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:
isCommitEventin interfaceEvent- Returns:
- true if a commit event false otherwise
-
setIsCommitEvent
public void setIsCommitEvent(boolean isCommit) Description copied from interface:EventSet the commit flag.- Specified by:
setIsCommitEventin interfaceEvent- See Also:
-
isImmediate
public boolean isImmediate()Description copied from interface:EventTests if event is ImmediateImmediate events are sent in bundle without waiting for a commit
- Specified by:
isImmediatein interfaceEvent- Returns:
- true if event is immediate, false otherwise
-
setImmediate
public void setImmediate(boolean immediate) Description copied from interface:EventSets the immediate flag.- Specified by:
setImmediatein interfaceEvent
-
getRollbackException
Description copied from interface:EventReturns the Exception associated the RollBack if any- Specified by:
getRollbackExceptionin interfaceEvent- Returns:
- the Exception associated the RollBack if any
-
getRollbackMessage
Description copied from interface:EventReturns the message associated to the RollBack if any- Specified by:
getRollbackMessagein interfaceEvent- Returns:
- the message associated to the RollBack if any
-