Class MCMUtil

java.lang.Object
com.day.cq.mcm.api.MCMUtil

public class MCMUtil extends Object
Utility methods for MCM.
  • Constructor Details

    • MCMUtil

      public MCMUtil()
  • Method Details

    • removePossibleJcrContent

      public static String removePossibleJcrContent(String path)
    • 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 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.