Class NodeHelper
java.lang.Object
org.ametys.plugins.repository.jcr.NodeHelper
Provides helper methods on nodes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getFullHashPath
(String name) Get the path with hashed nodes.static javax.jcr.Node
getOrCreateFinalHashNode
(javax.jcr.Node parentNode, String name) Get or create hash nodes for the given name, intermediate nodes are of type "ametys:collectionElement".static javax.jcr.Node
getOrCreateFinalHashNode
(javax.jcr.Node parentNode, String name, String hashType) Get or create hash nodes for the given name and intermediate primary type.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.static void
Rename the givenNode
with the given new name
-
Method Details
-
rename
Rename the givenNode
with the given new name- Parameters:
node
- the node to renamenewName
- the new name of the node- Throws:
AmetysRepositoryException
- if an error occurs.
-
hashAsList
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
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 nodesname
- 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 nodesname
- 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
-