Class IncludedProduct

java.lang.Object
com.broadleafcommerce.catalog.domain.product.IncludedProduct
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware, com.broadleafcommerce.translation.mapping.SubIdentifiable, Serializable

public class IncludedProduct extends Object implements Serializable, com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware, com.broadleafcommerce.translation.mapping.SubIdentifiable
A IncludedProduct represents a bundling of additional items with a parent product. For configurable bundles to give the customer the ability to select multiple or have options, see ProductOption
Author:
Samarth Dhruva (samarthd), Phillip Verheyden (phillipuniverse)
See Also:
  • Constructor Details

    • IncludedProduct

      public IncludedProduct(String id, String pricingKey, String type, String label, Long displayOrder, Product product, Variant variant, String variantParentProductId, javax.money.MonetaryAmount overridePrice, boolean discountAllowed, int quantity, com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState, IncludedProductAsset asset)
    • IncludedProduct

      public IncludedProduct()
  • Method Details

    • getDefaultPrice

      public javax.money.MonetaryAmount getDefaultPrice()
      Gets the default price as appropriate for the type.
      Returns:
      The default price as appropriate for the type.
    • getId

      public String getId()
      Specified by:
      getId in interface com.broadleafcommerce.translation.mapping.SubIdentifiable
      See Also:
      • SubIdentifiable.getId()
    • getPricingKey

      @Deprecated public String getPricingKey()
      Deprecated.
      Unique pricing key for this particular included product. Useful for scenarios such as pricing of included products, where a system wide unique identifier for the included product would be required to associate it with a price within an external system
      Returns:
      a unique key to identify this included product
    • getType

      public String getType()
      Describes which of the product, variant, or category/default selection fields should be used for this included product.
      Returns:
      the IncludedProductType of this included product
      See Also:
    • getLabel

      public String getLabel()
      The user-facing label that describes this included product.
      Returns:
      the user-facing label that describes this included product
    • getDisplayOrder

      public Long getDisplayOrder()
      Defines the display position of this included product in relation to other included products.
      Returns:
      the order in which this included product should be displayed relative to other included products
    • getProduct

      public Product getProduct()
      This field contains the specified product if the included product type is IncludedProductType.PRODUCT.
      Returns:
      the product to use if this included product is of type IncludedProductType.PRODUCT
    • getVariant

      public Variant getVariant()
      This field contains the specified variant if the type is IncludedProductType.VARIANT.
      Returns:
      the variant to use if this included product is of type IncludedProductType.VARIANT
      See Also:
      • variantParentProductId
    • getVariantParentProductId

      public String getVariantParentProductId()
      This field contains the id of the parent product of the specified variant if the type is IncludedProductType.VARIANT.

      This field is necessary because variants are a sub-resource of product and thus API callers cannot fetch them purely by variant id alone.

      Returns:
      the id of the parent product of the variant
      See Also:
      • variant
    • getOverridePrice

      @Deprecated public javax.money.MonetaryAmount getOverridePrice()
      Deprecated.
      The price of the included product itself. If no pricing is specified here, the price of the target product, variant, or selected product from the category will be used.
      Returns:
      the price of this included product
    • isDiscountAllowed

      @Deprecated public boolean isDiscountAllowed()
      Deprecated.
      Dictates whether or not discounts are allowed to be applied to this included product.
      Returns:
      true if discounts are allowed to be applied to this included product, false otherwise
    • getQuantity

      public int getQuantity()
      If the quantity type of this included product is IncludedProductQuantityType#FIXED, this field will hold the value of the fixed quantity.
      Returns:
      the fixed quantity of the included product's target product(s) that can be added if this included product's quantity type is of IncludedProductQuantityType#FIXED
    • getContextState

      public com.broadleafcommerce.data.tracking.core.EmbeddedContextState getContextState()
      A subset of Tracking information to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when the ChangeDetails for the parent object's entire attributes map are compared.
      Specified by:
      getContextState in interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
      Returns:
      a subset of Tracking information to expose the context state for this object
    • getAsset

      public IncludedProductAsset getAsset()
      The asset for this included product. Intended to override the asset normally shown for the product specifically in the context of this relationship.
      Returns:
      asset information for this included product
      See Also:
    • setId

      public void setId(String id)
      Specified by:
      setId in interface com.broadleafcommerce.translation.mapping.SubIdentifiable
      See Also:
      • SubIdentifiable.getId()
    • setPricingKey

      @Deprecated public void setPricingKey(String pricingKey)
      Deprecated.
      Unique pricing key for this particular included product. Useful for scenarios such as pricing of included products, where a system wide unique identifier for the included product would be required to associate it with a price within an external system
      Parameters:
      pricingKey - a unique key to identify this included product (usually a UUID)
    • setType

      public void setType(String type)
      Describes which of the product, variant, or category/default selection fields should be used for this included product.
      Parameters:
      type - the IncludedProductType of this included product
      See Also:
    • setLabel

      public void setLabel(String label)
      The user-facing label that describes this included product.
      Parameters:
      label - the user-facing label that describes this included product
    • setDisplayOrder

      public void setDisplayOrder(Long displayOrder)
      Defines the display position of this included product in relation to other included products.
      Parameters:
      displayOrder - the order in which this included product should be displayed relative to other included products
    • setProduct

      public void setProduct(Product product)
      This field contains the specified product if the included product type is IncludedProductType.PRODUCT.
      Parameters:
      product - the product to use if this included product is of type IncludedProductType.PRODUCT
    • setVariant

      public void setVariant(Variant variant)
      This field contains the specified variant if the type is IncludedProductType.VARIANT.
      Parameters:
      variant - the variant to use if this included product is of type IncludedProductType.VARIANT
      See Also:
      • variantParentProductId
    • setVariantParentProductId

      public void setVariantParentProductId(String variantParentProductId)
      This field contains the id of the parent product of the specified variant if the type is IncludedProductType.VARIANT.

      This field is necessary because variants are a sub-resource of product and thus API callers cannot fetch them purely by variant id alone.

      Parameters:
      variantParentProductId - the id of the parent product of the variant
      See Also:
      • variant
    • setOverridePrice

      @Deprecated public void setOverridePrice(javax.money.MonetaryAmount overridePrice)
      Deprecated.
      The price of the included product itself. If no pricing is specified here, the price of the target product, variant, or selected product from the category will be used.
      Parameters:
      overridePrice - the price of this included product
    • setDiscountAllowed

      @Deprecated public void setDiscountAllowed(boolean discountAllowed)
      Deprecated.
      Dictates whether or not discounts are allowed to be applied to this included product.
      Parameters:
      discountAllowed - true if discounts are allowed to be applied to this included product, false otherwise
    • setQuantity

      public void setQuantity(int quantity)
      If the quantity type of this included product is IncludedProductQuantityType#FIXED, this field will hold the value of the fixed quantity.
      Parameters:
      fixedQuantity - the fixed quantity of the included product's target product(s) that can be added if this included product's quantity type is of IncludedProductQuantityType#FIXED
    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState)
      A subset of Tracking information to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when the ChangeDetails for the parent object's entire attributes map are compared.
      Specified by:
      setContextState in interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
      Parameters:
      contextState - a subset of Tracking information to expose the context state for this object
    • setAsset

      public void setAsset(IncludedProductAsset asset)
      The asset for this included product. Intended to override the asset normally shown for the product specifically in the context of this relationship.
      Parameters:
      asset - asset information for this included product
      See Also:
    • 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