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
ConstructorDescriptionExternalCustomerSegmentProvider
(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> T
executeRequest
(Supplier<T> request) Executes a request with default Web Client error handling.protected String
Gets the RSQL filter to read dynamic customer segments.protected ExternalProviderUtility
protected org.springframework.http.HttpHeaders
getHeaders
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.fasterxml.jackson.databind.ObjectMapper
protected String
Gets the service's client ID.protected com.broadleafcommerce.common.extension.TypeFactory
protected org.springframework.web.reactive.function.client.WebClient
readDynamicCustomerSegments
(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 whatCustomerSegments
match 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:CustomerSegmentProvider
Reads all customer segments that can be dynamically applied under the current context for the current user.- Specified by:
readDynamicCustomerSegments
in 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:CustomerSegmentProvider
Sends a request to the Customer provider to evaluate the request to determine whatCustomerSegments
match 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:
resolveCustomerSegmentsForContext
in interfaceCustomerSegmentProvider<P extends CustomerSegment>
- Parameters:
request
- User details for evaluating rule-based customer segmentscontext
- The context details- Returns:
- The
ResolveCustomerSegmentResponse
with 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
-