Class HippoNodeUtils
java.lang.Object
org.onehippo.forge.content.exim.core.util.HippoNodeUtils
Hippo specific node related utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic NodecreateMissingHippoFolders(Session session, String absPath) Checks if all the folders exist in the givenabsPathand creates folders if not existing.static NodegetChildNodeOfType(Node baseNode, String childNodeName, String... childNodeTypes) Finds a child node bychildNodeNameandchildNodeTypesunder thebaseNode.static org.hippoecm.repository.api.StringCodecReturn the defaultStringCodecused in folder and document node name generation.static NodegetDocumentVariantByHippoStdState(Node handle, String hippoStdState) Finds a variant node by theHippoStdNodeType.HIPPOSTD_STATEproperty value such asHippoStdNodeType.PUBLISHEDorHippoStdNodeType.UNPUBLISHED.getDocumentVariantsMap(Node handle) Returns a map of variant nodes, keyed by variant states such asHippoStdNodeType.PUBLISHEDorHippoStdNodeType.UNPUBLISHED.static NodegetFirstVariantNode(Node handle) Find and return the first found variant node under the handle node.static NodegetHippoDocumentHandle(Node node) Returnsnodeif it is a document handle node or its parent if it is a document variant node.static org.hippoecm.repository.api.WorkflowgetHippoWorkflow(Session session, String category, Node node) ReturnsWorkflowinstance by thecategoryfor thenode.static booleanisAssetPath(String path) Return true if thepathreflects a asset path in Hippo.static booleanisBinaryPath(String path) Return true if thepathreflects a gallery or asset path in Hippo.static booleanisDocumentHandleLive(Node handle) Detects if the document handle is representing a live document at the moment.static booleanisDocumentPath(String path) Return true if thepathreflects a document path in Hippo.static booleanisGalleryPath(String path) Return true if thepathreflects a gallery path in Hippo.
-
Method Details
-
getDefaultUriEncoding
public static org.hippoecm.repository.api.StringCodec getDefaultUriEncoding()Return the defaultStringCodecused in folder and document node name generation.- Returns:
- the default
StringCodecused in folder and document node name generation
-
getChildNodeOfType
public static Node getChildNodeOfType(Node baseNode, String childNodeName, String... childNodeTypes) throws RepositoryException Finds a child node bychildNodeNameandchildNodeTypesunder thebaseNode.- Parameters:
baseNode- base nodechildNodeName- child node namechildNodeTypes- child node type names- Returns:
- a child node by
childNodeNameandchildNodeTypesunder 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 ReturnsWorkflowinstance by thecategoryfor thenode.- Parameters:
session- JCR sessioncategory- workflow categorynode- folder or document node- Returns:
Workflowinstance for thenodeand 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.PUBLISHEDorHippoStdNodeType.UNPUBLISHED.- Parameters:
handle- document handle node- Returns:
- a map of variant nodes, keyed by variant states such as
HippoStdNodeType.PUBLISHEDorHippoStdNodeType.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_STATEproperty value such asHippoStdNodeType.PUBLISHEDorHippoStdNodeType.UNPUBLISHED.- Parameters:
handle- document handle nodehippoStdState-HippoStdNodeType.HIPPOSTD_STATEproperty value such asHippoStdNodeType.PUBLISHEDorHippoStdNodeType.UNPUBLISHED- Returns:
- a variant node by the
HippoStdNodeType.HIPPOSTD_STATEproperty 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 givenabsPathand 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
Returnsnodeif it is a document handle node or its parent if it is a document variant node. Otherwise returns null.- Parameters:
node- JCR node- Returns:
nodeif 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 thepathreflects a document path in Hippo.- Parameters:
path- document path- Returns:
- true if the
pathreflects a document path in Hippo
-
isGalleryPath
Return true if thepathreflects a gallery path in Hippo.- Parameters:
path- gallery path- Returns:
- true if the
pathreflects a gallery path in Hippo
-
isAssetPath
Return true if thepathreflects a asset path in Hippo.- Parameters:
path- asset path- Returns:
- true if the
pathreflects a asset path in Hippo
-
isBinaryPath
Return true if thepathreflects a gallery or asset path in Hippo.- Parameters:
path- gallery or asset path- Returns:
- true if the
pathreflects a gallery or asset path in Hippo
-