Class ExternalCatalogSearchProvider<T extends Product>

    • Constructor Detail

      • ExternalCatalogSearchProvider

        public ExternalCatalogSearchProvider​(@Qualifier("catalogSearchWebClient")
                                             org.springframework.web.reactive.function.client.WebClient catalogSearchWebClient,
                                             com.fasterxml.jackson.databind.ObjectMapper mapper,
                                             com.broadleafcommerce.common.extension.TypeFactory typeFactory,
                                             PricingProvider browsePricingProvider,
                                             CatalogProvider browseCatalogProvider)
    • Method Detail

      • getHydratedProductSuggestionsPricing

        protected List<Map<String,​Object>> getHydratedProductSuggestionsPricing​(@NonNull
                                                                                      @NonNull List<Map<String,​Object>> suggestions,
                                                                                      @Nullable
                                                                                      com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext,
                                                                                      @Nullable
                                                                                      com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext,
                                                                                      @Nullable
                                                                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Hydrates pricing on product type-ahead suggetsions.
        Parameters:
        suggestions - Suggestions to be hydrated
        priceContext - PriceContext from the original request containing general pricing info
        priceInfoContext - PriceInfoContext from the original request containing info specific for getting PriceInfos such as prefetched PriceLists.
        contextInfo - ContextInfo from the original request containing tenant and sandbox info
        Returns:
        Hydrated product suggestions
      • hydrateProductPricing

        protected void hydrateProductPricing​(@NonNull
                                             @NonNull Collection<T> products,
                                             @Nullable
                                             com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext,
                                             @Nullable
                                             com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext,
                                             @Nullable
                                             com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Hydrates pricing onto the results of a search request.
        Parameters:
        products - The products from the SearchResponse to be hydrated
        priceContext - PriceContext from the original request containing general pricing info
        priceInfoContext - PriceInfoContext from the original request containing info specific for getting PriceInfos such as prefetched PriceLists.
        contextInfo - ContextInfo from the original request containing tenant and sandbox info
      • setProductPriceInfos

        protected void setProductPriceInfos​(@NonNull
                                            @NonNull Collection<T> products,
                                            @Nullable
                                            com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext,
                                            com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Ensures that all Products with simple prices have those replaced with a PriceInfo.
        Parameters:
        products - Search results whose contents to ensure to have a PriceInfos instead of simple prices.
      • hydrateProductAssets

        protected void hydrateProductAssets​(@NonNull
                                            @NonNull Collection<T> products,
                                            @Nullable
                                            org.springframework.util.MultiValueMap<String,​String> parameters,
                                            @Nullable
                                            com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Makes an additional call to the CatalogProvider to hydrate Assets for the search results.

        This hydration is gated by isHydrateAssets().

        Parameters:
        products - The search results.
        parameters - Additional parameters to include the request like filters
        contextInfo - Additional sandbox and multitenant state.
      • hydrateProductTags

        protected void hydrateProductTags​(@NonNull
                                          @NonNull Collection<T> products,
                                          @Nullable
                                          org.springframework.util.MultiValueMap<String,​String> parameters,
                                          @Nullable
                                          com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Makes an additional call to the CatalogProvider to hydrate ProductTags for the search results.
        Parameters:
        products - The search results.
        parameters - Additional parameters to include the request like filters
        contextInfo - Additional sandbox and multitenant state.
      • convertSuggestionsToProducts

        protected List<T> convertSuggestionsToProducts​(@NonNull
                                                       @NonNull List<Map<String,​Object>> suggestions)
      • convertSuggestionsToMap

        protected List<Map<String,​Object>> convertSuggestionsToMap​(@NonNull
                                                                         @NonNull List<T> suggestions)
      • getCatalogSearchWebClient

        protected org.springframework.web.reactive.function.client.WebClient getCatalogSearchWebClient()
      • getTypeFactory

        protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
      • getBrowsePricingProvider

        protected PricingProvider getBrowsePricingProvider()
      • getUrl

        public String getUrl()
        The base url for an external search service: https://localhost:8447/search.
      • setUrl

        public void setUrl​(String url)
        The base url for an external search service: https://localhost:8447/search.
      • getSearchUri

        public String getSearchUri()
        The context path to the catalog search endpoint
      • setSearchUri

        public void setSearchUri​(String searchUri)
        The context path to the catalog search endpoint
      • getSuggestUri

        public String getSuggestUri()
        The context path to the catalog search suggestions endpoint
      • setSuggestUri

        public void setSuggestUri​(String suggestUri)
        The context path to the catalog search suggestions endpoint
      • isHydrateAssets

        public boolean isHydrateAssets()
        Determines whether an additional call to Catalog Services should be made to hydrate the search results with additional product assets.
      • setHydrateAssets

        public void setHydrateAssets​(boolean hydrateAssets)
        Determines whether an additional call to Catalog Services should be made to hydrate the search results with additional product assets.
      • getServiceClient

        public String getServiceClient()
        The service client to use when calling search. Default is "catalogbrowseclient"
      • setServiceClient

        public void setServiceClient​(String serviceClient)
        The service client to use when calling search. Default is "catalogbrowseclient"