Class DefaultMarketingMessageUtils
java.lang.Object
com.broadleafcommerce.catalogbrowse.service.DefaultMarketingMessageUtils
- All Implemented Interfaces:
MarketingMessageUtils
Utilities to aid in the retrieval of
MarketingMessages- Author:
- Jon Fleschler (jfleschler)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultMarketingMessageUtils(com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddTargetsForProduct(@NonNull Map<Object, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget>> targetsMap, @NonNull Product product) Adds thePriceableTargets for the givenProductto the given map.protected LineItemDTObuildLineItemFromVariant(@NonNull Product product, @NonNull Variant variant) buildLineItems(@NonNull ProductList productDetails, boolean buildForAllTermsAndFrequencies, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) BuildLineItemDTOs from hydrated product details.fetchPriceInfosWithAllAvailableTermAndFrequencies(@NonNull List<T> products, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetches thePriceInfos for all available term and frequency combinations for the given products.protected PricingProvidergetCategoryIds(Map<String, Object> attributes) protected com.broadleafcommerce.common.extension.TypeFactoryprotected voidpopulateLineItemPricing(@NonNull LineItemDTO item, @NonNull com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) protected voidpopulateLineItemRecurringPricing(@NonNull LineItemDTO item, @NonNull com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) Populates the recurring pricing for the givenLineItemDTObased on the givenPriceInfo.populateProductsWithAllTermsAndFrequencies(@NonNull List<T> products, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates a new list ofProducts for each available term and frequency combination for each product in the input list.voidsetBrowsePricingProvider(PricingProvider browsePricingProvider) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.catalogbrowse.service.MarketingMessageUtils
buildLineItems
-
Constructor Details
-
DefaultMarketingMessageUtils
public DefaultMarketingMessageUtils(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
buildLineItems
public List<LineItemDTO> buildLineItems(@NonNull @NonNull ProductList productDetails, boolean buildForAllTermsAndFrequencies, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketingMessageUtilsBuildLineItemDTOs from hydrated product details.- Specified by:
buildLineItemsin interfaceMarketingMessageUtils- Parameters:
productDetails- the hydrated product detailsbuildForAllTermsAndFrequencies- whether to buildLineItemDTOs for all available terms and frequencies for each product. If true, all available frequencies will be fetched based onProduct.getTerms()andLineItemDTOs are built for each term and frequency combination.priceContext- thePriceContextcontaining details about the currencycontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- list of
LineItemDTOs
-
populateProductsWithAllTermsAndFrequencies
protected <T extends Product> List<T> populateProductsWithAllTermsAndFrequencies(@NonNull @NonNull List<T> products, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates a new list ofProducts for each available term and frequency combination for each product in the input list.This method will fetch the
PriceInfos for all available term and frequency combinations for each product, and clone the product (and variants if it has them) and set the correspondingPriceInfofor each combination.This is to ensure that
MarketingMessages for Offers that are targeting a specific term or frequency will be properly fetched.- Parameters:
products- the list of products to populatepriceContext- thePriceContextcontaining details about the currencycontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a new list of
Products with each available term and frequency combination - Since:
- Catalog Browse Service 2.2.0, Release Train 2.3.0
-
fetchPriceInfosWithAllAvailableTermAndFrequencies
protected <T extends Product> List<com.broadleafcommerce.pricing.client.domain.PriceInfo> fetchPriceInfosWithAllAvailableTermAndFrequencies(@NonNull @NonNull List<T> products, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetches thePriceInfos for all available term and frequency combinations for the given products.This will build a
PriceableTargetfor eachProduct.getTerms()and SKUs.- Parameters:
products- the list of products to fetch thePriceInfos forpriceContext- thePriceContextcontaining details about the currencycontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a list of
PriceInfos for all available term and frequency combinations for the given products - Since:
- Catalog Browse Service 2.2.0, Release Train 2.3.0
-
addTargetsForProduct
protected void addTargetsForProduct(@NonNull @NonNull Map<Object, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget>> targetsMap, @NonNull @NonNull Product product) Adds thePriceableTargets for the givenProductto the given map.This will add a target for the product's SKU and each variant SKU, then duplicated for each
Product.getTerms()if it has any.- Parameters:
targetsMap- a map of SKU toPriceableTargetsproduct- theProductto add the targets for- Since:
- Catalog Browse Service 2.2.0, Release Train 2.3.0
-
buildLineItemFromVariant
protected LineItemDTO buildLineItemFromVariant(@NonNull @NonNull Product product, @NonNull @NonNull Variant variant) -
populateLineItemPricing
protected void populateLineItemPricing(@NonNull @NonNull LineItemDTO item, @NonNull @NonNull com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) -
populateLineItemRecurringPricing
protected void populateLineItemRecurringPricing(@NonNull @NonNull LineItemDTO item, @NonNull @NonNull com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) Populates the recurring pricing for the givenLineItemDTObased on the givenPriceInfo.- Parameters:
item- theLineItemDTOto populatepriceInfo- thePriceInfoto get the recurring pricing from- Since:
- Catalog Browse Service 2.2.0, Release Train 2.3.0
-
getCategoryIds
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getBrowsePricingProvider
-
setBrowsePricingProvider
-