Class NodeHelper

java.lang.Object
org.ametys.plugins.repository.jcr.NodeHelper

public final class NodeHelper extends Object
Provides helper methods on nodes.
  • Method Details

    • rename

      public static void rename(javax.jcr.Node node, String newName) throws AmetysRepositoryException
      Rename the given Node with the given new name
      Parameters:
      node - the node to rename
      newName - the new name of the node
      Throws:
      AmetysRepositoryException - if an error occurs.
    • hashAsList

      public static List<String> hashAsList(String name)
      Computes a hashed path in the JCR tree from the name of the child object.
      Subclasses may override this method to provide a more suitable hash function.
      This implementation relies on the buzhash algorithm. This method MUST return an array of the same length for each name.
      Parameters:
      name - the name of the child object
      Returns:
      a hashed path of the name.
    • getFullHashPath

      public static String getFullHashPath(String name)
      Get the path with hashed nodes.
      Parameters:
      name - the name of the final node
      Returns:
      the path with hashed nodes
    • getOrCreateFinalHashNode

      public static javax.jcr.Node getOrCreateFinalHashNode(javax.jcr.Node parentNode, String name) throws AmetysRepositoryException
      Get or create hash nodes for the given name, intermediate nodes are of type "ametys:collectionElement". The final node is not created. The session is not saved.
      Parameters:
      parentNode - the parent node of the hashed nodes
      name - the name of the final node.
      Returns:
      the last level of hashed nodes
      Throws:
      AmetysRepositoryException - if an error occurs
    • getOrCreateFinalHashNode

      public static javax.jcr.Node getOrCreateFinalHashNode(javax.jcr.Node parentNode, String name, String hashType) throws AmetysRepositoryException
      Get or create hash nodes for the given name and intermediate primary type. The final node is not created. The session is not saved.
      Parameters:
      parentNode - the parent node of the hashed nodes
      name - the name of the final node.
      hashType - the primary type of hashed nodes
      Returns:
      the last level of hashed nodes
      Throws:
      AmetysRepositoryException - if an error occurs