Class ExternalCustomerSegmentProvider<P extends CustomerSegment>
java.lang.Object
com.broadleafcommerce.customer.client.provider.external.ExternalCustomerSegmentProvider<P>
- All Implemented Interfaces:
CustomerSegmentProvider<P>
public class ExternalCustomerSegmentProvider<P extends CustomerSegment>
extends Object
implements CustomerSegmentProvider<P>
-
Constructor Summary
ConstructorsConstructorDescriptionExternalCustomerSegmentProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalCustomerSegmentProviderProperties properties, ExternalProviderUtility externalProviderUtility) -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> TexecuteRequest(Supplier<T> request) Executes a request with default Web Client error handling.protected StringGets the RSQL filter to read dynamic customer segments.protected ExternalProviderUtilityprotected org.springframework.http.HttpHeadersgetHeaders(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.fasterxml.jackson.databind.ObjectMapperprotected StringGets the service's client ID.protected com.broadleafcommerce.common.extension.TypeFactoryprotected org.springframework.web.reactive.function.client.WebClientreadDynamicCustomerSegments(com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads all customer segments that can be dynamically applied under the current context for the current user.resolveCustomerSegmentsForContext(@NonNull ResolveCustomerSegmentsRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Sends a request to the Customer provider to evaluate the request to determine whatCustomerSegmentsmatch the context.
-
Constructor Details
-
ExternalCustomerSegmentProvider
public ExternalCustomerSegmentProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalCustomerSegmentProviderProperties properties, ExternalProviderUtility externalProviderUtility)
-
-
Method Details
-
readDynamicCustomerSegments
public List<P> readDynamicCustomerSegments(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:CustomerSegmentProviderReads all customer segments that can be dynamically applied under the current context for the current user.- Specified by:
readDynamicCustomerSegmentsin interfaceCustomerSegmentProvider<P extends CustomerSegment>- Parameters:
context- The context details- Returns:
- a List of rule-based dynamic customer segments
-
resolveCustomerSegmentsForContext
public ResolveCustomerSegmentResponse resolveCustomerSegmentsForContext(@NonNull @NonNull ResolveCustomerSegmentsRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:CustomerSegmentProviderSends a request to the Customer provider to evaluate the request to determine whatCustomerSegmentsmatch the context. This relies on the provider to evaluate any rules against the context rather than doing them in the client. SeeCustomerSegment.isInternalEvaluationRequired().- Specified by:
resolveCustomerSegmentsForContextin interfaceCustomerSegmentProvider<P extends CustomerSegment>- Parameters:
request- User details for evaluating rule-based customer segmentscontext- The context details- Returns:
- The
ResolveCustomerSegmentResponsewith the matching segments.
-
getDynamicCustomerSegmentsFilter
Gets the RSQL filter to read dynamic customer segments.- Returns:
- The RSQL filter to read dynamic customer segments.
-
getServiceClient
Gets the service's client ID.- Returns:
- The service's client ID.
-
executeRequest
Executes a request with default Web Client error handling.- Type Parameters:
T- the return type of the request operation- Parameters:
request- the request to execute- Returns:
- the value generated by the supplier
-
getHeaders
protected org.springframework.http.HttpHeaders getHeaders(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getWebClient
protected org.springframework.web.reactive.function.client.WebClient getWebClient() -
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getProperties
-
getExternalProviderUtility
-