|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softslate.commerce.businessobjects.core.BaseBusinessObject com.softslate.commerce.businessobjects.core.BaseBusinessProcessor com.softslate.commerce.businessobjects.order.BasicCartProcessor
Processes business logic having to do with a user's cart.
BasicCartProcessor
is the default implementation of the
CartProcessor
interface for the application.
CartProcessor
Field Summary | |
(package private) static org.apache.commons.logging.Log |
log
|
Fields inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor |
|
Constructor Summary | |
BasicCartProcessor()
|
Method Summary | |
java.lang.String |
getOrderAttribute(java.util.Map parameters,
java.lang.String productCode,
java.lang.String attributeCode)
Retrieves the value submitted for an attribute of a given product, as part of a request to add or edit an item in the user's cart. |
int |
getOrderItemQuantity(java.lang.String productCode,
java.util.Map parameters)
Looks up the submitted quantity of a given product contained in a request to add or edit a user's cart item. |
void |
initializeCart()
Initializes a user's cart. |
java.util.Map |
processAddItems(java.util.Map parameters)
Processes a request to add items to a user's cart. |
java.util.Map |
processCheckoutAddresses(java.util.Map parameters)
Processes a request to add address information to a user's cart. |
java.util.Map |
processEditItem(java.util.Map parameters)
Processes a request to edit a given item in a user's cart. |
void |
processItemAttribute(OrderItem orderItem,
java.util.Map productInfoMap,
java.lang.String attributeValue)
Adds an attribute to a given OrderItem . |
java.util.Map |
processOrderComplete(java.util.Map parameters)
Handles processing at the very end of the checkout process, after payments have been processed. |
java.util.Map |
processRemoveItem(OrderItem orderItem)
Removes a given OrderItem from the user's cart, updating the cart totals in the process. |
void |
updateOrderAndDeliveryTotals(OrderDelivery orderDelivery,
OrderItem orderItem)
Given a newly-added OrderItem , updates the totals of the
user's Order and the OrderDelivery the
OrderItem is under. |
void |
updateOrderItemQuantity(OrderItem orderItem,
int quantity)
Given an OrderItem in the user's cart and a new quantity
for that item, updates the totals of the user's Order and
the OrderDelivery the OrderItem is under. |
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor |
formatPrice, getBusinessObjectFactory, getDaoFactory, getSettingsBean, getUser, initialize, setBusinessObjectFactory, setDaoFactory, setSettingsBean, setUser |
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessObject |
formatDateTime, parseDateTime, prepareRequestData, sendHTTPPost |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject |
initialize |
Field Detail |
static org.apache.commons.logging.Log log
Constructor Detail |
public BasicCartProcessor()
Method Detail |
public java.util.Map processAddItems(java.util.Map parameters) throws java.lang.Exception
CartProcessor
initializeCart()
to create a new instance of
Order
in
the User
instance for the user. It then adds an
OrderDelivery
instance under the Order
and
OrderItem
instances under the OrderDelivery
.
The Map
must have the following keys:
orderProductCodes
(aString[]
holding the codes of the product(s) to add);
orderProductQuantities
(aString[]
holding the quantities of the product(s) to add); and
orderAttributes
(aHashMap
holding
attribute keys and values, where the attribute keys are in the form of
'productCode|attributeCode').
processAddItems
in interface CartProcessor
parameters
- A Map
representing the items and attributes
being added to the user's cart.
Map
representing the results of the processing.
java.lang.Exception
public void updateOrderAndDeliveryTotals(OrderDelivery orderDelivery, OrderItem orderItem)
OrderItem
, updates the totals of the
user's Order
and the OrderDelivery
the
OrderItem
is under. Calculates new totals for the
quantity, price total, and weight total.
orderDelivery
- The order delivery that contains the new
OrderItem
.orderItem
- The newly-added order item whose price must be added to the
order's total and the delivery's total.public java.lang.String getOrderAttribute(java.util.Map parameters, java.lang.String productCode, java.lang.String attributeCode) throws java.lang.Exception
orderAttributes
property (which is a HashMap
)
of the incoming Map
to look up the attribute's value. The
key for the attribute is formed like so:
productCode|attributeCode
.
parameters
- A Map
representing the items and properties
submitted to add or edit items in the user's cart.productCode
- The code of the product corresponding to the attribute.attributeCode
- The code of the attribute whose value is being looked up.
attibuteCode
, or null
, if the
attribute is not found.
java.lang.Exception
public void processItemAttribute(OrderItem orderItem, java.util.Map productInfoMap, java.lang.String attributeValue)
OrderItem
. Attributes under
an order item are each represented as a Map
within the
orderItemAttributes
property of the OrderItem
.
orderItem
- The OrderItem
that is having an attribute added
to it.productInfoMap
- A Map
representing information about a product,
attribute, and option. The map represents one row of a
database query joining the npcProduct
,
npcProductAttribute
,npcAttribute
,
and npcOption
tables.attributeValue
- The value of the attribute being added to the
OrderItem
.public int getOrderItemQuantity(java.lang.String productCode, java.util.Map parameters) throws java.lang.Exception
orderProductQuantities
property (which is a
String[]
) of the incoming Map
to look up
the value.
productCode
- The code of the product corresponding to the
OrderItem
being added or edited.parameters
- A Map
representing the items and properties
being added or edited.
java.lang.Exception
public java.util.Map processEditItem(java.util.Map parameters) throws java.lang.Exception
CartProcessor
Map
must have keys named orderItem
(which
identifies the order item being edited) and
orderProductQuantities
(which holds the new quantity for
the order item).
processEditItem
in interface CartProcessor
parameters
- A Map
identifying the item being edited and
specifying the item's new properties.
Map
representing the results of the processing.
java.lang.Exception
public java.util.Map processRemoveItem(OrderItem orderItem) throws java.lang.Exception
CartProcessor
processRemoveItem
in interface CartProcessor
orderItem
- The OrderItem
being removed.
java.lang.Exception
public void updateOrderItemQuantity(OrderItem orderItem, int quantity)
OrderItem
in the user's cart and a new quantity
for that item, updates the totals of the user's Order
and
the OrderDelivery
the OrderItem
is under.
orderItem
- The OrderItem
whose quantity is being changed.quantity
- The new quantity for the item.public void initializeCart() throws java.lang.Exception
CartProcessor
Order
and
OrderDelivery
representing a user's cart. Sets the current User
object's setOrder(Order order)
with the newly created
Order
.
initializeCart
in interface CartProcessor
java.lang.Exception
public java.util.Map processCheckoutAddresses(java.util.Map parameters) throws java.lang.Exception
CartProcessor
processCheckoutAddresses
in interface CartProcessor
parameters
- A Map
representing the address information of
the current user.
java.lang.Exception
public java.util.Map processOrderComplete(java.util.Map parameters) throws java.lang.Exception
CartProcessor
The order number is an integer given to each completed order, starting at the "orderNumberFloor" database setting (whose default is 1,000).
processOrderComplete
in interface CartProcessor
Map
representing the results of the processing.
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |