Class ProductBaseCharacteristicTranslationPostMapperMember
java.lang.Object
com.broadleafcommerce.catalog.mapping.ProductBaseCharacteristicTranslationPostMapperMember
- All Implemented Interfaces:
com.broadleafcommerce.common.extension.data.DataRoutePartitionAware
,com.broadleafcommerce.data.tracking.core.mapping.PostMapper
,com.broadleafcommerce.data.tracking.core.mapping.PostMapperMember
,org.springframework.core.Ordered
public class ProductBaseCharacteristicTranslationPostMapperMember
extends Object
implements com.broadleafcommerce.data.tracking.core.mapping.PostMapperMember
A
PostMapperMember
that is intended to run BEFORE
TranslationPostMapperMember
. See
getOrder()
.
This component will handle adding translations for any ProductCharacteristic.getValue()
where the ProductCharacteristicValue.getSourceCharacteristicValueId()
is present.
The expectation is that this runs in an early pass to pre-set anything from the base
translations, and then the normal
TranslationPostMapperMember
will be able to run
on top of this to apply any translations from the specific ProductCharacteristic
/
ProductCharacteristicValue
defined at the override level. This ensures the overrides
always win, but also ensures the base translations do come through if there are no overrides- Since:
- Catalog Service 2.2.0, Release Train 2.2.0
-
Field Summary
Fields inherited from interface com.broadleafcommerce.common.extension.data.DataRoutePartitionAware
ALL_MATCH
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorsConstructorDescriptionProductBaseCharacteristicTranslationPostMapperMember
(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, com.broadleafcommerce.translation.mapping.ContextLocaleHelper contextLocaleHelper) -
Method Summary
Modifier and TypeMethodDescriptionprotected <P> void
applyCharacteristicValueTranslations
(@NonNull List<P> projections, Map<String, List<org.apache.commons.lang3.tuple.Pair<String, com.broadleafcommerce.translation.domain.Translation>>> matchedTranslations, Locale locale) buildCharacteristicIdToValueIdsMap
(@NonNull List<P> projections) protected com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil
protected 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.ContextLocaleHelper
int
getOrder()
This component is intended to run BEFORETranslationPostMapperMember
protected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation>
void
setCharacteristicService
(CharacteristicService<Characteristic> characteristicService) void
setTranslationService
(com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationService) <P,
D> void transform
(@NonNull List<P> projections, List<D> entities, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Default any on with any translations that are defined on the associatedCharacteristicValue
if there isProductCharacteristicValue.getSourceCharacteristicValueId()
present.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.mapping.PostMapper
transform
-
Constructor Details
-
ProductBaseCharacteristicTranslationPostMapperMember
public ProductBaseCharacteristicTranslationPostMapperMember(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, com.broadleafcommerce.translation.mapping.ContextLocaleHelper contextLocaleHelper)
-
-
Method Details
-
getDataRoutePartition
- Specified by:
getDataRoutePartition
in interfacecom.broadleafcommerce.common.extension.data.DataRoutePartitionAware
-
getOrder
public int getOrder()This component is intended to run BEFORETranslationPostMapperMember
- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
- Specified by:
getOrder
in interfacecom.broadleafcommerce.data.tracking.core.mapping.PostMapperMember
- Returns:
- a higher precedence than TranslationPostMapperMember
-
transform
public <P,D> void transform(@NonNull @NonNull List<P> projections, @Nullable List<D> entities, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Default any on with any translations that are defined on the associatedCharacteristicValue
if there isProductCharacteristicValue.getSourceCharacteristicValueId()
present. If any translations are found for the given locale on the source characteristic value, then it will set that as a base, with the expectation that theTranslationPostMapperMember
can override the value if there is a translation specifically associated with the ProductCharacteristicValue- Specified by:
transform
in interfacecom.broadleafcommerce.data.tracking.core.mapping.PostMapper
- Parameters:
projections
- - list of business domain classesentities
- - list of repository domain classescontextInfo
- - the context
-
buildCharacteristicIdToValueIdsMap
-
applyCharacteristicValueTranslations
-
getCharacteristicTranslations
-
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() -
setTranslationService
@Autowired @Lazy public void setTranslationService(com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationService) -
getCharacteristicService
-
setCharacteristicService
@Autowired @Lazy public void setCharacteristicService(CharacteristicService<Characteristic> characteristicService)
-