|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.elasticpath.sfweb.ajax.bean.impl.CartItemBeanImpl
public class CartItemBeanImpl
A wrapper class for cart items sent through dwr.
Field Summary | |
---|---|
static long |
serialVersionUID
Serial version id. |
Constructor Summary | |
---|---|
CartItemBeanImpl(CartItem cartItem,
java.util.Currency currency,
java.util.Locale locale)
Creates a new dwr CartItemBean wrapper for a CartItem . |
Method Summary | |
---|---|
void |
addDependentCartItem(CartItem dependentCartItem)
Specify that another cart item depends on this cart item. |
void |
applyDiscount(java.math.BigDecimal amount)
Adds a discount amount to this cart item. |
void |
clearDiscount()
Removes previously applied CartItem discounts. |
void |
executeBeforePersistAction()
Interceptor to perform tasks before persisting changes. |
java.math.BigDecimal |
getAmount(java.util.Currency currency)
Get the total price of this shopping cart item. |
Money |
getAmountMoney(java.util.Currency currency)
Get the amount as a Money object. |
CartItem |
getCartItem()
|
java.util.Currency |
getCurrency()
|
java.util.Set |
getDependentCartItems()
Get the set of dependent cart items. |
java.lang.String |
getDisplayName()
Convenience method for getting the product's localized display name. |
ElasticPath |
getElasticPath()
Get the ElasticPath singleton. |
boolean |
getHasDependentCartItems()
Returns true if this CartItem has other cart items that depend on it such that the dependent items cannot exist in the cart on their own. |
java.lang.String |
getListPrice()
Convenience method for getting the ProductSku list price. |
java.util.Locale |
getLocale()
|
java.lang.String |
getLowestPrice()
Convenience method for getting the lowest ProductSku price. |
CartItem |
getParentCartItem()
Get the parent cart item that this cart item is dependent on. |
long |
getParentCartItemUidPk()
Get the uidPk of the parent cart item that this cart item is dependent on. |
java.lang.String |
getProductBrandName()
Convenience method for getting the product's seo url. |
java.lang.String |
getProductSeoUrl()
Convenience method for getting the product's seo url. |
ProductSku |
getProductSku()
Get the product SKU corresponding to this item in a cart. |
int |
getQuantity()
Get the quantity of this item as a primitive int. |
java.lang.String |
getSavings()
Convenience method for getting the amount of money saved. |
java.lang.String |
getTotalPrice()
Convenience method for getting the amount without needing to pass in the currency. |
java.lang.String |
getType()
Get the type of action, i.e. |
long |
getUidPk()
Gets the unique identifier for the cart item object. |
boolean |
hasDependentCartItem(java.lang.String skuCode)
Returns true if this CartItem has another cart items that depend on it which matches the supplied skuCode. |
boolean |
hasDependentCartItems()
Returns true if this CartItem has other cart items that depend on it such that the dependent items cannot exist in the cart on their own. |
boolean |
hasSufficientInventory()
Returns true if there is sufficent stock to sell this cart item (in the quantity set in the CartItem). |
boolean |
isDependent()
Returns true if this CartItem depends on another cart item such that it can't exist in the cart on its own. |
boolean |
isLowestLessThanList()
Convenience method for checking if item is on sale. |
boolean |
isPersistent()
True if the cart item has previously been persisted. |
void |
setCurrency(java.util.Currency currency)
|
void |
setDefaultValues()
Set default values for those fields that need default values. |
void |
setDependentCartItems(java.util.Set dependentCartItems)
Set the set of dependent cart items. |
void |
setElasticPath(ElasticPath elasticpath)
Inject the ElasticPath singleton. |
void |
setLocale(java.util.Locale locale)
|
void |
setParentCartItem(CartItem parentCartItem)
Set the parent cart item that this cart item is dependent on. |
void |
setProductSku(ProductSku productSku)
Set the product SKU corresponding to this item in a cart. |
void |
setQuantity(int quantity)
Set the quantity of this item as a primitive int. |
void |
setType(java.lang.String type)
Set the type of action. |
void |
setUidPk(long uidPk)
Sets the unique identifier for the cart item object. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long serialVersionUID
Constructor Detail |
---|
public CartItemBeanImpl(CartItem cartItem, java.util.Currency currency, java.util.Locale locale)
CartItem
.
cartItem
- the cart item to be wrappedcurrency
- the current currencylocale
- the current localeMethod Detail |
---|
public void addDependentCartItem(CartItem dependentCartItem)
addDependentCartItem
in interface CartItem
dependentCartItem
- the other, dependent cart itempublic void applyDiscount(java.math.BigDecimal amount)
applyDiscount
in interface CartItem
amount
- the amount to discountpublic void clearDiscount()
clearDiscount
in interface CartItem
public void executeBeforePersistAction()
executeBeforePersistAction
in interface Persistence
public java.math.BigDecimal getAmount(java.util.Currency currency)
getAmount
in interface CartItem
currency
- the currency of the total price to be returned
BigDecimal
object representing the total pricepublic Money getAmountMoney(java.util.Currency currency)
Money
object.
getAmountMoney
in interface CartItem
currency
- the currency of the total price to be returned
Money
object representing the total pricepublic CartItem getCartItem()
getCartItem
in interface CartItemBean
public java.util.Currency getCurrency()
getCurrency
in interface CartItemBean
public java.util.Set getDependentCartItems()
getDependentCartItems
in interface CartItem
public java.lang.String getDisplayName()
getDisplayName
in interface CartItemBean
public ElasticPath getElasticPath()
getElasticPath
in interface EpDomain
public boolean getHasDependentCartItems()
getHasDependentCartItems
in interface CartItemBean
public java.lang.String getListPrice()
getListPrice
in interface CartItemBean
public java.util.Locale getLocale()
getLocale
in interface CartItemBean
public java.lang.String getLowestPrice()
getLowestPrice
in interface CartItemBean
public CartItem getParentCartItem()
getParentCartItem
in interface CartItem
public long getParentCartItemUidPk()
getParentCartItemUidPk
in interface CartItemBean
public java.lang.String getProductBrandName()
getProductBrandName
in interface CartItemBean
public java.lang.String getProductSeoUrl()
getProductSeoUrl
in interface CartItemBean
public ProductSku getProductSku()
getProductSku
in interface CartItem
ProductSKU
public int getQuantity()
getQuantity
in interface CartItem
public java.lang.String getSavings()
getSavings
in interface CartItemBean
public java.lang.String getTotalPrice()
getTotalPrice
in interface CartItemBean
public java.lang.String getType()
CartItem
getType
in interface CartItem
public long getUidPk()
getUidPk
in interface Persistence
public boolean hasDependentCartItem(java.lang.String skuCode)
hasDependentCartItem
in interface CartItem
skuCode
- The GUID of the particular dependant SKU to be in the cart.
public boolean hasDependentCartItems()
hasDependentCartItems
in interface CartItem
public boolean hasSufficientInventory()
hasSufficientInventory
in interface CartItem
public boolean isDependent()
isDependent
in interface CartItem
public boolean isLowestLessThanList()
isLowestLessThanList
in interface CartItemBean
public boolean isPersistent()
isPersistent
in interface Persistence
public void setCurrency(java.util.Currency currency)
setCurrency
in interface CartItemBean
currency
- the currency to setpublic void setDefaultValues()
setDefaultValues
in interface Persistence
public void setDependentCartItems(java.util.Set dependentCartItems)
setDependentCartItems
in interface CartItem
dependentCartItems
- the set of dependent cart items.public void setElasticPath(ElasticPath elasticpath)
setElasticPath
in interface EpDomain
elasticpath
- the ElasticPath singleton.public void setLocale(java.util.Locale locale)
setLocale
in interface CartItemBean
locale
- the locale to setpublic void setParentCartItem(CartItem parentCartItem)
setParentCartItem
in interface CartItem
parentCartItem
- the parent cart item.public void setProductSku(ProductSku productSku)
setProductSku
in interface CartItem
productSku
- the ProductSKU
public void setQuantity(int quantity)
setQuantity
in interface CartItem
quantity
- the quantitypublic void setType(java.lang.String type)
CartItem
setType
in interface CartItem
type
- the cart item typepublic void setUidPk(long uidPk)
setUidPk
in interface Persistence
uidPk
- the new unique identifier.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |