|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.konakart.bl.BaseMgr
com.konakart.bl.BasketMgr
public class BasketMgr
Manages all business logic relevant to the management of the shopping cart within the system
| Nested Class Summary | |
|---|---|
protected class |
BasketMgr.OptionSortOrderComparator
Used to sort the Option objects based on option id |
| Field Summary | |
|---|---|
protected static org.apache.commons.logging.Log |
log
the log |
| Fields inherited from class com.konakart.bl.BaseMgr |
|---|
templateBaseDir |
| Constructor Summary | |
|---|---|
BasketMgr(KKEngIf eng)
Constructor |
|
| Method Summary | |
|---|---|
protected int |
addToBasket(int customerId,
Basket item,
AddToBasketOptionsIf options)
We must take the information passed into the method and create a customers_basket record as well as one or more customers_basket_attributes records. |
int |
addToBasket(java.lang.String sessionId,
int customerId,
BasketIf item)
Determines the customerId to use and calls the protected method with the customerId. |
int |
addToBasketWithOptions(java.lang.String sessionId,
int customerId,
BasketIf item,
AddToBasketOptionsIf options)
If options is set to null, this method is identical to addToBasket(). |
protected void |
checkBasketBelongsToCustomer(int customerId,
int basketId)
Throws an exception if the basket item doesn't belong to the customer. |
protected void |
checkBasketOptions(Basket b)
We may have the case where the basket object has an array of options that only have the id and value id set. |
java.lang.String |
createEncodedProduct(int productId,
OptionIf[] opts)
Create the encoded product The customers_basket table contains a products_id field which is encoded like this : 1{3}6{4}3 which means product of id==1 with product_options of id==3 and product_options_values of id==6 followed by product_options of id==4 and product_options_values of id==3. |
protected FetchProductOptionsIf |
createFetchProductOptions(AddToBasketOptionsIf options)
Creates a FetchProductOptions object from an AddToBasketOptions |
Option |
findOptionInProduct(ProductIf p,
Option o)
The basket object must have a populated product object with options. |
protected Basket |
getBasket(int basketId)
Used to get a basket object using the primary key |
Basket[] |
getBasketItemsPerCustomer(java.lang.String sessionId,
int customerId,
int languageId)
Get the basket items for a customer. |
protected Basket[] |
getBasketItemsPerCustomerWithOptions(int customerId,
Address custAddr,
int languageId,
AddToBasketOptionsIf options)
Get the basket items for a customer. |
Basket[] |
getBasketItemsPerCustomerWithOptions(java.lang.String sessionId,
int customerId,
int languageId,
AddToBasketOptionsIf options)
Get the basket items for a customer. |
protected Basket[] |
getBasketItemsPerEncodedProductAndCustomer(int customerId,
java.lang.String encodedProduct)
This is used to see if a product that we are adding to the basket already exists in it. |
protected int |
getCustomerId(java.lang.String sessionId,
int customerId)
If the sessionId is null, we check the customerId to ensure that it is negative. |
protected Option[] |
getOptsForBasketItem(Basket item,
int priceId,
int languageId,
AddToBasketOptionsIf a2bOptions)
The customers_basket table contains a products_id field which is encoded like this : 1{4}3{3}6 which means product of id==1 with product_options of id==4 and product_options_values of id==3 followed by product_options of id==3 and product_options_values of id==6. |
void |
mergeBaskets(java.lang.String sessionId,
int customerFromId)
Add all items from the basket of customerFrom to the basket of customerTo which is retrieved from the sessionId. |
void |
mergeBasketsWithOptions(java.lang.String sessionId,
int customerFromId,
AddToBasketOptionsIf options)
Add all items from the basket of customerFrom to the basket of customerTo which is retrieved from the sessionId. |
void |
populateOptsForBasketItem(Basket item,
int priceId,
int languageId,
AddToBasketOptionsIf a2bOptions)
The customers_basket table contains a products_id field which is encoded like this : 1{4}3{3}6 which means product of id==1 with product_options of id==4 and product_options_values of id==3 followed by product_options of id==3 and product_options_values of id==6. |
protected void |
removeBasketItemsPerCustomer(int customerId)
We delete all basket items that exist for the customer passed in as a parameter. |
void |
removeBasketItemsPerCustomer(java.lang.String sessionId,
int customerId)
We determine which customerId to use and then delete all basket items that exist for this customer by calling the protected method. |
protected void |
removeFromBasket(int customerId,
BasketIf item)
We must remove the customers_basket record and any associated customers_basket_attributes records. |
void |
removeFromBasket(java.lang.String sessionId,
int customerId,
BasketIf item)
We must remove the customers_basket record and any associated customers_basket_attributes records. |
protected void |
setCriteriaWithStandardAttributes(org.apache.torque.util.Criteria c)
Sets the criteria with the standard attributes so as not to have to repeat this code many times. |
protected void |
updateBasket(int customerId,
Basket item,
AddToBasketOptionsIf options)
We must update the customers_basket record. |
void |
updateBasket(java.lang.String sessionId,
int customerId,
BasketIf item)
If the sessionId is null, we check the customerId to ensure that it is negative. |
void |
updateBasketWithOptions(java.lang.String sessionId,
int customerId,
BasketIf item,
AddToBasketOptionsIf options)
If the sessionId is null, we check the customerId to ensure that it is negative. |
Basket[] |
updateBasketWithStockInfo(BasketIf[] basketItems)
Receives an array of basket items and updates each one with the current stock level. |
Basket[] |
updateBasketWithStockInfoWithOptions(BasketIf[] basketItems,
AddToBasketOptionsIf options)
Receives an array of basket items and updates each one with the current stock level. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.commons.logging.Log log
| Constructor Detail |
|---|
public BasketMgr(KKEngIf eng)
throws java.lang.Exception
eng -
java.lang.Exception| Method Detail |
|---|
public Basket[] getBasketItemsPerCustomer(java.lang.String sessionId,
int customerId,
int languageId)
throws java.lang.Exception
getBasketItemsPerCustomer in interface BasketMgrIfsessionId - customerId - languageId -
java.lang.Exception
public Basket[] getBasketItemsPerCustomerWithOptions(java.lang.String sessionId,
int customerId,
int languageId,
AddToBasketOptionsIf options)
throws java.lang.Exception
getBasketItemsPerCustomerWithOptions in interface BasketMgrIfsessionId - customerId - languageId - options -
java.lang.Exception
protected Basket[] getBasketItemsPerCustomerWithOptions(int customerId,
Address custAddr,
int languageId,
AddToBasketOptionsIf options)
throws java.lang.Exception
customerId - custAddr - languageId -
java.lang.Exception
public int addToBasketWithOptions(java.lang.String sessionId,
int customerId,
BasketIf item,
AddToBasketOptionsIf options)
throws java.lang.Exception
addToBasketWithOptions in interface BasketMgrIfsessionId - customerId - item - options -
java.lang.Exception
public int addToBasket(java.lang.String sessionId,
int customerId,
BasketIf item)
throws java.lang.Exception
addToBasket in interface BasketMgrIfsessionId - customerId - item -
java.lang.Exception
protected int addToBasket(int customerId,
Basket item,
AddToBasketOptionsIf options)
throws java.lang.Exception
customerId - item - options -
java.lang.Exception
protected Basket[] getBasketItemsPerEncodedProductAndCustomer(int customerId,
java.lang.String encodedProduct)
throws org.apache.torque.TorqueException,
com.workingdogs.village.DataSetException
customerId - encodedProduct -
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
protected void checkBasketOptions(Basket b)
throws KKException
b -
KKException
public Option findOptionInProduct(ProductIf p,
Option o)
throws KKException
findOptionInProduct in interface BasketMgrIfp - o -
KKException
public void updateBasket(java.lang.String sessionId,
int customerId,
BasketIf item)
throws KKException,
com.workingdogs.village.DataSetException,
java.lang.Exception
updateBasket in interface BasketMgrIfsessionId - customerId - item -
java.lang.Exception
com.workingdogs.village.DataSetException
KKException
public void updateBasketWithOptions(java.lang.String sessionId,
int customerId,
BasketIf item,
AddToBasketOptionsIf options)
throws KKException,
com.workingdogs.village.DataSetException,
java.lang.Exception
updateBasketWithOptions in interface BasketMgrIfsessionId - customerId - item - options -
java.lang.Exception
com.workingdogs.village.DataSetException
KKException
protected void updateBasket(int customerId,
Basket item,
AddToBasketOptionsIf options)
throws KKException,
com.workingdogs.village.DataSetException,
java.lang.Exception
customerId - item -
java.lang.Exception
com.workingdogs.village.DataSetException
KKException
public void removeBasketItemsPerCustomer(java.lang.String sessionId,
int customerId)
throws java.lang.Exception
removeBasketItemsPerCustomer in interface BasketMgrIfsessionId - customerId -
java.lang.Exception
protected void removeBasketItemsPerCustomer(int customerId)
throws java.lang.Exception
customerId -
java.lang.Exception
public void removeFromBasket(java.lang.String sessionId,
int customerId,
BasketIf item)
throws java.lang.Exception
removeFromBasket in interface BasketMgrIfsessionId - customerId - item -
java.lang.Exception
protected void removeFromBasket(int customerId,
BasketIf item)
throws java.lang.Exception
customerId - item -
java.lang.Exception
public void populateOptsForBasketItem(Basket item,
int priceId,
int languageId,
AddToBasketOptionsIf a2bOptions)
throws java.lang.Exception
populateOptsForBasketItem in interface BasketMgrIfitem - priceId - languageId - a2bOptions -
java.lang.Exception
protected Option[] getOptsForBasketItem(Basket item,
int priceId,
int languageId,
AddToBasketOptionsIf a2bOptions)
throws java.lang.Exception
item - priceId - languageId - a2bOptions -
java.lang.Exception
public java.lang.String createEncodedProduct(int productId,
OptionIf[] opts)
createEncodedProduct in interface BasketMgrIfproductId - opts -
public void mergeBaskets(java.lang.String sessionId,
int customerFromId)
throws java.lang.Exception
mergeBaskets in interface BasketMgrIfsessionId - customerFromId -
java.lang.Exception
public void mergeBasketsWithOptions(java.lang.String sessionId,
int customerFromId,
AddToBasketOptionsIf options)
throws java.lang.Exception
mergeBasketsWithOptions in interface BasketMgrIfsessionId - customerFromId - options -
java.lang.Exception
protected int getCustomerId(java.lang.String sessionId,
int customerId)
throws java.lang.Exception
sessionId - customerId -
java.lang.Exception
protected void checkBasketBelongsToCustomer(int customerId,
int basketId)
throws org.apache.torque.TorqueException,
KKException
customerId - basketId -
org.apache.torque.TorqueException
KKException
public Basket[] updateBasketWithStockInfo(BasketIf[] basketItems)
throws java.lang.Exception
updateBasketWithStockInfo in interface BasketMgrIfbasketItems -
java.lang.Exception
public Basket[] updateBasketWithStockInfoWithOptions(BasketIf[] basketItems,
AddToBasketOptionsIf options)
throws java.lang.Exception
updateBasketWithStockInfoWithOptions in interface BasketMgrIfbasketItems - options -
java.lang.Exceptionprotected FetchProductOptionsIf createFetchProductOptions(AddToBasketOptionsIf options)
options -
protected Basket getBasket(int basketId)
throws java.lang.Exception
basketId -
java.lang.Exceptionprotected void setCriteriaWithStandardAttributes(org.apache.torque.util.Criteria c)
c -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||