Class ProductTagConsolidationContributor
java.lang.Object
com.broadleafcommerce.catalog.service.product.consolidation.ContextualProductConsolidationContributor<ProductTag>
com.broadleafcommerce.catalog.service.product.consolidation.ProductTagConsolidationContributor
- All Implemented Interfaces:
ProductConsolidationContributor
public class ProductTagConsolidationContributor
extends ContextualProductConsolidationContributor<ProductTag>
- Author:
- Nathan Moore (nathandmoore)
-
Field Summary
Fields inherited from class com.broadleafcommerce.catalog.service.product.consolidation.ContextualProductConsolidationContributor
IGNORE_ARCHIVED_FILTER, typeFactory
-
Constructor Summary
ConstructorDescriptionProductTagConsolidationContributor
(com.broadleafcommerce.common.extension.TypeFactory typeFactory, ProductTagService<ProductTag> productTagService, com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationEntityService, AdvancedTagService<AdvancedTag> advancedTagService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
consolidateProducts
(Set<String> productIds, List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Consolidate products with their related domain and translations.protected List<AdvancedTagRef>
getAdvancedTags
(@NonNull Collection<? extends ProductTag> productTags) protected AdvancedTagService<AdvancedTag>
protected List<ProductTag>
getObjectsToConsolidate
(@NonNull Set<String> productIds, @NonNull List<ConsolidatedProduct> products, @NonNull com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve the full list of domain objects of this type to be consolidated into the products.protected ProductTagService<ProductTag>
protected List<AdvancedTagRef>
getSearchableAdvancedTags
(@NonNull Collection<? extends ProductTag> productTags) protected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation>
protected List<com.broadleafcommerce.translation.domain.Translation>
getTranslations
(List<String> entityIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected Function<ProductTag,
String> idGetter()
Defines the function which retrieves the contextId of the domain object in order to recognize it in different contexts.protected Function<ProductTag,
String> Defines the function which retrieves the Product ID from the domain object to consolidate, in order to group it with the appropriate product for processing.protected void
setTags
(@NonNull ConsolidatedProduct product, @NonNull List<? extends ProductTag> productTags) protected BiConsumer<ConsolidatedProduct,
List<ProductTag>> setter()
Defines the function which should be used to set the domain objects on the consolidated product.boolean
shouldConsolidate
(Set<String> productIds, List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Determines whether this contributor should be executed based on the given parameters and context.Methods inherited from class com.broadleafcommerce.catalog.service.product.consolidation.ContextualProductConsolidationContributor
consolidateRelations, contextCompositeKey, contextCompositeKey, contextStatesMatch, createOverrideProductForContext, findImplicitMatches, getCloneMapper, getInheritanceLevel, getMostSpecificCatalogId, getProductConsolidationRequest, getRsqlParser, getTypeFactory, ignoreArchived, isInheriting, setListValue, setSingleValue
-
Field Details
-
PRODUCT_TAG_TRANSLATION_HINT
- See Also:
-
-
Constructor Details
-
ProductTagConsolidationContributor
public ProductTagConsolidationContributor(com.broadleafcommerce.common.extension.TypeFactory typeFactory, ProductTagService<ProductTag> productTagService, com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationEntityService, AdvancedTagService<AdvancedTag> advancedTagService)
-
-
Method Details
-
shouldConsolidate
public boolean shouldConsolidate(Set<String> productIds, List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ProductConsolidationContributor
Determines whether this contributor should be executed based on the given parameters and context.Returns true by default.
- Parameters:
productIds
- the IDs of the products to consolidateproducts
- the product in all explicit context statesinheritanceLines
- the catalog inheritance lines top-down from all of the productscontext
- context information surrounding sandboxing/multitenant state
-
consolidateProducts
public void consolidateProducts(Set<String> productIds, List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ProductConsolidationContributor
Consolidate products with their related domain and translations. This includes both hydratingProduct
fields and combining external references likeCategoryProduct
. Any catalog or sandbox overrides made to external references for non-overridden products will generate new placeholder products to store those overrides.- Specified by:
consolidateProducts
in interfaceProductConsolidationContributor
- Overrides:
consolidateProducts
in classContextualProductConsolidationContributor<ProductTag>
- Parameters:
productIds
- the IDs of the products to consolidateproducts
- the product in all explicit context statesinheritanceLines
- the catalog inheritance lines top-down from all of the productscontext
- context information surrounding sandboxing/multitenant state
-
getObjectsToConsolidate
protected List<ProductTag> getObjectsToConsolidate(@NonNull @NonNull Set<String> productIds, @NonNull @NonNull List<ConsolidatedProduct> products, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from class:ContextualProductConsolidationContributor
Retrieve the full list of domain objects of this type to be consolidated into the products.- Specified by:
getObjectsToConsolidate
in classContextualProductConsolidationContributor<ProductTag>
- Parameters:
productIds
- the IDs of the products to consolidateproducts
- the products in all explicit context statesinheritanceLines
- the catalog inheritance lines top-down from all of the productscontext
- context information surrounding sandboxing/multitenant state- Returns:
- all domain objects of this type to consolidate into the products
-
productIdGetter
Description copied from class:ContextualProductConsolidationContributor
Defines the function which retrieves the Product ID from the domain object to consolidate, in order to group it with the appropriate product for processing.- Specified by:
productIdGetter
in classContextualProductConsolidationContributor<ProductTag>
- Returns:
- function to retrieve Product ID of the domain object
-
setter
Description copied from class:ContextualProductConsolidationContributor
Defines the function which should be used to set the domain objects on the consolidated product.- Specified by:
setter
in classContextualProductConsolidationContributor<ProductTag>
- Returns:
- function to set domain objects on the consolidated product
-
setTags
protected void setTags(@NonNull @NonNull ConsolidatedProduct product, @NonNull @NonNull List<? extends ProductTag> productTags) -
getAdvancedTags
protected List<AdvancedTagRef> getAdvancedTags(@NonNull @NonNull Collection<? extends ProductTag> productTags) -
getSearchableAdvancedTags
protected List<AdvancedTagRef> getSearchableAdvancedTags(@NonNull @NonNull Collection<? extends ProductTag> productTags) -
getTranslations
-
idGetter
Description copied from class:ContextualProductConsolidationContributor
Defines the function which retrieves the contextId of the domain object in order to recognize it in different contexts.- Specified by:
idGetter
in classContextualProductConsolidationContributor<ProductTag>
- Returns:
- function to retrieve contextId of the domain object
-
getProductTagService
-
getAdvancedTagService
-
getTranslationEntityService
protected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> getTranslationEntityService()
-