Class ContentNodeUtils
java.lang.Object
org.onehippo.forge.content.exim.core.util.ContentNodeUtils
Utilities to handle
ContentNode
objects.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
containsStringValueInProperty
(org.onehippo.forge.content.pojo.model.ContentNode contentNode, String propertyName, String value) Return true if the property (by the givenpropertyName
) in thecontentNode
has the same string value asvalue
.static void
prependUrlPrefixInJcrDataValues
(org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String startsWith, String urlPrefix) Find a givenurlPrefix
in the URL value ofjcr:data
property, and prepend it with the givenurlPrefix
if the value starts with thestartsWith
.static void
removeUrlPrefixInJcrDataValues
(org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String urlPrefix) Find a givenurlPrefix
in the URL value ofjcr:data
property, and remove the prefix if the value starts with theurlPrefix
.static void
replaceDocbasePropertiesByPaths
(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String jxpath) Selects all theContentProperty
objects underbaseContentNode
by the given JXPath expression,jxpath
and replace the string docbase property value by the path of the JCR node found by the existing UUID string value.static void
replaceDocbasesByPaths
(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode) Selects all theContentNode
objects underbaseContentNode
by the default JXPath expression,MIRROR_DOCBASES_XPATH
and replace thehippo:docbase
property value by the path of the JCR node found by the existing UUID string value.static void
replaceDocbasesByPaths
(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String jxpath) Selects all theContentNode
objects underbaseContentNode
by the given JXPath expression,jxpath
and replace thehippo:docbase
property value by the path of the JCR node found by the existing UUID string value.static void
replaceDocbasesByPaths
(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String jxpath, Collection<String> paths) Selects all theContentNode
objects underbaseContentNode
by the given JXPath expression,jxpath
and replace thehippo:docbase
property value by the path of the JCR node found by the existing UUID string value, and add those paths topaths
collection.
-
Field Details
-
MIRROR_DOCBASES_XPATH
Default JXPath expression to select all the nodes havinghippo:docbase
property.- See Also:
-
-
Method Details
-
replaceDocbasesByPaths
public static void replaceDocbasesByPaths(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode) throws RepositoryException Selects all theContentNode
objects underbaseContentNode
by the default JXPath expression,MIRROR_DOCBASES_XPATH
and replace thehippo:docbase
property value by the path of the JCR node found by the existing UUID string value.session
is used when finding a JCR node associated by the UUID value at the existinghippo:docbase
property.- Parameters:
session
- JCR sessionbaseContentNode
- baseContentNode
instance- Throws:
RepositoryException
- if fails to find a JCR node associated by the UUID value
-
replaceDocbasesByPaths
public static void replaceDocbasesByPaths(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String jxpath) throws RepositoryException Selects all theContentNode
objects underbaseContentNode
by the given JXPath expression,jxpath
and replace thehippo:docbase
property value by the path of the JCR node found by the existing UUID string value.session
is used when finding a JCR node associated by the UUID value at the existinghippo:docbase
property.- Parameters:
session
- JCR sessionbaseContentNode
- baseContentNode
instancejxpath
- JXPath expression- Throws:
RepositoryException
- if fails to find a JCR node associated by the UUID value
-
replaceDocbasesByPaths
public static void replaceDocbasesByPaths(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String jxpath, Collection<String> paths) throws RepositoryException Selects all theContentNode
objects underbaseContentNode
by the given JXPath expression,jxpath
and replace thehippo:docbase
property value by the path of the JCR node found by the existing UUID string value, and add those paths topaths
collection.session
is used when finding a JCR node associated by the UUID value at the existinghippo:docbase
property.- Parameters:
session
- JCR sessionbaseContentNode
- baseContentNode
instancejxpath
- JXPath expressionpaths
- replaced paths collection- Throws:
RepositoryException
- if fails to find a JCR node associated by the UUID value
-
replaceDocbasePropertiesByPaths
public static void replaceDocbasePropertiesByPaths(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String jxpath) throws RepositoryException Selects all theContentProperty
objects underbaseContentNode
by the given JXPath expression,jxpath
and replace the string docbase property value by the path of the JCR node found by the existing UUID string value.session
is used when finding a JCR node associated by the UUID value at the existing string UUID property value.- Parameters:
session
- JCR sessionbaseContentNode
- baseContentNode
instancejxpath
- JXPath expression- Throws:
RepositoryException
- if fails to find a JCR node associated by the UUID value
-
removeUrlPrefixInJcrDataValues
public static void removeUrlPrefixInJcrDataValues(org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String urlPrefix) Find a givenurlPrefix
in the URL value ofjcr:data
property, and remove the prefix if the value starts with theurlPrefix
.- Parameters:
baseContentNode
- base content nodeurlPrefix
- url prefix
-
prependUrlPrefixInJcrDataValues
public static void prependUrlPrefixInJcrDataValues(org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String startsWith, String urlPrefix) Find a givenurlPrefix
in the URL value ofjcr:data
property, and prepend it with the givenurlPrefix
if the value starts with thestartsWith
.- Parameters:
baseContentNode
- base content nodestartsWith
- start with string of the valueurlPrefix
- url prefix
-
containsStringValueInProperty
public static boolean containsStringValueInProperty(org.onehippo.forge.content.pojo.model.ContentNode contentNode, String propertyName, String value) Return true if the property (by the givenpropertyName
) in thecontentNode
has the same string value asvalue
.- Parameters:
contentNode
- content nodepropertyName
- property namevalue
- string value- Returns:
- true if the property (by the given
propertyName
) in thecontentNode
has the same string value asvalue
-