Class ExternalCatalogProvider
- java.lang.Object
-
- com.broadleafcommerce.catalogbrowse.service.provider.external.AbstractExternalProvider
-
- com.broadleafcommerce.catalogbrowse.service.provider.external.catalog.ExternalCatalogProvider
-
- All Implemented Interfaces:
CatalogProvider
@ConfigurationProperties("broadleaf.catalogbrowse.catalogprovider") public class ExternalCatalogProvider extends AbstractExternalProvider implements CatalogProviderConnects to an external catalog service.- Author:
- Nathan Moore (nathandmoore)
-
-
Constructor Summary
Constructors Constructor Description ExternalCatalogProvider(org.springframework.web.reactive.function.client.WebClient catalogBrowseWebClient, com.fasterxml.jackson.databind.ObjectMapper mapper, PricingProvider browsePricingProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.springframework.util.MultiValueMap<String,String>dataDrivenEnumDetailsRequestToParams(@NonNull DataDrivenEnumDetailsRequest detailsRequest)Converts aDataDrivenEnumDetailsRequestto request params.BrowseEntityDetailsfetchBrowseEntityDetails(@NonNull BrowseDetailsRequest request)Retrieves a product list or category that matches the givenrequest.CategoryfetchCategoryWithDetails(@NonNull CategoryDetailsRequest request)Retrieves the category with details for the request.DataDrivenEnumListfetchDataDrivenEnumsWithDetails(@NonNull DataDrivenEnumDetailsRequest request)Retrieves the data driven enum list with details for the request.ProductListfetchProductsWithDetails(@NonNull ProductDetailsRequest request)Retrieves the product list with details for the request.StringgetBrowseEntitiesUri()The URI path for retrieving browse entities when the type is not known by the caller.protected PricingProvidergetBrowsePricingProvider()protected org.springframework.web.reactive.function.client.WebClientgetCatalogBrowseWebClient()StringgetCategoriesUri()The URI path for retrieving categories.StringgetDataDrivenEnumsUri()The URI path for retrieving data driven enums.StringgetProductAssetsUri()The URI path for retrieving product assets.StringgetProductsUri()The URI path for retrieving products.StringgetProductTagsUri()The URI path for retrieving product tags.StringgetServiceClient()The service client to use when interacting with catalog.protected com.broadleafcommerce.common.extension.TypeFactorygetTypeFactory()StringgetUrl()The base url for an external catalog service:https://localhost:8447/catalog.<T extends Product>
voidhydrateProductAssets(@NonNull Collection<T> products, org.springframework.util.MultiValueMap<String,String> parameters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Retrieves theAssetsfor the providedproductsand populates them ontoProduct.setAssets(java.util.List<com.broadleafcommerce.catalogbrowse.domain.Asset>).protected <T extends Product>
List<T>hydrateProductsPricing(@NonNull List<T> toHydrate, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Hydrates pricing onto the retrieved products.<T extends Product>
voidhydrateProductTags(@NonNull Collection<T> products, org.springframework.util.MultiValueMap<String,String> parameters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Retrieves theProductTagsfor the providedproductsand populates them ontoProduct.getAdvancedTags().voidsetBrowseEntitiesUri(String browseEntitiesUri)The URI path for retrieving browse entities when the type is not known by the caller.voidsetCategoriesUri(String categoriesUri)The URI path for retrieving categories.voidsetDataDrivenEnumsUri(String dataDrivenEnumsUri)The URI path for retrieving data driven enums.voidsetProductAssetsUri(String productAssetsUri)The URI path for retrieving product assets.voidsetProductsUri(String productsUri)The URI path for retrieving products.voidsetProductTagsUri(String productTagsUri)The URI path for retrieving product tags.voidsetServiceClient(String serviceClient)The service client to use when interacting with catalog.voidsetUrl(String url)The base url for an external catalog service:https://localhost:8447/catalog.-
Methods inherited from class com.broadleafcommerce.catalogbrowse.service.provider.external.AbstractExternalProvider
getHeaders, getMapper
-
-
-
-
Constructor Detail
-
ExternalCatalogProvider
public ExternalCatalogProvider(@Qualifier("catalogBrowseWebClient") org.springframework.web.reactive.function.client.WebClient catalogBrowseWebClient, com.fasterxml.jackson.databind.ObjectMapper mapper, PricingProvider browsePricingProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Detail
-
fetchProductsWithDetails
public ProductList fetchProductsWithDetails(@NonNull @NonNull ProductDetailsRequest request)
Description copied from interface:CatalogProviderRetrieves the product list with details for the request.- Specified by:
fetchProductsWithDetailsin interfaceCatalogProvider- Parameters:
request- All of the relevant information to be used to retrieve a product's details- Returns:
- The product list for the parameters provided.
-
fetchCategoryWithDetails
public Category fetchCategoryWithDetails(@NonNull @NonNull CategoryDetailsRequest request)
Description copied from interface:CatalogProviderRetrieves the category with details for the request.- Specified by:
fetchCategoryWithDetailsin interfaceCatalogProvider- Parameters:
request- All of the relevant information to be used to retrieve a category's details- Returns:
- The category for the parameters provided.
-
fetchDataDrivenEnumsWithDetails
public DataDrivenEnumList fetchDataDrivenEnumsWithDetails(@NonNull @NonNull DataDrivenEnumDetailsRequest request)
Description copied from interface:CatalogProviderRetrieves the data driven enum list with details for the request.- Specified by:
fetchDataDrivenEnumsWithDetailsin interfaceCatalogProvider- Parameters:
request- All of the relevant information to be used to retrieve a list of data driven enum with their details- Returns:
- The data driven enum list for the parameters provided.
-
dataDrivenEnumDetailsRequestToParams
protected org.springframework.util.MultiValueMap<String,String> dataDrivenEnumDetailsRequestToParams(@NonNull @NonNull DataDrivenEnumDetailsRequest detailsRequest)
Converts aDataDrivenEnumDetailsRequestto request params.- Parameters:
detailsRequest- theDataDrivenEnumDetailsRequestto convert- Returns:
- a map of query parameters
-
hydrateProductAssets
public <T extends Product> void hydrateProductAssets(@NonNull @NonNull Collection<T> products, @Nullable org.springframework.util.MultiValueMap<String,String> parameters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:CatalogProviderRetrieves theAssetsfor the providedproductsand populates them ontoProduct.setAssets(java.util.List<com.broadleafcommerce.catalogbrowse.domain.Asset>).Note that this is only necessary if assets are requested separately from product details such as for hydrating search results. Otherwise, they are already hydrated on the results of
CatalogProvider.fetchProductsWithDetails(com.broadleafcommerce.catalogbrowse.domain.ProductDetailsRequest)andCatalogProvider.fetchCategoryWithDetails(com.broadleafcommerce.catalogbrowse.domain.CategoryDetailsRequest).- Specified by:
hydrateProductAssetsin interfaceCatalogProvider- Parameters:
products-Productsto hydrate.parameters- Request parameters to include when fetching assetscontextInfo- Additional sandbox and multitenant info.
-
hydrateProductTags
public <T extends Product> void hydrateProductTags(@NonNull @NonNull Collection<T> products, @Nullable org.springframework.util.MultiValueMap<String,String> parameters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:CatalogProviderRetrieves theProductTagsfor the providedproductsand populates them ontoProduct.getAdvancedTags().- Specified by:
hydrateProductTagsin interfaceCatalogProvider- Parameters:
products-Productsto hydrate.parameters- Request parameters to include when fetching assetscontextInfo- Additional sandbox and multitenant info.
-
fetchBrowseEntityDetails
public BrowseEntityDetails fetchBrowseEntityDetails(@NonNull @NonNull BrowseDetailsRequest request)
Description copied from interface:CatalogProviderRetrieves a product list or category that matches the givenrequest.- Specified by:
fetchBrowseEntityDetailsin interfaceCatalogProvider- Parameters:
request- All of the relevant information to be used to retrieve a browse entity's details such as a list of URIs.- Returns:
- The details of the browse entities matching the
request
-
hydrateProductsPricing
protected <T extends Product> List<T> hydrateProductsPricing(@NonNull @NonNull List<T> toHydrate, @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 retrieved products.- Type Parameters:
T- The type of theProducts- Parameters:
toHydrate- Products to hydratepriceContext-PriceContextfrom the originating requestpriceInfoContext-PriceInfoContextfrom the originating requestcontextInfo- Multitenant and sandbox info- Returns:
- A pricing-hydrated list of the provided products.
-
getCatalogBrowseWebClient
protected org.springframework.web.reactive.function.client.WebClient getCatalogBrowseWebClient()
-
getBrowsePricingProvider
protected PricingProvider getBrowsePricingProvider()
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
getUrl
public String getUrl()
The base url for an external catalog service:https://localhost:8447/catalog.
-
setUrl
public void setUrl(String url)
The base url for an external catalog service:https://localhost:8447/catalog.
-
getProductsUri
public String getProductsUri()
The URI path for retrieving products. This is appended tourl.
-
setProductsUri
public void setProductsUri(String productsUri)
The URI path for retrieving products. This is appended tourl.
-
getProductAssetsUri
public String getProductAssetsUri()
The URI path for retrieving product assets. This is appended toproductsUri. Note that this is only necessary if assets are requested separately from product details such as for hydrating search results. Otherwise, they are already hydrated on the results offetchProductsWithDetails(com.broadleafcommerce.catalogbrowse.domain.ProductDetailsRequest)andfetchCategoryWithDetails(com.broadleafcommerce.catalogbrowse.domain.CategoryDetailsRequest).
-
setProductAssetsUri
public void setProductAssetsUri(String productAssetsUri)
The URI path for retrieving product assets. This is appended toproductsUri. Note that this is only necessary if assets are requested separately from product details such as for hydrating search results. Otherwise, they are already hydrated on the results offetchProductsWithDetails(com.broadleafcommerce.catalogbrowse.domain.ProductDetailsRequest)andfetchCategoryWithDetails(com.broadleafcommerce.catalogbrowse.domain.CategoryDetailsRequest).
-
getCategoriesUri
public String getCategoriesUri()
The URI path for retrieving categories.
-
setCategoriesUri
public void setCategoriesUri(String categoriesUri)
The URI path for retrieving categories.
-
getBrowseEntitiesUri
public String getBrowseEntitiesUri()
The URI path for retrieving browse entities when the type is not known by the caller. This could be the case when the caller has a browser URL but does not know if it belongs to a Catalog or a Product.
-
setBrowseEntitiesUri
public void setBrowseEntitiesUri(String browseEntitiesUri)
The URI path for retrieving browse entities when the type is not known by the caller. This could be the case when the caller has a browser URL but does not know if it belongs to a Catalog or a Product.
-
getDataDrivenEnumsUri
public String getDataDrivenEnumsUri()
The URI path for retrieving data driven enums.
-
setDataDrivenEnumsUri
public void setDataDrivenEnumsUri(String dataDrivenEnumsUri)
The URI path for retrieving data driven enums.
-
getProductTagsUri
public String getProductTagsUri()
The URI path for retrieving product tags. This is appended toproductsUri. Note that this is only necessary if tags are requested separately from product details such as for hydrating search results. Otherwise, they are already hydrated on the results offetchProductsWithDetails(com.broadleafcommerce.catalogbrowse.domain.ProductDetailsRequest)andfetchCategoryWithDetails(com.broadleafcommerce.catalogbrowse.domain.CategoryDetailsRequest).
-
setProductTagsUri
public void setProductTagsUri(String productTagsUri)
The URI path for retrieving product tags. This is appended toproductsUri. Note that this is only necessary if tags are requested separately from product details such as for hydrating search results. Otherwise, they are already hydrated on the results offetchProductsWithDetails(com.broadleafcommerce.catalogbrowse.domain.ProductDetailsRequest)andfetchCategoryWithDetails(com.broadleafcommerce.catalogbrowse.domain.CategoryDetailsRequest).
-
getServiceClient
public String getServiceClient()
The service client to use when interacting with catalog. Default is "catalogbrowseclient"
-
setServiceClient
public void setServiceClient(String serviceClient)
The service client to use when interacting with catalog. Default is "catalogbrowseclient"
-
-