public class Cart extends JDBCObject<Cart>
There are two types of carts: shopping and favorites.
Shopping Cart
NextNumber
when the cart is created. The id of the cart is stored on the user's PC in
a cookie.FlashServlet
is executed. The cart is persisted to the
database as it is updated during the session so it can be recovered should
the session be interrupted. The cart id stored in the cookie is used to
recover the cart from the database.Favorites Cart
Modifier and Type | Field and Description |
---|---|
static char |
ORDERTYPE_ORDER
The order type for an order.
|
static char |
ORDERTYPE_QUOTE
The order type for a quote.
|
static int |
PAY_COD
The payment method type for COD.
|
static int |
PAY_CREDITCARD
The payment method type for credit card.
|
static int |
PAY_ONACCOUNT
The payment method type for on account.
|
static int |
PAY_UNKNOWN
The payment method type for unknown.
|
private static long |
serialVersionUID
The class' serialization version id.
|
static java.lang.String |
TYPE_FAVORITE
The cart type for a favorites cart.
|
static java.lang.String |
TYPE_SHOPPING
The cart type for a shopping cart.
|
LOWVAL_RPG_DATE, LOWVAL_RPG_TIME, STATUS_ACTIVE, STATUS_BLANK, STATUS_CANCELED, STATUS_DELETED, STATUS_INACTIVE, STATUS_PENDING
ivHashCode, ivHashFlds, ivObjAttrs
Constructor and Description |
---|
Cart()
Constructs a
Cart object with all field values set to null . |
Modifier and Type | Method and Description |
---|---|
void |
addAdjustmentLine(CartAdjustmentLine line)
(not persisted) Adds an adjustment line to the collection of adjustment
lines.
|
boolean |
addCartLine(FlashServletContext ctx,
CartLine cartline)
Adds a new cart line to this cart's collection of cart lines and to the
cart line database table.
|
boolean |
addCartLine(FlashServletContext ctx,
Product product,
int quantity)
Adds a new cart line to this cart's collection of cart lines and to the
cart line database table.
|
boolean |
addCartLine(FlashServletContext ctx,
Product product,
int quantity,
UnitMeasure orderuom,
UnitMeasure priceuom)
Adds a new cart line to this cart's collection of cart lines and to the
cart line database table.
|
boolean |
addCartLines(FlashServletContext ctx,
java.util.ArrayList<Product> products,
java.util.ArrayList<java.lang.Integer> quantities)
Adds one or more new cart lines to this cart's collection of cart lines
and to the cart line database table.
|
boolean |
addCartLines(FlashServletContext ctx,
java.util.ArrayList<Product> products,
java.util.ArrayList<java.lang.Integer> quantities,
java.util.ArrayList<UnitMeasure> orderuoms,
java.util.ArrayList<UnitMeasure> priceuoms)
Adds one or more new cart lines to this cart's collection of cart lines
and to the cart line database table.
|
void |
addConfirmationLine(CartConfirmationLine line)
(not persisted) Adds a confirmation line to the collection of confirmation
lines.
|
void |
deleteAdjustmentLines()
(not persisted) Deletes all adjustment lines from the collection of
adjustment lines.
|
boolean |
deleteCartLine(FlashServletContext ctx,
CartLine cartline)
Deletes a cart line from the cartline database table.
|
boolean |
deleteCartLine(FlashServletContext ctx,
int index)
Deletes a cart line from this cart's collection of cart lines and also
deletes the cart line from the cart line database table.
|
boolean |
deleteCartLines(FlashServletContext ctx)
Deletes all cart lines from the collection of cart lines and from the
cart line database table.
|
boolean |
deleteCartLines(FlashServletContext ctx,
java.util.ArrayList<java.lang.Integer> indexes)
Deletes one or more cart lines from this cart's collection of cart lines
and also deletes the cart lines from the cart line database table.
|
void |
deleteConfirmationLines()
(not persisted) Deletes all confirmation lines from the collection of
confirmation lines.
|
java.lang.String |
getAddToOrder()
(not persisted) Returns the add to existing order attribute.
|
java.util.ArrayList<CartAdjustmentLine> |
getAdjustmentLines()
(not persisted) Returns the collection of adjustment lines.
|
CartLine |
getCartLine(FlashServletContext ctx,
int index)
Returns the cart line at the given index.
|
java.util.ArrayList<CartLine> |
getCartLines(FlashServletContext ctx)
Returns the collection of cart lines for this cart.
|
int |
getCartLinesQuantity(FlashServletContext ctx)
Returns the total quantity of all cart lines for this cart.
|
java.lang.String |
getComments()
(not persisted) Returns the order comments.
|
java.util.ArrayList<CartConfirmationLine> |
getConfirmationLines()
(not persisted) Returns the collection of confirmation lines.
|
java.lang.String |
getConfirmContractNumber()
(not persisted) Returns the confirmed contract number.
|
CreditCard |
getConfirmCreditCard()
(not persisted) Returns the confirmed credit card object.
|
java.util.Date |
getConfirmOrderDate()
(not persisted) Returns the confirmed order date.
|
int |
getConfirmPayMethod()
(not persisted) Returns the confirmed payment method.
|
java.lang.String |
getConfirmPONumber()
(not persisted) Returns the confirmed customer P.O.
|
Shipper |
getConfirmShipper()
(not persisted) Returns the confirmed shipper object.
|
Customer |
getConfirmShipto()
(not persisted) Returns the confirmed ship-to customer object.
|
java.lang.String |
getConfirmUserDefinedField1()
(not persisted) Returns the confirmed order additional info.
|
java.lang.String |
getContractNumber()
(not persisted) Returns the contract number.
|
CreditCard |
getCreditCard()
(not persisted) Returns the credit card object.
|
java.math.BigDecimal |
getFreight()
(not persisted) Returns the freight charge amount.
|
java.lang.String |
getId()
Returns the unique id for the shopping cart or favorite items.
|
java.util.Date |
getLastAccess()
Returns the last time the shopping cart or favorite items was accessed.
|
java.lang.String |
getOrderId()
(not persisted) Returns the id of order in the ERP system.
|
int |
getOrderRef()
(not persisted) Returns the unique reference number for the order.
|
char |
getOrderType()
(not persisted) Returns the type of the order in the ERP system.
|
int |
getPayMethod()
(not persisted) Returns the payment method.
|
java.lang.String |
getPONumber()
(not persisted) Returns the customer P.O.
|
java.lang.String |
getReorderId()
(not persisted) Returns the order id that a reorder is based on.
|
java.util.Date |
getReqShipDate()
(not persisted) Returns the requested ship date.
|
Shipper |
getShipper()
(not persisted) Returns the shipper object.
|
Customer |
getShipto()
(not persisted) Returns the ship-to customer object.
|
java.math.BigDecimal |
getTax()
(not persisted) Returns the sales tax amount.
|
java.lang.String |
getType()
Returns the cart type code.
|
java.lang.String |
getUserDefinedField1()
(not persisted) Returns the order additional info.
|
java.math.BigDecimal |
getValue()
(not persisted) Returns the total order amount.
|
boolean |
hasCartLines()
Answers if cart line items have been retrieved and cached for this cart
(i.e.
|
int |
isProductInCart(FlashServletContext ctx,
Product product)
Answers if a given product is already in the cart.
|
void |
refreshCartLines(FlashServletContext ctx)
Refreshes the cart's cart lines.
|
void |
resetCartLines()
Resets the cart line cache to
null so the next request for the
cart's cart lines is forced to retrieve a fresh copy from the database. |
void |
setAddToOrder(java.lang.String value)
(not persisted) Sets the add to existing order attribute.
|
void |
setComments(java.lang.String value)
(not persisted) Sets the order comments.
|
void |
setConfirmContractNumber(java.lang.String value)
(not persisted) Sets the confirmed contract number.
|
void |
setConfirmCreditCard(CreditCard value)
(not persisted) Sets the confirmed credit card object.
|
void |
setConfirmOrderDate(java.util.Date value)
(not persisted) Sets the confirmed order date.
|
void |
setConfirmPayMethod(int value)
(not persisted) Sets the confirmed payment method.
|
void |
setConfirmPONumber(java.lang.String value)
(not persisted) Sets the confirmed customer P.O.
|
void |
setConfirmShipper(Shipper value)
(not persisted) Sets the confirmed shipper object.
|
void |
setConfirmShipto(Customer value)
(not persisted) Sets the confirmed ship-to customer object.
|
void |
setConfirmUserDefinedField1(java.lang.String value)
(not persisted) Sets the confirmed order additional info.
|
void |
setContractNumber(java.lang.String value)
(not persisted) Sets the contract number.
|
void |
setCreditCard(CreditCard value)
(not persisted) Sets the credit card object.
|
void |
setFreight(java.math.BigDecimal value)
(not persisted) Sets the freight charge amount.
|
void |
setId(java.lang.String value)
Sets the unique id for the shopping cart or favorite items.
|
void |
setLastAccess(java.util.Date value)
Sets the last time the shopping cart or favorite items was accessed.
|
void |
setOrderId(java.lang.String value)
(not persisted) Sets the id of order in the ERP system.
|
void |
setOrderRef(int value)
(not persisted) Sets the unique reference number for the order.
|
void |
setOrderType(char value)
(not persisted) Sets the type of the order in the ERP system.
|
void |
setPayMethod(int value)
(not persisted) Sets the payment method.
|
void |
setPONumber(java.lang.String value)
(not persisted) Sets the customer P.O.
|
void |
setRealtimeInfo(FlashServletContext ctx)
Sets the realtime information (current price, availability, etc.) for
each product within this cart's set of cart lines.
|
private void |
setRealtimeInfo(FlashServletContext ctx,
java.util.ArrayList<CartLine> cartlines)
Sets the realtime information (current price, availability, etc.) for
each product within a given set of cart lines.
|
void |
setReorderId(java.lang.String value)
(not persisted) Sets the order id that a reorder is based on.
|
void |
setReqShipDate(java.util.Date value)
(not persisted) Sets the requested ship date.
|
void |
setShipper(Shipper value)
(not persisted) Sets the shipper object.
|
void |
setShipto(Customer value)
(not persisted) Sets the ship-to customer object.
|
void |
setTax(java.math.BigDecimal value)
(not persisted) Sets the sales tax amount.
|
void |
setType(java.lang.String value)
Sets the cart type code.
|
void |
setUserDefinedField1(java.lang.String value)
(not persisted) Sets the order additional info.
|
void |
setValue(java.math.BigDecimal value)
(not persisted) Sets the total order amount.
|
boolean |
updateCartLine(FlashServletContext ctx,
CartLine cartline)
Updates a cart line in the collection of cart lines and in the cart line
database table.
|
boolean |
updateCartLine(FlashServletContext ctx,
int index,
int quantity,
UnitMeasure orderuom,
UnitMeasure priceuom)
Updates the values for a cart line in the collection of cart lines and
in the cart line database table.
|
boolean |
updateCartLines(FlashServletContext ctx,
java.util.ArrayList<java.lang.Integer> quantities,
java.util.ArrayList<UnitMeasure> orderuoms,
java.util.ArrayList<UnitMeasure> priceuoms)
Updates the values for one or more cart lines in the collection of cart
lines and in the cart line database table.
|
boolean |
updateLastAccess(FlashServletContext ctx)
Updates the last time the shopping cart or favorite items was accessed
to the current date and time.
|
after, before, compareTo, equals, fmtStatus, fmtStatus, getObjectStatus, hashKey, setObjectStatus
cloneMapAttributes, formatValue, formatValue, getHashFields, getMapArrayList, getMapAttributes, getMapBigDecimal, getMapBoolean, getMapDate, getMapDouble, getMapInteger, getMapLong, getMapMapped, getMapObject, getMapShort, getMapString, getMapString, getMapStringBuffer, getMapStringBuilder, getMapTime, getMapTimestamp, getMapVector, hashCode, setHashFields, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMapAttributes, setMapObject, setMapTime, setMapTimestamp, toStringArray
private static final long serialVersionUID
public static final java.lang.String TYPE_SHOPPING
public static final java.lang.String TYPE_FAVORITE
public static final int PAY_UNKNOWN
public static final int PAY_CREDITCARD
public static final int PAY_ONACCOUNT
public static final int PAY_COD
public static final char ORDERTYPE_ORDER
public static final char ORDERTYPE_QUOTE
public java.lang.String getId()
public void setId(java.lang.String value)
value
- (String) The unique id for the shopping cart or favorite
items.public java.util.Date getLastAccess()
public void setLastAccess(java.util.Date value)
value
- (java.util.Date) The last time the shopping cart or
favorite items was accessed.public java.lang.String getType()
public void setType(java.lang.String value)
value
- (String) The cart type code.public Customer getShipto()
public void setShipto(Customer value)
value
- (Customer) The ship-to customer.public java.lang.String getPONumber()
public void setPONumber(java.lang.String value)
value
- (String) The P.O. number.public java.lang.String getContractNumber()
public void setContractNumber(java.lang.String value)
value
- (String) The contract number.public java.lang.String getComments()
public void setComments(java.lang.String value)
value
- (String) The order comments.public Shipper getShipper()
public void setShipper(Shipper value)
value
- (Shipper) The shipper for this cart.public java.util.Date getReqShipDate()
public void setReqShipDate(java.util.Date value)
value
- (Date) The requested ship date.public int getPayMethod()
public void setPayMethod(int value)
value
- (int) The payment method.public CreditCard getCreditCard()
public void setCreditCard(CreditCard value)
value
- (CreditCard) The credit card.public java.lang.String getUserDefinedField1()
public void setUserDefinedField1(java.lang.String value)
value
- (String) The additional info.public java.util.Date getConfirmOrderDate()
public void setConfirmOrderDate(java.util.Date value)
value
- (Date) The confirmed order date.public Customer getConfirmShipto()
public void setConfirmShipto(Customer value)
value
- (Customer) The confirmed ship-to customer.public java.lang.String getConfirmPONumber()
public void setConfirmPONumber(java.lang.String value)
value
- (String) The confirmed P.O. number.public java.lang.String getConfirmContractNumber()
public void setConfirmContractNumber(java.lang.String value)
value
- (String) The confirmed contract number.public Shipper getConfirmShipper()
public void setConfirmShipper(Shipper value)
value
- (Shipper) The confirmed shipper for this cart.public int getConfirmPayMethod()
public void setConfirmPayMethod(int value)
value
- (int) The confirmed payment method.public CreditCard getConfirmCreditCard()
public void setConfirmCreditCard(CreditCard value)
value
- (CreditCard) The confirmed credit card.public java.lang.String getConfirmUserDefinedField1()
public void setConfirmUserDefinedField1(java.lang.String value)
value
- (String) The confirmed additional info.public java.math.BigDecimal getFreight()
public void setFreight(java.math.BigDecimal value)
value
- (BigDecimal) The freight charge amount.public java.math.BigDecimal getTax()
public void setTax(java.math.BigDecimal value)
value
- (BigDecimal) The sales tax amount.public java.math.BigDecimal getValue()
public void setValue(java.math.BigDecimal value)
value
- (BigDecimal) The total order amount.public java.lang.String getOrderId()
public void setOrderId(java.lang.String value)
value
- (String) The id of order in the ERP system.public char getOrderType()
public void setOrderType(char value)
value
- (char) The type of the order in the ERP system.public java.lang.String getReorderId()
public void setReorderId(java.lang.String value)
value
- (String) The order id that a reorder is based on.public int getOrderRef()
public void setOrderRef(int value)
value
- (int) The unique reference number for the order.public java.lang.String getAddToOrder()
public void setAddToOrder(java.lang.String value)
value
- (String) The order number value.public void addAdjustmentLine(CartAdjustmentLine line)
line
- (CartAdjustmentLine) The adjustment line.public void deleteAdjustmentLines()
public java.util.ArrayList<CartAdjustmentLine> getAdjustmentLines()
public void addConfirmationLine(CartConfirmationLine line)
line
- (CartConfirmationLine) The confirmation line.public void deleteConfirmationLines()
public java.util.ArrayList<CartConfirmationLine> getConfirmationLines()
public boolean addCartLine(FlashServletContext ctx, CartLine cartline)
ctx
- (FlashServletContext) The current servlet context.cartline
- (CartLine) The cart line to add.true
if the cart line successfully added,
otherwise false
.public boolean addCartLine(FlashServletContext ctx, Product product, int quantity)
ctx
- (FlashServletContext) The current servlet context.product
- (Product) The product to add.quantity
- (int) The product's order quantity.true
if the product successfully added,
otherwise false
.public boolean addCartLine(FlashServletContext ctx, Product product, int quantity, UnitMeasure orderuom, UnitMeasure priceuom)
ctx
- (FlashServletContext) The current servlet context.product
- (Product) The product to add.quantity
- (int) The product's order quantity.orderuom
- (UnitMeasure) The order unit of measure. Will be
null
if multiple uom processing is not active or if
multiple uom processing is active and cart lines are added
from anywhere other than the product details page.priceuom
- (UnitMeasure) The price unit of measure. Will be
null
if multiple uom processing is not active or if
multiple uom processing is active and cart lines are added
from anywhere other than the product details page.true
if the cart line successfully added,
otherwise false
.public boolean addCartLines(FlashServletContext ctx, java.util.ArrayList<Product> products, java.util.ArrayList<java.lang.Integer> quantities)
ctx
- (FlashServletContext) The current servlet context.products
- (ArrayList) The products to add.quantities
- (ArrayList) The quantities associated with the
products being added.true
if the cart lines successfully added,
otherwise false
.public boolean addCartLines(FlashServletContext ctx, java.util.ArrayList<Product> products, java.util.ArrayList<java.lang.Integer> quantities, java.util.ArrayList<UnitMeasure> orderuoms, java.util.ArrayList<UnitMeasure> priceuoms)
ctx
- (FlashServletContext) The current servlet context.products
- (ArrayList) The products to add.quantities
- (ArrayList) The quantities associated with the
products being added.orderuoms
- (ArrayList) The order units of measure associated
with the products being added. Note that this parameter may be
null
.priceuoms
- (ArrayList) The price units of measure associated
with the products being added. Note that this parameter may be
null
.true
if the cart lines successfully added,
otherwise false
.public boolean deleteCartLine(FlashServletContext ctx, CartLine cartline)
delete
method in CartLineController
.ctx
- (FlashServletContext) The current servlet context.cartline
- (CartLine) The cart line to delete.true
if the cart line successfully deleted,
otherwise false
.public boolean deleteCartLine(FlashServletContext ctx, int index)
ctx
- (FlashServletContext) The current servlet context.index
- (int) The index in the cart line collection for the line
to delete.true
if the cart line successfully deleted,
otherwise false
.public boolean deleteCartLines(FlashServletContext ctx)
ctx
- (FlashServletContext) The current servlet context.true
if the cart lines successfully deleted,
otherwise false
.public boolean deleteCartLines(FlashServletContext ctx, java.util.ArrayList<java.lang.Integer> indexes)
ctx
- (FlashServletContext) The current servlet context.indexes
- (ArrayList) The indexes in the cart line collection for
the lines to delete.true
if the cart lines successfully deleted,
otherwise false
.public CartLine getCartLine(FlashServletContext ctx, int index)
ctx
- (FlashServletContext) The current servlet context.null
if the cart
has no cart lines or if the supplied index is out of range.public java.util.ArrayList<CartLine> getCartLines(FlashServletContext ctx)
ctx
- (FlashServletContext) The current servlet context. Pass
a null
to only retrieve from the cache.public int getCartLinesQuantity(FlashServletContext ctx)
ctx
- (FlashServletContext) The current servlet context. Pass
a null
to only retrieve from the cache.public boolean hasCartLines()
null
or not null
). The answer
returned here simply indicates whether cart lines have been retrieved and
cached; it is not an indicator of whether the cart actually has any cart
lines in the database. To determine the latter, invoke getCartLines
and check for an empty collection.true
if cart lines have been retrieved and
cached, otherwise false
.public void refreshCartLines(FlashServletContext ctx)
ctx
- (FlashServletContext) The current servlet context.public void resetCartLines()
null
so the next request for the
cart's cart lines is forced to retrieve a fresh copy from the database.public boolean updateCartLine(FlashServletContext ctx, CartLine cartline)
ctx
- (FlashServletContext) The current servlet context.cartline
- (CartLine) The cart line to update.true
if the cart line successfully updated,
otherwise false
.public boolean updateCartLine(FlashServletContext ctx, int index, int quantity, UnitMeasure orderuom, UnitMeasure priceuom)
ctx
- (FlashServletContext) The current servlet context.index
- (int) The index in the cart line collection for the line
to update.quantity
- (int) The new order quantity.orderuom
- (UnitMeasure) The order unit of measure. Will be
null
if multiple uom processing is not active.priceuom
- (UnitMeasure) The price unit of measure. Will be
null
if multiple uom processing is not active.true
if the cart line successfully updated,
otherwise false
.public boolean updateCartLines(FlashServletContext ctx, java.util.ArrayList<java.lang.Integer> quantities, java.util.ArrayList<UnitMeasure> orderuoms, java.util.ArrayList<UnitMeasure> priceuoms)
ctx
- (FlashServletContext) The current servlet context.quantities
- (ArrayList) The quantities that are to be updated in
the cart. The sequence of the collection elements must coincide
with the sequence of the cart lines in the cart.orderuoms
- (ArrayList) The order units of measure that are to be
updated in the cart. The sequence of the collection elements must
coincide with the sequence of the cart lines in the cart. Note
that this parameter may be null
.priceuoms
- (ArrayList) The price units of measure that are to be
updated in the cart. The sequence of the collection elements must
coincide with the sequence of the cart lines in the cart. Note
that this parameter may be null
.true
if the cart lines successfully updated,
otherwise false
.public boolean updateLastAccess(FlashServletContext ctx)
ctx
- (FlashServletContext) The current servlet context.true
if the cart was successfully updated,
otherwise false
.public int isProductInCart(FlashServletContext ctx, Product product)
ctx
- (FlashServletContext) The current servlet context.product
- (Product) A product to search for in the cart.public void setRealtimeInfo(FlashServletContext ctx)
ctx
- (FlashServletContext) The current servlet context.private void setRealtimeInfo(FlashServletContext ctx, java.util.ArrayList<CartLine> cartlines)
ctx
- (FlashServletContext) The current servlet context.cartlines
- (ArrayList) The cart lines to process.