Class ProductTag

java.lang.Object
com.broadleafcommerce.catalog.domain.tag.ProductTag
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ChangeContainerOverridable, com.broadleafcommerce.data.tracking.core.ContextStateAware, com.broadleafcommerce.data.tracking.core.sort.business.domain.Sorted, Serializable, Comparable<ProductTag>

public class ProductTag extends Object implements Serializable, com.broadleafcommerce.data.tracking.core.ContextStateAware, com.broadleafcommerce.data.tracking.core.ChangeContainerOverridable, com.broadleafcommerce.data.tracking.core.sort.business.domain.Sorted, Comparable<ProductTag>
This defines the relationship between a Product or Variant and AdvancedTag. A product can have multiple ProductTags and determine relative priority via ordering them in the admin. This relationship will also be used during indexing to hydrate the tags for a product to enable faceting, searching, and boosting.
Author:
Nathan Moore (nathandmoore)
See Also:
  • Constructor Details

    • ProductTag

      public ProductTag()
  • Method Details

    • compareTo

      public int compareTo(@NotNull @NotNull ProductTag o)
      Specified by:
      compareTo in interface Comparable<ProductTag>
    • getProductId

      public String getProductId()
    • getTagId

      public String getTagId()
    • getVariantId

      public String getVariantId()
    • getId

      public String getId()
      A unique system identifier.
      Returns:
      A unique system identifier.
    • getTag

      public AdvancedTag getTag()
      The AdvancedTag to associate with the product.

      IMPORTANT: This value is not automatically hydrated when the persistent domain is converted into this projection. That can be done programmatically if needed. The persistent domain stores a leaner representation by default so that updates to the tag don't have to be synced and there is no unnecessary duplication of data.
      Returns:
      The AdvancedTag to associate with the product.
    • getProduct

      public Product getProduct()
      The Variant to associate to the tag to. May be null, but one of either the Variant or Product must be set. See #targetType.

      IMPORTANT: This value is not automatically hydrated when the persistent domain is converted into this projection. That can be done programmatically if needed. The persistent domain stores a leaner representation by default so that updates to the product don't have to be synced and there is no unnecessary duplication of data.
      Returns:
      The Product to associate to the tag to.
    • getVariant

      public Variant getVariant()
      The Variant to associate to the tag to. May be null, but one of either the Variant or Product must be set. See #targetType.

      IMPORTANT: This value is not automatically hydrated when the persistent domain is converted into this projection. That can be done programmatically if needed. The persistent domain stores a leaner representation by default so that updates to the product don't have to be synced and there is no unnecessary duplication of data.
      Returns:
      The Product to associate to the tag to.
    • getSorted

      public Boolean getSorted()
      Whether the persistent counterpart to this object has a non-default value for Sortable.getSorting(), which determines order in admin list-grids and the relative precedence of the tag compared to others related to the product on the storefront.
      Specified by:
      getSorted in interface com.broadleafcommerce.data.tracking.core.sort.business.domain.Sorted
      Returns:
      Whether the persistent counterpart to this object has a non-default value for Sortable.getSorting().
      See Also:
      • Sorted.getSorted()
      • Sortable
      • for specific sort order value
    • getSorting

      public String getSorting()
      Field indicating a sort order, if sorted. This is alphanumeric, allowing for lexicographical sorting.
      Returns:
      Field indicating a sort order, if sorted.
      See Also:
      • which is a flag signifying whether this is sorted
    • getActiveStartDate

      public Instant getActiveStartDate()
      Start of when this tag should be active for the product. This implicitly inherits from the AdvancedTag: If the tag isn't active, neither will this ProductTag, but the reverse is not true.
      Returns:
      the date when this tag should start being active
    • getActiveEndDate

      public Instant getActiveEndDate()
      End when this tag is not longer active. Unset indicates that it is always active. This implicitly inherits from the AdvancedTag: If the tag isn't active, neither will this ProductTag, but the reverse is not true.
      Returns:
      the date when this tag should no longer be active
    • 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.
      Specified by:
      getContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Returns:
      a subset of Tracking information to expose the context state for this object
    • getOverrideChangeContainer

      public com.broadleafcommerce.data.tracking.core.filtering.domain.ChangeContainer getOverrideChangeContainer()
      Specified by:
      getOverrideChangeContainer in interface com.broadleafcommerce.data.tracking.core.ChangeContainerOverridable
    • setId

      public void setId(String id)
      A unique system identifier.
      Parameters:
      id - A unique system identifier.
    • setTag

      public void setTag(AdvancedTag tag)
      The AdvancedTag to associate with the product.

      IMPORTANT: This value is not automatically hydrated when the persistent domain is converted into this projection. That can be done programmatically if needed. The persistent domain stores a leaner representation by default so that updates to the tag don't have to be synced and there is no unnecessary duplication of data.
      Parameters:
      tag - The AdvancedTag to associate with the product.
    • setProduct

      public void setProduct(Product product)
      The Variant to associate to the tag to. May be null, but one of either the Variant or Product must be set. See #targetType.

      IMPORTANT: This value is not automatically hydrated when the persistent domain is converted into this projection. That can be done programmatically if needed. The persistent domain stores a leaner representation by default so that updates to the product don't have to be synced and there is no unnecessary duplication of data.
      Parameters:
      product - The Product to associate to the tag to.
    • setVariant

      public void setVariant(Variant variant)
      The Variant to associate to the tag to. May be null, but one of either the Variant or Product must be set. See #targetType.

      IMPORTANT: This value is not automatically hydrated when the persistent domain is converted into this projection. That can be done programmatically if needed. The persistent domain stores a leaner representation by default so that updates to the product don't have to be synced and there is no unnecessary duplication of data.
      Parameters:
      product - The Product to associate to the tag to.
    • setSorted

      public void setSorted(Boolean sorted)
      Whether the persistent counterpart to this object has a non-default value for Sortable.getSorting(), which determines order in admin list-grids and the relative precedence of the tag compared to others related to the product on the storefront.
      Parameters:
      sorted - Whether the persistent counterpart to this object has a non-default value for Sortable.getSorting().
      See Also:
      • Sorted.getSorted()
      • Sortable
      • for specific sort order value
    • setSorting

      public void setSorting(String sorting)
      Field indicating a sort order, if sorted. This is alphanumeric, allowing for lexicographical sorting.
      Parameters:
      sorting - Field indicating a sort order, if sorted.
      See Also:
      • which is a flag signifying whether this is sorted
    • setActiveStartDate

      public void setActiveStartDate(Instant activeStartDate)
      Start of when this tag should be active for the product. This implicitly inherits from the AdvancedTag: If the tag isn't active, neither will this ProductTag, but the reverse is not true.
      Parameters:
      activeStartDate - the date when this tag should start being active
    • setActiveEndDate

      public void setActiveEndDate(Instant activeEndDate)
      End when this tag is not longer active. Unset indicates that it is always active. This implicitly inherits from the AdvancedTag: If the tag isn't active, neither will this ProductTag, but the reverse is not true.
      Parameters:
      activeEndDate - the date when this tag should no longer be active
    • 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.
      Specified by:
      setContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Parameters:
      contextState - a subset of Tracking information to expose the context state for this object
    • setOverrideChangeContainer

      public void setOverrideChangeContainer(com.broadleafcommerce.data.tracking.core.filtering.domain.ChangeContainer overrideChangeContainer)
      Specified by:
      setOverrideChangeContainer in interface com.broadleafcommerce.data.tracking.core.ChangeContainerOverridable
    • 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