Interface TargetedContentManager


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

      • getTeaserInfo

        JSONObject getTeaserInfo​(ResourceResolver resolver,
                                 java.lang.String campaignPath,
                                 java.lang.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
      • getTeasers

        java.util.List<Teaser> getTeasers​(ResourceResolver resolver,
                                          java.lang.String location,
                                          java.lang.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

        java.util.List<Teaser> getTeasers​(SlingHttpServletRequest request,
                                          java.lang.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

        java.util.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

        java.util.List<Page> getCampaigns​(ResourceResolver resolver,
                                          java.lang.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

        java.util.List<Location> findLocations​(ResourceResolver resolver,
                                               java.lang.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

        java.util.List<Location> getCampaignLocations​(ResourceResolver resolver,
                                                      java.lang.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)