@Entity public class SkuImpl extends Object implements Sku
Sku. A SKU is a
specific item that can be sold including any specific attributes of the item
such as color or size. Sku.For admin required field validation, if this Sku is apart of an additionalSkus list (meaning it is not a defaultSku) then
it should have no required restrictions on it. All additional Skus can delegate to the defaultSku of the related product
for all of its fields. For this reason, if you would like to mark more fields as required then rather than using
AdminPresentation.requiredOverride(), use the mo:overrides section in bl-admin-applicationContext.xml for Product
and reference each required field like 'defaultSku.name' or 'defaultSku.retailPrice'.
Sku},
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected Date |
activeEndDate |
protected Date |
activeStartDate |
protected Character |
available
Deprecated.
|
protected BroadleafCurrency |
currency
Note that this field is not the target of the currencyCodeField attribute on either retailPrice or salePrice.
|
protected Product |
defaultProduct
This will be non-null if and only if this Sku is the default Sku for a Product
|
protected String |
description |
protected Dimension |
dimension |
protected Character |
discountable |
protected String |
displayTemplate |
protected DynamicSkuPrices |
dynamicPrices |
protected List<FulfillmentOption> |
excludedFulfillmentOptions |
protected String |
externalId |
protected List<SkuFee> |
fees |
protected Map<FulfillmentOption,BigDecimal> |
fulfillmentFlatRates |
protected String |
fulfillmentType |
protected Long |
id |
protected String |
inventoryType |
protected Boolean |
isMachineSortable |
protected Set<ProductOptionValue> |
legacyProductOptionValues |
protected Map<String,Media> |
legacySkuMedia |
protected String |
longDescription |
protected String |
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 Set<SkuProductOptionValueXref> |
productOptionValueXrefs |
protected Integer |
quantityAvailable |
protected BigDecimal |
retailPrice |
protected BigDecimal |
salePrice |
protected Map<String,SkuAttribute> |
skuAttributes |
protected Map<String,SkuMediaXref> |
skuMedia |
protected Character |
taxable |
protected String |
taxCode |
protected String |
upc |
protected String |
urlKey |
protected Weight |
weight |
| Constructor and Description |
|---|
SkuImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearDynamicPrices()
Clears any currently stored dynamic pricing
|
<G extends Sku> |
createOrRetrieveCopyInstance(MultiTenantCopyContext context) |
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
|
BroadleafCurrency |
getCurrency()
Note: When using dynamic pricing, this method is unreliable and should not be called outside of the
Broadleaf admin Instead, you should rely on the
BroadleafRequestContext.getBroadleafCurrency()
instead of storing at the SKU level. |
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() |
String |
getDisplayTemplate()
Returns the name of a display template that is used to render this sku.
|
List<FulfillmentOption> |
getExcludedFulfillmentOptions()
Gets the
FulfillmentOptions that this Sku should be excluded from. |
String |
getExternalId()
Intended to hold any unique identifier not tied to the Broadleaf Database Sequence Identifier.
|
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. |
FulfillmentType |
getFulfillmentType()
Returns the fulfillment type for this sku.
|
Long |
getId()
Returns the id of this sku
|
InventoryType |
getInventoryType()
Returns the type of inventory for this sku
|
Boolean |
getIsMachineSortable()
Whether this Sku can be sorted by a machine
|
Money |
getListPrice()
Deprecated.
|
String |
getLongDescription()
Returns the long description of the sku.
|
String |
getName()
Returns the name of the Sku.
|
Money |
getPrice()
Resolves the price of the Sku.
|
DynamicSkuPrices |
getPriceData()
If a DynamicPricingService is being used, this method will return the dynamic Sku prices.
|
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()
Deprecated.
|
Set<ProductOptionValue> |
getProductOptionValuesCollection()
Gets the ProductOptionValues used to map to this Sku.
|
Set<SkuProductOptionValueXref> |
getProductOptionValueXrefs()
Returns the ProductOptionValues that should be mapped to this Sku using the middle
XREF entity,
SkuProductOptionValueXref |
Integer |
getQuantityAvailable()
Used in conjuction with
InventoryType.CHECK_QUANTITY within the blAddItemWorkflow and blUpdateItemWorkflow. |
Money |
getRetailPrice()
Returns the Retail Price of the Sku.
|
protected Money |
getRetailPriceInternal() |
Money |
getSalePrice()
Returns the Sale Price of the Sku.
|
Map<String,SkuAttribute> |
getSkuAttributes()
Denormalized set of key-value pairs to attach to a Sku.
|
Map<String,Media> |
getSkuMedia()
Deprecated.
|
Map<String,SkuMediaXref> |
getSkuMediaXref()
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 cross-reference to a media object.
|
Map<String,SkuMediaXref> |
getSkuMediaXrefIgnoreDefaultSku()
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 cross-reference to a media object.
|
Boolean |
getTaxable()
Convenience that passes through to isTaxable
|
String |
getTaxCode()
Returns the Tax Code for this particular Entity.
|
String |
getUpc()
Gets the Universal Product Code (UPC)
|
String |
getUrlKey()
Returns the sku specific portion of a full url used for a sku info page.
|
Weight |
getWeight()
Gets the embedded Weight for this Sku
|
protected boolean |
hasDefaultSku() |
int |
hashCode() |
boolean |
hasRetailPrice()
Provides a way of determining if a Sku has a retail price without getting an IllegalStateException.
|
boolean |
hasSalePrice()
Determines if there is a sale price.
|
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()
Availability is really a concern of inventory vs a concern of the Sku being active or not.
|
Boolean |
isDiscountable()
Returns whether the Sku qualifies for discounts or not.
|
Boolean |
isMachineSortable()
Deprecated.
|
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.
|
protected Sku |
lookupDefaultSku() |
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)
Availability is really a concern of inventory vs a concern of the Sku being active or not.
|
void |
setCurrency(BroadleafCurrency currency)
Sets the currency for this Sku
Note: Currency is ignored when using dynamic pricing
|
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 |
setDisplayTemplate(String displayTemplate)
Sets the name of a display template that is used to render this sku.
|
void |
setExcludedFulfillmentOptions(List<FulfillmentOption> excludedFulfillmentOptions)
Sets the
FulfillmentOptions that this Sku should be excluded from being apart of |
void |
setExternalId(String externalId)
Sets a unique external ID
|
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 |
setFulfillmentType(FulfillmentType fulfillmentType)
Sets the fulfillment type for this sku.
|
void |
setId(Long id)
Sets the id of this sku
|
void |
setInventoryType(InventoryType inventoryType)
Sets the type of inventory for this sku
|
void |
setIsMachineSortable(Boolean isMachineSortable)
Sets whether or not this Sku can be sorted by a machine
|
void |
setListPrice(Money listPrice)
Deprecated.
|
void |
setLongDescription(String longDescription)
Sets the long description of the sku.
|
void |
setMachineSortable(Boolean isMachineSortable)
Deprecated.
|
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)
Deprecated.
|
void |
setProductOptionValuesCollection(Set<ProductOptionValue> productOptionValues)
Sets the ProductOptionValues that should be mapped to this Sku
|
void |
setProductOptionValueXrefs(Set<SkuProductOptionValueXref> productOptionValueXrefs)
Sets the ProductOptionValues that should be mapped to this Sku using the middle
XREF entity,
SkuProductOptionValueXref |
void |
setQuantityAvailable(Integer quantityAvailable)
Used in conjunction with
InventoryType.CHECK_QUANTITY from Sku.getInventoryType(). |
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(Map<String,SkuAttribute> skuAttributes)
Sets the denormalized set of key-value pairs on a Sku
|
void |
setSkuMedia(Map<String,Media> skuMedia)
Deprecated.
|
void |
setSkuMediaXref(Map<String,SkuMediaXref> skuMediaXref)
Sets a map of key/value pairs where the key is a string for the name of a media object and the value
is a cross-reference object to type Media.
|
void |
setTaxable(Boolean taxable)
Sets the whether the Sku qualifies for taxes or not.
|
void |
setTaxCode(String taxCode)
Sets the tax code for this SKU
|
void |
setUpc(String upc)
Sets the Universal Product Code (UPC)
|
void |
setUrlKey(String urlKey)
Sets the sku specific portion of a full url used for a sku info page.
|
void |
setWeight(Weight weight)
Sets the embedded Weight for this Sku
|
protected Long id
protected String externalId
protected String urlKey
protected String displayTemplate
protected String upc
protected BigDecimal salePrice
protected BigDecimal retailPrice
protected String name
protected String description
protected String longDescription
protected String taxCode
protected Character taxable
protected Character discountable
@Deprecated protected Character available
protected Date activeStartDate
protected Date activeEndDate
protected Dimension dimension
protected Weight weight
protected DynamicSkuPrices dynamicPrices
protected Boolean isMachineSortable
protected Map<String,SkuMediaXref> skuMedia
protected Product defaultProduct
protected Product product
protected Map<String,SkuAttribute> skuAttributes
protected Set<SkuProductOptionValueXref> productOptionValueXrefs
protected Set<ProductOptionValue> legacyProductOptionValues
protected Map<FulfillmentOption,BigDecimal> fulfillmentFlatRates
protected List<FulfillmentOption> excludedFulfillmentOptions
protected String inventoryType
protected Integer quantityAvailable
protected String fulfillmentType
protected BroadleafCurrency currency
public String getUrlKey()
Skupublic void setUrlKey(String urlKey)
Skupublic String getDisplayTemplate()
SkugetDisplayTemplate in interface Skupublic void setDisplayTemplate(String displayTemplate)
SkusetDisplayTemplate in interface Skupublic boolean isOnSale()
Skuprotected boolean hasDefaultSku()
protected Sku lookupDefaultSku()
public Money getProductOptionValueAdjustments()
SkugetProductOptionValueAdjustments 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 itselfgetSalePrice in interface SkuSkuPricingConsiderationContext, DynamicSkuPricingServicepublic boolean hasSalePrice()
SkuhasSalePrice in interface Skupublic void setSalePrice(Money salePrice)
SkusetSalePrice 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, DynamicSkuPricingService, Sku.hasRetailPrice()protected Money getRetailPriceInternal()
public DynamicSkuPrices getPriceData()
SkugetPriceData in interface Skupublic boolean hasRetailPrice()
SkuhasRetailPrice in interface SkuSku.getRetailPrice()public void setRetailPrice(Money retailPrice)
SkusetRetailPrice in interface SkuretailPrice - price for the Skupublic Money getPrice()
Sku@Deprecated public Money getListPrice()
SkugetListPrice in interface Sku@Deprecated public void setListPrice(Money listPrice)
SkusetListPrice in interface Skupublic String getName()
Skupublic void setName(String name)
Skupublic String getDescription()
SkugetDescription in interface Skupublic void setDescription(String description)
SkusetDescription in interface Skupublic String getLongDescription()
SkugetLongDescription in interface Skupublic void setLongDescription(String longDescription)
SkusetLongDescription in interface Skupublic Boolean isTaxable()
Skupublic Boolean getTaxable()
SkugetTaxable in interface Skupublic void setTaxable(Boolean taxable)
SkusetTaxable in interface Skupublic Boolean isDiscountable()
SkuisDiscountable in interface Skupublic Boolean getDiscountable()
public void setDiscountable(Boolean discountable)
SkusetDiscountable in interface Skupublic Boolean isAvailable()
SkuAvailability is really a concern of inventory vs a concern of the Sku being active or not. A Sku could be marked as unavailable but still be considered 'active' where you still want to show the Sku on the site but not actually sell it. This defaults to true
This method only checks that this Sku is not marked as InventoryType.UNAVAILABLE. If Sku.getInventoryType()
is set to InventoryType.CHECK_QUANTITY then this will return true.
isAvailable in interface Skupublic Boolean getAvailable()
SkugetAvailable in interface Sku#isAvailable()}public void setAvailable(Boolean available)
SkusetAvailable in interface Skupublic Date getActiveStartDate()
SkugetActiveStartDate in interface Skupublic void setActiveStartDate(Date activeStartDate)
SkusetActiveStartDate in interface Skupublic Date getActiveEndDate()
SkugetActiveEndDate in interface Skupublic void setActiveEndDate(Date activeEndDate)
SkusetActiveEndDate in interface Skupublic Dimension getDimension()
SkugetDimension in interface Skupublic void setDimension(Dimension dimension)
SkusetDimension in interface Skupublic Weight getWeight()
Skupublic void setWeight(Weight weight)
Skupublic boolean isActive()
Skupublic boolean isActive(Product product, Category category)
Sku@Deprecated public Map<String,Media> getSkuMedia()
SkugetSkuMedia in interface Sku@Deprecated public void setSkuMedia(Map<String,Media> skuMedia)
SkusetSkuMedia in interface Skupublic Map<String,SkuMediaXref> getSkuMediaXref()
SkugetSkuMediaXref in interface Skupublic Map<String,SkuMediaXref> getSkuMediaXrefIgnoreDefaultSku()
SkuSku.getSkuMediaXref().getSkuMediaXrefIgnoreDefaultSku in interface Skupublic void setSkuMediaXref(Map<String,SkuMediaXref> skuMediaXref)
SkusetSkuMediaXref in interface Skupublic Product getDefaultProduct()
SkugetDefaultProduct in interface SkuSku.getProduct()public void setDefaultProduct(Product defaultProduct)
SkuSku.setProduct(Product) or Product.setAdditionalSkus(List) which would then cause this Sku to show up in the list of Skus for
the given ProductsetDefaultProduct 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 Set<SkuProductOptionValueXref> getProductOptionValueXrefs()
SkuSkuProductOptionValueXrefgetProductOptionValueXrefs in interface SkuSkuProductOptionValueXrefspublic void setProductOptionValueXrefs(Set<SkuProductOptionValueXref> productOptionValueXrefs)
SkuSkuProductOptionValueXrefsetProductOptionValueXrefs in interface Skupublic Set<ProductOptionValue> getProductOptionValuesCollection()
SkugetProductOptionValuesCollection in interface SkuProductOptionValue}, {@link ProductOption}public void setProductOptionValuesCollection(Set<ProductOptionValue> productOptionValues)
SkusetProductOptionValuesCollection in interface SkuProductOptionValue}, {@link ProductOption}@Deprecated public List<ProductOptionValue> getProductOptionValues()
SkugetProductOptionValues in interface SkuProductOptionValue}, {@link ProductOption}@Deprecated public void setProductOptionValues(List<ProductOptionValue> productOptionValues)
SkusetProductOptionValues in interface SkuProductOptionValue}, {@link ProductOption}@Deprecated public Boolean isMachineSortable()
SkuisMachineSortable in interface Skupublic Boolean getIsMachineSortable()
SkugetIsMachineSortable in interface Sku@Deprecated public void setMachineSortable(Boolean isMachineSortable)
SkusetMachineSortable in interface Skupublic void setIsMachineSortable(Boolean isMachineSortable)
SkusetIsMachineSortable in interface Skupublic List<SkuFee> getFees()
SkuFulfillmentGroup.getFulfillmentGroupFees() for an Orderpublic void setFees(List<SkuFee> fees)
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-daygetExcludedFulfillmentOptions in interface Skupublic void setExcludedFulfillmentOptions(List<FulfillmentOption> excludedFulfillmentOptions)
SkuFulfillmentOptions that this Sku should be excluded from being apart ofsetExcludedFulfillmentOptions in interface Skupublic InventoryType getInventoryType()
SkugetInventoryType in interface SkuInventoryType for this skupublic void setInventoryType(InventoryType inventoryType)
SkusetInventoryType in interface SkuinventoryType - the InventoryType for this skupublic Integer getQuantityAvailable()
SkuUsed in conjuction with InventoryType.CHECK_QUANTITY within the blAddItemWorkflow and blUpdateItemWorkflow.
This field is checked within the CheckAvailabilityActivity to determine if inventory is actually available
for this Sku.
getQuantityAvailable in interface Skupublic void setQuantityAvailable(Integer quantityAvailable)
SkuUsed in conjunction with InventoryType.CHECK_QUANTITY from Sku.getInventoryType(). This sets how much
inventory is available for this Sku.
setQuantityAvailable in interface SkuquantityAvailable - the quantity available for this skupublic FulfillmentType getFulfillmentType()
SkugetFulfillmentType in interface Skupublic void setFulfillmentType(FulfillmentType fulfillmentType)
SkusetFulfillmentType in interface Skupublic Map<String,SkuAttribute> getSkuAttributes()
SkuProductOption scenario (like colors, sizes, etc) see Sku.getProductOptionValues()
and Sku.setProductOptionValues(List)getSkuAttributes in interface Skupublic void setSkuAttributes(Map<String,SkuAttribute> skuAttributes)
SkusetSkuAttributes in interface Skupublic BroadleafCurrency getCurrency()
SkuBroadleafRequestContext.getBroadleafCurrency()
instead of storing at the SKU level.
As such, for supported, enterprise installations, this method should always return null.
This method was not deprecated as it may have some use in non-standard Broadleaf installations but
using its use is not suggested for most implementations.getCurrency in interface Skupublic void setCurrency(BroadleafCurrency currency)
SkusetCurrency in interface Skupublic void clearDynamicPrices()
SkuclearDynamicPrices in interface Skupublic String getTaxCode()
SkugetTaxCode in interface Skupublic void setTaxCode(String taxCode)
SkusetTaxCode in interface Skupublic String getExternalId()
SkugetExternalId in interface Skupublic void setExternalId(String externalId)
SkusetExternalId in interface Skupublic String getUpc()
Skupublic void setUpc(String upc)
Skupublic <G extends Sku> CreateResponse<G> createOrRetrieveCopyInstance(MultiTenantCopyContext context) throws CloneNotSupportedException
createOrRetrieveCopyInstance in interface MultiTenantCloneable<Sku>CloneNotSupportedExceptionCopyright © 2017. All rights reserved.