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 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 interface CustomerSegmentProvider<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 what CustomerSegments match the context. This relies on the provider to evaluate any rules against the context rather than doing them in the client. See CustomerSegment.isInternalEvaluationRequired().
      Specified by:
      resolveCustomerSegmentsForContext in interface CustomerSegmentProvider<P extends CustomerSegment>
      Parameters:
      request - User details for evaluating rule-based customer segments
      context - The context details
      Returns:
      The ResolveCustomerSegmentResponse with the matching segments.
    • getDynamicCustomerSegmentsFilter

      protected String getDynamicCustomerSegmentsFilter()
      Gets the RSQL filter to read dynamic customer segments.
      Returns:
      The RSQL filter to read dynamic customer segments.
    • getServiceClient

      protected String getServiceClient()
      Gets the service's client ID.
      Returns:
      The service's client ID.
    • executeRequest

      protected <T> T executeRequest(Supplier<T> request)
      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

      protected ExternalCustomerSegmentProviderProperties getProperties()
    • getExternalProviderUtility

      protected ExternalProviderUtility getExternalProviderUtility()