Package com.day.cq.wcm.commons
Class UGCUtil
- java.lang.Object
-
- com.day.cq.wcm.commons.UGCUtil
-
public class UGCUtil extends java.lang.ObjectCollection of utilities revolving around CQ Social Collaboration features.- Since:
- CQ 5.6
-
-
Constructor Summary
Constructors Constructor Description UGCUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetIdFromResource(Resource resource)Returns the givenresource's name without selectors and / or file extension.static java.lang.StringgetPagePath(Resource resource)Returns the givenresource's path without its potential /jcr:content/... suffix, thus representing a page path.static java.lang.StringprepareUserGeneratedContent(ResourceResolver resolver, java.lang.String pagePath)Gets or creates user generated content nodestatic java.lang.StringresourceToUGCPath(Resource resource)This method maps the givenresourceto its equivalent path in /usergenerated, e.g.static java.lang.StringUGCToResourcePath(Resource resource)This method maps the givenresourcein /content/usergenerated to its equivalent path in the normal content tree, e.g.
-
-
-
Method Detail
-
resourceToUGCPath
public static java.lang.String resourceToUGCPath(Resource resource)
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
public static java.lang.String UGCToResourcePath(Resource resource)
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
public static java.lang.String getPagePath(Resource resource)
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 java.lang.String prepareUserGeneratedContent(ResourceResolver resolver, java.lang.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
public static java.lang.String getIdFromResource(Resource resource)
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.
-
-