Package com.day.cq.wcm.commons
Class UGCUtil
java.lang.Object
com.day.cq.wcm.commons.UGCUtil
Collection of utilities revolving around CQ Social Collaboration features.
- Since:
- CQ 5.6
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetIdFromResource(Resource resource) Returns the givenresource's name without selectors and / or file extension.static StringgetPagePath(Resource resource) Returns the givenresource's path without its potential /jcr:content/... suffix, thus representing a page path.static StringprepareUserGeneratedContent(ResourceResolver resolver, String pagePath) Gets or creates user generated content nodestatic StringresourceToUGCPath(Resource resource) This method maps the givenresourceto its equivalent path in /usergenerated, e.g.static StringUGCToResourcePath(Resource resource) This method maps the givenresourcein /content/usergenerated to its equivalent path in the normal content tree, e.g.
-
Constructor Details
-
UGCUtil
public UGCUtil()
-
-
Method Details
-
resourceToUGCPath
This method maps the givenresourceto its equivalent path in /usergenerated, e.g. as the relationship a page /content/test to its comment at /content/usergenerated/content/test.- Parameters:
resource- The resource to transpose to the comment's UCG path.- Returns:
- A
Stringrepresenting the equivalent UCG path.
-
UGCToResourcePath
This method maps the givenresourcein /content/usergenerated to its equivalent path in the normal content tree, e.g. as the relationship of a comment in //content/usergenerated/content/test to its parent resource at /content/test.- Parameters:
resource- The resource to transpose.- Returns:
- A
Stringrepresenting the equivalent normal content path.
-
getPagePath
Returns the givenresource's path without its potential /jcr:content/... suffix, thus representing a page path.- Parameters:
resource- The resource to check.- Returns:
- A
Stringrepresenting the page path.
-
prepareUserGeneratedContent
public static String prepareUserGeneratedContent(ResourceResolver resolver, String pagePath) throws WCMException Gets or creates user generated content node- Parameters:
resolver- The resource resolver.pagePath- The page path.- Returns:
- A
Stringrepresenting the UCG path. - Throws:
WCMException- If an error occurs while getting or creating user generated content node
-
getIdFromResource
Returns the givenresource's name without selectors and / or file extension.- Parameters:
resource- The resource from which to retrieve its name.- Returns:
- A
Stringrepresenting the id.
-