Interface TargetedContentManager


@ProviderType public interface TargetedContentManager
A service which provides access to campaigns, experiences and targeted content.
  • Method Details

    • getTeaserInfo

      JSONObject getTeaserInfo(ResourceResolver resolver, String campaignPath, String location)
      Returns a JSON array of active teasers for a particular campaignPath (legacy teasers) or location. The JSON for each teaser includes:
      • path
      • name
      • title
      • campainName (misspelled for legacy reasons)
      • thumbnail
      • id
      • segments[]
      • tags[]
        • name
        • title
        • titlePath
        • path
        • tagID
      Teasers are ordered first by campaign priority and then by experience page order. This allows the "first" strategy to be used for priority selection. While it might be nice to support more sophisticated strategies (for instance, a more specific segment in a lower-priority campaign ahead of a more generic segment in a higher-priority campaign), there is currently no support for this.
      Parameters:
      resolver - A resourceResolver from the request (for access control).
      campaignPath - A campaign path for a legacy teaser (or null).
      location - A named destination (or null for a legacy teaser).
      Returns:
      JSONObject as described
    • getTeaserInfo

      JSONObject getTeaserInfo(SlingHttpServletRequest request, String campaignPath, String location)
      Returns a JSON array of active teasers for a particular campaignPath (legacy teasers) or location.
      Parameters:
      request - A sling servlet request. Cannot be null
      campaignPath - A campaign path for a legacy teaser (or null).
      location - A named destination (or null for a legacy teaser).
      Returns:
      JSONObject as described in getTeaserInfo(ResourceResolver, String, String).
    • getTeasers

      List<Teaser> getTeasers(ResourceResolver resolver, String location, String pageUrl)
      Returns a list of teasers that are available for a location
      Parameters:
      resolver - a ResourceResolver used to access the repository. Cannot be null
      location - the name of the location for which to return the teasers. Cannot be null
      pageUrl - the url of the page for which to retrieve the teasers. This url includes the extensions and the selectors. If null or empty string then the teasers url won't contain the selectors and the default teaser won't be in the list of teasers returned by this method
      Returns:
      a list of Teaser objects or an empty list if no teasers are found
    • getTeasers

      List<Teaser> getTeasers(SlingHttpServletRequest request, String location)
      Returns a list of teasers that are available for a location
      Parameters:
      request - a SlingHttpServletRequest. Cannot be null
      location - the name of the location for which to return the teasers. Cannot be null
      Returns:
      a list of Teaser objects or an empty list if no teasers are found
    • getCampaigns

      List<Page> getCampaigns(ResourceResolver resourceResolver) throws RepositoryException
      Returns a list of campaigns sorted by priority.
      Parameters:
      resourceResolver - A resourceResolver from the request (for access control).
      Returns:
      returns a list of campaigns sorted by priority.
      Throws:
      RepositoryException - if an error occurs during repository operations.
    • getCampaigns

      List<Page> getCampaigns(ResourceResolver resolver, String location) throws RepositoryException
      Returns a list of campaigns which hold offers with the specified location value.
      Parameters:
      resolver - ResourceResolver bound to the users session
      location - A named destination
      Returns:
      A list of campaigns holding activities offers with the specified location
      Throws:
      RepositoryException - if an error occurs during repository operations.
    • findLocations

      List<Location> findLocations(ResourceResolver resolver, String... locationName)
      Finds the actual content paths for a given list of location names.
      Parameters:
      resolver - a ResourceResolver used to access the repository
      locationName - one or more location names for which to retrieve the path
      Returns:
      a List of Location objects an empty list if no paths were found.
    • getCampaignLocations

      List<Location> getCampaignLocations(ResourceResolver resolver, String campaignPath)
      Retrieves the list of locations for this campaign.
      Parameters:
      resolver - a ResourceResolver used to access the repo
      campaignPath - the path to the campaign
      Returns:
      a List of Location objects or an empty list if the campaign doesn't have any locations (i.e . offers)