Class Product

  • All Implemented Interfaces:
    com.broadleafcommerce.money.jackson.CurrencyContextAware, Serializable

    public class Product
    extends Object
    implements Serializable, com.broadleafcommerce.money.jackson.CurrencyContextAware
    A reference to a product, typically used as a holder for information communicated from an external service.
    Author:
    Chad Harchar (charchar)
    See Also:
    Serialized Form
    • Constructor Detail

      • Product

        public Product()
    • Method Detail

      • addAdditionalAttribute

        public void addAdditionalAttribute​(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
      • getAdditionalAttribute

        public Map<String,​Object> getAdditionalAttribute()
        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.
      • getCurrency

        public javax.money.CurrencyUnit getCurrency()
      • getId

        public String getId()
        The ID of the Product.
        Returns:
        The ID of the Product.
      • getName

        public String getName()
        The name of the product.
        Returns:
        The name of the product.
      • getUri

        public String getUri()
        The navigable uri of this product.
        Returns:
        The navigable uri of this product.
      • getSku

        public String getSku()
        This uniquely identifies this product in the catalog when it is sold and is used for other contexts like inventory and pricing.
        Returns:
        the Stock Keeping Unit identifier which means that this Product is sold in the store
      • isDiscountable

        public boolean isDiscountable()

        Whether or not this product be applied to any offers or promotions.

        Defaults to true

        Returns:
        whether or not this product can be applied to any offers or promotions
      • getPriceInfo

        public com.broadleafcommerce.pricing.client.domain.PriceInfo getPriceInfo()
        Summary of the pricing information related to the product.
        Returns:
        Summary of the pricing information related to the product
      • getPricingKey

        public String getPricingKey()
        System-wide unique identifier to configure specific pricing for the product. Relevant if pricing data is managed in a separate system or data store, like the Broadleaf pricing services.
        Returns:
        a unique key to identify this product
      • getMergingType

        public String getMergingType()
        Determines how this Product should merge with other similar items when it gets added to a cart. This will override the global setting on item merging. Out of box supported values are those in DefaultMergingType.
        Returns:
        the merging type to use for this Product
      • getFulfillmentFlatRates

        public Map<String,​FulfillmentFlatRate> getFulfillmentFlatRates()
        A map of flat rates for fulfilling (e.g., shipping) this product for a particular fulfillment option type (e.g., standard shipping). Depending on if the option is configured to use flat rates, this flat rate will be used in calculating the cost of fulfilling this product.

        The key of the map is the type of the fulfillment option such as FIXED_STANDARD or BANDED_PRICE_EXPRESS.

        Returns:
        Map of Fulfillment option types to flat rates for this product.
        See Also:
        FulfillmentFlatRate
      • getIncludedProducts

        public List<IncludedProduct> getIncludedProducts()

        Additional products that are always included with the product, no matter what. Used to configure "bundles" or "kits".

        If some of these items should be optional or the user should decide which additional items are added to their cart, use options instead.

        Returns:
        additional products that bundle with this product as their parent
        See Also:
        IncludedProduct
      • getPrimaryAsset

        public com.broadleafcommerce.cart.client.domain.ImageAssetRef getPrimaryAsset()
        The asset associated with this product marked as primary.
        Returns:
        The primary asset for this product.
      • getAssets

        public List<com.broadleafcommerce.cart.client.domain.ImageAssetRef> getAssets()
        All ProductAssets for this product.
        Returns:
        All ProductAssets for this product.
      • getAttributes

        public Map<String,​Attribute> getAttributes()
        Dynamic attributes that are a part of the product.
        Returns:
        dynamic attributes that are a part of the product
      • getOptions

        public List<ProductOption> getOptions()
        Drives additional information that the customer should enter when purchasing this product. this can be in the form of additional variations, additional items that can be bundled with this product or simply more information that the customer needs to enter about what they are purchasing (like a personalized message).
        Returns:
        Different options that the user can configure to further refine their purchase.
      • getInventoryType

        public String getInventoryType()
        Describes the product's type of fulfillment - ie is it a physical or virtual item?
        Returns:
        the product's type of inventory
      • isAvailableOnline

        public boolean isAvailableOnline()
        Whether or not this product is available online - ie inventory is available somewhere to fulfill this product.
        Returns:
        Whether or not this product is available online.
      • getInventoryCheckStrategy

        public String getInventoryCheckStrategy()
        Describes when the product's inventory should be checked for availability.
        Returns:
        the product's inventory check strategy
      • getInventoryReservationStrategy

        public String getInventoryReservationStrategy()
        Describes when the product's inventory should be reserved.
        Returns:
        the product's inventory reservation strategy
      • getTags

        public List<String> getTags()
        A list of simple labels used to categorize the product
        Returns:
        a list of simple labels used to categorize the product
      • getParentCategories

        public Set<Category> getParentCategories()
        All Categories that include the product.
        Returns:
        All Categories that include the product.
      • getWeight

        public Weight getWeight()
        Returns:
        the weight of this product
      • isIndividuallySold

        public boolean isIndividuallySold()

        If this product or any of its variants can be sold individually in the store, or if they must be apart of another product as an add-on.

        This defaults to true.

        Returns:
        whether or not this product or any of its variants can be sold individually
      • getCurrencyContext

        public com.broadleafcommerce.money.CurrencyContext getCurrencyContext()
        Transient ability to have a currency initialized
        Specified by:
        getCurrencyContext in interface com.broadleafcommerce.money.jackson.CurrencyContextAware
      • getVendorRef

        public String getVendorRef()
        Soft reference to the vendor associated with this catalog. This value can be null, in which case, no vendor is associated.
        Returns:
        Soft reference to the vendor associated with this catalog.
      • getBrand

        public DataDrivenEnum getBrand()
        Returns:
        the brand of this product
      • getMerchandisingType

        public DataDrivenEnum getMerchandisingType()
        Returns:
        the merchandising type of this product
      • getTargetDemographic

        public DataDrivenEnum getTargetDemographic()
        Returns:
        the target demographic of this product
      • getAdditionalAttributes

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

        public Integer getMinimumThreshold()
        The minimum count of this product that must be added in a cart.
        Returns:
        the minimum count of this product that must be added in a cart
      • getMaximumThreshold

        public Integer getMaximumThreshold()
        The maximum count of this product that must be added in a cart.
        Returns:
        the maximum count of this product that must be added in a cart
      • setId

        public void setId​(String id)
        The ID of the Product.
        Parameters:
        id - The ID of the Product.
      • setName

        public void setName​(String name)
        The name of the product.
        Parameters:
        name - The name of the product.
      • setUri

        public void setUri​(String uri)
        The navigable uri of this product.
        Parameters:
        uri - The navigable uri of this product.
      • setSku

        public void setSku​(String sku)
        This uniquely identifies this product in the catalog when it is sold and is used for other contexts like inventory and pricing.
        Parameters:
        sku - the Stock Keeping Unit identifier for this Product. Typically only set this if intending to sell this single Product in the store, but can also be set to the same value as a related variant's sku to declare a default variant/default sku for the product
      • setDiscountable

        public void setDiscountable​(boolean discountable)

        Whether or not this product be applied to any offers or promotions.

        Defaults to true

        Parameters:
        discountable - whether or not this product can be applied to any offers or promotions
      • setPriceInfo

        public void setPriceInfo​(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)
        Summary of the pricing information related to the product.
        Parameters:
        priceInfo - Summary of the pricing information related to the product
      • setPricingKey

        public void setPricingKey​(String pricingKey)
        System-wide unique identifier to configure specific pricing for the product. Relevant if pricing data is managed in a separate system or data store, like the Broadleaf pricing services.
        Parameters:
        pricingKey - a unique key to identify this product (usually a UUID)
      • setMergingType

        public void setMergingType​(String mergingType)
        Determines how this Product should merge with other similar items when it gets added to a cart. This will override the global setting on item merging. Out of box supported values are those in DefaultMergingType.
        Parameters:
        mergingType - the merging type to use for this Product
      • setFulfillmentFlatRates

        public void setFulfillmentFlatRates​(Map<String,​FulfillmentFlatRate> fulfillmentFlatRates)
        A map of flat rates for fulfilling (e.g., shipping) this product for a particular fulfillment option type (e.g., standard shipping). Depending on if the option is configured to use flat rates, this flat rate will be used in calculating the cost of fulfilling this product.

        The key of the map is the type of the fulfillment option such as FIXED_STANDARD or BANDED_PRICE_EXPRESS.

        Parameters:
        fulfillmentFlatRates - Map of Fulfillment option types to flat rates for this product.
        See Also:
        FulfillmentFlatRate
      • setIncludedProducts

        public void setIncludedProducts​(List<IncludedProduct> includedProducts)

        Additional products that are always included with the product, no matter what. Used to configure "bundles" or "kits".

        If some of these items should be optional or the user should decide which additional items are added to their cart, use options instead.

        Parameters:
        includedProducts - that bundle with this product as their parent
        See Also:
        IncludedProduct
      • setPrimaryAsset

        public void setPrimaryAsset​(com.broadleafcommerce.cart.client.domain.ImageAssetRef primaryAsset)
        The asset associated with this product marked as primary.
        Parameters:
        primaryAsset - The primary asset for this product.
      • setAssets

        public void setAssets​(List<com.broadleafcommerce.cart.client.domain.ImageAssetRef> assets)
        All ProductAssets for this product.
        Parameters:
        assets - All ProductAssets for this product.
      • setAttributes

        public void setAttributes​(Map<String,​Attribute> attributes)
        Dynamic attributes that are a part of the product.
        Parameters:
        attributes - dynamic attributes that are a part of the product
      • setOptions

        public void setOptions​(List<ProductOption> options)
        Drives additional information that the customer should enter when purchasing this product. this can be in the form of additional variations, additional items that can be bundled with this product or simply more information that the customer needs to enter about what they are purchasing (like a personalized message).
        Parameters:
        options - the options for this product
      • setInventoryType

        public void setInventoryType​(String inventoryType)
        Describes the product's type of fulfillment - ie is it a physical or virtual item?
        Parameters:
        inventoryType - a String representation of the product's type of inventory
      • setAvailableOnline

        public void setAvailableOnline​(boolean availableOnline)
        Whether or not this product is available online - ie inventory is available somewhere to fulfill this product.
        Parameters:
        availableOnline - Whether or not this product is available online.
      • setInventoryCheckStrategy

        public void setInventoryCheckStrategy​(String inventoryCheckStrategy)
        Describes when the product's inventory should be checked for availability.
        Parameters:
        inventoryCheckStrategy - the product's inventory check strategy
      • setInventoryReservationStrategy

        public void setInventoryReservationStrategy​(String inventoryReservationStrategy)
        Describes when the product's inventory should be reserved.
        Parameters:
        inventoryReservationStrategy - the product's inventory reservation strategy
      • setTags

        public void setTags​(List<String> tags)
        A list of simple labels used to categorize the product
        Parameters:
        tags - a list of simple labels used to categorize the product
      • setParentCategories

        public void setParentCategories​(Set<Category> parentCategories)
        All Categories that include the product.
        Parameters:
        parentCategories - All Categories that include the product.
      • setVariants

        public void setVariants​(List<Variant> variants)
        All Variants for this product.
        Parameters:
        variants - All Variants for this product.
      • setWeight

        public void setWeight​(Weight weight)
        Parameters:
        weight - the weight of this product
      • setIndividuallySold

        public void setIndividuallySold​(boolean individuallySold)

        If this product or any of its variants can be sold individually in the store, or if they must be apart of another product as an add-on.

        This defaults to true.

        Parameters:
        individuallySold - whether or not this product or any of its variants can be sold individually
      • setCurrencyContext

        public void setCurrencyContext​(com.broadleafcommerce.money.CurrencyContext currencyContext)
        Transient ability to have a currency initialized
        Specified by:
        setCurrencyContext in interface com.broadleafcommerce.money.jackson.CurrencyContextAware
      • setVendorRef

        public void setVendorRef​(String vendorRef)
        Soft reference to the vendor associated with this catalog. This value can be null, in which case, no vendor is associated.
        Parameters:
        vendorRef - Soft reference to the vendor associated with this catalog.
      • setBrand

        public void setBrand​(DataDrivenEnum brand)
        Parameters:
        brand - the brand of this product
      • setMerchandisingType

        public void setMerchandisingType​(DataDrivenEnum merchandisingType)
        Parameters:
        merchandisingType - the merchandising type of this product
      • setTargetDemographic

        public void setTargetDemographic​(DataDrivenEnum targetDemographic)
        Parameters:
        targetDemographic - the target demographic of this product
      • setAdditionalAttributes

        public void setAdditionalAttributes​(Map<String,​Object> additionalAttributes)
        Map holding any additional attributes passed in the request not matching any defined properties.
      • setMinimumThreshold

        public void setMinimumThreshold​(Integer minimumThreshold)
        The minimum count of this product that must be added in a cart.
        Parameters:
        minimumThreshold - the minimum count of this product that must be added in a cart
      • setMaximumThreshold

        public void setMaximumThreshold​(Integer maximumThreshold)
        The maximum count of this product that must be added in a cart.
        Parameters:
        maximumThreshold - the maximum count of this product that must be added in a cart
      • canEqual

        protected boolean canEqual​(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object