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, wait
getCoreSession, getPrincipal, setCoreSession, setPrincipal
protected Map<String,Serializable> properties
protected String repositoryName
protected AbstractEventContext()
protected AbstractEventContext(Object... args)
public Object[] getArguments()
EventContext
For 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 EventContext
public Map<String,Serializable> getProperties()
EventContext
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.
getProperties
in interface EventContext
public void setProperties(Map<String,Serializable> properties)
EventContext
setProperties
in interface EventContext
properties
- the properties to usepublic Serializable getProperty(String key)
EventContext
getProperty
in interface EventContext
key
- the property keypublic boolean hasProperty(String key)
EventContext
hasProperty
in interface EventContext
key
- the property to testpublic void setProperty(String key, Serializable value)
EventContext
setProperty
in interface EventContext
key
- the property keyvalue
- the property valuepublic Event newEvent(String name)
EventContext
newEvent
in interface EventContext
name
- the event nameEventContext.newEvent(String, int)
public Event newEvent(String name, int flags)
EventContext
newEvent
in interface EventContext
name
- the event nameflags
- the event flags to usepublic String getRepositoryName()
EventContext
getRepositoryName
in interface EventContext
public void setRepositoryName(String repositoryName)
EventContext
setRepositoryName
in interface EventContext
repositoryName
- the repository name, or null
Copyright © 2016 Nuxeo SA. All rights reserved.