org.broadleafcommerce.core.catalog.domain
Interface Product

All Superinterfaces:
Serializable
All Known Subinterfaces:
ProductBundle
All Known Implementing Classes:
ProductBundleImpl, ProductImpl

public interface Product
extends Serializable

Implementations of this interface are used to hold data for a Product. A product is a general description of an item that can be sold (for example: a hat). Products are not sold or added to a cart. Skus which are specific items (for example: a XL Blue Hat) are sold or added to a cart.

You should implement this class if you want to make significant changes to how the Product is persisted. If you just want to add additional fields then you should extend ProductImpl.

Author:
btaylor
See Also:
ProductImpl},{@link Sku}, {@link Category}

Method Summary
 void clearDynamicPrices()
          Removes any currently stored dynamic pricing
 Date getActiveEndDate()
          Returns the last date a product will be available that is used to determine whether to display the product.
 Date getActiveStartDate()
          Returns the first date a product will be available that is used to determine whether to display the product.
 List<Sku> getAdditionalSkus()
          Gets all the additional Skus associated with this Product.
 List<Category> getAllParentCategories()
          Deprecated. Use getAllParentCategoryXrefs() instead.
 List<CategoryProductXref> getAllParentCategoryXrefs()
           
 Map<String,Media> getAllSkuMedia()
          Convenience method for returning all of the media associated with this Product by adding all the media in getDefaultSku() as well as all the media in the Skus represented by getAdditionalSkus()
 List<Sku> getAllSkus()
          Returns all the Skus that are associated with this Product (including getDefaultSku()) regardless of whether or not the Skus are active or not

Note: in the event that the default Sku was added to the list of getAdditionalSkus(), it is filtered out so that only a single instance of getDefaultSku() is contained in the resulting list
 Boolean getCanSellWithoutOptions()
           
 ContainerShapeType getContainer()
          Gets the dimension container shape

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 List<RelatedProduct> getCrossSaleProducts()
          Returns a List of this product's related Cross Sales
 List<RelatedProduct> getCumulativeCrossSaleProducts()
          Returns a list of the cross sale products for this product as well all cross sale products in all parent categories of this product.
 List<RelatedProduct> getCumulativeUpSaleProducts()
          Returns a list of the upsale products for this product as well as all upsale products in all parent categories of this product.
 Category getDefaultCategory()
          Returns the default Category this product is associated with.
 Sku getDefaultSku()
          Gets the default Sku associated with this Product.
 BigDecimal getDepth()
          Returns the dimension depth

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 String getDescription()
          Returns a brief description of the product that is used for display.
 Dimension getDimension()
          Returns the Dimension for this product

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 String getDimensionString()
          Returns a String representation of the dimension

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 String getDisplayTemplate()
          Returns the name of a display template that is used to render this product.
 String getGeneratedUrl()
          Generates a URL that can be used to access the product.
 BigDecimal getGirth()
          Gets the dimension girth

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 BigDecimal getHeight()
          Returns the dimension height

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 Long getId()
          The id of the Product.
 String getLongDescription()
          Returns a long description of the product that is used for display.
 String getManufacturer()
          Returns the manufacture name for this product
 Map<String,Media> getMedia()
          Gets the media for this product.
 String getModel()
          Returns the model number of the product
 String getName()
          Returns the name of the product that is used for display purposes.
 Map<String,ProductAttribute> getProductAttributes()
          Generic key-value pair of attributes to associate to this Product for maximum extensibility.
 List<ProductOption> getProductOptions()
          The available ProductOptions for this Product.
 String getPromoMessage()
          Gets the promotional message for this Product.
 ContainerSizeType getSize()
          Returns the dimension container size

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 List<Sku> getSkus()
          Returns a list of Skus filtered by whether the Skus are active or not.
 String getTaxCode()
          Returns the tax code of the product.
 List<RelatedProduct> getUpSaleProducts()
          Returns a List of this product's related Up Sales
 String getUrl()
          A product can have a designated URL.
 String getUrlKey()
          Sets a url-fragment.
 Weight getWeight()
          Returns the weight of the product

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 BigDecimal getWidth()
          Returns the dimension width

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 boolean isActive()
          Returns a boolean that indicates if the product is currently active.
 boolean isFeaturedProduct()
          Returns whether or not the product is featured
 void setActiveEndDate(Date activeEndDate)
          Sets the last date a product will be available that is used to determine whether to display the product.
 void setActiveStartDate(Date activeStartDate)
          Sets the first date a product will be available that is used to determine whether to display the product.
 void setAdditionalSkus(List<Sku> skus)
          Sets the additional Skus associated to this Product.
 void setAllParentCategories(List<Category> allParentCategories)
          Deprecated. Use setAllParentCategoryXrefs() instead.
 void setAllParentCategoryXrefs(List<CategoryProductXref> allParentCategories)
           
 void setCanSellWithoutOptions(Boolean canSellWithoutOptions)
          Sets whether or not the default sku can be sold in the case that no product options are specified.
 void setContainer(ContainerShapeType container)
          Sets the dimension container shape

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 void setCrossSaleProducts(List<RelatedProduct> crossSaleProducts)
          Sets the related Cross Sales
 void setDefaultCategory(Category defaultCategory)
          Sets the default Category to associate this product with.
 void setDefaultSku(Sku defaultSku)
          Sets the default Sku for this Product

Note: this operation is cascaded with CascadeType.ALL which saves from having to persist the Product in 2 operations: first persist the Sku and then take the merged Sku, set it as this Product's default Sku, and then persist this Product.
 void setDepth(BigDecimal depth)
          Sets the dimension depth

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 void setDescription(String description)
          Sets a brief description of the product that is used for display.
 void setDimension(Dimension dimension)
          Sets the Dimension for this product

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 void setDisplayTemplate(String displayTemplate)
          Sets the name of a display template that is used to render this product.
 void setFeaturedProduct(boolean isFeaturedProduct)
          Sets whether or not the product is featured
 void setGirth(BigDecimal girth)
          Sets the dimension girth

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 void setHeight(BigDecimal height)
          Sets the dimension height

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 void setId(Long id)
          Sets the id of the Product.
 void setLongDescription(String longDescription)
          Sets a long description of the product that is used for display.
 void setManufacturer(String manufacturer)
          Sets the manufacture for this product
 void setMedia(Map<String,Media> media)
          Gets the media for this product.
 void setModel(String model)
          Sets the model number of the product
 void setName(String name)
          Sets the name of the product that is used for display purposes.
 void setProductAttributes(Map<String,ProductAttribute> productAttributes)
          Sets a generic list of key-value pairs for Product
 void setProductOptions(List<ProductOption> productOptions)
          Sets the list of available ProductOptions for this Product
 void setPromoMessage(String promoMessage)
          Sets the promotional message for this Product
 void setSize(ContainerSizeType size)
          Sets the dimension container size

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 void setTaxCode(String taxCode)
          Sets the tax code for this product.
 void setUpSaleProducts(List<RelatedProduct> upSaleProducts)
          Sets the related Up Sales
 void setUrl(String url)
          Sets the URL that a customer could type in to reach this product.
 void setUrlKey(String url)
          Sets a url-fragment to be used with this product.
 void setWeight(Weight weight)
          Sets the product weight

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 void setWidth(BigDecimal width)
          Sets the dimension width

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()
 

Method Detail

getId

Long getId()
The id of the Product.

Returns:
the id of the Product

setId

void setId(Long id)
Sets the id of the Product.

Parameters:
id - - the id of the product

getName

String getName()
Returns the name of the product that is used for display purposes.

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
the name of the product

setName

void setName(String name)
Sets the name of the product that is used for display purposes.

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
name - - the name of the Product

getDescription

String getDescription()
Returns a brief description of the product that is used for display.

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
a brief description of the product

setDescription

void setDescription(String description)
Sets a brief description of the product that is used for display.

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
description - - a brief description of the product

getLongDescription

String getLongDescription()
Returns a long description of the product that is used for display.

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
a long description of the product

setLongDescription

void setLongDescription(String longDescription)
Sets a long description of the product that is used for display.

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
longDescription - the long description

getActiveStartDate

Date getActiveStartDate()
Returns the first date a product will be available that is used to determine whether to display the product.

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
the first date the product will be available

setActiveStartDate

void setActiveStartDate(Date activeStartDate)
Sets the first date a product will be available that is used to determine whether to display the product.

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
activeStartDate - - the first day the product is available

getActiveEndDate

Date getActiveEndDate()
Returns the last date a product will be available that is used to determine whether to display the product.

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
the last day the product is available

setActiveEndDate

void setActiveEndDate(Date activeEndDate)
Sets the last date a product will be available that is used to determine whether to display the product.

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
activeEndDate - - the last day the product is available

isActive

boolean isActive()
Returns a boolean that indicates if the product is currently active.

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
a boolean indicates if the product is active.

getDefaultSku

Sku getDefaultSku()
Gets the default Sku associated with this Product. A Product is required to have a default Sku which holds specific information about the Product like weight, dimensions, price, etc. Many of the Product attributes that have getters and setters on Product are actually pass-through to the default Sku.

Products can also have multiple Skus associated with it that are represented by ProductOptions. For instance, a large, blue shirt. For more information on that relationship see getAdditionalSkus().

Returns:
the default Sku for this Product

setDefaultSku

void setDefaultSku(Sku defaultSku)
Sets the default Sku for this Product

Note: this operation is cascaded with CascadeType.ALL which saves from having to persist the Product in 2 operations: first persist the Sku and then take the merged Sku, set it as this Product's default Sku, and then persist this Product.

Parameters:
defaultSku - - the Sku that should be the default for this Product

getCanSellWithoutOptions

Boolean getCanSellWithoutOptions()
Returns:
whether or not the default sku can be used for a multi-sku product in the case that no product options are set. Defaults to false if not specified. Note that this only affects multi-sku products.

setCanSellWithoutOptions

void setCanSellWithoutOptions(Boolean canSellWithoutOptions)
Sets whether or not the default sku can be sold in the case that no product options are specified. Note that this only affects multi-sku products.

Parameters:
canSellWithoutOptions -

getSkus

List<Sku> getSkus()
Returns a list of Skus filtered by whether the Skus are active or not. This list does not contain the getDefaultSku() and filters by Sku.isActive().

Returns:
a list of active Skus from getAdditionalSkus() for this Product

getAdditionalSkus

List<Sku> getAdditionalSkus()
Gets all the additional Skus associated with this Product. For instance, if this Product represented a T-shirt and you could pick the size of the T-shirt as a ProductOption (like "small", "medium", "large") this would return 3 Skus if you had different inventory or price constraints on each ProductOptionValue.

This list does not take into account whether any of these additional Skus are active or not, nor does it contain the getDefaultSku() for this Product. For this functionality, see getSkus() and getAllSkus(), respectively.

Returns:
the additional Skus for this Product
See Also:
ProductOption}, {@link ProductOptionValue}

setAdditionalSkus

void setAdditionalSkus(List<Sku> skus)
Sets the additional Skus associated to this Product. These additional Skus should come from ProductOptionValues and are used in instance where you need to track inventory or change pricing on a per-option value basis.

Parameters:
skus - - a List of Skus to associate with this Product, usually based off of ProductOptions
See Also:
#getAdditionalSkus()}, {@link ProductOption}, {@link ProductOptionValue}

getAllSkus

List<Sku> getAllSkus()
Returns all the Skus that are associated with this Product (including getDefaultSku()) regardless of whether or not the Skus are active or not

Note: in the event that the default Sku was added to the list of getAdditionalSkus(), it is filtered out so that only a single instance of getDefaultSku() is contained in the resulting list

Returns:
all the Skus associated to this Product

getMedia

Map<String,Media> getMedia()
Gets the media for this product. This serves as a pass-through to the getDefaultSku() media

Returns:
the Media for the default Sku associated with this Product
See Also:
Sku

setMedia

void setMedia(Map<String,Media> media)
Gets the media for this product. This serves as a pass-through to the getDefaultSku() media

Parameters:
media - Media map to set on the default Sku associated with this Product
See Also:
Sku

getAllSkuMedia

Map<String,Media> getAllSkuMedia()
Convenience method for returning all of the media associated with this Product by adding all the media in getDefaultSku() as well as all the media in the Skus represented by getAdditionalSkus()

Returns:
all of the Media for all of the Skus for this Product

getDefaultCategory

Category getDefaultCategory()
Returns the default Category this product is associated with.


setDefaultCategory

void setDefaultCategory(Category defaultCategory)
Sets the default Category to associate this product with.

Parameters:
defaultCategory - - the default Category to associate this product with

getModel

String getModel()
Returns the model number of the product

Returns:
the model number

setModel

void setModel(String model)
Sets the model number of the product

Parameters:
model -

getManufacturer

String getManufacturer()
Returns the manufacture name for this product

Returns:
the manufacture name

setManufacturer

void setManufacturer(String manufacturer)
Sets the manufacture for this product

Parameters:
manufacturer -

getDimension

Dimension getDimension()
Returns the Dimension for this product

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
a ProductDimensions object

setDimension

void setDimension(Dimension dimension)
Sets the Dimension for this product

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
dimension -

getWidth

BigDecimal getWidth()
Returns the dimension width

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
width dimension of the product

setWidth

void setWidth(BigDecimal width)
Sets the dimension width

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
width -

getHeight

BigDecimal getHeight()
Returns the dimension height

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
height dimension of the product

setHeight

void setHeight(BigDecimal height)
Sets the dimension height

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
height -

getDepth

BigDecimal getDepth()
Returns the dimension depth

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
width depth of the product

setDepth

void setDepth(BigDecimal depth)
Sets the dimension depth

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
depth -

getGirth

BigDecimal getGirth()
Gets the dimension girth

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
the dimension girth

setGirth

void setGirth(BigDecimal girth)
Sets the dimension girth

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
girth -

getSize

ContainerSizeType getSize()
Returns the dimension container size

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
dimension container size

setSize

void setSize(ContainerSizeType size)
Sets the dimension container size

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
size -

getContainer

ContainerShapeType getContainer()
Gets the dimension container shape

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
dimension container shape

setContainer

void setContainer(ContainerShapeType container)
Sets the dimension container shape

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
container -

getDimensionString

String getDimensionString()
Returns a String representation of the dimension

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
a dimension String

getWeight

Weight getWeight()
Returns the weight of the product

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Returns:
weight of product

setWeight

void setWeight(Weight weight)
Sets the product weight

Note: this is a convenience method that merely serves as a pass-through to the same method via getDefaultSku()

Parameters:
weight -

getCrossSaleProducts

List<RelatedProduct> getCrossSaleProducts()
Returns a List of this product's related Cross Sales

Returns:

setCrossSaleProducts

void setCrossSaleProducts(List<RelatedProduct> crossSaleProducts)
Sets the related Cross Sales

Parameters:
crossSaleProducts -

getUpSaleProducts

List<RelatedProduct> getUpSaleProducts()
Returns a List of this product's related Up Sales

Returns:

setUpSaleProducts

void setUpSaleProducts(List<RelatedProduct> upSaleProducts)
Sets the related Up Sales

Parameters:
upSaleProducts -

isFeaturedProduct

boolean isFeaturedProduct()
Returns whether or not the product is featured

Returns:
isFeaturedProduct as Boolean

setFeaturedProduct

void setFeaturedProduct(boolean isFeaturedProduct)
Sets whether or not the product is featured

Parameters:
isFeaturedProduct -

getProductAttributes

Map<String,ProductAttribute> getProductAttributes()
Generic key-value pair of attributes to associate to this Product for maximum extensibility.

Returns:
the attributes for this Product

setProductAttributes

void setProductAttributes(Map<String,ProductAttribute> productAttributes)
Sets a generic list of key-value pairs for Product

Parameters:
productAttributes -

getPromoMessage

String getPromoMessage()
Gets the promotional message for this Product. For instance, this could be a limited-time Product

Returns:
the Product's promotional message

setPromoMessage

void setPromoMessage(String promoMessage)
Sets the promotional message for this Product

Parameters:
promoMessage -

getProductOptions

List<ProductOption> getProductOptions()
The available ProductOptions for this Product. For instance, if this Product is a T-Shirt, you might be able to specify a size and color. This would be modeled by 2 ProductOptions, each that could have multiple ProductOptionValues (which could be "small" "medium" "large", "blue", "yellow", "green"). For specific pricing or inventory needs on a per-value basis, multiple Skus can be associated to this Product based off of the ProductOptionValues

Returns:
the ProductOptions for this Product
See Also:
Product#getAdditionalSkus(), {@link ProductOption}, {@link ProductOptionValue}

setProductOptions

void setProductOptions(List<ProductOption> productOptions)
Sets the list of available ProductOptions for this Product

Parameters:
productOptions -

getUrl

String getUrl()
A product can have a designated URL. When set, the ProductHandlerMapping will check for this URL and forward this user to the getDisplayTemplate(). Alternatively, most sites will rely on the getGeneratedUrl() to define the url for a product page.

Returns:
See Also:
org.broadleafcommerce.core.web.catalog.ProductHandlerMapping

setUrl

void setUrl(String url)
Sets the URL that a customer could type in to reach this product.

Parameters:
url -

getUrlKey

String getUrlKey()
Sets a url-fragment. By default, the system will attempt to create a unique url-fragment for this product by taking the Product.getName() and removing special characters and replacing dashes with spaces.


setUrlKey

void setUrlKey(String url)
Sets a url-fragment to be used with this product. By default, the system will attempt to create a unique url-fragment for this product by taking the Product.getName() and removing special characters and replacing dashes with spaces.


getDisplayTemplate

String getDisplayTemplate()
Returns the name of a display template that is used to render this product. Most implementations have a default template for all products. This allows for the user to define a specific template to be used by this product.

Returns:

setDisplayTemplate

void setDisplayTemplate(String displayTemplate)
Sets the name of a display template that is used to render this product. Most implementations have a default template for all products. This allows for the user to define a specific template to be used by this product.

Parameters:
displayTemplate -

getGeneratedUrl

String getGeneratedUrl()
Generates a URL that can be used to access the product. Builds the url by combining the url of the default category with the getUrlKey() of this product.


getCumulativeCrossSaleProducts

List<RelatedProduct> getCumulativeCrossSaleProducts()
Returns a list of the cross sale products for this product as well all cross sale products in all parent categories of this product.

Returns:
the cumulative cross sale products

getCumulativeUpSaleProducts

List<RelatedProduct> getCumulativeUpSaleProducts()
Returns a list of the upsale products for this product as well as all upsale products in all parent categories of this product.

Returns:
the cumulative upsale products

clearDynamicPrices

void clearDynamicPrices()
Removes any currently stored dynamic pricing


getAllParentCategoryXrefs

List<CategoryProductXref> getAllParentCategoryXrefs()

setAllParentCategoryXrefs

void setAllParentCategoryXrefs(List<CategoryProductXref> allParentCategories)

getAllParentCategories

@Deprecated
List<Category> getAllParentCategories()
Deprecated. Use getAllParentCategoryXrefs() instead.

Returns all parent Category(s) this product is associated with.

Returns:
the all parent categories for this product

setAllParentCategories

@Deprecated
void setAllParentCategories(List<Category> allParentCategories)
Deprecated. Use setAllParentCategoryXrefs() instead.

Sets all parent Categorys this product is associated with.

Parameters:
allParentCategories - - a List of all parent Category(s) to associate this product with

getTaxCode

String getTaxCode()
Returns the tax code of the product. If the tax code is null, then returns the tax code of this products category.

Returns:
taxCode

setTaxCode

void setTaxCode(String taxCode)
Sets the tax code for this product.

Parameters:
taxCode -


Copyright © 2013. All Rights Reserved.