|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.broadleafcommerce.core.catalog.domain.SkuImpl
@Entity public class SkuImpl
The Class SkuImpl is the default implementation of Sku. A SKU is a
specific item that can be sold including any specific attributes of the item
such as color or size.
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 SkuImpl then you should implement
your own version of Sku.
This implementation uses a Hibernate implementation of JPA configured through
annotations. The Entity references the following tables: BLC_SKU,
BLC_SKU_IMAGE
Sku},
Serialized Form| Field Summary | |
|---|---|
protected Date |
activeEndDate
The active end date. |
protected Date |
activeStartDate
The active start date. |
protected Character |
available
The available. |
protected Product |
defaultProduct
This will be non-null if and only if this Sku is the default Sku for a Product |
protected String |
description
The description. |
protected Dimension |
dimension
The product dimensions |
protected Character |
discountable
The discountable. |
protected DynamicSkuPrices |
dynamicPrices
|
protected List<FulfillmentOption> |
excludedFulfillmentOptions
|
protected List<SkuFee> |
fees
|
protected Map<FulfillmentOption,BigDecimal> |
fulfillmentFlatRates
|
protected Long |
id
The id. |
protected Boolean |
isMachineSortable
|
protected String |
longDescription
The long description. |
protected String |
name
The name. |
protected Product |
product
This relationship will be non-null if and only if this Sku is contained in the list of additional Skus for a Product (for Skus based on ProductOptions) |
protected List<ProductOptionValue> |
productOptionValues
|
protected BigDecimal |
retailPrice
The retail price. |
protected BigDecimal |
salePrice
The sale price. |
protected List<SkuAttribute> |
skuAttributes
|
protected Map<String,Media> |
skuMedia
The sku media. |
protected Character |
taxable
The taxable. |
protected Weight |
weight
The product weight |
| Constructor Summary | |
|---|---|
SkuImpl()
|
|
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
|
Date |
getActiveEndDate()
Returns the the last date that the Sku should be available for sale. |
Date |
getActiveStartDate()
Returns the first date that the Sku should be available for sale. |
Boolean |
getAvailable()
Convenience that passes through to isAvailable |
Product |
getDefaultProduct()
This will be a value if and only if this Sku is the defaultSku of a Product (and thus has a @OneToOne relationship with a Product). |
String |
getDescription()
Returns the brief description of the Sku. |
Dimension |
getDimension()
Get the dimensions for this Sku |
Boolean |
getDiscountable()
|
List<FulfillmentOption> |
getExcludedFulfillmentOptions()
Gets the FulfillmentOptions that this Sku should be excluded from. |
List<SkuFee> |
getFees()
Gets all the extra fees for this particular Sku. |
Map<FulfillmentOption,BigDecimal> |
getFulfillmentFlatRates()
Gets the flat rate for fulfilling this Sku for a particular FulfillmentOption. |
Long |
getId()
Returns the id of this sku |
Money |
getListPrice()
Returns the List Price of the Sku. |
String |
getLongDescription()
Returns the long description of the sku. |
Map<String,SkuAttribute> |
getMappedSkuAttributes()
|
String |
getName()
Returns the name of the Sku. |
Product |
getProduct()
This will return the correct Product association that is being used on the Sku. |
Money |
getProductOptionValueAdjustments()
This is the sum total of the priceAdjustments from the associated ProductOptionValues |
List<ProductOptionValue> |
getProductOptionValues()
Gets the ProductOptionValues used to map to this Sku. |
Money |
getRetailPrice()
Returns the Retail Price of the Sku. |
Money |
getSalePrice()
Returns the Sale Price of the Sku. |
SkuAttribute |
getSkuAttributeByName(String name)
Convenience method to return a given sku attribute by its name |
List<SkuAttribute> |
getSkuAttributes()
Denormalized set of key-value pairs to attach to a Sku. |
Map<String,Media> |
getSkuMedia()
Returns a map of key/value pairs where the key is a string for the name of a media object and the value is a media object. |
Boolean |
getTaxable()
Convenience that passes through to isTaxable |
Weight |
getWeight()
Gets the embedded Weight for this Sku |
int |
hashCode()
|
boolean |
isActive()
Returns a boolean indicating whether this sku is active. |
boolean |
isActive(Product product,
Category category)
Returns whether or not this Sku, the given Product and the given Category are all active |
Boolean |
isAvailable()
Returns whether the Sku is available. |
Boolean |
isDiscountable()
Returns whether the Sku qualifies for discounts or not. |
Boolean |
isMachineSortable()
Whether this Sku can be sorted by a machine |
boolean |
isOnSale()
A product is on sale provided the sale price is not null, non-zero, and less than the retail price |
Boolean |
isTaxable()
Returns whether the Sku qualifies for taxes or not. |
void |
setActiveEndDate(Date activeEndDate)
Sets the the last date that the Sku should be available for sale. |
void |
setActiveStartDate(Date activeStartDate)
Sets the the first date that the Sku should be available for sale. |
void |
setAvailable(Boolean available)
Sets the whether the Sku is available. |
void |
setDefaultProduct(Product defaultProduct)
The relationship for a Product's default Sku (and thus a Sku's default Product) is actually maintained on the Product entity as a foreign key to Sku. |
void |
setDescription(String description)
Sets the brief description of the Sku. |
void |
setDimension(Dimension dimension)
Sets the embedded Dimension for this Sku |
void |
setDiscountable(Boolean discountable)
Sets the whether the Sku qualifies for discounts or not. |
void |
setExcludedFulfillmentOptions(List<FulfillmentOption> excludedFulfillmentOptions)
Sets the FulfillmentOptions that this Sku should be excluded from being apart of |
void |
setFees(List<SkuFee> fees)
Sets the extra fees for this particular Sku |
void |
setFulfillmentFlatRates(Map<FulfillmentOption,BigDecimal> fulfillmentFlatRates)
Sets the flat rates for fulfilling this Sku for a particular FulfillmentOption. |
void |
setId(Long id)
Sets the id of this sku |
void |
setListPrice(Money listPrice)
Sets the the List Price of the Sku. |
void |
setLongDescription(String longDescription)
Sets the long description of the sku. |
void |
setMachineSortable(Boolean isMachineSortable)
Sets whether or not this Sku can be sorted by a machine |
void |
setName(String name)
Sets the the name of the Sku. |
void |
setProduct(Product product)
Associates a Sku to a given Product. |
void |
setProductOptionValues(List<ProductOptionValue> productOptionValues)
Sets the ProductOptionValues that should be mapped to this Sku |
void |
setRetailPrice(Money retailPrice)
Sets the retail price for the Sku. |
void |
setSalePrice(Money salePrice)
Sets the the Sale Price of the Sku. |
void |
setSkuAttributes(List<SkuAttribute> skuAttributes)
Sets the denormalized set of key-value pairs on a Sku |
void |
setSkuMedia(Map<String,Media> skuMedia)
Sets a map of key/value pairs where the key is a string for the name of a media object and the value is an object of type Media. |
void |
setTaxable(Boolean taxable)
Sets the whether the Sku qualifies for taxes or not. |
void |
setWeight(Weight weight)
Sets the embedded Weight for this Sku |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Long id
protected BigDecimal salePrice
protected BigDecimal retailPrice
protected String name
protected String description
protected String longDescription
protected Character taxable
protected Character discountable
protected Character available
protected Date activeStartDate
protected Date activeEndDate
protected Dimension dimension
protected Weight weight
protected DynamicSkuPrices dynamicPrices
protected Boolean isMachineSortable
protected Map<String,Media> skuMedia
protected Product defaultProduct
protected Product product
protected List<SkuAttribute> skuAttributes
protected List<ProductOptionValue> productOptionValues
protected List<SkuFee> fees
protected Map<FulfillmentOption,BigDecimal> fulfillmentFlatRates
protected List<FulfillmentOption> excludedFulfillmentOptions
| Constructor Detail |
|---|
public SkuImpl()
| Method Detail |
|---|
public Long getId()
Sku
getId in interface Skupublic void setId(Long id)
Sku
setId in interface Skupublic boolean isOnSale()
Sku
isOnSale in interface Skupublic Money getProductOptionValueAdjustments()
Sku
getProductOptionValueAdjustments in interface SkuProductOptionValue}public Money getSalePrice()
SkuSkuPricingConsiderationContext is set, this uses the DynamicSkuPricingService
to calculate what this should actually be rather than use the property itself
getSalePrice in interface SkuSkuPricingConsiderationContext, DynamicSkuPricingServicepublic void setSalePrice(Money salePrice)
Sku
setSalePrice in interface Skupublic Money getRetailPrice()
SkuSkuPricingConsiderationContext
is set, this uses the DynamicSkuPricingService to calculate what this should actually be rather than use the property
itself
getRetailPrice in interface SkuSkuPricingConsiderationContext, DynamicSkuPricingServicepublic void setRetailPrice(Money retailPrice)
Sku
setRetailPrice in interface Skupublic Money getListPrice()
Sku
getListPrice in interface Skupublic void setListPrice(Money listPrice)
Sku
setListPrice in interface Skupublic String getName()
Sku
getName in interface Skupublic void setName(String name)
Sku
setName in interface Skupublic String getDescription()
Sku
getDescription in interface Skupublic void setDescription(String description)
Sku
setDescription in interface Skupublic String getLongDescription()
Sku
getLongDescription in interface Skupublic void setLongDescription(String longDescription)
Sku
setLongDescription in interface Skupublic Boolean isTaxable()
Sku
isTaxable in interface Skupublic Boolean getTaxable()
Sku
getTaxable in interface Skupublic void setTaxable(Boolean taxable)
Sku
setTaxable in interface Skupublic Boolean isDiscountable()
Sku
isDiscountable in interface Skupublic Boolean getDiscountable()
public void setDiscountable(Boolean discountable)
Sku
setDiscountable in interface Skupublic Boolean isAvailable()
Sku
isAvailable in interface Skupublic Boolean getAvailable()
Sku
getAvailable in interface Skupublic void setAvailable(Boolean available)
Sku
setAvailable in interface Skupublic Date getActiveStartDate()
Sku
getActiveStartDate in interface Skupublic void setActiveStartDate(Date activeStartDate)
Sku
setActiveStartDate in interface Skupublic Date getActiveEndDate()
Sku
getActiveEndDate in interface Skupublic void setActiveEndDate(Date activeEndDate)
Sku
setActiveEndDate in interface Skupublic Dimension getDimension()
Sku
getDimension in interface Skupublic void setDimension(Dimension dimension)
Sku
setDimension in interface Skupublic Weight getWeight()
Sku
getWeight in interface Skupublic void setWeight(Weight weight)
Sku
setWeight in interface Skupublic boolean isActive()
Sku
isActive in interface Sku
public boolean isActive(Product product,
Category category)
Sku
isActive in interface Skuproduct - - Product that should be activecategory - - Category that should be active
product and category are all active
false otherwisepublic Map<String,Media> getSkuMedia()
Sku
getSkuMedia in interface Skupublic void setSkuMedia(Map<String,Media> skuMedia)
Sku
setSkuMedia in interface Skupublic Product getDefaultProduct()
Sku
getDefaultProduct in interface SkuSku.getProduct()public void setDefaultProduct(Product defaultProduct)
SkuSku.setProduct(Product) or Product#setSkus(List) which would then cause this Sku to show up in the list of Skus for
the given Product
setDefaultProduct in interface Skupublic Product getProduct()
SkuSku.getDefaultProduct() != null) than this will return Sku.getDefaultProduct(). If this is not
a default Sku for a Product, this will return the @ManyToOne Product relationship created by adding this Sku to a Product's
list of Skus, or using Sku.setProduct(Product).
Product.setDefaultSku(Sku))
as well as the @ManyToOne association set (Sku.setProduct(Product)). In this case, This method would only return
the result of Sku.getDefaultProduct(). However, the @OneToOne and @ManyToOne association should never actually
refer to different Products, and would represent an error state. If you require this, consider subclassing and using
your own @ManyToMany relationship between Product and Sku. If you are trying to model bundles, consider using a ProductBundle
and subsequent SkuBundleItems.
getProduct in interface SkuSku.getDefaultProduct() if Sku.getDefaultProduct() is non-null, the @ManyToOne Product association otherwise. If no
relationship is set, returns nullpublic void setProduct(Product product)
SkuProduct.getSkus()
setProduct in interface Skuproduct - - Product to associate this Sku toProduct.getSkus()public List<SkuAttribute> getSkuAttributes()
SkuProductOption scenario (like colors, sizes, etc) see Sku.getProductOptionValues()
and setProductOptionValues()
getSkuAttributes in interface Skupublic SkuAttribute getSkuAttributeByName(String name)
Sku
getSkuAttributeByName in interface Skupublic Map<String,SkuAttribute> getMappedSkuAttributes()
getMappedSkuAttributes in interface Skupublic List<ProductOptionValue> getProductOptionValues()
Sku
getProductOptionValues in interface SkuProductOptionValue}, {@link ProductOption}public void setProductOptionValues(List<ProductOptionValue> productOptionValues)
Sku
setProductOptionValues in interface SkuProductOptionValue}, {@link ProductOption}public void setSkuAttributes(List<SkuAttribute> skuAttributes)
Sku
setSkuAttributes in interface Skupublic Boolean isMachineSortable()
Sku
isMachineSortable in interface Skupublic void setMachineSortable(Boolean isMachineSortable)
Sku
setMachineSortable in interface Skupublic List<SkuFee> getFees()
SkuFulfillmentGroup.getFulfillmentGroupFees() for an Order
getFees in interface SkuSkuFees for this Skupublic void setFees(List<SkuFee> fees)
Sku
setFees in interface Skupublic Map<FulfillmentOption,BigDecimal> getFulfillmentFlatRates()
SkuSku for a particular FulfillmentOption. Depending
on the result of FulfillmentOption.getUseFlatRates(), this flat rate will be used in calculating
the cost of fulfilling this Sku.
getFulfillmentFlatRates in interface SkuSkupublic void setFulfillmentFlatRates(Map<FulfillmentOption,BigDecimal> fulfillmentFlatRates)
SkuSku for a particular FulfillmentOption. Depending
on the result of FulfillmentOption.getUseFlatRates(), this flat rate will be used in calculating
the cost of fulfilling this Sku.
setFulfillmentFlatRates in interface Skupublic List<FulfillmentOption> getExcludedFulfillmentOptions()
SkuFulfillmentOptions that this Sku should be excluded from. For instance,
some Skus might not be available to be fulfilled next-day
getExcludedFulfillmentOptions in interface Skupublic void setExcludedFulfillmentOptions(List<FulfillmentOption> excludedFulfillmentOptions)
SkuFulfillmentOptions that this Sku should be excluded from being apart of
setExcludedFulfillmentOptions in interface Skupublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||