Class DefaultCharacteristicsTranslationService
java.lang.Object
com.broadleafcommerce.catalog.service.product.characteristic.DefaultCharacteristicsTranslationService
- All Implemented Interfaces:
CharacteristicsTranslationService
public class DefaultCharacteristicsTranslationService
extends Object
implements CharacteristicsTranslationService
- Since:
- CatalogServices 2.3.0, Release Train 2.3.0
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCharacteristicsTranslationService(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, com.broadleafcommerce.translation.mapping.ContextLocaleHelper contextLocaleHelper, com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationService, ProductCharacteristicService<ProductCharacteristic> productCharacteristicService, ProductService<Product> productService, CharacteristicService<Characteristic> characteristicService) -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyBaseCharacteristicsTranslations(Product product, ResolvedProductReferences foundItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handle finding and applying translations of aCharacteristicValuedefined on the baseCharacteristicentityprotected <P> voidapplyCharacteristicValueTranslations(@NonNull Product product, Map<String, List<org.apache.commons.lang3.tuple.Pair<String, com.broadleafcommerce.translation.domain.Translation>>> matchedTranslations, Locale locale) voidapplyConsolidatedCharacteristicsTranslationsToProduct(Product product, ResolvedProductReferences foundItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handle finding and applying translations for anyProductCharacteristic.getValue()where theProductCharacteristicValue.getSourceCharacteristicValueId()is present.voidapplyDirectProductCharacteristicsTranslations(Product product, ResolvedProductReferences foundItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handle finding and applying translations for anyProductCharacteristic.getValue()where theProductCharacteristicValue.getSourceCharacteristicValueId()is present.protected <P> voidapplyTranslations(Product product, Locale locale, List<com.broadleafcommerce.translation.domain.Translation> languageTranslations) protected voidfindCharacteristicsOnProductTranslations(ProductReferences references, ResolvedProductReferences resolved, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidfindProductCharacteristicsTranslations(ProductReferences references, ResolvedProductReferences resolved, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) voidfindTranslationsForProductsCharacteristics(ProductReferences references, ResolvedProductReferences resolved, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds thetranslationsfor theproducts characteristicvalues andcharacteristicvalues translations.protected com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtilprotected CharacteristicService<Characteristic>protected List<com.broadleafcommerce.translation.domain.Translation>getCharacteristicTranslations(List<String> sourceCharacteristicIds, List<Locale> locales, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.translation.mapping.ContextLocaleHelperprotected ProductService<Product>protected com.broadleafcommerce.translation.mapping.TranslationHelperprotected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation>voidsetTranslationHelper(com.broadleafcommerce.translation.mapping.TranslationHelper translationHelper)
-
Constructor Details
-
DefaultCharacteristicsTranslationService
public DefaultCharacteristicsTranslationService(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, com.broadleafcommerce.translation.mapping.ContextLocaleHelper contextLocaleHelper, com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationService, ProductCharacteristicService<ProductCharacteristic> productCharacteristicService, ProductService<Product> productService, CharacteristicService<Characteristic> characteristicService)
-
-
Method Details
-
applyConsolidatedCharacteristicsTranslationsToProduct
public void applyConsolidatedCharacteristicsTranslationsToProduct(Product product, ResolvedProductReferences foundItems, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CharacteristicsTranslationServiceHandle finding and applying translations for anyProductCharacteristic.getValue()where theProductCharacteristicValue.getSourceCharacteristicValueId()is present. If there is a translation directly defined under theProductfor itsProductCharacteristicelements, then they will be used with higher priority. As a fallback, if there is aCharacteristicValuetranslation defined on the baseCharacteristicentity, it will be applied.- Specified by:
applyConsolidatedCharacteristicsTranslationsToProductin interfaceCharacteristicsTranslationService- Parameters:
product- The product instance with its characteristics already hydratedfoundItems- the pre-fetched data that should be used for hydration. At a minimum, this must include:ResolvedProductReferences.getCharacteristicValueTranslationsByCharacteristicId()(for all the product characteristics),ResolvedProductReferences.getProductCharacteristicTranslationsByProductId()(for all the product's product characteristics)contextInfo- context surrounding sandboxing and multitenant state
-
applyDirectProductCharacteristicsTranslations
public void applyDirectProductCharacteristicsTranslations(Product product, ResolvedProductReferences foundItems, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CharacteristicsTranslationServiceHandle finding and applying translations for anyProductCharacteristic.getValue()where theProductCharacteristicValue.getSourceCharacteristicValueId()is present.- Specified by:
applyDirectProductCharacteristicsTranslationsin interfaceCharacteristicsTranslationService- Parameters:
product- The product instance with its characteristics already hydratedfoundItems- the pre-fetched data that should be used for hydration. At a minimum, this must include:ResolvedProductReferences.getProductCharacteristicTranslationsByProductId()(for all the product's product characteristics)contextInfo- context surrounding sandboxing and multitenant state
-
applyBaseCharacteristicsTranslations
public void applyBaseCharacteristicsTranslations(Product product, ResolvedProductReferences foundItems, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CharacteristicsTranslationServiceHandle finding and applying translations of aCharacteristicValuedefined on the baseCharacteristicentity- Specified by:
applyBaseCharacteristicsTranslationsin interfaceCharacteristicsTranslationService- Parameters:
product- The product instance with its characteristics already hydratedfoundItems- the pre-fetched data that should be used for hydration. At a minimum, this must include:ResolvedProductReferences.getCharacteristicValueTranslationsByCharacteristicId()(for all the products characteristics)contextInfo- context surrounding sandboxing and multitenant state
-
applyTranslations
-
applyCharacteristicValueTranslations
-
findTranslationsForProductsCharacteristics
public void findTranslationsForProductsCharacteristics(ProductReferences references, ResolvedProductReferences resolved, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CharacteristicsTranslationServiceFinds thetranslationsfor theproducts characteristicvalues andcharacteristicvalues translations. This method populatesResolvedProductReferences.getCharacteristicValueTranslationsByCharacteristicId()andResolvedProductReferences.getProductCharacteristicTranslationsByProductId()- Specified by:
findTranslationsForProductsCharacteristicsin interfaceCharacteristicsTranslationService- Parameters:
references- the product references containing theProductReferences.getProductIdsToFindProductCharacteristicsFor()productIds to find characteristics forresolved- the resolved product references to populate, also need to containResolvedProductReferences.getProductCharacteristicsByProductId()contextInfo- context information surrounding sandboxing and multitenant state
-
findCharacteristicsOnProductTranslations
protected void findCharacteristicsOnProductTranslations(ProductReferences references, ResolvedProductReferences resolved, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getCharacteristicTranslations
-
findProductCharacteristicsTranslations
protected void findProductCharacteristicsTranslations(ProductReferences references, ResolvedProductReferences resolved, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getBehaviorUtil
protected com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil getBehaviorUtil() -
getContextLocaleHelper
protected com.broadleafcommerce.translation.mapping.ContextLocaleHelper getContextLocaleHelper() -
getTranslationService
protected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> getTranslationService() -
getProductCharacteristicService
-
getProductService
-
getCharacteristicService
-
getTranslationHelper
protected com.broadleafcommerce.translation.mapping.TranslationHelper getTranslationHelper() -
setTranslationHelper
@Autowired public void setTranslationHelper(com.broadleafcommerce.translation.mapping.TranslationHelper translationHelper)
-