public final class EventStateCollection extends Object
EventStateCollection
class implements how EventState
objects are created based on the ItemState
s
passed to the createEventStates(org.apache.jackrabbit.core.id.NodeId, org.apache.jackrabbit.core.state.ChangeLog, org.apache.jackrabbit.core.state.ItemStateManager)
method.
The basic sequence of method calls is:
createEventStates(org.apache.jackrabbit.core.id.NodeId, org.apache.jackrabbit.core.state.ChangeLog, org.apache.jackrabbit.core.state.ItemStateManager)
or addAll(java.util.Collection<org.apache.jackrabbit.core.observation.EventState>)
to create or add event
states to the collectionprepare()
or prepareDeleted(org.apache.jackrabbit.core.state.ChangeLog)
to prepare the events. If
this step is omitted, EventListeners might see events of deleted item
they are not allowed to see.dispatch()
to dispatch the events to the EventListeners.Constructor and Description |
---|
EventStateCollection(org.apache.jackrabbit.core.observation.EventDispatcher dispatcher,
SessionImpl session,
Path pathPrefix)
Creates a new empty
EventStateCollection . |
Modifier and Type | Method and Description |
---|---|
void |
addAll(Collection<EventState> c)
Adds all event states in the given collection to this collection
|
void |
createEventStates(NodeId rootNodeId,
ChangeLog changes,
ItemStateManager stateMgr)
|
void |
dispatch()
Dispatches the events to the
EventListener s. |
String |
getCommonPath()
Get the longest common path of all event state paths.
|
List<EventState> |
getEvents()
Return the list of events.
|
Path |
getPathPrefix()
Returns the path prefix for this event state collection or
null
if no path prefix was set in the constructor of this collection. |
SessionImpl |
getSession()
Return the session who is the origin of this events.
|
long |
getTimestamp() |
String |
getUserData() |
void |
prepare()
Prepares already added events for dispatching.
|
void |
prepareDeleted(ChangeLog changes)
Prepares deleted items from
changes . |
void |
setTimestamp(long timestamp)
Sets a new timestamp for this collection.
|
void |
setUserData(String userData)
Sets the user data for this event state collection.
|
int |
size()
Get the number of events.
|
public EventStateCollection(org.apache.jackrabbit.core.observation.EventDispatcher dispatcher, SessionImpl session, Path pathPrefix)
EventStateCollection
.
Because the item state manager in createEventStates(org.apache.jackrabbit.core.id.NodeId, org.apache.jackrabbit.core.state.ChangeLog, org.apache.jackrabbit.core.state.ItemStateManager)
may represent
only a subset of the over all item state hierarchy, this constructor
also takes a path prefix argument. If non null
all events
created by this collection are prefixed with this path.
dispatcher
- event dispatchersession
- the session that created these events.pathPrefix
- the path to prefix the event paths or null
if no prefix should be used.public void createEventStates(NodeId rootNodeId, ChangeLog changes, ItemStateManager stateMgr) throws ItemStateException
rootNodeId
- the id of the root node.changes
- the changes on ItemState
s.stateMgr
- an ItemStateManager
to provide ItemState
of items that are not contained in the changes
collection.ItemStateException
- if an error occurs while creating events
states for the item state changes.public void addAll(Collection<EventState> c)
c
- public void prepare()
public void prepareDeleted(ChangeLog changes)
changes
.changes
- the changes to prepare.public void dispatch()
EventListener
s.public Path getPathPrefix()
null
if no path prefix was set in the constructor of this collection. See
also EventStateCollection(org.apache.jackrabbit.core.observation.EventDispatcher, org.apache.jackrabbit.core.SessionImpl, org.apache.jackrabbit.spi.Path)
.public long getTimestamp()
public void setTimestamp(long timestamp)
timestamp
- the new timestamp value.public List<EventState> getEvents()
public int size()
public SessionImpl getSession()
public String getUserData()
public void setUserData(String userData)
userData
- the user data.public String getCommonPath()
Copyright © 2004–2022 The Apache Software Foundation. All rights reserved.