Class TranslationPostMapperMember

java.lang.Object
com.broadleafcommerce.translation.mapping.TranslationPostMapperMember
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 TranslationPostMapperMember extends Object implements com.broadleafcommerce.data.tracking.core.mapping.PostMapperMember
A post mapper member that attempts to update field values for the projections with any translations that are found for the given locale and entities.
Author:
Chad Harchar (charchar), Jeff Fischer
  • Constructor Details

    • TranslationPostMapperMember

      public TranslationPostMapperMember(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, ContextLocaleHelper contextLocaleHelper)
  • Method Details

    • setEntityTranslationAppliers

      @Autowired(required=false) public void setEntityTranslationAppliers(@Nullable List<EntityTranslationApplier> entityTranslationAppliers)
    • getDataRoutePartition

      public String getDataRoutePartition()
      Specified by:
      getDataRoutePartition in interface com.broadleafcommerce.common.extension.data.DataRoutePartitionAware
    • setTranslationService

      @Autowired @Lazy public void setTranslationService(TranslationEntityService<Translation> translationService)
    • transform

      public <P, D> void transform(List<P> projections, List<D> entities, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Specified by:
      transform in interface com.broadleafcommerce.data.tracking.core.mapping.PostMapper
    • applyTranslations

      protected <P> void applyTranslations(List<P> projections, List<String> primaryKeys, Locale locale, List<Translation> languageTranslations)
    • standardUpdateField

      protected <P> void standardUpdateField(P businessDomain, Translation translation)
      Updates field value with translation using the standard field-value-applying logic. Delegates to TranslationHelper by default.
      Type Parameters:
      P - type of the business domain object
      Parameters:
      businessDomain - a business domain object
      translation - a field translation that will be applied to a business domain object
    • updateField

      @Deprecated(since="TranslationCommon 2.0.5", forRemoval=true) protected <P> void updateField(P businessDomain, Translation translation)
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method is no longer used and the logic has moved to TranslationHelper instead. See standardUpdateField(Object, Translation)
      Type Parameters:
      P - business domain type
      Parameters:
      businessDomain - business domain
      translation - translation
    • setTranslatedValueOnField

      @Deprecated(since="TranslationCommon 2.0.5", forRemoval=true) protected <P> void setTranslatedValueOnField(P targetEntity, Field field, Object translatedValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method is no longer used and the logic has moved to TranslationHelper instead. See standardUpdateField(Object, Translation)
      Type Parameters:
      P - entity type
      Parameters:
      targetEntity - target entity
      field - field
      translatedValue - translated value
    • setTranslatedValueInMap

      @Deprecated(since="TranslationCommon 2.0.5", forRemoval=true) protected <P> void setTranslatedValueInMap(P targetEntity, PathUtil.PathResult item, Object translatedValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method is no longer used and the logic has moved to TranslationHelper instead. See standardUpdateField(Object, Translation)
      Type Parameters:
      P - target entity type
      Parameters:
      targetEntity - target entity
      item - item
      translatedValue - value
    • getTranslationHelper

      protected TranslationHelper getTranslationHelper()
    • setTranslationHelper

      @Autowired public void setTranslationHelper(TranslationHelper translationHelper)
    • getEntityTranslationAppliers

      protected List<EntityTranslationApplier> getEntityTranslationAppliers()