Class JCREventHelper
- java.lang.Object
-
- org.ametys.plugins.repository.events.JCREventHelper
-
- All Implemented Interfaces:
Component
public final class JCREventHelper extends Object implements Component
Helper for implementingEventHolder
in JCR.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Node
addEventNode(EventHolder eventHolder, Date eventDate, String eventType, UserIdentity author)
Add an event nodestatic NodeIterator
getEvents(Session session, Expression filterExpression)
Returns events sorted by ascending date The method search for events in all the repository and not a specificEventHolder
.static NodeIterator
getEvents(EventHolder eventHolder)
Returns the event child nodesstatic NodeIterator
getEvents(EventHolder eventHolder, String[] types)
Returns the events sorted by ascending datestatic Node
getEventsRootNode(Node node)
Get the node holding the JCR events under the given nodestatic String
getEventXPathQuery(EventHolder eventHolder, Expression eventExpression, SortCriteria sortCriteria)
Creates the XPath query corresponding to specifiedExpression
.
-
-
-
Method Detail
-
getEventsRootNode
public static Node getEventsRootNode(Node node) throws RepositoryException
Get the node holding the JCR events under the given node- Parameters:
node
- The parent node- Returns:
- the events' root node
- Throws:
RepositoryException
- if an error occurred
-
getEvents
public static NodeIterator getEvents(EventHolder eventHolder) throws RepositoryException
Returns the event child nodes- Parameters:
eventHolder
- The event holder- Returns:
- The event child nodes
- Throws:
RepositoryException
- if an error occurred
-
getEvents
public static NodeIterator getEvents(EventHolder eventHolder, String[] types) throws RepositoryException
Returns the events sorted by ascending date- Parameters:
eventHolder
- The event holdertypes
- The types of events to return. Can benull
to get all events- Returns:
- The event child nodes
- Throws:
RepositoryException
- if an error occurred
-
getEvents
public static NodeIterator getEvents(Session session, Expression filterExpression) throws RepositoryException
Returns events sorted by ascending date The method search for events in all the repository and not a specificEventHolder
.- Parameters:
session
- The session to use to find the query managerfilterExpression
- TheExpression
used to filter the result. Can benull
.- Returns:
- The event child nodes
- Throws:
RepositoryException
- if an error occurred
-
getEventXPathQuery
public static String getEventXPathQuery(EventHolder eventHolder, Expression eventExpression, SortCriteria sortCriteria) throws RepositoryException
Creates the XPath query corresponding to specifiedExpression
.- Parameters:
eventHolder
- the event holdereventExpression
- the query predicates.sortCriteria
- the sort criteria.- Returns:
- the created XPath query.
- Throws:
RepositoryException
- if an error occurred
-
addEventNode
public static Node addEventNode(EventHolder eventHolder, Date eventDate, String eventType, UserIdentity author) throws RepositoryException
Add an event node- Parameters:
eventHolder
- The event holdereventDate
- The event's dateeventType
- The event's typeauthor
- The event's author- Returns:
- The created event node
- Throws:
RepositoryException
- if an error occurred
-
-