Class SitecatalystUtil
- java.lang.Object
-
- com.day.cq.analytics.sitecatalyst.SitecatalystUtil
-
public class SitecatalystUtil extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Resource
findAnalyticsResource(ResourceResolver resolver, Resource resource)
static java.lang.Integer
getCookieDomainNamePeriod(SlingHttpServletRequest request, java.lang.String server)
Returns number of domain name periods.static java.lang.String
getFormattedPagePath(Resource pageResource, Configuration configuration)
Formats the resource path of a ResourcepageResource
relative to the providedConfiguration
path.static java.lang.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 suitestatic java.lang.String
getReportSuites(SlingSettingsService settingsService, Configuration configuration)
Returns a comma separated list of report suites depending on the current run mode of the server.static java.lang.String
getServer(SlingHttpServletRequest request, Configuration config)
Returns server URL according to request scheme.
-
-
-
Method Detail
-
getServer
public static java.lang.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 java.lang.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 java.lang.Integer getCookieDomainNamePeriod(SlingHttpServletRequest request, java.lang.String server)
Returns number of domain name periods.- Parameters:
request
- the requestserver
- the server url- Returns:
- number ofdomain name periods
-
getFormattedPagePath
public static java.lang.String getFormattedPagePath(Resource pageResource, Configuration configuration)
Formats the resource path of a ResourcepageResource
relative to the providedConfiguration
path. A trailing slash will be removed if present, all other slashes will be replaced by colons./content/geometrixx/en/support
will 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 theResource
until aPage
with a valid analytics configuration is found. The configuration is considered valid if the node has a property cq:services.- Parameters:
resolver
-ResourceResolver
resource
-Resource
- Returns:
- Analytics resource or
null
if none could be found.
-
getPublishPreferredReportSuite
public static java.lang.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
-
-