Package com.day.cq.mcm.api
Class MCMUtil
- java.lang.Object
-
- com.day.cq.mcm.api.MCMUtil
-
public class MCMUtil extends 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 voidaddPossibleSegmentsToValues(ValueMap content, Map<String,Object> values, ResourceResolver resourceResolver)static voidaddPossibleTagsToValues(Page aPage, Map<String,Object> values)static UsergetAuthorizedUser(ResourceResolver rr, String userId)API to get authorizable user for the given Idstatic StringgetSegmentName(ResourceResolver resolver, String path)Retrieves the title of the page under path or returns the path if the path doesn't lead to a page.static StringgetUserId(ResourceResolver rr, String userId)Fetch user name from the given idstatic booleanisAnExperience(Resource resource)Checks if theresourceis of an experience type (cq/personalization/components/teaserpage, cq/personalization/components/offerpage, mcm/components/newsletter/page, mcm/campaign/components/campaign_newsletterpage).static StringremovePossibleJcrContent(String path)static <T> voidwriteMapAsJsonObject(JSONWriter out, Map<String,T> m)
-
-
-
Method Detail
-
writeMapAsJsonObject
public static <T> void writeMapAsJsonObject(JSONWriter out, Map<String,T> m) throws JSONException
- Parameters:
out-m-- Throws:
JSONException
-
addPossibleTagsToValues
public static void addPossibleTagsToValues(Page aPage, Map<String,Object> values) throws JSONException
- Throws:
JSONException
-
addPossibleSegmentsToValues
public static void addPossibleSegmentsToValues(ValueMap content, Map<String,Object> values, ResourceResolver resourceResolver) throws JSONException
- Throws:
JSONException
-
getSegmentName
public static String getSegmentName(ResourceResolver resolver, 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, String userId)
API to get authorizable user for the given Id- Parameters:
rr-userId-- Returns:
-
getUserId
public static String getUserId(ResourceResolver rr, String userId)
Fetch user name from the given id- Parameters:
rr-userId-- Returns:
-
isAnExperience
public static boolean isAnExperience(Resource resource)
Checks if theresourceis of an experience type (cq/personalization/components/teaserpage, cq/personalization/components/offerpage, mcm/components/newsletter/page, mcm/campaign/components/campaign_newsletterpage).- Parameters:
resource-- Returns:
trueif type is an experience type,falseotherwise.
-
-