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 booleancontainsStringValueInProperty(org.onehippo.forge.content.pojo.model.ContentNode contentNode, String propertyName, String value) Return true if the property (by the givenpropertyName) in thecontentNodehas the same string value asvalue.static voidprependUrlPrefixInJcrDataValues(org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String startsWith, String urlPrefix) Find a givenurlPrefixin the URL value ofjcr:dataproperty, and prepend it with the givenurlPrefixif the value starts with thestartsWith.static voidremoveUrlPrefixInJcrDataValues(org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String urlPrefix) Find a givenurlPrefixin the URL value ofjcr:dataproperty, and remove the prefix if the value starts with theurlPrefix.static voidreplaceDocbasePropertiesByPaths(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String jxpath) Selects all theContentPropertyobjects underbaseContentNodeby the given JXPath expression,jxpathand replace the string docbase property value by the path of the JCR node found by the existing UUID string value.static voidreplaceDocbasesByPaths(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode) Selects all theContentNodeobjects underbaseContentNodeby the default JXPath expression,MIRROR_DOCBASES_XPATHand replace thehippo:docbaseproperty value by the path of the JCR node found by the existing UUID string value.static voidreplaceDocbasesByPaths(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String jxpath) Selects all theContentNodeobjects underbaseContentNodeby the given JXPath expression,jxpathand replace thehippo:docbaseproperty value by the path of the JCR node found by the existing UUID string value.static voidreplaceDocbasesByPaths(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode, String jxpath, Collection<String> paths) Selects all theContentNodeobjects underbaseContentNodeby the given JXPath expression,jxpathand replace thehippo:docbaseproperty value by the path of the JCR node found by the existing UUID string value, and add those paths topathscollection.
-
Field Details
-
MIRROR_DOCBASES_XPATH
Default JXPath expression to select all the nodes havinghippo:docbaseproperty.- See Also:
-
-
Method Details
-
replaceDocbasesByPaths
public static void replaceDocbasesByPaths(Session session, org.onehippo.forge.content.pojo.model.ContentNode baseContentNode) throws RepositoryException Selects all theContentNodeobjects underbaseContentNodeby the default JXPath expression,MIRROR_DOCBASES_XPATHand replace thehippo:docbaseproperty value by the path of the JCR node found by the existing UUID string value.sessionis used when finding a JCR node associated by the UUID value at the existinghippo:docbaseproperty.- Parameters:
session- JCR sessionbaseContentNode- baseContentNodeinstance- 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 theContentNodeobjects underbaseContentNodeby the given JXPath expression,jxpathand replace thehippo:docbaseproperty value by the path of the JCR node found by the existing UUID string value.sessionis used when finding a JCR node associated by the UUID value at the existinghippo:docbaseproperty.- Parameters:
session- JCR sessionbaseContentNode- baseContentNodeinstancejxpath- 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 theContentNodeobjects underbaseContentNodeby the given JXPath expression,jxpathand replace thehippo:docbaseproperty value by the path of the JCR node found by the existing UUID string value, and add those paths topathscollection.sessionis used when finding a JCR node associated by the UUID value at the existinghippo:docbaseproperty.- Parameters:
session- JCR sessionbaseContentNode- baseContentNodeinstancejxpath- 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 theContentPropertyobjects underbaseContentNodeby the given JXPath expression,jxpathand replace the string docbase property value by the path of the JCR node found by the existing UUID string value.sessionis used when finding a JCR node associated by the UUID value at the existing string UUID property value.- Parameters:
session- JCR sessionbaseContentNode- baseContentNodeinstancejxpath- 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 givenurlPrefixin the URL value ofjcr:dataproperty, 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 givenurlPrefixin the URL value ofjcr:dataproperty, and prepend it with the givenurlPrefixif 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 thecontentNodehas the same string value asvalue.- Parameters:
contentNode- content nodepropertyName- property namevalue- string value- Returns:
- true if the property (by the given
propertyName) in thecontentNodehas the same string value asvalue
-