Class RelatedVariantsCategoryContextContributor
java.lang.Object
com.broadleafcommerce.catalog.service.category.commerce.context.contributor.RelatedVariantsCategoryContextContributor
- All Implemented Interfaces:
CategoryDetailsContextContributor
,org.springframework.core.Ordered
public class RelatedVariantsCategoryContextContributor
extends Object
implements CategoryDetailsContextContributor
Contributes all of the related
Variants
to the CategoryDetailsContext
.
This will look for direct variants of the related products.
This should be run after RelatedProductsCategoryContextContributor
to allow us to gather
all the variants at once.
Extend contributeOtherVariantIds(com.broadleafcommerce.catalog.domain.category.commerce.CategoryDetailsContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo)
to contribute other variant IDs before fetching all of
the related variants.
- Author:
- Nathan Moore (nathandmoore)
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionRelatedVariantsCategoryContextContributor
(VariantService<Variant> variantService, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptioncontribute
(@NonNull CategoryDetailsContext categoryDetailsContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Contributes to the suppliedCategoryDetailsContext
.contributeOtherVariantIds
(@NonNull CategoryDetailsContext categoryDetailsContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Extension point for contributing other variant IDs to the set.int
getOrder()
protected com.broadleafcommerce.common.extension.TypeFactory
protected VariantService<Variant>
-
Field Details
-
DEFAULT_ORDER
public static final int DEFAULT_ORDER- See Also:
-
-
Constructor Details
-
RelatedVariantsCategoryContextContributor
public RelatedVariantsCategoryContextContributor(VariantService<Variant> variantService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
contribute
public CategoryDetailsContext contribute(@NonNull @NonNull CategoryDetailsContext categoryDetailsContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CategoryDetailsContextContributor
Contributes to the suppliedCategoryDetailsContext
. This should not mutate the inputted context, but return a new one with the new contributions.- Specified by:
contribute
in interfaceCategoryDetailsContextContributor
- Parameters:
categoryDetailsContext
- The context to which to contributecontextInfo
- context information surrounding sandboxing/multitenant state- Returns:
- A version of the supplied
CategoryDetailsContext
with the new contributions.
-
contributeOtherVariantIds
protected Set<String> contributeOtherVariantIds(@NonNull @NonNull CategoryDetailsContext categoryDetailsContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Extension point for contributing other variant IDs to the set.- Parameters:
categoryDetailsContext
- The context to which to contributecontextInfo
- context information surrounding sandboxing/multitenant state- Returns:
- A set of variant IDs related to the
related products
.
-
getVariantService
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-