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 implementing EventHolder in JCR.
  • Method Details

    • getEventsRootNode

      public static javax.jcr.Node getEventsRootNode(javax.jcr.Node node) throws javax.jcr.RepositoryException
      Get the node holding the JCR events under the given node
      Parameters:
      node - The parent node
      Returns:
      the events' root node
      Throws:
      javax.jcr.RepositoryException - if an error occurred
    • getEvents

      public static javax.jcr.NodeIterator getEvents(EventHolder eventHolder) throws javax.jcr.RepositoryException
      Returns the event child nodes
      Parameters:
      eventHolder - The event holder
      Returns:
      The event child nodes
      Throws:
      javax.jcr.RepositoryException - if an error occurred
    • getEvents

      public static javax.jcr.NodeIterator getEvents(EventHolder eventHolder, String[] types) throws javax.jcr.RepositoryException
      Returns the events sorted by ascending date
      Parameters:
      eventHolder - The event holder
      types - The types of events to return. Can be null to get all events
      Returns:
      The event child nodes
      Throws:
      javax.jcr.RepositoryException - if an error occurred
    • getEvents

      public static javax.jcr.NodeIterator getEvents(javax.jcr.Session session, Expression filterExpression) throws javax.jcr.RepositoryException
      Returns events sorted by ascending date The method search for events in all the repository and not a specific EventHolder.
      Parameters:
      session - The session to use to find the query manager
      filterExpression - The Expression used to filter the result. Can be null.
      Returns:
      The event child nodes
      Throws:
      javax.jcr.RepositoryException - if an error occurred
    • getEventXPathQuery

      public static String getEventXPathQuery(EventHolder eventHolder, Expression eventExpression, SortCriteria sortCriteria) throws javax.jcr.RepositoryException
      Creates the XPath query corresponding to specified Expression.
      Parameters:
      eventHolder - the event holder
      eventExpression - the query predicates.
      sortCriteria - the sort criteria.
      Returns:
      the created XPath query.
      Throws:
      javax.jcr.RepositoryException - if an error occurred
    • addEventNode

      public static javax.jcr.Node addEventNode(EventHolder eventHolder, Date eventDate, String eventType, UserIdentity author) throws javax.jcr.RepositoryException
      Add an event node
      Parameters:
      eventHolder - The event holder
      eventDate - The event's date
      eventType - The event's type
      author - The event's author
      Returns:
      The created event node
      Throws:
      javax.jcr.RepositoryException - if an error occurred