Class IncludedProduct

java.lang.Object
com.broadleafcommerce.catalogbrowse.domain.IncludedProduct
All Implemented Interfaces:
Priceable, Serializable

public class IncludedProduct extends Object implements Serializable, Priceable
An IncludedItem 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:
Nathan Moore (nathandmoore)
See Also:
  • Constructor Details

    • IncludedProduct

      public IncludedProduct()
  • Method Details

    • addAttribute

      public void addAttribute(String name, Object value)
      Takes in any additional attributes passed in the request not matching any defined properties.
      Parameters:
      name - Name of the additional attribute
      value - Value of the additional attribute
    • getAttribute

      public Map<String,Object> getAttribute()
      Return any additional attributes passed in the request not matching any defined properties.
      Returns:
      any additional attributes passed in the request not matching any defined properties.
    • getVendorRef

      @Nullable public String getVendorRef()
    • getPricingKey

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

      public String getType()
      Defines the type of the item: usually a Product or Variant.
      Returns:
      the type of the item
      See Also:
    • getPriceInfo

      public com.broadleafcommerce.pricing.client.domain.PriceInfo getPriceInfo()
      Summary of the pricing information related to the included item. The consumer of this service is expecting this to be the source of truth for the pricing of this item, so this field should be calculated from its own override price if present or be a copy of the underlying product's or variant's pricing to simplify the consumer's logic.
      Specified by:
      getPriceInfo in interface Priceable
      Returns:
      The PriceInfo on the entity.
      See Also:
      • for special pricing considerations
    • getOverridePrice

      public javax.money.MonetaryAmount getOverridePrice()
      The specific price set for this included item that overrides the price of underlying product or variant. This is primarily used for reference in determining whether priceInfo should be disregarded in pricing calculations in this service: If there is an overridePrice, then the priceInfo received from the CatalogProvider should be used as the base for additional pricing calculations informed by the PricingProvider. Otherwise, the received priceInfo should be discarded since it is really a copy of the underlying product or variant and cannot be used as a basis for additional pricing calculations for the IncludedProduct itself.
      Returns:
      the price of this included product
    • getQuantity

      public int getQuantity()
      Fixed quantity of the item that is included with the parent product.
      Returns:
      Fixed quantity of the item that is included with the parent product.
    • getProduct

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

      public Variant getVariant()
      This field contains the specified variant if the type is DefaultIncludedProductType.VARIANT.
      Returns:
      the variant to use if this included product is of type DefaultIncludedProductType.VARIANT
    • getAttributes

      public Map<String,Object> getAttributes()
      Map holding any additional attributes passed in the request not matching any defined properties.
    • setPricingKey

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

      public void setType(String type)
      Defines the type of the item: usually a Product or Variant.
      Parameters:
      type - the type of the item
      See Also:
    • setPriceInfo

      public void setPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)
      Summary of the pricing information related to the included item. The consumer of this service is expecting this to be the source of truth for the pricing of this item, so this field should be calculated from its own override price if present or be a copy of the underlying product's or variant's pricing to simplify the consumer's logic.
      Specified by:
      setPriceInfo in interface Priceable
      Parameters:
      priceInfo - The PriceInfo to set.
      See Also:
      • for special pricing considerations
    • setOverridePrice

      public void setOverridePrice(javax.money.MonetaryAmount overridePrice)
      The specific price set for this included item that overrides the price of underlying product or variant. This is primarily used for reference in determining whether priceInfo should be disregarded in pricing calculations in this service: If there is an overridePrice, then the priceInfo received from the CatalogProvider should be used as the base for additional pricing calculations informed by the PricingProvider. Otherwise, the received priceInfo should be discarded since it is really a copy of the underlying product or variant and cannot be used as a basis for additional pricing calculations for the IncludedProduct itself.
      Parameters:
      overridePrice - the price of this included product
    • setQuantity

      public void setQuantity(int quantity)
      Fixed quantity of the item that is included with the parent product.
      Parameters:
      quantity - Fixed quantity of the item that is included with the parent product.
    • setProduct

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

      public void setVariant(Variant variant)
      This field contains the specified variant if the type is DefaultIncludedProductType.VARIANT.
      Parameters:
      variant - the variant to use if this included product is of type DefaultIncludedProductType.VARIANT
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Map holding any additional attributes passed in the request not matching any defined properties.
    • 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