Class PricingEntityContributor
java.lang.Object
com.broadleafcommerce.datafeed.service.collector.product.PricingEntityContributor
- All Implemented Interfaces:
- CollectedEntityContributor,- org.springframework.core.Ordered
Contributes dynamic/advanced Pricing data to the Products that are collected for a Data Feed.
- Author:
- Kelly Tisdell (ktisdell)
- 
Field SummaryFieldsFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructorsConstructorDescriptionPricingEntityContributor(PricingProvider externalPricingProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application> applicationService, List<ProductPriceableTargetsBuilder> productPriceableTargetsBuilders, CollectedProductJsonAccessorUtils collectedProductJsonAccessorUtils) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidassignDefaultProductPriceInfos(@NonNull List<CollectedProduct> products, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidassignPriceInfosToProducts(@NonNull List<CollectedProduct> products, @NonNull Map<Object, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget>> targetsMap, @NonNull List<com.broadleafcommerce.pricing.client.domain.PriceInfo> priceInfos, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, @NonNull DataFeedCollectionRequest request, @NonNull Map<String, Object> processState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) booleancanHandle(@NonNull Class<?> entityType, @NonNull DataFeedCollectionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Indicates if thisCollectedEntityContributorcan handle the given batch of collected entities.protected <T extends com.broadleafcommerce.pricing.client.domain.PriceInfo>
 Optional<T>checkForPriceInfoForVariantFromPriceList(List<T> candidatePriceInfos, VariantSummary variant) protected com.broadleafcommerce.pricing.client.domain.context.PriceContextconstructPriceContext(@NonNull List<CollectedProduct> products, @NonNull DataFeedCollectionRequest request, @NonNull Map<String, Object> processState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Constructs aPriceContextusing theApplicationassociated with theDataFeedProcessExecution.getApplicationId().protected com.broadleafcommerce.pricing.client.domain.context.PriceInfoContextconstructPriceInfoContext(@NonNull List<CollectedProduct> products, @NonNull Map<Object, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget>> targetsMap, @NonNull DataFeedCollectionRequest request, @NonNull Map<String, Object> processState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) voidcontribute(@NonNull List<? extends CollectedEntity<?>> entities, @NonNull DataFeedCollectionRequest request, @NonNull Map<String, Object> processState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hook point to allow the augmentation or decoration of a batch of entities that have been fetched, but that may need additional data from other sources.createTargetsMap(@NonNull List<CollectedProduct> products, @NonNull DataFeedCollectionRequest request, @NonNull Map<String, Object> processState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected <T extends com.broadleafcommerce.pricing.client.domain.PriceInfo>
 List<T>filterPriceInfosForCurrency(List<T> priceInfos, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext) protected <T extends com.broadleafcommerce.pricing.client.domain.PriceInfo>
 voidfixStandardPriceIfNeeded(T variantPriceInfo, List<T> candidatePriceInfos) protected com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application>protected CollectedProductJsonAccessorUtilsprotected PricingProviderprotected <T extends com.broadleafcommerce.pricing.client.domain.PriceInfo>
 Optional<T>getPriceInfoForPriceableEntity(Priceable entity, List<T> candidatePriceInfos, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext) protected List<ProductPriceableTargetsBuilder>protected com.broadleafcommerce.common.extension.TypeFactoryprotected <T extends com.broadleafcommerce.pricing.client.domain.PriceInfo>
 Optional<T>hasPriceInfoFromPriceList(List<T> candidatePriceInfos) protected booleanisBasePrice(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) protected booleanisBaseSalePrice(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) protected booleanisDirectVariantPrice(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, VariantSummary variant) protected booleanisTargetingVariantSku(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, VariantSummary variant) protected com.broadleafcommerce.data.tracking.core.tenant.domain.ApplicationreadApplication(@NonNull DataFeedCollectionRequest request, @NonNull Map<String, Object> processState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.datafeed.service.collector.CollectedEntityContributorgetOrder
- 
Field Details- 
INCLUDED_PRODUCT_PRICING_TARGET_TYPE- See Also:
 
 
- 
- 
Constructor Details- 
PricingEntityContributorpublic PricingEntityContributor(PricingProvider externalPricingProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application> applicationService, List<ProductPriceableTargetsBuilder> productPriceableTargetsBuilders, CollectedProductJsonAccessorUtils collectedProductJsonAccessorUtils) 
 
- 
- 
Method Details- 
canHandlepublic boolean canHandle(@NonNull @NonNull Class<?> entityType, @NonNull @NonNull DataFeedCollectionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CollectedEntityContributorIndicates if thisCollectedEntityContributorcan handle the given batch of collected entities.- Specified by:
- canHandlein interface- CollectedEntityContributor
- Parameters:
- entityType- the class that represents the batch of items to receive contributions
- request- the original request
- contextInfo- the context info associated with this process
- Returns:
 
- 
contributepublic void contribute(@NonNull @NonNull List<? extends CollectedEntity<?>> entities, @NonNull @NonNull DataFeedCollectionRequest request, @NonNull @NonNull Map<String, Object> processState, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CollectedEntityContributorHook point to allow the augmentation or decoration of a batch of entities that have been fetched, but that may need additional data from other sources.- Specified by:
- contributein interface- CollectedEntityContributor
- Parameters:
- entities- the List of entities that may require contributions
- request- the original request
- processState- A Map of shared context for storing details of the collection process - expected to be thread-safe
- contextInfo- the context info associated with this process
 
- 
constructPriceContextprotected com.broadleafcommerce.pricing.client.domain.context.PriceContext constructPriceContext(@NonNull @NonNull List<CollectedProduct> products, @NonNull @NonNull DataFeedCollectionRequest request, @NonNull @NonNull Map<String, Object> processState, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Constructs aPriceContextusing theApplicationassociated with theDataFeedProcessExecution.getApplicationId(). The Application instance is fetched from the DB and provides the default locale and currency to the PriceContext. By default, the constructed PriceContext also has an anonymous customerUserTargetRefassigned to it.- Parameters:
- products-
- request-
- processState-
- contextInfo-
- Returns:
 
- 
constructPriceInfoContextprotected com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext constructPriceInfoContext(@NonNull @NonNull List<CollectedProduct> products, @NonNull @NonNull Map<Object, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget>> targetsMap, @NonNull @NonNull DataFeedCollectionRequest request, @NonNull @NonNull Map<String, Object> processState, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) 
- 
createTargetsMapprotected Map<Object,Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget>> createTargetsMap(@NonNull @NonNull List<CollectedProduct> products, @NonNull @NonNull DataFeedCollectionRequest request, @NonNull @NonNull Map<String, Object> processState, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) 
- 
assignDefaultProductPriceInfosprotected void assignDefaultProductPriceInfos(@NonNull @NonNull List<CollectedProduct> products, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) 
- 
assignPriceInfosToProductsprotected void assignPriceInfosToProducts(@NonNull @NonNull List<CollectedProduct> products, @NonNull @NonNull Map<Object, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget>> targetsMap, @NonNull @NonNull List<com.broadleafcommerce.pricing.client.domain.PriceInfo> priceInfos, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, @NonNull @NonNull DataFeedCollectionRequest request, @NonNull @NonNull Map<String, Object> processState, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) 
- 
getPriceInfoForPriceableEntity
- 
checkForPriceInfoForVariantFromPriceListprotected <T extends com.broadleafcommerce.pricing.client.domain.PriceInfo> Optional<T> checkForPriceInfoForVariantFromPriceList(List<T> candidatePriceInfos, VariantSummary variant) 
- 
isDirectVariantPriceprotected boolean isDirectVariantPrice(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, VariantSummary variant) 
- 
isTargetingVariantSkuprotected boolean isTargetingVariantSku(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, VariantSummary variant) 
- 
fixStandardPriceIfNeededprotected <T extends com.broadleafcommerce.pricing.client.domain.PriceInfo> void fixStandardPriceIfNeeded(T variantPriceInfo, List<T> candidatePriceInfos) 
- 
hasPriceInfoFromPriceList
- 
isBasePriceprotected boolean isBasePrice(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) 
- 
isBaseSalePriceprotected boolean isBaseSalePrice(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) 
- 
filterPriceInfosForCurrency
- 
readApplicationprotected com.broadleafcommerce.data.tracking.core.tenant.domain.Application readApplication(@NonNull @NonNull DataFeedCollectionRequest request, @NonNull @NonNull Map<String, Object> processState, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) 
- 
getExternalPricingProvider
- 
getTypeFactoryprotected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
- 
getApplicationServiceprotected com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application> getApplicationService()
- 
getProductPriceableTargetsBuilders
- 
getCollectedProductJsonAccessorUtils
 
-