org.broadleafcommerce.core.catalog.domain
Class ProductImpl

java.lang.Object
  extended by org.broadleafcommerce.core.catalog.domain.ProductImpl
All Implemented Interfaces:
java.io.Serializable, Product
Direct Known Subclasses:
ProductSkuImpl

@Entity
public class ProductImpl
extends java.lang.Object
implements Product

The Class ProductImpl is the default implementation of 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.

If you want to add fields specific to your implementation of BroadLeafCommerce you should extend this class and add your fields. If you need to make significant changes to the ProductImpl then you should implement your own version of Product.

This implementation uses a Hibernate implementation of JPA configured through annotations. The Entity references the following tables: BLC_PRODUCT, BLC_PRODUCT_SKU_XREF, BLC_PRODUCT_IMAGE

Author:
btaylor
See Also:
Product}, {@link SkuImpl}, {@link CategoryImpl}, Serialized Form

Field Summary
protected  java.util.Date activeEndDate
          The active end date.
protected  java.util.Date activeStartDate
          The active start date.
protected  java.util.List<Category> allParentCategories
           
protected  java.util.List<Sku> allSkus
          The all skus.
protected  java.util.List<RelatedProduct> crossSaleProducts
           
protected  Category defaultCategory
          The default category.
protected  java.lang.String description
          The description.
protected  ProductDimension dimension
          The product dimensions
protected  java.lang.Long id
          The id.
protected  boolean isFeaturedProduct
           
protected  boolean isMachineSortable
           
protected  java.lang.String longDescription
          The long description.
protected  java.lang.String manufacturer
          The manufacture name
protected  java.lang.String model
          The product model number
protected  java.lang.String name
          The name.
protected  java.util.List<ProductAttribute> productAttributes
           
protected  java.util.Map<java.lang.String,java.lang.String> productImages
          Deprecated. 
protected  java.util.Map<java.lang.String,Media> productMedia
          The product media.
protected  java.lang.String promoMessage
           
protected  java.util.List<Sku> skus
          The skus.
protected  java.util.List<RelatedProduct> upSaleProducts
           
protected  ProductWeight weight
          The product weight
 
Constructor Summary
ProductImpl()
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.util.Date getActiveEndDate()
          Returns the last date a product will be available that is used to determine whether to display the product.
 java.util.Date getActiveStartDate()
          Returns the first date a product will be available that is used to determine whether to display the product.
 java.util.List<Category> getAllParentCategories()
          Returns all parent Category(s) this product is associated with.
 java.util.List<Sku> getAllSkus()
          Gets the all skus.
 ContainerShapeType getContainer()
           
 java.util.List<RelatedProduct> getCrossSaleProducts()
          Returns a List of this product's related Cross Sales
 Category getDefaultCategory()
          Returns the default Category this product is associated with.
 java.math.BigDecimal getDepth()
          Returns the product dimension depth
 java.lang.String getDescription()
          Returns a brief description of the product that is used for display.
 ProductDimension getDimension()
          Returns the ProductDimension for this product
 java.lang.String getDimensionString()
          Returns the product dimensions as a String (assumes measurements are in inches)
 java.math.BigDecimal getGirth()
           
 java.math.BigDecimal getHeight()
          Returns the product dimension height
 java.lang.Long getId()
          The id of the Product.
 java.lang.String getLongDescription()
          Returns a long description of the product that is used for display.
 java.lang.String getManufacturer()
          Returns the manufacture name for this product
 java.lang.String getModel()
          Returns the model number of the product
 java.lang.String getName()
          Returns the name of the product that is used for display purposes.
 java.util.List<ProductAttribute> getProductAttributes()
           
 java.lang.String getProductImage(java.lang.String imageKey)
          Deprecated. 
 java.util.Map<java.lang.String,java.lang.String> getProductImages()
          Deprecated. 
 java.util.Map<java.lang.String,Media> getProductMedia()
          Returns a map of key/value pairs that associate the media name (key) with the Media object(value)
 java.lang.String getPromoMessage()
           
 ContainerSizeType getSize()
           
 java.util.List<Sku> getSkus()
          Returns a list of Skus that are part of this product.
 java.util.List<RelatedProduct> getUpSaleProducts()
          Returns a List of this product's related Up Sales
 ProductWeight getWeight()
          Returns the weight of the product
 java.math.BigDecimal getWidth()
          Returns the product dimension width
 int hashCode()
           
 boolean isActive()
          Returns a boolean that indicates if the product is currently active.
 boolean isFeaturedProduct()
          Returns whether or not the product is featured
 boolean isMachineSortable()
           
 void setActiveEndDate(java.util.Date activeEndDate)
          Sets the last date a product will be available that is used to determine whether to display the product.
 void setActiveStartDate(java.util.Date activeStartDate)
          Sets the first date a product will be available that is used to determine whether to display the product.
 void setAllParentCategories(java.util.List<Category> allParentCategories)
          Sets all parent Categorys this product is associated with.
 void setAllSkus(java.util.List<Sku> skus)
          Sets the Skus that are to be associated with this product.
 void setContainer(ContainerShapeType container)
           
 void setCrossSaleProducts(java.util.List<RelatedProduct> crossSaleProducts)
          Sets the related Cross Sales
 void setDefaultCategory(Category defaultCategory)
          Sets the default Category to associate this product with.
 void setDepth(java.math.BigDecimal depth)
          Sets the product dimension depth
 void setDescription(java.lang.String description)
          Sets a brief description of the product that is used for display.
 void setDimension(ProductDimension dimension)
          Sets the ProductDimension for this product
 void setFeaturedProduct(boolean isFeaturedProduct)
          Sets whether or not the product is featured
 void setGirth(java.math.BigDecimal girth)
           
 void setHeight(java.math.BigDecimal height)
          Sets the product dimension height
 void setId(java.lang.Long id)
          Sets the id of the Product.
 void setLongDescription(java.lang.String longDescription)
          Sets a long description of the product that is used for display.
 void setMachineSortable(boolean isMachineSortable)
           
 void setManufacturer(java.lang.String manufacturer)
          Sets the manufacture for this product
 void setModel(java.lang.String model)
          Sets the model number of the product
 void setName(java.lang.String name)
          Sets the name of the product that is used for display purposes.
 void setProductAttributes(java.util.List<ProductAttribute> productAttributes)
           
 void setProductImages(java.util.Map<java.lang.String,java.lang.String> productImages)
          Deprecated. 
 void setProductMedia(java.util.Map<java.lang.String,Media> productMedia)
          Sets the product media map.
 void setPromoMessage(java.lang.String promoMessage)
           
 void setSize(ContainerSizeType size)
           
 void setUpSaleProducts(java.util.List<RelatedProduct> upSaleProducts)
          Sets the related Up Sales
 void setWeight(ProductWeight weight)
          Sets the product weight
 void setWidth(java.math.BigDecimal width)
          Sets the product dimension width
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected java.lang.Long id
The id.


name

protected java.lang.String name
The name.


description

protected java.lang.String description
The description.


longDescription

protected java.lang.String longDescription
The long description.


activeStartDate

protected java.util.Date activeStartDate
The active start date.


activeEndDate

protected java.util.Date activeEndDate
The active end date.


model

protected java.lang.String model
The product model number


manufacturer

protected java.lang.String manufacturer
The manufacture name


dimension

protected ProductDimension dimension
The product dimensions


weight

protected ProductWeight weight
The product weight


isFeaturedProduct

protected boolean isFeaturedProduct

isMachineSortable

protected boolean isMachineSortable

skus

protected java.util.List<Sku> skus
The skus.


promoMessage

protected java.lang.String promoMessage

crossSaleProducts

protected java.util.List<RelatedProduct> crossSaleProducts

upSaleProducts

protected java.util.List<RelatedProduct> upSaleProducts

allSkus

protected java.util.List<Sku> allSkus
The all skus.


productImages

@Deprecated
protected java.util.Map<java.lang.String,java.lang.String> productImages
Deprecated. 
The product images.


productMedia

protected java.util.Map<java.lang.String,Media> productMedia
The product media.


defaultCategory

protected Category defaultCategory
The default category.


allParentCategories

protected java.util.List<Category> allParentCategories

productAttributes

protected java.util.List<ProductAttribute> productAttributes
Constructor Detail

ProductImpl

public ProductImpl()
Method Detail

getId

public java.lang.Long getId()
Description copied from interface: Product
The id of the Product.

Specified by:
getId in interface Product
Returns:
the id of the Product

setId

public void setId(java.lang.Long id)
Description copied from interface: Product
Sets the id of the Product.

Specified by:
setId in interface Product
Parameters:
id - - the id of the product

getName

public java.lang.String getName()
Description copied from interface: Product
Returns the name of the product that is used for display purposes.

Specified by:
getName in interface Product
Returns:
the name of the product

setName

public void setName(java.lang.String name)
Description copied from interface: Product
Sets the name of the product that is used for display purposes.

Specified by:
setName in interface Product
Parameters:
name - - the name of the Product

getDescription

public java.lang.String getDescription()
Description copied from interface: Product
Returns a brief description of the product that is used for display.

Specified by:
getDescription in interface Product
Returns:
a brief description of the product

setDescription

public void setDescription(java.lang.String description)
Description copied from interface: Product
Sets a brief description of the product that is used for display.

Specified by:
setDescription in interface Product
Parameters:
description - - a brief description of the product

getLongDescription

public java.lang.String getLongDescription()
Description copied from interface: Product
Returns a long description of the product that is used for display.

Specified by:
getLongDescription in interface Product
Returns:
a long description of the product

setLongDescription

public void setLongDescription(java.lang.String longDescription)
Description copied from interface: Product
Sets a long description of the product that is used for display.

Specified by:
setLongDescription in interface Product
Parameters:
longDescription - the long description

getActiveStartDate

public java.util.Date getActiveStartDate()
Description copied from interface: Product
Returns the first date a product will be available that is used to determine whether to display the product.

Specified by:
getActiveStartDate in interface Product
Returns:
the first date the product will be available

setActiveStartDate

public void setActiveStartDate(java.util.Date activeStartDate)
Description copied from interface: Product
Sets the first date a product will be available that is used to determine whether to display the product.

Specified by:
setActiveStartDate in interface Product
Parameters:
activeStartDate - - the first day the product is available

getActiveEndDate

public java.util.Date getActiveEndDate()
Description copied from interface: Product
Returns the last date a product will be available that is used to determine whether to display the product.

Specified by:
getActiveEndDate in interface Product
Returns:
the last day the product is available

setActiveEndDate

public void setActiveEndDate(java.util.Date activeEndDate)
Description copied from interface: Product
Sets the last date a product will be available that is used to determine whether to display the product.

Specified by:
setActiveEndDate in interface Product
Parameters:
activeEndDate - - the last day the product is available

isActive

public boolean isActive()
Description copied from interface: Product
Returns a boolean that indicates if the product is currently active.

Specified by:
isActive in interface Product
Returns:
a boolean indicates if the product is active.

getModel

public java.lang.String getModel()
Description copied from interface: Product
Returns the model number of the product

Specified by:
getModel in interface Product
Returns:
the model number

setModel

public void setModel(java.lang.String model)
Description copied from interface: Product
Sets the model number of the product

Specified by:
setModel in interface Product

getManufacturer

public java.lang.String getManufacturer()
Description copied from interface: Product
Returns the manufacture name for this product

Specified by:
getManufacturer in interface Product
Returns:
the manufacture name

setManufacturer

public void setManufacturer(java.lang.String manufacturer)
Description copied from interface: Product
Sets the manufacture for this product

Specified by:
setManufacturer in interface Product

getDimension

public ProductDimension getDimension()
Description copied from interface: Product
Returns the ProductDimension for this product

Specified by:
getDimension in interface Product
Returns:
a ProductDimensions object

setDimension

public void setDimension(ProductDimension dimension)
Description copied from interface: Product
Sets the ProductDimension for this product

Specified by:
setDimension in interface Product

getWidth

public java.math.BigDecimal getWidth()
Description copied from interface: Product
Returns the product dimension width

Specified by:
getWidth in interface Product
Returns:
width dimension of the product

setWidth

public void setWidth(java.math.BigDecimal width)
Description copied from interface: Product
Sets the product dimension width

Specified by:
setWidth in interface Product

getHeight

public java.math.BigDecimal getHeight()
Description copied from interface: Product
Returns the product dimension height

Specified by:
getHeight in interface Product
Returns:
height dimension of the product

setHeight

public void setHeight(java.math.BigDecimal height)
Description copied from interface: Product
Sets the product dimension height

Specified by:
setHeight in interface Product

getDepth

public java.math.BigDecimal getDepth()
Description copied from interface: Product
Returns the product dimension depth

Specified by:
getDepth in interface Product
Returns:
width depth of the product

setDepth

public void setDepth(java.math.BigDecimal depth)
Description copied from interface: Product
Sets the product dimension depth

Specified by:
setDepth in interface Product

setGirth

public void setGirth(java.math.BigDecimal girth)
Specified by:
setGirth in interface Product

getGirth

public java.math.BigDecimal getGirth()
Specified by:
getGirth in interface Product

getSize

public ContainerSizeType getSize()
Specified by:
getSize in interface Product

setSize

public void setSize(ContainerSizeType size)
Specified by:
setSize in interface Product

getContainer

public ContainerShapeType getContainer()
Specified by:
getContainer in interface Product

setContainer

public void setContainer(ContainerShapeType container)
Specified by:
setContainer in interface Product

getDimensionString

public java.lang.String getDimensionString()
Returns the product dimensions as a String (assumes measurements are in inches)

Specified by:
getDimensionString in interface Product
Returns:
a String value of the product dimensions

isFeaturedProduct

public boolean isFeaturedProduct()
Description copied from interface: Product
Returns whether or not the product is featured

Specified by:
isFeaturedProduct in interface Product
Returns:
isFeaturedProduct as Boolean

setFeaturedProduct

public void setFeaturedProduct(boolean isFeaturedProduct)
Description copied from interface: Product
Sets whether or not the product is featured

Specified by:
setFeaturedProduct in interface Product

isMachineSortable

public boolean isMachineSortable()
Specified by:
isMachineSortable in interface Product

setMachineSortable

public void setMachineSortable(boolean isMachineSortable)
Specified by:
setMachineSortable in interface Product

getWeight

public ProductWeight getWeight()
Description copied from interface: Product
Returns the weight of the product

Specified by:
getWeight in interface Product
Returns:
weight of product

setWeight

public void setWeight(ProductWeight weight)
Description copied from interface: Product
Sets the product weight

Specified by:
setWeight in interface Product

getPromoMessage

public java.lang.String getPromoMessage()
Specified by:
getPromoMessage in interface Product
Returns:
the promoMessage

setPromoMessage

public void setPromoMessage(java.lang.String promoMessage)
Specified by:
setPromoMessage in interface Product
Parameters:
promoMessage - the promoMessage to set

getAllSkus

public java.util.List<Sku> getAllSkus()
Gets the all skus.

Specified by:
getAllSkus in interface Product
Returns:
the all skus

getSkus

public java.util.List<Sku> getSkus()
Description copied from interface: Product
Returns a list of Skus that are part of this product.

Specified by:
getSkus in interface Product
Returns:
a list of Skus associated with this product

setAllSkus

public void setAllSkus(java.util.List<Sku> skus)
Description copied from interface: Product
Sets the Skus that are to be associated with this product.

Specified by:
setAllSkus in interface Product
Parameters:
skus - - a List of Skus to associate with this product.

getProductImages

@Deprecated
public java.util.Map<java.lang.String,java.lang.String> getProductImages()
Deprecated. 

Description copied from interface: Product
Returns a map of key/value pairs that associate the image name (key) with the URL to the image (value) for display purposes. This method is deprecated. Use getProductMedia instead.

Specified by:
getProductImages in interface Product
Returns:
a map of product images

getProductImage

@Deprecated
public java.lang.String getProductImage(java.lang.String imageKey)
Deprecated. 

Description copied from interface: Product
Returns a string URL to an image given the string key passed in for this product.

Specified by:
getProductImage in interface Product
Parameters:
imageKey - - a string key to lookup the image for the product
Returns:
a URL to the image associated witht he key passed in.

setProductImages

@Deprecated
public void setProductImages(java.util.Map<java.lang.String,java.lang.String> productImages)
Deprecated. 

Description copied from interface: Product
Sets the product images map. This method is deprecated. Use setProductMedia instead.

Specified by:
setProductImages in interface Product
Parameters:
productImages - - a map of product images

getDefaultCategory

public Category getDefaultCategory()
Description copied from interface: Product
Returns the default Category this product is associated with.

Specified by:
getDefaultCategory in interface Product

getProductMedia

public java.util.Map<java.lang.String,Media> getProductMedia()
Description copied from interface: Product
Returns a map of key/value pairs that associate the media name (key) with the Media object(value)

Specified by:
getProductMedia in interface Product
Returns:
a map of product media

setProductMedia

public void setProductMedia(java.util.Map<java.lang.String,Media> productMedia)
Description copied from interface: Product
Sets the product media map.

Specified by:
setProductMedia in interface Product

setDefaultCategory

public void setDefaultCategory(Category defaultCategory)
Description copied from interface: Product
Sets the default Category to associate this product with.

Specified by:
setDefaultCategory in interface Product
Parameters:
defaultCategory - - the default Category to associate this product with

getAllParentCategories

public java.util.List<Category> getAllParentCategories()
Description copied from interface: Product
Returns all parent Category(s) this product is associated with.

Specified by:
getAllParentCategories in interface Product
Returns:
the all parent categories for this product

setAllParentCategories

public void setAllParentCategories(java.util.List<Category> allParentCategories)
Description copied from interface: Product
Sets all parent Categorys this product is associated with.

Specified by:
setAllParentCategories in interface Product
Parameters:
allParentCategories - - a List of all parent Category(s) to associate this product with

getCrossSaleProducts

public java.util.List<RelatedProduct> getCrossSaleProducts()
Description copied from interface: Product
Returns a List of this product's related Cross Sales

Specified by:
getCrossSaleProducts in interface Product
Returns:

setCrossSaleProducts

public void setCrossSaleProducts(java.util.List<RelatedProduct> crossSaleProducts)
Description copied from interface: Product
Sets the related Cross Sales

Specified by:
setCrossSaleProducts in interface Product

getUpSaleProducts

public java.util.List<RelatedProduct> getUpSaleProducts()
Description copied from interface: Product
Returns a List of this product's related Up Sales

Specified by:
getUpSaleProducts in interface Product
Returns:

setUpSaleProducts

public void setUpSaleProducts(java.util.List<RelatedProduct> upSaleProducts)
Description copied from interface: Product
Sets the related Up Sales

Specified by:
setUpSaleProducts in interface Product

getProductAttributes

public java.util.List<ProductAttribute> getProductAttributes()
Specified by:
getProductAttributes in interface Product

setProductAttributes

public void setProductAttributes(java.util.List<ProductAttribute> productAttributes)
Specified by:
setProductAttributes in interface Product

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2012. All Rights Reserved.