Class MboxHelper
java.lang.Object
com.day.cq.analytics.testandtarget.util.MboxHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateLocationName(Resource currentResource, WCMMode wcmMode, String... ambitMappings) Generates the location name used by this location in Adobe Target.getClientContextParameterNames(Resource resource, InheritanceValueMap pageProperties, ConfigurationManager configurationManager) Returns the names of the ClientContext parameters which should be sent as part of mbox callsstatic StringgetCustomMboxJsPath(Resource resource, Page currentPage, ConfigurationManager cfgMgr) Returns the repository path to a custommbox.jsfile for the current specifiedresourceandcurrentPagegetMappedClientContextParameterNames(Resource resource, InheritanceValueMap pageProperties, ConfigurationManager configurationManager) Returns the names and mapped values of the ClientContext parameters which should be sent as part of mbox callsstatic StringGenerates an mbox ID from an mbox location.static StringGenerates an mbox ID.static StringgetMboxName(Resource rsrc) Returns a name for theResource.getStaticParameters(Resource resource) Returns the static parameters configured for this target component.static booleanisAccurateRendering(Resource resource) Returns true if the mbox represented by theresourcehas accurateTargeting enabled.static StringqualifyMboxNameOrId(String mboxNameOrId, WCMMode wcmMode) Adds the WCM mode qualifier to the mbox name, if necessarystatic StringqualifyMboxNameOrId(String mboxNameOrId, WCMMode wcmMode, String ambitName) Adds the necessary qualifiers (WCM Mode and the name of the ambit) to the mbox namestatic ResourcesearchStartElement(Resource resource) Search the start element for the current element type.
-
Method Details
-
getMboxName
Returns a name for theResource. As name the jcr:title with removed whitespaces is used if available. If no jcr:title is specified, a name is generated bygetMboxId(Resource). -
generateLocationName
public static String generateLocationName(Resource currentResource, WCMMode wcmMode, 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 theWCMModeisWCMMode.DISABLEDthen it's omitted. If not, the "--author" suffix is used. -
getMboxId
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
Adds the WCM mode qualifier to the mbox name, if necessary- Parameters:
mboxNameOrId- the mbox namewcmMode- theWCMMode- Returns:
- the mbox name containing the WCM mode, if necessary. It the WCM mode is
WCMMode.DISABLEDthen the return value is the one passed in the mboxNameOrId parameter
-
qualifyMboxNameOrId
Adds the necessary qualifiers (WCM Mode and the name of the ambit) to the mbox name- Parameters:
mboxNameOrId- the actual mbox namewcmMode- theWCMModeambitName- 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.DISABLEDand the ambit name is "master" then the return value is the one passed on the mboxNameOrId parameter
-
getMboxId
Generates an mbox ID from an mbox location.
Slashes are replaced with dashes. If this location is a repository path thenjcr:contentis stripped from it.- Parameters:
location- the mbox location- Returns:
- the mbox id
- See Also:
-
searchStartElement
Search the start element for the current element type.- Parameters:
resource-Resource- Returns:
- start element for the current element type
-
getCustomMboxJsPath
public static String getCustomMboxJsPath(Resource resource, Page currentPage, ConfigurationManager cfgMgr) throws RepositoryException Returns the repository path to a custommbox.jsfile for the current specifiedresourceandcurrentPage- Parameters:
resource-ResourcecurrentPage- currentPagecfgMgr-ConfigurationManager- Returns:
- the path to the custom
mbox.jsfile or null if the default one should be used - Throws:
RepositoryException-RepositoryException
-
isAccurateRendering
Returns true if the mbox represented by theresourcehas accurateTargeting enabled.- Parameters:
resource-Resource- Returns:
- true if the mbox represented by the
resourcehas accurateTargeting enabled. - Throws:
RepositoryException-RepositoryException
-
getClientContextParameterNames
public static List<String> getClientContextParameterNames(Resource resource, InheritanceValueMap pageProperties, ConfigurationManager configurationManager) throws RepositoryException Returns the names of the ClientContext parameters which should be sent as part of mbox callsThis method merges the directly defined parameter names with the parameters names inherited from a Adobe Target framework.
- Parameters:
resource- thetargetresourcepageProperties-InheritanceValueMapconfigurationManager-ConfigurationManager- Returns:
- a list of parameter names, never null
- Throws:
RepositoryException-RepositoryException
-
getMappedClientContextParameterNames
public static Map<String,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 callsThis 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- thetargetresourcepageProperties-InheritanceValueMapconfigurationManager-ConfigurationManager- Returns:
- parameter mappings never null
- Throws:
RepositoryException-RepositoryException
-
getStaticParameters
Returns the static parameters configured for this target component. These parameters are used when performing mbox calls.
-