Package org.nuxeo.ecm.core.event.impl
Class AbstractEventContext
- java.lang.Object
-
- org.nuxeo.ecm.core.event.impl.AbstractEventContext
-
- All Implemented Interfaces:
Serializable
,EventContext
- Direct Known Subclasses:
EventContextImpl
public abstract class AbstractEventContext extends Object implements EventContext
Base class to be used to create new context events.This class handles context properties and event creation.
- Author:
- Bogdan Stefanescu
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Object[]
args
protected static Object[]
EMPTY
protected Map<String,Serializable>
properties
protected String
repositoryName
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractEventContext()
Constructor to be used by derived classesprotected
AbstractEventContext(Object... args)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 propertyvoid
setRepositoryName(String repositoryName)
Sets the repository name.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.core.event.EventContext
getCoreSession, getPrincipal, setCoreSession, setPrincipal
-
-
-
-
Constructor Detail
-
AbstractEventContext
protected AbstractEventContext()
Constructor to be used by derived classes
-
AbstractEventContext
protected AbstractEventContext(Object... args)
-
-
Method Detail
-
getArguments
public Object[] getArguments()
Description copied from interface:EventContext
Gets event data. More objects can be associated with an event.For this reason an array of objects is returned. This array is usually representing the arguments of the operation that raised the event.
- Specified by:
getArguments
in interfaceEventContext
- Returns:
- the event data
-
getProperties
public Map<String,Serializable> getProperties()
Description copied from interface:EventContext
Gets the events properties.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.
- Specified by:
getProperties
in interfaceEventContext
- Returns:
- the event properties
-
setProperties
public void setProperties(Map<String,Serializable> properties)
Description copied from interface:EventContext
Replaces all properties with the given ones. The given map is set as is - no copy occurs.- Specified by:
setProperties
in interfaceEventContext
- Parameters:
properties
- the properties to use
-
getProperty
public Serializable getProperty(String key)
Description copied from interface:EventContext
Gets the named property from this context or null if not exists.- Specified by:
getProperty
in interfaceEventContext
- Parameters:
key
- the property key- Returns:
- the property, or null if it does not exist
-
hasProperty
public boolean hasProperty(String key)
Description copied from interface:EventContext
Tests whether or not the given property exists.- Specified by:
hasProperty
in interfaceEventContext
- Parameters:
key
- the property to test- Returns:
- true if the named property was set, false otherwise
-
setProperty
public void setProperty(String key, Serializable value)
Description copied from interface:EventContext
Sets a event context property- Specified by:
setProperty
in interfaceEventContext
- Parameters:
key
- the property keyvalue
- the property value
-
newEvent
public Event newEvent(String name)
Description copied from interface:EventContext
Creates a new event in that context given the event name. The default flags for the event will be used.- Specified by:
newEvent
in interfaceEventContext
- Parameters:
name
- the event name- Returns:
- the event
- See Also:
EventContext.newEvent(String, int)
-
newEvent
public Event newEvent(String name, int flags)
Description copied from interface:EventContext
Creates a new event in that context given the event name. The given flags will be applied on the event.- Specified by:
newEvent
in interfaceEventContext
- Parameters:
name
- the event nameflags
- the event flags to use- Returns:
- the event
-
getRepositoryName
public String getRepositoryName()
Description copied from interface:EventContext
Returns the repository name associated to the event context, if any.- Specified by:
getRepositoryName
in interfaceEventContext
- Returns:
- the repository name
-
setRepositoryName
public void setRepositoryName(String repositoryName)
Description copied from interface:EventContext
Sets the repository name. Only used if no CoreSession is available.- Specified by:
setRepositoryName
in interfaceEventContext
- Parameters:
repositoryName
- the repository name, ornull
-
-