|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.component.shop.model.ShoppingCart
public class ShoppingCart
is a Session based ShoppingCart.
| Nested Class Summary | |
|---|---|
static class |
ShoppingCart.Total
the Total of the ShoppingCart. |
| Constructor Summary | |
|---|---|
ShoppingCart(Bundle b, ServiceRequest r)
creates a new ShoppingCart for the given Bundle
and the Locale of the ServiceRequest and adds
it to the Session. |
|
| Method Summary | |
|---|---|
void |
addItem(ShopItem item)
Adds/increments the given ShopItem to/in the
ShoppingCart. |
void |
addItem(ShopItem item,
int amount)
Adds/increments the given ShopItem to/in the
ShoppingCart. |
void |
clear()
Removes all ShopItems from the ShoppingCart. |
int |
containsItem(ShopItem item)
Determines whether the given ShopItem is in the
ShoppingCart. |
org.jdom.Element |
deserializeToJDOM()
returns a JDOM representation of the ShoppingCart. |
org.jdom.Element |
deserializeToJDOM(ServiceRequest r)
returns a JDOM representation of the ShoppingCart. |
int |
getAmount(ShopItem item)
returns the amount of the given items in the cart. |
Bundle |
getBundle()
Returns the Bundle of the ShoppingCart. |
static ShoppingCart |
getCart(Bundle bundle, ServiceRequest request)
returns the ShoppingCart for the current Bundle
. |
java.util.Locale |
getLocale()
Returns the Locale of the ShoppingCart. |
java.util.Set<ShoppingCartPosition> |
getPositions()
Returns the ShoppingCartPositions of the
ShoppingCart. |
ShopItem |
getShopItem(java.lang.String shopItemId)
returns the ShopItem identified by the given shop-item-id. |
ShoppingCart.Total |
getTotal(User u, ShopSettings s)
returns the total of the ShoppingCart. |
boolean |
isEmpty()
Determines whether the ShoppingCart is empty. |
void |
putItem(ShopItem item,
int amount)
puts the given ShopItem to/in the ShoppingCart
or removes it, if the amount is zero. |
void |
removeItem(ShopItem item)
Removes the given ShopItem from/in the
ShoppingCart. |
void |
setPositions(java.util.Set<ShoppingCartPosition> pos)
Sets the ShoppingCartPositions of the
ShoppingCart omitting all ShoppingCartPositions
with an amount which is not greater than zero. |
net.sf.json.JSONObject |
toJSON(User user)
returns the cart as JSON. |
static boolean |
validateShopItemId(java.lang.String id)
validates a given shop-item-id ShopItem.getShopItemId()
syntactically. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ShoppingCart(Bundle b, ServiceRequest r)
ShoppingCart for the given Bundle
and the Locale of the ServiceRequest and adds
it to the Session.
b - the bundler - the request| Method Detail |
|---|
public final Bundle getBundle()
Bundle of the ShoppingCart.
Bundle of the ShoppingCart.public final java.util.Locale getLocale()
Locale of the ShoppingCart.
Locale of the ShoppingCart.public final java.util.Set<ShoppingCartPosition> getPositions()
ShoppingCartPositions of the
ShoppingCart.
ShoppingCartPositions of the
ShoppingCart. (shallow copy)public final void setPositions(java.util.Set<ShoppingCartPosition> pos)
ShoppingCartPositions of the
ShoppingCart omitting all ShoppingCartPositions
with an amount which is not greater than zero.
pos - the ShoppingCartPositions to be set. (final)public final void addItem(ShopItem item)
ShopItem to/in the
ShoppingCart.
item - the ShopItem to be added/incremented.
public final void addItem(ShopItem item,
int amount)
ShopItem to/in the
ShoppingCart.
item - the ShopItem to be added/incremented.amount - the amount of ShopItems to be added/incremented.
public final void putItem(ShopItem item,
int amount)
ShopItem to/in the ShoppingCart
or removes it, if the amount is zero.
item - the ShopItem to be added/incremented.amount - the amount of ShopItems to be added/incremented.public final int containsItem(ShopItem item)
ShopItem is in the
ShoppingCart.
item - the ShopItem to be sought-after.
ShopItems equal to the given
ShopItem.public final void removeItem(ShopItem item)
ShopItem from/in the
ShoppingCart.
item - the ShopItem to be removed.public int getAmount(ShopItem item)
item - the item
public final ShopItem getShopItem(java.lang.String shopItemId)
ShopItem identified by the given shop-item-id.
shopItemId - a string identifying the ShopItem, starting
either with c for Contents or
v for Variant followed by the
primary key
ShopItem or null, if the item is
not in the cartShopItem.getShopItemId()public static final boolean validateShopItemId(java.lang.String id)
ShopItem.getShopItemId()
syntactically.
id - the shop-item-id
true, if and only if the given id is syntactically
valid. Otherwise false.public final void clear()
ShopItems from the ShoppingCart.
public final boolean isEmpty()
ShoppingCart is empty.
true, if the ShoppingCart is empty.
Returns false, otherwise.public final net.sf.json.JSONObject toJSON(User user)
user - the user used for calculating prices
public final ShoppingCart.Total getTotal(User u, ShopSettings s)
ShoppingCart.
u - the users - the ShopSettings
public static final ShoppingCart getCart(Bundle bundle, ServiceRequest request)
ShoppingCart for the current Bundle
.
bundle - the current bundlerequest - the current request
public final org.jdom.Element deserializeToJDOM()
ShoppingCart.
deserializeToJDOM in interface JDOMableShoppingCartJDOMable.deserializeToJDOM()public final org.jdom.Element deserializeToJDOM(ServiceRequest r)
ShoppingCart.
deserializeToJDOM in interface ExtendedJDOMabler - the request for adding further information
ShoppingCartJDOMable.deserializeToJDOM()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||