Class Product
- java.lang.Object
-
- com.broadleafcommerce.catalogbrowse.domain.Product
-
- All Implemented Interfaces:
Priceable,com.broadleafcommerce.money.CurrencyConsumer,Serializable,javax.money.CurrencySupplier
public class Product extends Object implements Serializable, com.broadleafcommerce.money.CurrencyConsumer, javax.money.CurrencySupplier, Priceable
A structure containing all the info necessary for a product details page shown in a commerce-facing app (as opposed to a PIM UI).- Author:
- Nathan Moore (nathandmoore)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Product()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(String name, Object value)Takes in any additional attributes passed in the request not matching any defined properties.protected booleancanEqual(Object other)booleanequals(Object o)List<ProductTag>getAdvancedTags()A list ofProductTagssorted based on the sort position of theProductTagfor the produt with ties broken byAdvancedTag.getPriority().List<Asset>getAssets()AllAssetassets for this product.Map<String,Object>getAttribute()Return any additional attributes passed in the request not matching any defined properties.Map<String,Object>getAttributes()Map holding any additional attributes passed in the request not matching any defined properties.javax.money.CurrencyUnitgetCurrency()Currency for this product.StringgetId()The unique identifier for this product.List<IncludedProduct>getIncludedProducts()Additional products or variants that are always included with the product, no matter what.IntegergetMaximumThreshold()The maximum count of this product that must be added in a cart.StringgetMergingType()Determines how this Product should merge with other similar items when it gets added to a cart.IntegergetMinimumThreshold()The minimum count of this product that must be added in a cart.List<ProductOption>getOptions()Drives additional information that the customer should enter when purchasing this product.javax.money.MonetaryAmountgetPrice()The price of the product.com.broadleafcommerce.pricing.client.domain.PriceInfogetPriceInfo()Summary of thepricing informationrelated to the product.StringgetPricingKey()System-wide unique identifier to configure specific pricing for the product.AssetgetPrimaryAsset()The primary or defaultAssetto display.StringgetProductType()Defines the type of the product.Map<String,List<PromotionalProduct>>getPromotionalProducts()Map of all of the relatedPromotionalProductsgrouped bytype.StringgetSku()This uniquely identifies this product in the catalog when it is sold and is used for other contexts like inventory and pricing.List<Variant>getVariants()AllVariantsfor this product.StringgetVendorRef()Soft reference to the vendor associated with this catalog.inthashCode()voidsetAdvancedTags(List<ProductTag> advancedTags)A list ofProductTagssorted based on the sort position of theProductTagfor the produt with ties broken byAdvancedTag.getPriority().voidsetAssets(List<Asset> assets)AllAssetassets for this product.voidsetAttributes(Map<String,Object> attributes)Map holding any additional attributes passed in the request not matching any defined properties.voidsetCurrency(javax.money.CurrencyUnit currency)Currency for this product.voidsetId(String id)The unique identifier for this product.voidsetIncludedProducts(List<IncludedProduct> includedProducts)Additional products or variants that are always included with the product, no matter what.voidsetMaximumThreshold(Integer maximumThreshold)The maximum count of this product that must be added in a cart.voidsetMergingType(String mergingType)Determines how this Product should merge with other similar items when it gets added to a cart.voidsetMinimumThreshold(Integer minimumThreshold)The minimum count of this product that must be added in a cart.voidsetOptions(List<ProductOption> options)Drives additional information that the customer should enter when purchasing this product.voidsetPrice(javax.money.MonetaryAmount price)The price of the product.voidsetPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)Summary of thepricing informationrelated to the product.voidsetPricingKey(String pricingKey)System-wide unique identifier to configure specific pricing for the product.voidsetPrimaryAsset(Asset primaryAsset)The primary or defaultAssetto display.voidsetProductType(String productType)Defines the type of the product.voidsetPromotionalProducts(Map<String,List<PromotionalProduct>> promotionalProducts)Map of all of the relatedPromotionalProductsgrouped bytype.voidsetSku(String sku)This uniquely identifies this product in the catalog when it is sold and is used for other contexts like inventory and pricing.voidsetVariants(List<Variant> variants)AllVariantsfor this product.voidsetVendorRef(String vendorRef)Soft reference to the vendor associated with this catalog.StringtoString()
-
-
-
Method Detail
-
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 attributevalue- 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.
-
getId
public String getId()
The unique identifier for this product.- Returns:
- The unique identifier for 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
-
getPriceInfo
public com.broadleafcommerce.pricing.client.domain.PriceInfo getPriceInfo()
Summary of thepricing informationrelated to the product.- Specified by:
getPriceInfoin interfacePriceable- Returns:
- The
PriceInfoon the entity.
-
getCurrency
public javax.money.CurrencyUnit getCurrency()
Currency for this product.- Specified by:
getCurrencyin interfacejavax.money.CurrencySupplier- Returns:
- currency
-
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
-
getPrice
public javax.money.MonetaryAmount getPrice()
The price of the product. Sometimes services won't return a propertyPriceInfobut just a price instead. This should be converted to a price info and not returned as a separate field.- Returns:
- The price of the 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 inDefaultMergingType.- Returns:
- the merging type to use for this Product
-
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
-
getOptions
public List<ProductOption> getOptions()
Drives additional information that the customer should enter when purchasing this product. this can be in the form of additionalvariations, 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.
-
getVariants
public List<Variant> getVariants()
AllVariantsfor this product.- Returns:
- All
Variantsfor this product.
-
getIncludedProducts
public List<IncludedProduct> getIncludedProducts()
Additional products or variants that are always included with the product, no matter what. Used to create fixed "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
optionsinstead.- Returns:
- Additional products or variants that are always included with the product
-
getPromotionalProducts
public Map<String,List<PromotionalProduct>> getPromotionalProducts()
Map of all of the relatedPromotionalProductsgrouped bytype.- Returns:
- Related
PromotionalProductsgrouped bytype.
-
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.
-
getProductType
public String getProductType()
Defines the type of the product.- Returns:
- The type of the product
- See Also:
DefaultProductType
-
getAssets
public List<Asset> getAssets()
AllAssetassets for this product.- Returns:
- All
Assetassets for this product.
-
getPrimaryAsset
public Asset getPrimaryAsset()
The primary or defaultAssetto display.- Returns:
- The primary or default
Assetto display.
-
getAdvancedTags
public List<ProductTag> getAdvancedTags()
A list ofProductTagssorted based on the sort position of theProductTagfor the produt with ties broken byAdvancedTag.getPriority().- Returns:
- A list of
ProductTags.
-
getAttributes
public Map<String,Object> getAttributes()
Map holding any additional attributes passed in the request not matching any defined properties.
-
setId
public void setId(String id)
The unique identifier for this product.- Parameters:
id- The unique identifier for 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 relatedvariant'ssku to declare a default variant/default sku for the product
-
setPriceInfo
public void setPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)
Summary of thepricing informationrelated to the product.- Specified by:
setPriceInfoin interfacePriceable- Parameters:
priceInfo- ThePriceInfoto set.
-
setCurrency
public void setCurrency(javax.money.CurrencyUnit currency)
Currency for this product.- Specified by:
setCurrencyin interfacecom.broadleafcommerce.money.CurrencyConsumer- Parameters:
currency-
-
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)
-
setPrice
public void setPrice(javax.money.MonetaryAmount price)
The price of the product. Sometimes services won't return a propertyPriceInfobut just a price instead. This should be converted to a price info and not returned as a separate field.- Parameters:
price- The price of the product.
-
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 inDefaultMergingType.- Parameters:
mergingType- the merging type to use for this Product
-
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
-
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 additionalvariations, 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
-
setVariants
public void setVariants(List<Variant> variants)
AllVariantsfor this product.- Parameters:
variants- AllVariantsfor this product.
-
setIncludedProducts
public void setIncludedProducts(List<IncludedProduct> includedProducts)
Additional products or variants that are always included with the product, no matter what. Used to create fixed "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
optionsinstead.- Parameters:
includedProducts- Additional products or variants that are always included with the product
-
setPromotionalProducts
public void setPromotionalProducts(Map<String,List<PromotionalProduct>> promotionalProducts)
Map of all of the relatedPromotionalProductsgrouped bytype.- Parameters:
promotionalProducts- RelatedPromotionalProductsgrouped bytype.
-
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.
-
setProductType
public void setProductType(String productType)
Defines the type of the product.- Parameters:
productType- The type of the product- See Also:
DefaultProductType
-
setAssets
public void setAssets(List<Asset> assets)
AllAssetassets for this product.- Parameters:
assets- AllAssetassets for this product.
-
setPrimaryAsset
public void setPrimaryAsset(Asset primaryAsset)
The primary or defaultAssetto display.- Parameters:
primaryAsset- The primary or defaultAssetto display.
-
setAdvancedTags
public void setAdvancedTags(List<ProductTag> advancedTags)
A list ofProductTagssorted based on the sort position of theProductTagfor the produt with ties broken byAdvancedTag.getPriority().- Parameters:
advancedTags- A list ofProductTags.
-
setAttributes
public void setAttributes(Map<String,Object> attributes)
Map holding any additional attributes passed in the request not matching any defined properties.
-
canEqual
protected boolean canEqual(Object other)
-
-