Class EventState
- java.lang.Object
-
- org.apache.jackrabbit.core.observation.EventState
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EventState
childNodeAdded(NodeId parentId, Path parentPath, NodeId childId, Path childPath, Name nodeType, Set<Name> mixins, Session session)
Creates a newEvent
of typeEvent.NODE_ADDED
.static EventState
childNodeAdded(NodeId parentId, Path parentPath, NodeId childId, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeEvent.NODE_ADDED
.static EventState
childNodeRemoved(NodeId parentId, Path parentPath, NodeId childId, Path childPath, Name nodeType, Set<Name> mixins, Session session)
Creates a newEvent
of typeEvent.NODE_REMOVED
.static EventState
childNodeRemoved(NodeId parentId, Path parentPath, NodeId childId, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeEvent.NODE_REMOVED
.boolean
equals(Object obj)
Returnstrue
if thisEventState
is equal to another object.NodeId
getChildId()
Returns the Id of a child node operation.Path
getChildRelPath()
static String
getCommonPath(List<EventState> events, SessionImpl session)
Get the longest common path of all event state paths.Map<String,InternalValue>
getInfo()
Set<Name>
getMixinNames()
Returns a set ofName
s which are the names of the mixins assigned to the parent node associated with this event.Name
getNodeType()
Returns the node type of the parent node associated with this event.Set<NodeType>
getNodeTypes(NodeTypeManagerImpl ntMgr)
Returns theSet
ofNodeType
s assigned to the parent node associated with this event.NodeId
getParentId()
Returns the uuid of the parent node.Path
getParentPath()
Returns the path of the parent node.int
getType()
String
getUserId()
int
hashCode()
Returns a hashCode for thisEventState
.static EventState
nodeMoved(NodeId parentId, Path parentPath, NodeId childId, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeNODE_MOVED
.static EventState
nodeMovedWithInfo(NodeId parentId, Path destPath, NodeId childId, Path srcPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeNODE_MOVED
.static EventState
nodeReordered(NodeId parentId, Path parentPath, NodeId childId, Path destChildPath, Path srcChildPath, Path beforeChildPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeNODE_MOVED
.static EventState
persist(Session session, boolean external)
Creates a newEvent
of typeEvent.PERSIST
.static EventState
propertyAdded(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session)
Creates a newEvent
of typeEvent.PROPERTY_ADDED
.static EventState
propertyAdded(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeEvent.PROPERTY_ADDED
.static EventState
propertyChanged(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session)
Creates a newEvent
of typeEvent.PROPERTY_CHANGED
.static EventState
propertyChanged(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeEvent.PROPERTY_CHANGED
.static EventState
propertyRemoved(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session)
Creates a newEvent
of typeEvent.PROPERTY_REMOVED
.static EventState
propertyRemoved(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeEvent.PROPERTY_REMOVED
.void
setInfo(Map<String,InternalValue> info)
Sets a new info map for this event.String
toString()
Returns a String representation of thisEventState
.static String
valueOf(int eventType)
Returns a String representation ofeventType
.
-
-
-
Method Detail
-
childNodeAdded
public static EventState childNodeAdded(NodeId parentId, Path parentPath, NodeId childId, Path childPath, Name nodeType, Set<Name> mixins, Session session)
Creates a newEvent
of typeEvent.NODE_ADDED
.- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childId
- the id of the child node associated with this event.childPath
- the relative path of the child node that was added.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that added the node.- Returns:
- an
EventState
instance.
-
childNodeAdded
public static EventState childNodeAdded(NodeId parentId, Path parentPath, NodeId childId, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeEvent.NODE_ADDED
.- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childId
- the id of the child node associated with this event.childPath
- the relative path of the child node that was added.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that added the node.external
- flag indicating whether this is an external event- Returns:
- an
EventState
instance.
-
childNodeRemoved
public static EventState childNodeRemoved(NodeId parentId, Path parentPath, NodeId childId, Path childPath, Name nodeType, Set<Name> mixins, Session session)
Creates a newEvent
of typeEvent.NODE_REMOVED
.- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childId
- the id of the child node associated with this event.childPath
- the relative path of the child node that was removed.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that removed the node.- Returns:
- an
EventState
instance.
-
childNodeRemoved
public static EventState childNodeRemoved(NodeId parentId, Path parentPath, NodeId childId, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeEvent.NODE_REMOVED
.- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childId
- the id of the child node associated with this event.childPath
- the relative path of the child node that was removed.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that removed the node.external
- flag indicating whether this is an external event- Returns:
- an
EventState
instance.
-
nodeMoved
public static EventState nodeMoved(NodeId parentId, Path parentPath, NodeId childId, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeNODE_MOVED
. The parent node associated with this event type is the parent node of the destination of the move! This method creates an event state without an info map. A caller of this method must ensure that it is properly set afterwards.- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childId
- the id of the child node associated with this event.childPath
- the relative path of the child node that was moved.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that moved the node.external
- flag indicating whether this is an external event- Returns:
- an
EventState
instance.
-
nodeMovedWithInfo
public static EventState nodeMovedWithInfo(NodeId parentId, Path destPath, NodeId childId, Path srcPath, Name nodeType, Set<Name> mixins, Session session, boolean external) throws ItemStateException
Creates a newEvent
of typeNODE_MOVED
. The parent node associated with this event type is the parent node of the destination of the move!- Parameters:
parentId
- the id of the parent node associated with thisEventState
.destPath
- the path of the destination of the move.childId
- the id of the child node associated with this event.srcPath
- the path of the source of the move.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that removed the node.external
- flag indicating whether this is an external event- Returns:
- an
EventState
instance. - Throws:
ItemStateException
- ifdestPath
does not have a parent.
-
nodeReordered
public static EventState nodeReordered(NodeId parentId, Path parentPath, NodeId childId, Path destChildPath, Path srcChildPath, Path beforeChildPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeNODE_MOVED
. The parent node associated with this event type is the parent node of the destination of the reorder!- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childId
- the id of the child node associated with this event.destChildPath
- the name element of the node before it was reordered.srcChildPath
- the name element of the reordered node before the reorder operation.beforeChildPath
- the name element of the node before which the reordered node is placed. (may benull
if reordered to the end.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that removed the node.external
- flag indicating whether this is an external event- Returns:
- an
EventState
instance.
-
propertyAdded
public static EventState propertyAdded(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session)
Creates a newEvent
of typeEvent.PROPERTY_ADDED
.- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childPath
- the relative path of the property that was added.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that added the property.- Returns:
- an
EventState
instance.
-
propertyAdded
public static EventState propertyAdded(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeEvent.PROPERTY_ADDED
.- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childPath
- the relative path of the property that was added.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that added the property.external
- flag indicating whether this is an external event- Returns:
- an
EventState
instance.
-
propertyRemoved
public static EventState propertyRemoved(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session)
Creates a newEvent
of typeEvent.PROPERTY_REMOVED
.- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childPath
- the relative path of the property that was removed.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that removed the property.- Returns:
- an
EventState
instance.
-
propertyRemoved
public static EventState propertyRemoved(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeEvent.PROPERTY_REMOVED
.- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childPath
- the relative path of the property that was removed.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that removed the property.external
- flag indicating whether this is an external event- Returns:
- an
EventState
instance.
-
propertyChanged
public static EventState propertyChanged(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session)
Creates a newEvent
of typeEvent.PROPERTY_CHANGED
.- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childPath
- the relative path of the property that changed.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that changed the property.- Returns:
- an
EventState
instance.
-
propertyChanged
public static EventState propertyChanged(NodeId parentId, Path parentPath, Path childPath, Name nodeType, Set<Name> mixins, Session session, boolean external)
Creates a newEvent
of typeEvent.PROPERTY_CHANGED
.- Parameters:
parentId
- the id of the parent node associated with thisEventState
.parentPath
- the path of the parent node associated with thisEventState
.childPath
- the relative path of the property that changed.nodeType
- the node type of the parent node.mixins
- mixins assigned to the parent node.session
- the session that changed the property.external
- flag indicating whether this is an external event- Returns:
- an
EventState
instance.
-
persist
public static EventState persist(Session session, boolean external)
Creates a newEvent
of typeEvent.PERSIST
.- Parameters:
session
- the session that changed the property.external
- flag indicating whether this is an external event- Returns:
- an
EventState
instance.
-
getType
public int getType()
-
getParentId
public NodeId getParentId()
Returns the uuid of the parent node.- Returns:
- the uuid of the parent node.
-
getParentPath
public Path getParentPath()
Returns the path of the parent node.- Returns:
- the path of the parent node.
-
getChildId
public NodeId getChildId()
Returns the Id of a child node operation. If thisEventState
was generated for a property operation this method returnsnull
.- Returns:
- the id of a child node operation.
-
getChildRelPath
public Path getChildRelPath()
- Returns:
- the
Path
associated with this event.
-
getNodeType
public Name getNodeType()
Returns the node type of the parent node associated with this event.- Returns:
- the node type of the parent associated with this event.
-
getMixinNames
public Set<Name> getMixinNames()
Returns a set ofName
s which are the names of the mixins assigned to the parent node associated with this event.- Returns:
- the mixin names as
Name
s.
-
getNodeTypes
public Set<NodeType> getNodeTypes(NodeTypeManagerImpl ntMgr)
Returns theSet
ofNodeType
s assigned to the parent node associated with this event. ThisSet
includes the primary type as well as all the mixin types assigned to the parent node.- Returns:
Set
ofNodeType
s.
-
getUserId
public String getUserId()
-
getInfo
public Map<String,InternalValue> getInfo()
- Returns:
- an unmodifiable info Map.
-
setInfo
public void setInfo(Map<String,InternalValue> info)
Sets a new info map for this event.- Parameters:
info
- the new info map.
-
toString
public String toString()
Returns a String representation of thisEventState
.
-
hashCode
public int hashCode()
Returns a hashCode for thisEventState
.
-
equals
public boolean equals(Object obj)
Returnstrue
if thisEventState
is equal to another object.
-
valueOf
public static String valueOf(int eventType)
Returns a String representation ofeventType
.- Parameters:
eventType
- an event type defined byEvent
.- Returns:
- a String representation of
eventType
.
-
getCommonPath
public static String getCommonPath(List<EventState> events, SessionImpl session)
Get the longest common path of all event state paths.- Parameters:
events
- The list of EventStatesession
- The associated session; it can be null- Returns:
- the longest common path
-
-