Class ExternalRecommendationProvider
java.lang.Object
com.broadleafcommerce.catalogbrowse.service.provider.external.AbstractExternalProvider
com.broadleafcommerce.catalogbrowse.service.provider.external.recommendation.ExternalRecommendationProvider
- All Implemented Interfaces:
RecommendationProvider
public class ExternalRecommendationProvider
extends AbstractExternalProvider
implements RecommendationProvider
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionExternalRecommendationProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper mapper, ExternalRecommendationProviderProperties properties, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildCustomerContextHeader(CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected CustomerContextcreateCustomerContext(CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) fetchRecommendationsForCustomer(RecommendationRequest recommendationRequest, CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves any recommendations for the user based on context.protected com.fasterxml.jackson.databind.ObjectMapperprotected ExternalRecommendationProviderPropertiesprotected Stringprotected com.broadleafcommerce.common.extension.TypeFactoryprotected org.springframework.web.reactive.function.client.WebClientMethods inherited from class com.broadleafcommerce.catalogbrowse.service.provider.external.AbstractExternalProvider
getAuthenticationUtils, getExternalProviderProperties, getHeaders, getHeaders, isCallerWhitelistedService, setAuthenticationUtils, setExternalProviderProperties
-
Field Details
-
CUSTOMER_CONTEXT_HEADER
- See Also:
-
-
Constructor Details
-
ExternalRecommendationProvider
public ExternalRecommendationProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper mapper, ExternalRecommendationProviderProperties properties, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
fetchRecommendationsForCustomer
public UserRecommendation fetchRecommendationsForCustomer(RecommendationRequest recommendationRequest, CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:RecommendationProviderRetrieves any recommendations for the user based on context.- Specified by:
fetchRecommendationsForCustomerin interfaceRecommendationProvider- Parameters:
recommendationRequest- all the relevant information to be used to retrieve recommendationscustomerRef- the customer for which recommendations should be returnedcontextInfo- additional context info needed to query appropriate recommendations- Returns:
- Recommendations for the user provided.
-
buildCustomerContextHeader
protected String buildCustomerContextHeader(CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
createCustomerContext
protected CustomerContext createCustomerContext(CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getServiceClient
-
getWebClient
protected org.springframework.web.reactive.function.client.WebClient getWebClient() -
getMapper
protected com.fasterxml.jackson.databind.ObjectMapper getMapper()- Overrides:
getMapperin classAbstractExternalProvider
-
getProperties
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-