|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.broadleafcommerce.core.catalog.domain.ProductImpl
@Entity public class ProductImpl
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
Product}, {@link SkuImpl}, {@link CategoryImpl},
Serialized Form| Field Summary | |
|---|---|
protected List<Sku> |
additionalSkus
The all skus. |
protected List<Category> |
allParentCategories
|
protected ArchiveStatus |
archiveStatus
|
protected Boolean |
canSellWithoutOptions
|
protected List<RelatedProduct> |
crossSaleProducts
|
protected Category |
defaultCategory
The default category. |
protected Sku |
defaultSku
|
protected String |
displayTemplate
|
protected Long |
id
The id. |
protected Boolean |
isFeaturedProduct
|
protected String |
manufacturer
The manufacture name |
protected String |
model
The product model number |
protected List<ProductAttribute> |
productAttributes
|
protected List<ProductOption> |
productOptions
|
protected String |
promoMessage
|
protected List<Sku> |
skus
The skus. |
protected List<RelatedProduct> |
upSaleProducts
|
protected String |
url
|
protected String |
urlKey
|
| Constructor Summary | |
|---|---|
ProductImpl()
|
|
| Method Summary | |
|---|---|
void |
clearDynamicPrices()
Removes any currently stored dynamic pricing |
boolean |
equals(Object obj)
|
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()
Returns all parent Category(s) this product is associated with. |
Map<String,Media> |
getAllSkuMedia()
Convenience method for returning all of the media associated with this Product by adding all the media in Product.getDefaultSku() as well as all the media in the Skus represented by
Product.getAdditionalSkus() |
List<Sku> |
getAllSkus()
Returns all the Skus that are associated with this Product (including Product.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 Product.getAdditionalSkus(), it is filtered out
so that only a single instance of Product.getDefaultSku() is contained in the resulting list |
Character |
getArchived()
|
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 Product.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 Product.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 Product.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 Product.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 Product.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 Product.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,ProductAttribute> |
getMappedProductAttributes()
|
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. |
ProductAttribute |
getProductAttributeByName(String name)
Looks at all ProductAttributes for this product and returns the attribute that matches the given name |
List<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 Product.getDefaultSku() |
List<Sku> |
getSkus()
Returns a list of Skus filtered by whether the Skus are active or not. |
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 Product.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 Product.getDefaultSku() |
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 |
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)
Sets all parent Categorys this product is associated with. |
void |
setArchived(Character archived)
|
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 Product.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 Product.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 Product.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 Product.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 Product.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(List<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 Product.getDefaultSku() |
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 urlKey)
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 Product.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 Product.getDefaultSku() |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Long id
protected String url
protected String urlKey
protected String displayTemplate
protected String model
protected String manufacturer
protected Boolean isFeaturedProduct
protected Sku defaultSku
protected Boolean canSellWithoutOptions
protected List<Sku> skus
protected String promoMessage
protected List<RelatedProduct> crossSaleProducts
protected List<RelatedProduct> upSaleProducts
protected List<Sku> additionalSkus
protected Category defaultCategory
protected List<Category> allParentCategories
protected List<ProductAttribute> productAttributes
protected List<ProductOption> productOptions
protected ArchiveStatus archiveStatus
| Constructor Detail |
|---|
public ProductImpl()
| Method Detail |
|---|
public Long getId()
Product
getId in interface Productpublic void setId(Long id)
Product
setId in interface Productid - - the id of the productpublic String getName()
ProductProduct.getDefaultSku()
getName in interface Productpublic void setName(String name)
ProductProduct.getDefaultSku()
setName in interface Productname - - the name of the Productpublic String getDescription()
ProductProduct.getDefaultSku()
getDescription in interface Productpublic void setDescription(String description)
ProductProduct.getDefaultSku()
setDescription in interface Productdescription - - a brief description of the productpublic String getLongDescription()
ProductProduct.getDefaultSku()
getLongDescription in interface Productpublic void setLongDescription(String longDescription)
ProductProduct.getDefaultSku()
setLongDescription in interface ProductlongDescription - the long descriptionpublic Date getActiveStartDate()
ProductProduct.getDefaultSku()
getActiveStartDate in interface Productpublic void setActiveStartDate(Date activeStartDate)
ProductProduct.getDefaultSku()
setActiveStartDate in interface ProductactiveStartDate - - the first day the product is availablepublic Date getActiveEndDate()
ProductProduct.getDefaultSku()
getActiveEndDate in interface Productpublic void setActiveEndDate(Date activeEndDate)
ProductProduct.getDefaultSku()
setActiveEndDate in interface ProductactiveEndDate - - the last day the product is availablepublic boolean isActive()
ProductProduct.getDefaultSku()
isActive in interface StatusisActive in interface Productpublic String getModel()
Product
getModel in interface Productpublic void setModel(String model)
Product
setModel in interface Productpublic String getManufacturer()
Product
getManufacturer in interface Productpublic void setManufacturer(String manufacturer)
Product
setManufacturer in interface Productpublic boolean isFeaturedProduct()
Product
isFeaturedProduct in interface Productpublic void setFeaturedProduct(boolean isFeaturedProduct)
Product
setFeaturedProduct in interface Productpublic Sku getDefaultSku()
ProductSku 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.
ProductOptions. For instance, a large, blue shirt. For more information on
that relationship see Product.getAdditionalSkus().
getDefaultSku in interface Productpublic Boolean getCanSellWithoutOptions()
getCanSellWithoutOptions in interface Productpublic void setCanSellWithoutOptions(Boolean canSellWithoutOptions)
Product
setCanSellWithoutOptions in interface Productpublic void setDefaultSku(Sku defaultSku)
Product
setDefaultSku in interface ProductdefaultSku - - the Sku that should be the default for this Productpublic String getPromoMessage()
Product
getPromoMessage in interface Productpublic void setPromoMessage(String promoMessage)
Product
setPromoMessage in interface Productpublic List<Sku> getAllSkus()
ProductSkus that are associated with this Product (including Product.getDefaultSku())
regardless of whether or not the Skus are active or not
Product.getAdditionalSkus(), it is filtered out
so that only a single instance of Product.getDefaultSku() is contained in the resulting list
getAllSkus in interface Productpublic List<Sku> getSkus()
ProductSkus filtered by whether the Skus are active or not.
This list does not contain the Product.getDefaultSku() and filters by Sku.isActive().
getSkus in interface ProductProduct.getAdditionalSkus() for this Productpublic List<Sku> getAdditionalSkus()
ProductProductOption (like "small", "medium", "large") this would return 3 Skus
if you had different inventory or price constraints on each ProductOptionValue.
Product.getDefaultSku() for this Product. For this functionality, see
Product.getSkus() and Product.getAllSkus(), respectively.
getAdditionalSkus in interface ProductProductOption}, {@link ProductOptionValue}public void setAdditionalSkus(List<Sku> skus)
ProductProductOptionValues and are used in instance where you need to track inventory
or change pricing on a per-option value basis.
setAdditionalSkus in interface Productskus - - a List of Skus to associate with this Product, usually based off of ProductOptions#getAdditionalSkus()}, {@link ProductOption}, {@link ProductOptionValue}public Category getDefaultCategory()
ProductCategory this product is associated with.
getDefaultCategory in interface Productpublic Map<String,Media> getMedia()
ProductProduct.getDefaultSku() media
getMedia in interface ProductSkupublic void setMedia(Map<String,Media> media)
ProductProduct.getDefaultSku() media
setMedia in interface Productmedia - Media map to set on the default Sku associated with this ProductSkupublic Map<String,Media> getAllSkuMedia()
ProductProduct.getDefaultSku() as well as all the media in the Skus represented by
Product.getAdditionalSkus()
getAllSkuMedia in interface Productpublic void setDefaultCategory(Category defaultCategory)
ProductCategory to associate this product with.
setDefaultCategory in interface ProductdefaultCategory - - the default Category to associate this product withpublic List<Category> getAllParentCategories()
ProductCategory(s) this product is associated with.
getAllParentCategories in interface Productpublic void setAllParentCategories(List<Category> allParentCategories)
ProductCategorys this product is associated with.
setAllParentCategories in interface ProductallParentCategories - - a List of all parent Category(s) to associate this product withpublic Dimension getDimension()
ProductDimension for this product
Product.getDefaultSku()
getDimension in interface Productpublic void setDimension(Dimension dimension)
ProductDimension for this product
Product.getDefaultSku()
setDimension in interface Productpublic BigDecimal getWidth()
ProductProduct.getDefaultSku()
getWidth in interface Productpublic void setWidth(BigDecimal width)
ProductProduct.getDefaultSku()
setWidth in interface Productpublic BigDecimal getHeight()
ProductProduct.getDefaultSku()
getHeight in interface Productpublic void setHeight(BigDecimal height)
ProductProduct.getDefaultSku()
setHeight in interface Productpublic BigDecimal getDepth()
ProductProduct.getDefaultSku()
getDepth in interface Productpublic void setDepth(BigDecimal depth)
ProductProduct.getDefaultSku()
setDepth in interface Productpublic BigDecimal getGirth()
ProductProduct.getDefaultSku()
getGirth in interface Productpublic void setGirth(BigDecimal girth)
ProductProduct.getDefaultSku()
setGirth in interface Productpublic ContainerSizeType getSize()
ProductProduct.getDefaultSku()
getSize in interface Productpublic void setSize(ContainerSizeType size)
ProductProduct.getDefaultSku()
setSize in interface Productpublic ContainerShapeType getContainer()
ProductProduct.getDefaultSku()
getContainer in interface Productpublic void setContainer(ContainerShapeType container)
ProductProduct.getDefaultSku()
setContainer in interface Productpublic String getDimensionString()
ProductProduct.getDefaultSku()
getDimensionString in interface Productpublic Weight getWeight()
ProductProduct.getDefaultSku()
getWeight in interface Productpublic void setWeight(Weight weight)
ProductProduct.getDefaultSku()
setWeight in interface Productpublic List<RelatedProduct> getCrossSaleProducts()
Product
getCrossSaleProducts in interface Productpublic void setCrossSaleProducts(List<RelatedProduct> crossSaleProducts)
Product
setCrossSaleProducts in interface Productpublic List<RelatedProduct> getUpSaleProducts()
Product
getUpSaleProducts in interface Productpublic void setUpSaleProducts(List<RelatedProduct> upSaleProducts)
Product
setUpSaleProducts in interface Productpublic List<RelatedProduct> getCumulativeCrossSaleProducts()
Product
getCumulativeCrossSaleProducts in interface Productpublic List<RelatedProduct> getCumulativeUpSaleProducts()
Product
getCumulativeUpSaleProducts in interface Productpublic List<ProductAttribute> getProductAttributes()
Product
getProductAttributes in interface Productpublic void setProductAttributes(List<ProductAttribute> productAttributes)
Product
setProductAttributes in interface Productpublic List<ProductOption> getProductOptions()
ProductProductOptions 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
getProductOptions in interface ProductProductOptions for this ProductProduct#getAdditionalSkus(), {@link ProductOption}, {@link ProductOptionValue}public void setProductOptions(List<ProductOption> productOptions)
Product
setProductOptions in interface Productpublic String getUrl()
ProductProduct.getDisplayTemplate().
Alternatively, most sites will rely on the Product.getGeneratedUrl() to define the
url for a product page.
getUrl in interface Productorg.broadleafcommerce.core.web.catalog.ProductHandlerMappingpublic void setUrl(String url)
Product
setUrl in interface Productpublic String getDisplayTemplate()
Product
getDisplayTemplate in interface Productpublic void setDisplayTemplate(String displayTemplate)
Product
setDisplayTemplate in interface Productpublic ProductAttribute getProductAttributeByName(String name)
Product
getProductAttributeByName in interface Productname - the name of the attribute
public Map<String,ProductAttribute> getMappedProductAttributes()
getMappedProductAttributes in interface Productpublic Character getArchived()
getArchived in interface Statuspublic void setArchived(Character archived)
setArchived in interface Statuspublic int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic String getUrlKey()
ProductProduct.getName() and removing special characters and replacing
dashes with spaces.
getUrlKey in interface Productpublic void setUrlKey(String urlKey)
ProductProduct.getName() and removing special characters and replacing
dashes with spaces.
setUrlKey in interface Productpublic String getGeneratedUrl()
Product
getGeneratedUrl in interface Productpublic void clearDynamicPrices()
Product
clearDynamicPrices in interface Product
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||