Class MboxHelper


  • public class MboxHelper
    extends java.lang.Object
    • Method Detail

      • getMboxName

        public static java.lang.String getMboxName​(Resource rsrc)
        Returns a name for the Resource. As name the jcr:title with removed whitespaces is used if available. If no jcr:title is specified, a name is generated by getMboxId(Resource).
        Parameters:
        rsrc - Resource
        Returns:
        a name for the Resource
      • generateLocationName

        public static java.lang.String generateLocationName​(Resource currentResource,
                                                            WCMMode wcmMode,
                                                            java.lang.String... ambitMappings)
        Generates the location name used by this location in Adobe Target. The location name uses the following pattern: {location-name-in-aem}-{the non-master ambit names joined by # and hashed using MD5}--{wcm mode}. If the WCMMode is WCMMode.DISABLED then it's omitted. If not, the "--author" suffix is used.
        Parameters:
        currentResource - the Resource representing the target component
        wcmMode - the WCMMode
        ambitMappings - Array of ambits
        Returns:
        the location name generated using the pattern described above
      • getMboxId

        public static java.lang.String getMboxId​(Resource rsrc)
        Generates an mbox ID. The ID is generated by replacing slashes and removing jcr:content from the resource path of the start element. If the corresponding start element can not be found the provided element is used.
        Parameters:
        rsrc - Resource of start/end element
        Returns:
        an MboxId for the Resource
      • qualifyMboxNameOrId

        public static java.lang.String qualifyMboxNameOrId​(java.lang.String mboxNameOrId,
                                                           WCMMode wcmMode)
        Adds the WCM mode qualifier to the mbox name, if necessary
        Parameters:
        mboxNameOrId - the mbox name
        wcmMode - the WCMMode
        Returns:
        the mbox name containing the WCM mode, if necessary. It the WCM mode is WCMMode.DISABLED then the return value is the one passed in the mboxNameOrId parameter
      • qualifyMboxNameOrId

        public static java.lang.String qualifyMboxNameOrId​(java.lang.String mboxNameOrId,
                                                           WCMMode wcmMode,
                                                           java.lang.String ambitName)
        Adds the necessary qualifiers (WCM Mode and the name of the ambit) to the mbox name
        Parameters:
        mboxNameOrId - the actual mbox name
        wcmMode - the WCMMode
        ambitName - the name of the ambit, if this mbox belongs to a site using MSM
        Returns:
        the location name containing the ambit name and the wcm mode, if necessary. If the WCM mode is WCMMode.DISABLED and the ambit name is "master" then the return value is the one passed on the mboxNameOrId parameter
      • getMboxId

        public static java.lang.String getMboxId​(java.lang.String location)
        Generates an mbox ID from an mbox location.
        Slashes are replaced with dashes. If this location is a repository path then jcr:content is stripped from it.
        Parameters:
        location - the mbox location
        Returns:
        the mbox id
        See Also:
        getMboxId(Resource)
      • searchStartElement

        public static Resource searchStartElement​(Resource resource)
        Search the start element for the current element type.
        Parameters:
        resource - Resource
        Returns:
        start element for the current element type
      • isAccurateRendering

        public static boolean isAccurateRendering​(Resource resource)
                                           throws RepositoryException
        Returns true if the mbox represented by the resource has accurateTargeting enabled.
        Parameters:
        resource - Resource
        Returns:
        true if the mbox represented by the resource has accurateTargeting enabled.
        Throws:
        RepositoryException - RepositoryException
      • getMappedClientContextParameterNames

        public static java.util.Map<java.lang.String,​java.lang.String> getMappedClientContextParameterNames​(Resource resource,
                                                                                                                  InheritanceValueMap pageProperties,
                                                                                                                  ConfigurationManager configurationManager)
                                                                                                           throws RepositoryException
        Returns the names and mapped values of the ClientContext parameters which should be sent as part of mbox calls

        This method merges the directly defined parameter names with the parameters names inherited from a Adobe Target framework.

        The mapped values are usually defined by the Framework. In case they are defined statically on the component the property name is transformed by transforming all slashes ('/') to dots ('.').

        Parameters:
        resource - the target resource
        pageProperties - InheritanceValueMap
        configurationManager - ConfigurationManager
        Returns:
        parameter mappings never null
        Throws:
        RepositoryException - RepositoryException
      • getStaticParameters

        public static java.util.Map<java.lang.String,​java.lang.String> getStaticParameters​(Resource resource)
        Returns the static parameters configured for this target component. These parameters are used when performing mbox calls.
        Parameters:
        resource - the Resource representing the target component
        Returns:
        a Map containing the mapped parameters