Package com.day.cq.mcm.api
Class MCMUtil
- java.lang.Object
-
- com.day.cq.mcm.api.MCMUtil
-
public class MCMUtil extends java.lang.Object
Utility methods for MCM.
-
-
Constructor Summary
Constructors Constructor Description MCMUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addPossibleSegmentsToValues(ValueMap content, java.util.Map<java.lang.String,java.lang.Object> values, ResourceResolver resourceResolver)
static void
addPossibleTagsToValues(Page aPage, java.util.Map<java.lang.String,java.lang.Object> values)
static User
getAuthorizedUser(ResourceResolver rr, java.lang.String userId)
API to get authorizable user for the given Idstatic java.lang.String
getSegmentName(ResourceResolver resolver, java.lang.String path)
Retrieves the title of the page under path or returns the path if the path doesn't lead to a page.static java.lang.String
getUserId(ResourceResolver rr, java.lang.String userId)
Fetch user name from the given idstatic boolean
isAnExperience(Resource resource)
Checks if theresource
is of an experience type (cq/personalization/components/teaserpage, cq/personalization/components/offerpage, mcm/components/newsletter/page, mcm/campaign/components/campaign_newsletterpage).static java.lang.String
removePossibleJcrContent(java.lang.String path)
static <T> void
writeMapAsJsonObject(JSONWriter out, java.util.Map<java.lang.String,T> m)
-
-
-
Method Detail
-
removePossibleJcrContent
public static java.lang.String removePossibleJcrContent(java.lang.String path)
-
writeMapAsJsonObject
public static <T> void writeMapAsJsonObject(JSONWriter out, java.util.Map<java.lang.String,T> m) throws JSONException
- Parameters:
out
-m
-- Throws:
JSONException
-
addPossibleTagsToValues
public static void addPossibleTagsToValues(Page aPage, java.util.Map<java.lang.String,java.lang.Object> values) throws JSONException
- Throws:
JSONException
-
addPossibleSegmentsToValues
public static void addPossibleSegmentsToValues(ValueMap content, java.util.Map<java.lang.String,java.lang.Object> values, ResourceResolver resourceResolver) throws JSONException
- Throws:
JSONException
-
getSegmentName
public static java.lang.String getSegmentName(ResourceResolver resolver, java.lang.String path)
Retrieves the title of the page under path or returns the path if the path doesn't lead to a page.- Parameters:
resolver
-path
-- Returns:
-
getAuthorizedUser
public static User getAuthorizedUser(ResourceResolver rr, java.lang.String userId)
API to get authorizable user for the given Id- Parameters:
rr
-userId
-- Returns:
-
getUserId
public static java.lang.String getUserId(ResourceResolver rr, java.lang.String userId)
Fetch user name from the given id- Parameters:
rr
-userId
-- Returns:
-
isAnExperience
public static boolean isAnExperience(Resource resource)
Checks if theresource
is of an experience type (cq/personalization/components/teaserpage, cq/personalization/components/offerpage, mcm/components/newsletter/page, mcm/campaign/components/campaign_newsletterpage).- Parameters:
resource
-- Returns:
true
if type is an experience type,false
otherwise.
-
-