Class ExternalRecommendationProvider
java.lang.Object
com.broadleafcommerce.search.core.service.provider.external.ExternalRecommendationProvider
- All Implemented Interfaces:
RecommendationProvider
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionExternalRecommendationProvider
(org.springframework.web.reactive.function.client.WebClient webClient, ExternalSearchRecommendationProperties properties, com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper mapper) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
buildCustomerContextHeader
(com.broadleafcommerce.search.api.domain.CustomerContext customerContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected URI
protected com.broadleafcommerce.common.extension.cache.CacheStateManager
protected org.springframework.http.HttpHeaders
getHeaders
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds the headers to be passed along with the request to the provider.protected com.fasterxml.jackson.databind.ObjectMapper
protected ExternalSearchRecommendationProperties
protected String
protected com.broadleafcommerce.common.extension.TypeFactory
protected org.springframework.web.reactive.function.client.WebClient
readRecommendationsByCustomer
(com.broadleafcommerce.search.api.domain.CustomerContext customerContext, int numberOfRecommendations, String recommendationType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads a list ofSearchRecommendations
for the givenuserId
.
-
Field Details
-
SEARCH_RECOMMENDATION_CACHE
- See Also:
-
-
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 ofSearchRecommendations
for the givenuserId
.- Specified by:
readRecommendationsByCustomer
in interfaceRecommendationProvider
numberOfRecommendations
- the number of recommendations to fetchcontextInfo
- 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
-
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
-
getWebClient
protected org.springframework.web.reactive.function.client.WebClient getWebClient() -
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()
-