org.hippoecm.hst.util
Class NodeUtils

java.lang.Object
  extended by org.hippoecm.hst.util.NodeUtils

public class NodeUtils
extends Object

NodeUtils

Version:
$Id: NodeUtils.java 35065 2012-07-09 10:07:02Z aschrijvers $

Constructor Summary
NodeUtils()
           
 
Method Summary
static javax.jcr.Node getCanonicalNode(javax.jcr.Node node)
          Returns the canonical version of this node, and null when there is no canonical node
static javax.jcr.Node getCanonicalNode(javax.jcr.Node node, javax.jcr.Node defaultNode)
          Deprecated. use getCanonicalNode(Node) instead
static javax.jcr.Node getDeref(javax.jcr.Node mirrorNode)
           
static boolean isDereferenceable(javax.jcr.Node node)
          Checks if the node is dereferenceable.
static boolean isNodeType(javax.jcr.Node node, String... nodeTypeNames)
          Checks if the node is type of any of the nodeTypeNames.
static boolean isNodeType(javax.jcr.Node node, String nodeTypeName)
          Checks if the node is type of the nodeTypeName.
static boolean isPrimaryNodeType(javax.jcr.Node node, String... primaryNodeTypeNames)
          Checks if the primary nodetype of node is equal to one of the supplied primaryNodeTypeNames.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeUtils

public NodeUtils()
Method Detail

getCanonicalNode

public static javax.jcr.Node getCanonicalNode(javax.jcr.Node node)
Returns the canonical version of this node, and null when there is no canonical node

Parameters:
node -
Returns:
the canonical version of this node, and null when there is no canonical node.
Throws:
RuntimeException - when the repository throws a general repository exception

getCanonicalNode

@Deprecated
public static javax.jcr.Node getCanonicalNode(javax.jcr.Node node,
                                                         javax.jcr.Node defaultNode)
Deprecated. use getCanonicalNode(Node) instead

Returns the canonical version of this node, and defaultNode when there is no canonical node

Parameters:
node -
defaultNode -
Returns:
the canonical version of this node, and defaultNode when there is no canonical node.
Throws:
RuntimeException - when the repository throws a general repository exception

isDereferenceable

public static boolean isDereferenceable(javax.jcr.Node node)
                                 throws javax.jcr.RepositoryException
Checks if the node is dereferenceable. When the node is type of either "hippo:facetselect" or "hippo:mirror" (or subtype of one of these), the node is regarded as dereferenceable and the dereferenced node can be retrieved by using getDeref(Node) method.

Parameters:
node -
Returns:
true when the node is dereferenceable
Throws:
javax.jcr.RepositoryException

getDeref

public static javax.jcr.Node getDeref(javax.jcr.Node mirrorNode)
Parameters:
mirrorNode -
Returns:
the dereferenced node and null when the mirrorNode is not a dereferenceable type or when no dereferenced node can be found

isNodeType

public static boolean isNodeType(javax.jcr.Node node,
                                 String nodeTypeName)
                          throws javax.jcr.RepositoryException
Checks if the node is type of the nodeTypeName. Returns true if this node is of the specified primary node type or mixin type, or a subtype thereof of the nodeTypeName. Returns false otherwise. Also see Node.isNodeType(String)

Parameters:
node -
nodeTypeName -
Returns:
true when node is of the specified primary node type or mixin type, or a subtype thereof of any of the nodeTypeName
Throws:
javax.jcr.RepositoryException

isNodeType

public static boolean isNodeType(javax.jcr.Node node,
                                 String... nodeTypeNames)
                          throws javax.jcr.RepositoryException
Checks if the node is type of any of the nodeTypeNames. Returns true if this node is of the specified primary node type or mixin type, or a subtype thereof of any of the nodeTypeNames. Returns false otherwise. Also see Node.isNodeType(String)

Parameters:
node - the jcr node
nodeTypeNames - the list of nodeTypeNames to check.
Returns:
true when node is of the specified primary node type or mixin type, or a subtype thereof of any of the nodeTypeNames. If the node is null then false is returned
Throws:
javax.jcr.RepositoryException

isPrimaryNodeType

public static boolean isPrimaryNodeType(javax.jcr.Node node,
                                        String... primaryNodeTypeNames)
                                 throws javax.jcr.RepositoryException
Checks if the primary nodetype of node is equal to one of the supplied primaryNodeTypeNames.

It returns true if node.getPrimaryNodeType().getName().equals(primaryNodeTypeName) returns true for any of the primaryNodeTypeNames

Parameters:
node -
primaryNodeTypeNames -
Returns:
true if node.getPrimaryNodeType().getName().equals(primaryNodeTypeName) returns true for any of the primaryNodeTypeNames
Throws:
javax.jcr.RepositoryException


Copyright © 2008-2012 Hippo. All Rights Reserved.