Class JcrHelper


  • public class JcrHelper
    extends Object
    Helper class for common jcr operations
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.jcr.Item getPrimaryItem​(javax.jcr.Node node)
      Retrieve the primary item of a node, according to the primary node type hierarchy.
      static javax.jcr.version.Version getVersionParent​(javax.jcr.version.Version version)
      Find the first checked-in version of the parent of a node that contains a particular version of the child.
      static boolean isNodeType​(javax.jcr.Node node, String type)
      Determine whether node is of the specified type, by using the jcr:mixinTypes property.
      static boolean isVirtualNode​(javax.jcr.Node node)
      Determine whether node in question is a virtual node.
      static boolean isVirtualRoot​(javax.jcr.Node node)
      Determine whether the node is a virtual root node (facet search or facet navigation)
    • Method Detail

      • isNodeType

        public static boolean isNodeType​(javax.jcr.Node node,
                                         String type)
                                  throws javax.jcr.RepositoryException
        Determine whether node is of the specified type, by using the jcr:mixinTypes property. This is necessary when a mixin has been added to the node, but the node hasn't been saved yet.
        Parameters:
        node -
        type -
        Returns:
        true when the node is of the specified type
        Throws:
        javax.jcr.RepositoryException
      • getVersionParent

        public static javax.jcr.version.Version getVersionParent​(javax.jcr.version.Version version)
                                                          throws javax.jcr.ItemNotFoundException,
                                                                 javax.jcr.RepositoryException
        Find the first checked-in version of the parent of a node that contains a particular version of the child. I.e. given a version of a child, the oldest version of the parent that contains the child is returned.
        Parameters:
        version -
        Throws:
        javax.jcr.ItemNotFoundException
        javax.jcr.RepositoryException
      • getPrimaryItem

        public static javax.jcr.Item getPrimaryItem​(javax.jcr.Node node)
                                             throws javax.jcr.ItemNotFoundException,
                                                    javax.jcr.RepositoryException
        Retrieve the primary item of a node, according to the primary node type hierarchy. Plain JackRabbit only checks the declared items of a type, not the inherited ones.
        Parameters:
        node -
        Returns:
        primary item
        Throws:
        javax.jcr.ItemNotFoundException
        javax.jcr.RepositoryException
      • isVirtualNode

        public static boolean isVirtualNode​(javax.jcr.Node node)
                                     throws javax.jcr.RepositoryException
        Determine whether node in question is a virtual node.
        Parameters:
        node - the node to check for virtuality
        Returns:
        whether the node is a virtual node or not
        Throws:
        javax.jcr.RepositoryException
      • isVirtualRoot

        public static boolean isVirtualRoot​(javax.jcr.Node node)
                                     throws javax.jcr.RepositoryException
        Determine whether the node is a virtual root node (facet search or facet navigation)
        Parameters:
        node -
        Throws:
        javax.jcr.RepositoryException