Interface ProductHydrationService
- All Known Implementing Classes:
DefaultProductHydrationService
public interface ProductHydrationService
Responsible for performing simple hydration of references within
Products
by
querying for those references and populating their full values.
By default, the following references will be hydrated in hydrate(Product, ContextInfo)
and hydrate(Page, ContextInfo)
:
Product.getPrimaryAsset()
Product.getPrimaryCategory()
Product.getBrand()
Product.getMerchandisingType()
Product.getTargetDemographic()
- For each of the
Product.includedProducts
: - For each of the
Product.options
with anProductOption.itemChoice
:
For a much more comprehensive and deeper aggregation of product data, see
ProductConsolidationService
.
- Author:
- Samarth Dhruva (samarthd)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionhydrate
(ProductOption unhydrated, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets the IDs of items that are referenced by theunhydrated
option, finds the referenced items in the data store, and then replaces each item reference on the option with the fully-populated representation of the item.hydrate
(Product unhydrated, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets the IDs of items that are referenced by theunhydrated
product, finds the referenced items in the data store, and then replaces each item reference on the product with the fully-populated representation of the item.org.springframework.data.domain.Page<Product>
hydrate
(org.springframework.data.domain.Page<Product> unhydrated, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets the IDs of items that are referenced by each product, finds the referenced items in the data store, and then replaces each item reference on the product with the fully-populated representation of the item.org.springframework.data.domain.Page<Product>
hydratePrimaryAssets
(org.springframework.data.domain.Page<Product> unhydrated, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Specifically finds and hydrates theProduct.primaryAsset
of each product in the given page.
-
Method Details
-
hydrate
Product hydrate(Product unhydrated, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets the IDs of items that are referenced by theunhydrated
product, finds the referenced items in the data store, and then replaces each item reference on the product with the fully-populated representation of the item.The class-level javadoc above describes the references which will be hydrated by default.
- Parameters:
unhydrated
- the unhydrated product whose references should be hydrated- Returns:
- the product after applying the hydration
-
hydrate
org.springframework.data.domain.Page<Product> hydrate(org.springframework.data.domain.Page<Product> unhydrated, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets the IDs of items that are referenced by each product, finds the referenced items in the data store, and then replaces each item reference on the product with the fully-populated representation of the item.A page of those hydrated products is then returned.
The class-level javadoc above describes the references which will be hydrated by default.
- Parameters:
unhydrated
- the page of unhydrated products whose references should be hydratedcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- a page of the hydrated products
-
hydratePrimaryAssets
org.springframework.data.domain.Page<Product> hydratePrimaryAssets(org.springframework.data.domain.Page<Product> unhydrated, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Specifically finds and hydrates theProduct.primaryAsset
of each product in the given page.- Parameters:
unhydrated
- the page of unhydrated products whose primary assets should be hydratedcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- a page of the hydrated products
-
hydrate
ProductOption hydrate(ProductOption unhydrated, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets the IDs of items that are referenced by theunhydrated
option, finds the referenced items in the data store, and then replaces each item reference on the option with the fully-populated representation of the item.The class-level javadoc above describes the references which will be hydrated by default.
- Parameters:
unhydrated
- the unhydrated option whose references should be hydratedcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the option after applying the hydration
-