Class TranslationProductConsolidationContributor
java.lang.Object
com.broadleafcommerce.catalog.service.product.consolidation.ContextualProductConsolidationContributor<ProductTranslation>
com.broadleafcommerce.catalog.service.product.consolidation.TranslationProductConsolidationContributor
- All Implemented Interfaces:
ProductConsolidationContributor
public class TranslationProductConsolidationContributor
extends ContextualProductConsolidationContributor<ProductTranslation>
Consolidates
Translation
s into products.
This contributor should run after any other contributors which consolidate translatable data,
such as the PrimaryAssetProductConsolidationContributor
,
VariantProductConsolidationContributor
,
and @CategoryProductConsolidationContributor
.
-
Field Summary
Fields inherited from class com.broadleafcommerce.catalog.service.product.consolidation.ContextualProductConsolidationContributor
IGNORE_ARCHIVED_FILTER, typeFactory
-
Constructor Summary
ConstructorDescriptionTranslationProductConsolidationContributor
(com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationEntityService, ProductService<Product> productService, VariantService<Variant> variantService, ProductAssetService<ProductAsset> productAssetService, CategoryService<Category> categoryService, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected CategoryService<Category>
protected List<ProductTranslation>
getObjectsToConsolidate
(Set<String> productIds, List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, 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 ProductAssetService<ProductAsset>
protected ProductService<Product>
protected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation>
protected List<ProductTranslation>
getTranslations
(String entityType, List<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, org.springframework.util.MultiValueMap<String, String> productIdsForEntityIds) protected VariantService<Variant>
protected Function<ProductTranslation,
String> idGetter()
Defines the function which retrieves the contextId of the domain object in order to recognize it in different contexts.protected Function<ProductTranslation,
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 List<ProductTranslation>
retrieveAllCategoriesTranslations
(List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected List<ProductTranslation>
retrieveAllPrimaryAssetTranslations
(List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected List<ProductTranslation>
retrieveAllProductTranslations
(Set<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected List<ProductTranslation>
retrieveAllVariantsTranslations
(List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected BiConsumer<ConsolidatedProduct,
List<ProductTranslation>> setter()
Defines the function which should be used to set the domain objects on the consolidated product.protected void
setTranslations
(ConsolidatedProduct consolidatedProduct, List<ProductTranslation> productTranslations) Methods inherited from class com.broadleafcommerce.catalog.service.product.consolidation.ContextualProductConsolidationContributor
consolidateProducts, consolidateRelations, contextCompositeKey, contextCompositeKey, contextStatesMatch, createOverrideProductForContext, findImplicitMatches, getCloneMapper, getInheritanceLevel, getMostSpecificCatalogId, getRsqlParser, getTypeFactory, ignoreArchived, isInheriting, setListValue, setSingleValue
-
Field Details
-
ORDER
public static final int ORDER- See Also:
-
-
Constructor Details
-
TranslationProductConsolidationContributor
public TranslationProductConsolidationContributor(com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationEntityService, ProductService<Product> productService, VariantService<Variant> variantService, ProductAssetService<ProductAsset> productAssetService, CategoryService<Category> categoryService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
getObjectsToConsolidate
protected List<ProductTranslation> getObjectsToConsolidate(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 class:ContextualProductConsolidationContributor
Retrieve the full list of domain objects of this type to be consolidated into the products.- Specified by:
getObjectsToConsolidate
in classContextualProductConsolidationContributor<ProductTranslation>
- 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
-
retrieveAllProductTranslations
protected List<ProductTranslation> retrieveAllProductTranslations(Set<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
retrieveAllPrimaryAssetTranslations
protected List<ProductTranslation> retrieveAllPrimaryAssetTranslations(List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
retrieveAllVariantsTranslations
protected List<ProductTranslation> retrieveAllVariantsTranslations(List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
retrieveAllCategoriesTranslations
protected List<ProductTranslation> retrieveAllCategoriesTranslations(List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
getTranslations
-
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<ProductTranslation>
- Returns:
- function to set domain objects on the consolidated product
-
setTranslations
protected void setTranslations(ConsolidatedProduct consolidatedProduct, List<ProductTranslation> productTranslations) -
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<ProductTranslation>
- Returns:
- function to retrieve Product ID of the domain object
-
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<ProductTranslation>
- Returns:
- function to retrieve contextId of the domain object
-
getTranslationEntityService
protected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> getTranslationEntityService() -
getProductService
-
getVariantService
-
getProductAssetService
-
getCategoryService
-