public abstract class AbstractEventContext extends Object implements EventContext
This class handles context properties and event creation.
| Modifier and Type | Field and Description |
|---|---|
protected Object[] |
args |
protected static Object[] |
EMPTY |
protected Map<String,Serializable> |
properties |
protected String |
repositoryName |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractEventContext()
Constructor to be used by derived classes
|
protected |
AbstractEventContext(Object... args) |
| Modifier and Type | Method and Description |
|---|---|
Object[] |
getArguments()
Gets event data.
|
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 |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCoreSession, getPrincipal, setCoreSession, setPrincipalprotected Map<String,Serializable> properties
protected String repositoryName
protected AbstractEventContext()
protected AbstractEventContext(Object... args)
public Object[] getArguments()
EventContextFor this reason an array of objects is returned. This array is usually representing the arguments of the operation that raised the event.
getArguments in interface EventContextpublic Map<String,Serializable> getProperties()
EventContextEvent 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.
getProperties in interface EventContextpublic void setProperties(Map<String,Serializable> properties)
EventContextsetProperties in interface EventContextproperties - the properties to usepublic Serializable getProperty(String key)
EventContextgetProperty in interface EventContextkey - the property keypublic boolean hasProperty(String key)
EventContexthasProperty in interface EventContextkey - the property to testpublic void setProperty(String key, Serializable value)
EventContextsetProperty in interface EventContextkey - the property keyvalue - the property valuepublic Event newEvent(String name)
EventContextnewEvent in interface EventContextname - the event nameEventContext.newEvent(String, int)public Event newEvent(String name, int flags)
EventContextnewEvent in interface EventContextname - the event nameflags - the event flags to usepublic String getRepositoryName()
EventContextgetRepositoryName in interface EventContextpublic void setRepositoryName(String repositoryName)
EventContextsetRepositoryName in interface EventContextrepositoryName - the repository name, or nullCopyright © 2019 Nuxeo. All rights reserved.