public interface EventContext extends Serializable
You can subclass this class to implement more specialized event contexts like operations.
An event context is exposing information about the process the raised the event such as
An event context also acts as an event factory. See newEvent(String)
and newEvent(String, int)
methods. Events created by an event context are automatically mapped to that context.
Modifier and Type | Method and Description |
---|---|
Object[] |
getArguments()
Gets event data.
|
CoreSession |
getCoreSession()
Gets the current core session if any.
|
Principal |
getPrincipal()
Gets the current principal.
|
Map<String,Serializable> |
getProperties()
Gets the events properties.
|
Serializable |
getProperty(String key)
Gets the named property from this context or null if not exists.
|
String |
getRepositoryName()
Returns the repository name associated to the event context, if any.
|
boolean |
hasProperty(String key)
Tests whether or not the given property exists.
|
Event |
newEvent(String name)
Creates a new event in that context given the event name.
|
Event |
newEvent(String name,
int flags)
Creates a new event in that context given the event name.
|
void |
setCoreSession(CoreSession session)
Sets the core session.
|
void |
setPrincipal(Principal principal)
Sets the principal.
|
void |
setProperties(Map<String,Serializable> properties)
Replaces all properties with the given ones.
|
void |
setProperty(String key,
Serializable value)
Sets a event context property
|
void |
setRepositoryName(String repositoryName)
Sets the repository name.
|
Object[] getArguments()
For this reason an array of objects is returned. This array is usually representing the arguments of the operation that raised the event.
Map<String,Serializable> getProperties()
Event properties are used to attach random information to an event context and can be set by the event source or by any listener that is processing the event. These properties usually serves to share data between the source and the listeners.
void setProperties(Map<String,Serializable> properties)
properties
- the properties to usevoid setProperty(String key, Serializable value)
key
- the property keyvalue
- the property valueSerializable getProperty(String key)
key
- the property keyboolean hasProperty(String key)
key
- the property to testCoreSession getCoreSession()
Principal getPrincipal()
void setCoreSession(CoreSession session)
void setPrincipal(Principal principal)
Event newEvent(String name)
name
- the event namenewEvent(String, int)
Event newEvent(String name, int flags)
name
- the event nameflags
- the event flags to useString getRepositoryName()
void setRepositoryName(String repositoryName)
repositoryName
- the repository name, or null
Copyright © 2017 Nuxeo. All rights reserved.