Class MCMUtil


  • public class MCMUtil
    extends java.lang.Object
    Utility methods for MCM.
    • Constructor Summary

      Constructors 
      Constructor Description
      MCMUtil()  
    • Constructor Detail

      • MCMUtil

        public MCMUtil()
    • 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
      • 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 the resource 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.