Class RelatedDataDrivenEnumsProductContextContributor
java.lang.Object
com.broadleafcommerce.catalog.service.product.commerce.context.contributor.RelatedDataDrivenEnumsProductContextContributor
- All Implemented Interfaces:
ProductDetailsContextContributor
,org.springframework.core.Ordered
public class RelatedDataDrivenEnumsProductContextContributor
extends Object
implements ProductDetailsContextContributor
Contributes all of the related
DataDrivenEnums
to the
ProductDetailsContext
.- Author:
- Sunny Yu
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionRelatedDataDrivenEnumsProductContextContributor
(DataDrivenEnumService<DataDrivenEnum> dataDrivenEnumService) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDataDrivenEnumIdByProductId
(DataDrivenEnum dataDrivenEnum, String productId, Map<String, Set<String>> enumIdsByProductId) protected void
<T extends ProductDetailsContext>
Collection<T>contribute
(@NonNull Collection<T> productDetailsContexts, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Contributes to the suppliedProductDetailsContext
.getDataDrivenEnumIdsByProductId
(@NonNull Collection<? extends ProductDetailsContext> productDetailsContexts) Gets a set of referenced data driven enum ids mapped by the resolved product id.protected DataDrivenEnumService<DataDrivenEnum>
int
getOrder()
protected void
setDataDrivenEnums
(@NonNull Collection<? extends ProductDetailsContext> productDetailsContexts, List<DataDrivenEnum> dataDrivenEnumsForAllProducts, Map<String, Set<String>> enumIdsByProductId)
-
Field Details
-
DEFAULT_ORDER
public static final int DEFAULT_ORDER- See Also:
-
-
Constructor Details
-
RelatedDataDrivenEnumsProductContextContributor
public RelatedDataDrivenEnumsProductContextContributor(DataDrivenEnumService<DataDrivenEnum> dataDrivenEnumService)
-
-
Method Details
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
contribute
public <T extends ProductDetailsContext> Collection<T> contribute(@NonNull @NonNull Collection<T> productDetailsContexts, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ProductDetailsContextContributor
Contributes to the suppliedProductDetailsContext
. This should not mutate the inputted context, but return a new one with the new contributions.- Specified by:
contribute
in interfaceProductDetailsContextContributor
- Parameters:
productDetailsContexts
- The contexts to which to contributecontextInfo
- context information surrounding sandboxing/multitenant state- Returns:
- A version of the supplied
ProductDetailsContext
with the new contributions.
-
getDataDrivenEnumIdsByProductId
protected Map<String,Set<String>> getDataDrivenEnumIdsByProductId(@NonNull @NonNull Collection<? extends ProductDetailsContext> productDetailsContexts) Gets a set of referenced data driven enum ids mapped by the resolved product id.- Parameters:
productDetailsContexts
- a collection ofProductDetailsContext
to get the resolved product and its referenced data driven enums from- Returns:
- a set of referenced data driven enum ids mapped by the resolved product id
-
addDataDrivenEnumIdsForProduct
-
addDataDrivenEnumIdByProductId
-
setDataDrivenEnums
protected void setDataDrivenEnums(@NonNull @NonNull Collection<? extends ProductDetailsContext> productDetailsContexts, List<DataDrivenEnum> dataDrivenEnumsForAllProducts, Map<String, Set<String>> enumIdsByProductId) -
getDataDrivenEnumService
-