Class SitecatalystUtil
- java.lang.Object
-
- com.day.cq.analytics.sitecatalyst.SitecatalystUtil
-
public class SitecatalystUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ResourcefindAnalyticsResource(ResourceResolver resolver, Resource resource)static IntegergetCookieDomainNamePeriod(SlingHttpServletRequest request, String server)Returns number of domain name periods.static StringgetFormattedPagePath(Resource pageResource, Configuration configuration)Formats the resource path of a ResourcepageResourcerelative to the providedConfigurationpath.static StringgetPublishPreferredReportSuite(Configuration config)Returns one of the configured report suites based on the following rules: return first publish report suite, if not, return first report suite for all run modes and if still nothing available return first author report suitestatic StringgetReportSuites(SlingSettingsService settingsService, Configuration configuration)Returns a comma separated list of report suites depending on the current run mode of the server.static StringgetServer(SlingHttpServletRequest request, Configuration config)Returns server URL according to request scheme.
-
-
-
Method Detail
-
getServer
public static String getServer(SlingHttpServletRequest request, Configuration config)
Returns server URL according to request scheme. If the scheme is HTTP the tracking server is returned otherwise the secure tracking server is returned.- Parameters:
request- the requestconfig- the configuration- Returns:
- server URL
-
getReportSuites
public static String getReportSuites(SlingSettingsService settingsService, Configuration configuration)
Returns a comma separated list of report suites depending on the current run mode of the server. If no report suite matches the current run mode an empty string is returned.- Parameters:
settingsService- SlingSettingsServiceconfiguration- the configuratin- Returns:
- comma separated list of report suites for runmode of current server
-
getCookieDomainNamePeriod
public static Integer getCookieDomainNamePeriod(SlingHttpServletRequest request, String server)
Returns number of domain name periods.- Parameters:
request- the requestserver- the server url- Returns:
- number ofdomain name periods
-
getFormattedPagePath
public static String getFormattedPagePath(Resource pageResource, Configuration configuration)
Formats the resource path of a ResourcepageResourcerelative to the providedConfigurationpath. A trailing slash will be removed if present, all other slashes will be replaced by colons./content/geometrixx/en/supportwill be formatted tocontent:geometrixx:en:support- Parameters:
pageResource- page Resourceconfiguration- SiteCatalyst configuration- Returns:
- Formatted path
-
findAnalyticsResource
public static Resource findAnalyticsResource(ResourceResolver resolver, Resource resource)
Ascends theResourceuntil aPagewith a valid analytics configuration is found. The configuration is considered valid if the node has a property cq:services.- Parameters:
resolver-ResourceResolverresource-Resource- Returns:
- Analytics resource or
nullif none could be found.
-
getPublishPreferredReportSuite
public static String getPublishPreferredReportSuite(Configuration config)
Returns one of the configured report suites based on the following rules: return first publish report suite, if not, return first report suite for all run modes and if still nothing available return first author report suite- Parameters:
config- the Analytics configuration- Returns:
- the preferred report suite ID
-
-