Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2004 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.beasys.commerce.ebusiness.shoppingcart
Class ShoppingCartImpl

    java.lang.Object
      com.beasys.commerce.foundation.BelongingImpl
          com.beasys.commerce.ebusiness.shoppingcart.ShoppingCartImpl

All Implemented Interfaces:
  Belonging, BusinessSmartComponent, Cloneable, Comparable, RelationalReference, Serializable, ShoppingCart

public class ShoppingCartImpl
extends BelongingImpl
implements ShoppingCart

The ShoppingCart is used to contain a list of ShoppingCartLines. The ShoppingCart also has a Customer associated with it so that it can calculate Customer dependent prices if necessary.

See Also:
  `ShoppingCart`, `ShoppingCartHome`, Serialized Form

Field Summary
`Money` | `shipping` Containment: By Value Multiplicity: 1:1
`Collection` | `shoppingCartLines` The shopping cart contains a list of ShoppingCart lines Containment: By Value Multiplicity: 0:N Interface: java.util.Collection
`Money` | `subtotal`
`Money` | `total`

Fields inherited from class com.beasys.commerce.foundation.BelongingImpl
`__classIdentifier, __containingBelonging, __containingEntity, __mapKey, __sequenceNumber, _isDirty`

Constructor Summary
`ShoppingCartImpl()`

Method Summary
`void` | `addItemsFromShoppingCart(ShoppingCart items)` Add the ShoppingCartLines from the specified ShoppingCart to this ShoppingCart.
`ShoppingCartLine` | `addProductItem(ProductItem item, double quantity)` Add an Item to the ShoppingCart.
`ShoppingCartLine` | `addProductItem(ProductItem item, double quantity, Money unitPrice)` Add an Item to the ShoppingCart.
`boolean` | `addShoppingCartLine(ShoppingCartLine element)` Ensures that this collection contains the specified element (optional operation).
`boolean` | `addShoppingCartLineCollection(Collection collection)` Adds all of the elements in the specified collection to this collection (optional operation).
`void` | `clearShoppingCartLineCollection()` Removes all of the elements from this collection (optional operation).
`int` | `compareTo(Object o)` Compare this belonging to another
`boolean` | `containsShoppingCartLine(ShoppingCartLine element)` Returns true if this collection contains the specified element.
`boolean` | `containsShoppingCartLineCollection(Collection collection)` Returns true if this collection contains all of the elements in the specified collection.
`ShoppingCartLine` | `createShoppingCartLine()` Used internally by the ShoppingCart to create ShoppingCartLines.
`boolean` | `equalsShoppingCartLineCollection(Object object)` Compares the specified object with this collection for equality.
`ShoppingCartLine` | `findShoppingCartLine(String productIdentifier)` Find the ShoppingCartLine associated with the specified Item.
`double` | `getCategoryQuantity(String categoryId)` Count the number of product items that belong to a category Note This method creates/calls the CatalogManager and the ProductItemManager to resolve which items belong to what category!
`double` | `getNumberOfUnits()` Count the total quantity of items by summing the quantity on each line.
`ArrayList` | `getOrderDiscountPresentations()` Gets the order level discount list
`Money` | `getShipping()` Get the value of shipping
`ArrayList` | `getShippingDiscountPresentations()` Gets the shipping discount list
`Collection` | `getShoppingCartLineCollection()` Returns a deep copy of the entire collection
`Money` | `getSubtotal()` Get the value of subtotal
`Money` | `getTotal()` Get the value of total
`Money` | `getTotal(int totalType)` Gets the shopping cart total for the given total type
`Money` | `getTotalPrice()` Gets the overal shopping cart total
`String` | `interfaceName()` interfaceName() returns the unqualified name of the interface from the UML model
`boolean` | `isEmpty()` Returns true if the shopping cart has no items
`boolean` | `isShoppingCartLineCollectionEmpty()` Returns true if this collection contains no elements.
`void` | `removeAllProductItems()` Removes all ShoppingCartLines.
`ProductItem` | `removeProductItem(String productIdentifier)` Remove the ShoppingCartLine associated with the Item specified.
`boolean` | `removeShoppingCartLine(ShoppingCartLine element)` Removes a single instance of the specified element from this collection, if it is present (optional operation).
`boolean` | `removeShoppingCartLineCollection(Collection collection)` Removes all this collection's elements that are also contained in the specified collection (optional operation).
`boolean` | `retainShoppingCartLineCollection(Collection collection)` Retains only the elements in this collection that are contained in the specified collection (optional operation).
`void` | `setByValue(Belonging value)` It is possible to call set-by-value with a superclass.
`void` | `setOrderDiscountPresentations(ArrayList orderDiscountPresentations)` Sets the order level discount list
`void` | `setProductItemQuantity(ProductItem item, double quantity)` Sets the Quantity of the ShoppingCartLine associated with this Item.
`void` | `setShipping(Money shipping)` Set the value of shipping
`void` | `setShippingDiscountPresentations(ArrayList shippingDiscountPresentations)` Sets the shipping discount list
`void` | `setShoppingCartLineCollection(Collection collection)` Sets the entire collection
`void` | `setSubtotal(Money subtotal)` Set the value of subtotal
`void` | `setTotal(Money total)` Set the value of total
`int` | `shoppingCartLineCollectionHashCode()` Returns the hash code value for this collection.
`Iterator` | `shoppingCartLineCollectionIterator()` Returns an iterator over the elements in this collection.
`int` | `shoppingCartLineCollectionSize()` Returns the number of elements in this collection.
`Belonging` | `value()` value() is a more typesafe implementation of clone()

Methods inherited from class com.beasys.commerce.foundation.BelongingImpl
`clearRelationalBinding, clearRelationalBinding, clearRelationalBinding, clearRelationalBinding, clone, doRelationalBinding, doRelationalBinding, doRelationalBindingOnElement, doRelationalBindingOnElement, doRelationalBindingOnElement, doRelationalBindingOnSingleton, doRelationalBindingOnSingleton, doRelationalBindingOnSingleton, doRelationalBindingWithMapKey, doRelationalBindingWithMapKey, doRelationalBindingWithMapKey, enumerateRelationalBinding, enumerateRelationalBinding, equals, get__classIdentifier, get__containingBelonging, get__containingEntity, get__containingEntityReference, get__mapKey, get__sequenceNumber, getPersistenceHelperPlugin, hashCode, set__classIdentifier, set__containingBelonging, set__containingEntity, set__containingEntityReference, set__mapKey, toString`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.beasys.commerce.foundation.Belonging
`clone, equals`

Field Detail

### shipping

    public Money shipping

  - Containment: By Value
  - Multiplicity: 1:1

### shoppingCartLines

    public Collection shoppingCartLines

  The shopping cart contains a list of ShoppingCart lines
  - Containment: By Value
  - Multiplicity: 0:N
  - Interface: java.util.Collection

### subtotal

    public Money subtotal

### total

    public Money total

Constructor Detail

### ShoppingCartImpl

    public ShoppingCartImpl()

Method Detail

### addItemsFromShoppingCart

    public void addItemsFromShoppingCart(ShoppingCart items)
                                  throws InvalidArgumentException

  Add the ShoppingCartLines from the specified ShoppingCart to this ShoppingCart.

  Specified by:
    `addItemsFromShoppingCart` in interface `ShoppingCart`
  Throws:
    `InvalidArgumentException`

### addProductItem

    public ShoppingCartLine addProductItem(ProductItem item,
                                           double quantity)
                                    throws InvalidArgumentException

  Add an Item to the ShoppingCart. If the Item is already in the ShoppingCart, increase its quantity.

  Specified by:
    `addProductItem` in interface `ShoppingCart`
  Throws:
    `InvalidArgumentException`

### addProductItem

    public ShoppingCartLine addProductItem(ProductItem item,
                                           double quantity,
                                           Money unitPrice)
                                    throws InvalidArgumentException

  Add an Item to the ShoppingCart. If the Item is already in the ShoppingCart, increase its quantity.

  Specified by:
    `addProductItem` in interface `ShoppingCart`
  Throws:
    `InvalidArgumentException`

### addShoppingCartLine

    public boolean addShoppingCartLine(ShoppingCartLine element)

  Ensures that this collection contains the specified element (optional operation).

  Specified by:
    `addShoppingCartLine` in interface `ShoppingCart`

### addShoppingCartLineCollection

    public boolean addShoppingCartLineCollection(Collection collection)

  Adds all of the elements in the specified collection to this collection (optional operation).

  Specified by:
    `addShoppingCartLineCollection` in interface `ShoppingCart`

### clearShoppingCartLineCollection

    public void clearShoppingCartLineCollection()

  Removes all of the elements from this collection (optional operation).

  Specified by:
    `clearShoppingCartLineCollection` in interface `ShoppingCart`

### compareTo

    public int compareTo(Object o)

  Compare this belonging to another

  Specified by:
    `compareTo` in interface `Comparable`
  Specified by:
    `compareTo` in class `BelongingImpl`
  Parameters:
    `o` - target object for comparision
  Returns:
    0 objects are equal

### containsShoppingCartLine

    public boolean containsShoppingCartLine(ShoppingCartLine element)

  Returns true if this collection contains the specified element.

  Specified by:
    `containsShoppingCartLine` in interface `ShoppingCart`

### containsShoppingCartLineCollection

    public boolean containsShoppingCartLineCollection(Collection collection)

  Returns true if this collection contains all of the elements in the specified collection.

  Specified by:
    `containsShoppingCartLineCollection` in interface `ShoppingCart`

### createShoppingCartLine

    public ShoppingCartLine createShoppingCartLine()

  Used internally by the ShoppingCart to create ShoppingCartLines. If ShoppingCart is used to manage a list of lines that extend ShoppingCartLine, this method should be overridden to return an instance of the appropiate sub class.

  Specified by:
    `createShoppingCartLine` in interface `ShoppingCart`

### equalsShoppingCartLineCollection

    public boolean equalsShoppingCartLineCollection(Object object)

  Compares the specified object with this collection for equality.

  Specified by:
    `equalsShoppingCartLineCollection` in interface `ShoppingCart`

### findShoppingCartLine

    public ShoppingCartLine findShoppingCartLine(String productIdentifier)
                                          throws ItemNotInShoppingCartException,
                                                 InvalidArgumentException

  Find the ShoppingCartLine associated with the specified Item. Throws an ItemNotInShoppingCartException if the Item cannot be found.

  Specified by:
    `findShoppingCartLine` in interface `ShoppingCart`
  Throws:
    `ItemNotInShoppingCartException`
    `InvalidArgumentException`

### getCategoryQuantity

    public double getCategoryQuantity(String categoryId)
                               throws RemoteException

  Count the number of product items that belong to a category Note This method creates/calls the CatalogManager and the ProductItemManager to resolve which items belong to what category! This means the performance of this method cannot be great, and the method should be used parcimoniously.

  Specified by:
    `getCategoryQuantity` in interface `ShoppingCart`
  Returns:
    the count over all the items which belong to that category
  Throws:
    `RemoteException`

### getNumberOfUnits

    public double getNumberOfUnits()

  Count the total quantity of items by summing the quantity on each line.

  Specified by:
    `getNumberOfUnits` in interface `ShoppingCart`

### getOrderDiscountPresentations

    public ArrayList getOrderDiscountPresentations()

  Gets the order level discount list

  Specified by:
    `getOrderDiscountPresentations` in interface `ShoppingCart`

### getShipping

    public Money getShipping()

  Get the value of shipping

  Specified by:
    `getShipping` in interface `ShoppingCart`
  Returns:
    shipping.

### getShippingDiscountPresentations

    public ArrayList getShippingDiscountPresentations()

  Gets the shipping discount list

  Specified by:
    `getShippingDiscountPresentations` in interface `ShoppingCart`

### getShoppingCartLineCollection

    public Collection getShoppingCartLineCollection()

  Returns a deep copy of the entire collection

  Specified by:
    `getShoppingCartLineCollection` in interface `ShoppingCart`

### getSubtotal

    public Money getSubtotal()

  Get the value of subtotal

  Specified by:
    `getSubtotal` in interface `ShoppingCart`
  Returns:
    subtotal.

### getTotal

    public Money getTotal()

  Get the value of total

  Specified by:
    `getTotal` in interface `ShoppingCart`
  Returns:
    total.

### getTotal

    public Money getTotal(int totalType)
                   throws InvalidArgumentException

  Gets the shopping cart total for the given total type

  Specified by:
    `getTotal` in interface `ShoppingCart`
  Throws:
    `InvalidArgumentException`

### getTotalPrice

    public Money getTotalPrice()

  Gets the overal shopping cart total

  Specified by:
    `getTotalPrice` in interface `ShoppingCart`

### interfaceName

    public String interfaceName()

  interfaceName() returns the unqualified name of the interface from the UML model

  Specified by:
    `interfaceName` in interface `Belonging`
  Returns:
    the unqualified name of the belonging interface from the UML model

### isEmpty

    public boolean isEmpty()

  Returns true if the shopping cart has no items

  Specified by:
    `isEmpty` in interface `ShoppingCart`

### isShoppingCartLineCollectionEmpty

    public boolean isShoppingCartLineCollectionEmpty()

  Returns true if this collection contains no elements.

  Specified by:
    `isShoppingCartLineCollectionEmpty` in interface `ShoppingCart`

### removeAllProductItems

    public void removeAllProductItems()

  Removes all ShoppingCartLines. This resets the entire ShoppingCart.

  Specified by:
    `removeAllProductItems` in interface `ShoppingCart`

### removeProductItem

    public ProductItem removeProductItem(String productIdentifier)
                                  throws InvalidArgumentException

  Remove the ShoppingCartLine associated with the Item specified.

  Specified by:
    `removeProductItem` in interface `ShoppingCart`
  Throws:
    `InvalidArgumentException`

### removeShoppingCartLine

    public boolean removeShoppingCartLine(ShoppingCartLine element)

  Removes a single instance of the specified element from this collection, if it is present (optional operation).

  Specified by:
    `removeShoppingCartLine` in interface `ShoppingCart`

### removeShoppingCartLineCollection

    public boolean removeShoppingCartLineCollection(Collection collection)

  Removes all this collection's elements that are also contained in the specified collection (optional operation).

  Specified by:
    `removeShoppingCartLineCollection` in interface `ShoppingCart`

### retainShoppingCartLineCollection

    public boolean retainShoppingCartLineCollection(Collection collection)

  Retains only the elements in this collection that are contained in the specified collection (optional operation).

  Specified by:
    `retainShoppingCartLineCollection` in interface `ShoppingCart`

### setByValue

    public void setByValue(Belonging value)

  It is possible to call set-by-value with a superclass. If that is the case, only the fields in the superclass will be set in this instance. The remaining fields get the default values.

  It is also possible to call set-by-value with a subclass. In this case, the specialized fields in the subclass will be ignored. The overridden fields in the subclass will be populated.

  Specified by:
    `setByValue` in interface `Belonging`
  Overrides:
    `setByValue` in class `BelongingImpl`
  Parameters:
    `value` - The `Belonging` to use for initialization.

### setOrderDiscountPresentations

    public void setOrderDiscountPresentations(ArrayList orderDiscountPresentations)

  Sets the order level discount list

  Specified by:
    `setOrderDiscountPresentations` in interface `ShoppingCart`

### setProductItemQuantity

    public void setProductItemQuantity(ProductItem item,
                                       double quantity)
                                throws InvalidArgumentException

  Sets the Quantity of the ShoppingCartLine associated with this Item. A new ShoppingCartLine is created if the Item is not present. This differs from addItem in that this method explicitly sets the absolute Quantity of a ShoppingCartLine rather than incrementing the existing value .

  Specified by:
    `setProductItemQuantity` in interface `ShoppingCart`
  Throws:
    `InvalidArgumentException`

### setShipping

    public void setShipping(Money shipping)

  Set the value of shipping

  Specified by:
    `setShipping` in interface `ShoppingCart`
  Parameters:
    `shipping` - shipping to be added

### setShippingDiscountPresentations

    public void setShippingDiscountPresentations(ArrayList shippingDiscountPresentations)

  Sets the shipping discount list

  Specified by:
    `setShippingDiscountPresentations` in interface `ShoppingCart`

### setShoppingCartLineCollection

    public void setShoppingCartLineCollection(Collection collection)

  Sets the entire collection

  Specified by:
    `setShoppingCartLineCollection` in interface `ShoppingCart`

### setSubtotal

    public void setSubtotal(Money subtotal)

  Set the value of subtotal

  Specified by:
    `setSubtotal` in interface `ShoppingCart`
  Parameters:
    `subtotal` - subtotal to be added

### setTotal

    public void setTotal(Money total)

  Set the value of total

  Specified by:
    `setTotal` in interface `ShoppingCart`
  Parameters:
    `total` - total to be added

### shoppingCartLineCollectionHashCode

    public int shoppingCartLineCollectionHashCode()

  Returns the hash code value for this collection.

  Specified by:
    `shoppingCartLineCollectionHashCode` in interface `ShoppingCart`

### shoppingCartLineCollectionIterator

    public Iterator shoppingCartLineCollectionIterator()

  Returns an iterator over the elements in this collection.

  Specified by:
    `shoppingCartLineCollectionIterator` in interface `ShoppingCart`

### shoppingCartLineCollectionSize

    public int shoppingCartLineCollectionSize()

  Returns the number of elements in this collection.

  Specified by:
    `shoppingCartLineCollectionSize` in interface `ShoppingCart`

### value

    public Belonging value()

  value() is a more typesafe implementation of clone()

  Specified by:
    `value` in interface `Belonging`
  Returns:
    a clone of this instance

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2004 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 BEA Systems, Inc. All Rights Reserved