Class HippoNodeUtils
java.lang.Object
org.onehippo.forge.content.exim.core.util.HippoNodeUtils
Hippo specific node related utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Node
createMissingHippoFolders
(Session session, String absPath) Checks if all the folders exist in the givenabsPath
and creates folders if not existing.static Node
getChildNodeOfType
(Node baseNode, String childNodeName, String... childNodeTypes) Finds a child node bychildNodeName
andchildNodeTypes
under thebaseNode
.static org.hippoecm.repository.api.StringCodec
Return the defaultStringCodec
used in folder and document node name generation.static Node
getDocumentVariantByHippoStdState
(Node handle, String hippoStdState) Finds a variant node by theHippoStdNodeType.HIPPOSTD_STATE
property value such asHippoStdNodeType.PUBLISHED
orHippoStdNodeType.UNPUBLISHED
.getDocumentVariantsMap
(Node handle) Returns a map of variant nodes, keyed by variant states such asHippoStdNodeType.PUBLISHED
orHippoStdNodeType.UNPUBLISHED
.static Node
getFirstVariantNode
(Node handle) Find and return the first found variant node under the handle node.static Node
getHippoDocumentHandle
(Node node) Returnsnode
if it is a document handle node or its parent if it is a document variant node.static org.hippoecm.repository.api.Workflow
getHippoWorkflow
(Session session, String category, Node node) ReturnsWorkflow
instance by thecategory
for thenode
.static boolean
isAssetPath
(String path) Return true if thepath
reflects a asset path in Hippo.static boolean
isBinaryPath
(String path) Return true if thepath
reflects a gallery or asset path in Hippo.static boolean
isDocumentHandleLive
(Node handle) Detects if the document handle is representing a live document at the moment.static boolean
isDocumentPath
(String path) Return true if thepath
reflects a document path in Hippo.static boolean
isGalleryPath
(String path) Return true if thepath
reflects a gallery path in Hippo.
-
Method Details
-
getDefaultUriEncoding
public static org.hippoecm.repository.api.StringCodec getDefaultUriEncoding()Return the defaultStringCodec
used in folder and document node name generation.- Returns:
- the default
StringCodec
used in folder and document node name generation
-
getChildNodeOfType
public static Node getChildNodeOfType(Node baseNode, String childNodeName, String... childNodeTypes) throws RepositoryException Finds a child node bychildNodeName
andchildNodeTypes
under thebaseNode
.- Parameters:
baseNode
- base nodechildNodeName
- child node namechildNodeTypes
- child node type names- Returns:
- a child node by
childNodeName
andchildNodeTypes
under thebaseNode
- Throws:
RepositoryException
- if any repository/workflow exception occurs
-
getHippoWorkflow
public static org.hippoecm.repository.api.Workflow getHippoWorkflow(Session session, String category, Node node) throws RepositoryException ReturnsWorkflow
instance by thecategory
for thenode
.- Parameters:
session
- JCR sessioncategory
- workflow categorynode
- folder or document node- Returns:
Workflow
instance for thenode
and thecategory
- Throws:
RepositoryException
- if any repository/workflow exception occurs
-
getFirstVariantNode
Find and return the first found variant node under the handle node.- Parameters:
handle
- handle node- Returns:
- the first found variant node under the handle node
- Throws:
RepositoryException
- if repository exception occurs
-
getDocumentVariantsMap
Returns a map of variant nodes, keyed by variant states such asHippoStdNodeType.PUBLISHED
orHippoStdNodeType.UNPUBLISHED
.- Parameters:
handle
- document handle node- Returns:
- a map of variant nodes, keyed by variant states such as
HippoStdNodeType.PUBLISHED
orHippoStdNodeType.UNPUBLISHED
- Throws:
RepositoryException
- if any repository/workflow exception occurs
-
getDocumentVariantByHippoStdState
public static Node getDocumentVariantByHippoStdState(Node handle, String hippoStdState) throws RepositoryException Finds a variant node by theHippoStdNodeType.HIPPOSTD_STATE
property value such asHippoStdNodeType.PUBLISHED
orHippoStdNodeType.UNPUBLISHED
.- Parameters:
handle
- document handle nodehippoStdState
-HippoStdNodeType.HIPPOSTD_STATE
property value such asHippoStdNodeType.PUBLISHED
orHippoStdNodeType.UNPUBLISHED
- Returns:
- a variant node by the
HippoStdNodeType.HIPPOSTD_STATE
property value - Throws:
RepositoryException
- if any repository/workflow exception occurs
-
isDocumentHandleLive
Detects if the document handle is representing a live document at the moment.- Parameters:
handle
- document handle node- Returns:
- true if the document handle is representing a live document at the moment
- Throws:
RepositoryException
- if any repository/workflow exception occurs
-
createMissingHippoFolders
public static Node createMissingHippoFolders(Session session, String absPath) throws RepositoryException, org.hippoecm.repository.api.WorkflowException Checks if all the folders exist in the givenabsPath
and creates folders if not existing.- Parameters:
session
- JCR sessionabsPath
- absolute folder node path- Returns:
- the final folder node if successful
- Throws:
RepositoryException
- if any repository exception occursorg.hippoecm.repository.api.WorkflowException
- if any workflow exception occurs
-
getHippoDocumentHandle
Returnsnode
if it is a document handle node or its parent if it is a document variant node. Otherwise returns null.- Parameters:
node
- JCR node- Returns:
node
if it is a document handle node or its parent if it is a document variant node. Otherwise returns null.- Throws:
RepositoryException
- if repository exception occurs
-
isDocumentPath
Return true if thepath
reflects a document path in Hippo.- Parameters:
path
- document path- Returns:
- true if the
path
reflects a document path in Hippo
-
isGalleryPath
Return true if thepath
reflects a gallery path in Hippo.- Parameters:
path
- gallery path- Returns:
- true if the
path
reflects a gallery path in Hippo
-
isAssetPath
Return true if thepath
reflects a asset path in Hippo.- Parameters:
path
- asset path- Returns:
- true if the
path
reflects a asset path in Hippo
-
isBinaryPath
Return true if thepath
reflects a gallery or asset path in Hippo.- Parameters:
path
- gallery or asset path- Returns:
- true if the
path
reflects a gallery or asset path in Hippo
-