java.lang.Object
com.broadleafcommerce.datafeed.service.collector.domain.Translation

public class Translation extends Object

Defines an entity that holds the value for a translation of a String field on another entity in a particular Locale. This is used to override the default value of that field in a matching locale.

Translations are designed to be unique per locale, entityType, entityId and entityField within a particular tenant context.

Author:
Kelly Tisdell (ktisdell)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    Translation(String id, Locale locale, String entityType, String entityId, String entityField, Object value, com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
     
    boolean
     
    com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
    A subset of Tracking information to expose the context state for this object.
    The name of the field on the entity to which this translation applies.
    The ID of the entity to which this translation applies.
    The type of the entity to which this translation applies, e.g., PRODUCT, CATEGORY, OFFER.
    The context ID of this Translation
    The Locale wherein this Translation is applicable
    This field holds the actual translated value.
    int
     
    void
    setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
    A subset of Tracking information to expose the context state for this object.
    void
    setEntityField(String entityField)
    The name of the field on the entity to which this translation applies.
    void
    setEntityId(String entityId)
    The ID of the entity to which this translation applies.
    void
    setEntityType(String entityType)
    The type of the entity to which this translation applies, e.g., PRODUCT, CATEGORY, OFFER.
    void
    The context ID of this Translation
    void
    setLocale(Locale locale)
    The Locale wherein this Translation is applicable
    void
    This field holds the actual translated value.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Translation

      public Translation(String id, Locale locale, String entityType, String entityId, String entityField, Object value, com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
    • Translation

      public Translation()
  • Method Details

    • getId

      public String getId()
      The context ID of this Translation
      Returns:
      The context ID of this Translation
    • getLocale

      public Locale getLocale()
      The Locale wherein this Translation is applicable
      Returns:
      The Locale wherein this Translation is applicable.
    • getEntityType

      public String getEntityType()
      The type of the entity to which this translation applies, e.g., PRODUCT, CATEGORY, OFFER.
      Returns:
      The type of the entity to which this translation applies, e.g., PRODUCT, CATEGORY, OFFER.
    • getEntityId

      public String getEntityId()
      The ID of the entity to which this translation applies.
      Returns:
      The ID of the entity to which this translation applies.
    • getEntityField

      public String getEntityField()
      The name of the field on the entity to which this translation applies.
      Returns:
      The name of the field on the entity to which this translation applies.
    • getValue

      public Object getValue()
      This field holds the actual translated value. This is an Object to allow flexibility for what can be translated (ex: a String or a List of Strings). This should ideally match the type of the value held by entityField.

      Note, however, that for certain value types, there may be type mismatches with entityField once Jackson deserializes the value received in a request. For example, if a JSON array is received as the value, Jackson will simply deserialize it to a List.

      Returns:
      the actual translated value
    • getContextState

      public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
      A subset of Tracking information to expose the context state for this object.
      Returns:
      a subset of Tracking information to expose the context state for this object
    • setId

      public void setId(String id)
      The context ID of this Translation
      Parameters:
      id - The context ID of this Translation
    • setLocale

      public void setLocale(Locale locale)
      The Locale wherein this Translation is applicable
      Parameters:
      locale - The Locale wherein this Translation is applicable.
    • setEntityType

      public void setEntityType(String entityType)
      The type of the entity to which this translation applies, e.g., PRODUCT, CATEGORY, OFFER.
      Parameters:
      entityType - The type of the entity to which this translation applies, e.g., PRODUCT, CATEGORY, OFFER.
    • setEntityId

      public void setEntityId(String entityId)
      The ID of the entity to which this translation applies.
      Parameters:
      entityId - The ID of the entity to which this translation applies.
    • setEntityField

      public void setEntityField(String entityField)
      The name of the field on the entity to which this translation applies.
      Parameters:
      entityField - The name of the field on the entity to which this translation applies.
    • setValue

      public void setValue(Object value)
      This field holds the actual translated value. This is an Object to allow flexibility for what can be translated (ex: a String or a List of Strings). This should ideally match the type of the value held by entityField.

      Note, however, that for certain value types, there may be type mismatches with entityField once Jackson deserializes the value received in a request. For example, if a JSON array is received as the value, Jackson will simply deserialize it to a List.

      Parameters:
      value - the actual translated value
    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
      A subset of Tracking information to expose the context state for this object.
      Parameters:
      contextState - a subset of Tracking information to expose the context state for this object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object