© 2002 BEA Systems, Inc.


com.bea.commerce.ebusiness.campaign
Class ShoppingCartAttributeLoader

java.lang.Object
  |
  +--com.bea.commerce.ebusiness.campaign.ShoppingCartAttributeLoader

public class ShoppingCartAttributeLoader
extends java.lang.Object
implements Request.AttributeLoader

A p13n request attribute loader which will load the ShoppingCart into the p13n request.

This will, by default, pull the shopping cart from the pipeline session at a session attribute "wlcs_shoppingCart", and, if found, set it in the p13n Request at an attribute called "wlcs_shoppingCart". The attribute names are controlled by the getShoppingCartSetName(), getShoppingCartNamespace(com.bea.p13n.appflow.common.PipelineSession), and getShoppingCartGetNames() method.

To use this class, register it in your application-config.xml in the following places:


Field Summary
static java.lang.String[] DEF_SHOPPING_CART_GET_NAMES
          The default list of names in the PipelineSession to look for the ShoppingCart.
static java.lang.String DEF_SHOPPING_CART_SET_NAME
          The name of the attribute to set the ShoppingCart in the p13n Request.
static java.lang.String SHOPPING_CART
          Deprecated. Replaced by DEF_SHOPPING_CART_SET_NAME.
 
Constructor Summary
ShoppingCartAttributeLoader()
           
 
Method Summary
 PipelineSession getPipelineSession(javax.servlet.http.HttpServletRequest req)
          Get the PipelineSession from the http request.
 ShoppingCart getShoppingCart(javax.servlet.http.HttpServletRequest req)
          Get the shopping cart from the http session.
 ShoppingCart getShoppingCart(PipelineSession pSession)
          Get the shopping cart from the pipeline session.
protected  java.lang.String[] getShoppingCartGetNames()
          Return the list of names of PipelineSession attributes to try to find the shopping cart at.
protected  java.lang.String getShoppingCartNamespace(PipelineSession session)
          Return the PipelineSession namespace to check for the shopping cart in.
protected  java.lang.String getShoppingCartSetName()
          Return the name of the attribute in the p13n Request to set the ShoppingCart to.
 void loadAttributes(Request request, javax.servlet.http.HttpServletRequest origRequest)
          Load the shopping cart from the original request to the new request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEF_SHOPPING_CART_SET_NAME

public static final java.lang.String DEF_SHOPPING_CART_SET_NAME
The name of the attribute to set the ShoppingCart in the p13n Request.

Defaults to "wlcs_shoppingCart".

See Also:
getShoppingCartSetName(), PipelineSessionConstants.SHOPPING_CART

SHOPPING_CART

public static final java.lang.String SHOPPING_CART
Deprecated. Replaced by DEF_SHOPPING_CART_SET_NAME.
The name of the attribute to set the ShoppingCart in the p13n Request.

DEF_SHOPPING_CART_GET_NAMES

public static final java.lang.String[] DEF_SHOPPING_CART_GET_NAMES
The default list of names in the PipelineSession to look for the ShoppingCart.

Defaults to an array containing "wlcs_shoppingCart".

See Also:
getShoppingCartGetNames()
Constructor Detail

ShoppingCartAttributeLoader

public ShoppingCartAttributeLoader()
Method Detail

loadAttributes

public void loadAttributes(Request request,
                           javax.servlet.http.HttpServletRequest origRequest)
Load the shopping cart from the original request to the new request.
Specified by:
loadAttributes in interface Request.AttributeLoader

See Also:
getShoppingCart(com.bea.p13n.appflow.common.PipelineSession)

getShoppingCartSetName

protected java.lang.String getShoppingCartSetName()
Return the name of the attribute in the p13n Request to set the ShoppingCart to.

Defaults to "wlcs_shoppingCart".

Subclasses can override this to return something else.


getShoppingCartGetNames

protected java.lang.String[] getShoppingCartGetNames()
Return the list of names of PipelineSession attributes to try to find the shopping cart at.

This object will use the first shopping cart found.

Defaults to an array containing

Subclasses can override to return a different list of names to check.

"wlcs_shoppingCart".


getShoppingCartNamespace

protected java.lang.String getShoppingCartNamespace(PipelineSession session)
Return the PipelineSession namespace to check for the shopping cart in.

This returns the PipelineSession's default namespace, but subclasses can override this.


getPipelineSession

public PipelineSession getPipelineSession(javax.servlet.http.HttpServletRequest req)
Get the PipelineSession from the http request.

Returns:
the PipelineSession if it's been created, null if not.

getShoppingCart

public ShoppingCart getShoppingCart(PipelineSession pSession)
Get the shopping cart from the pipeline session.

This will look through the pipeline session session attributes defined by getShoppingCartGetNames() in the namespace defined by getShoppingCartNamespace(com.bea.p13n.appflow.common.PipelineSession) and return the first ShoppingCart found.

Returns:
the shopping cart if it's been initialized, null if not.

getShoppingCart

public ShoppingCart getShoppingCart(javax.servlet.http.HttpServletRequest req)
Get the shopping cart from the http session.

Returns:
the shopping cart if it's been initialized, null if not.
See Also:
getPipelineSession(javax.servlet.http.HttpServletRequest), getShoppingCart(com.bea.p13n.appflow.common.PipelineSession)

© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved