Class ExternalRecommendationProvider

java.lang.Object
com.broadleafcommerce.search.core.service.provider.external.ExternalRecommendationProvider
All Implemented Interfaces:
RecommendationProvider

public class ExternalRecommendationProvider extends Object implements RecommendationProvider
  • Field Details

  • Constructor Details

    • ExternalRecommendationProvider

      public ExternalRecommendationProvider(org.springframework.web.reactive.function.client.WebClient webClient, ExternalSearchRecommendationProperties properties, @Nullable com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper mapper)
  • Method Details

    • readRecommendationsByCustomer

      public SearchRecommendation readRecommendationsByCustomer(com.broadleafcommerce.search.api.domain.CustomerContext customerContext, int numberOfRecommendations, String recommendationType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: RecommendationProvider
      Reads a list of SearchRecommendations for the given userId.
      Specified by:
      readRecommendationsByCustomer in interface RecommendationProvider
      numberOfRecommendations - the number of recommendations to fetch
      contextInfo - context information around sandbox and multitenant state
      Returns:
      A list of search recommendations
    • buildCustomerContextHeader

      protected String buildCustomerContextHeader(com.broadleafcommerce.search.api.domain.CustomerContext customerContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • buildRecommendationsUri

      protected URI buildRecommendationsUri()
    • getHeaders

      protected org.springframework.http.HttpHeaders getHeaders(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Builds the headers to be passed along with the request to the provider.
      Parameters:
      contextInfo - ContextInfo from the original request containing tenant and sandbox info
      Returns:
      The headers to be passed along with the request to the provider.
    • getServiceClient

      protected String getServiceClient()
    • getWebClient

      protected org.springframework.web.reactive.function.client.WebClient getWebClient()
    • getProperties

      protected ExternalSearchRecommendationProperties getProperties()
    • getCacheStateManager

      @Nullable protected com.broadleafcommerce.common.extension.cache.CacheStateManager getCacheStateManager()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
    • getMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getMapper()