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.bea.campaign
Class ShoppingCartAttributeLoader

    java.lang.Object
      com.bea.campaign.ShoppingCartAttributeLoader

All Implemented Interfaces:
  Request.AttributeLoader

Direct Known Subclasses:
  ShoppingCartAttributeLoader

public class ShoppingCartAttributeLoader
extends 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(java.lang.Object)`, and `getShoppingCartGetNames()` method.

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

- put the fully-qualified class name in the <AttributeLoader RequestLoaders="..."> attribute.
- put the return value of `getShoppingCartSetName()` (defaults to "wlcs_shoppingCart") in <ScenarioService RulesRequestAttrNames="..."> attribute.

Field Summary
`static String[]` | `DEF_SHOPPING_CART_GET_NAMES` The default list of names in the PipelineSession to look for the ShoppingCart.
`static String` | `DEF_SHOPPING_CART_SET_NAME` The name of the attribute to set the ShoppingCart in the p13n Request.
`static String` | `SHOPPING_CART` Deprecated. Replaced by `DEF_SHOPPING_CART_SET_NAME`.

Constructor Summary
`ShoppingCartAttributeLoader()`

Method Summary
`Object` | `getPipelineSession(HttpServletRequest req)` Get the PipelineSession from the http request.
`Object` | `getShoppingCart(HttpServletRequest req)` Get the shopping cart from the http session.
`Object` | `getShoppingCart(Object pSession)` Get the shopping cart from the pipeline session.
`protected String[]` | `getShoppingCartGetNames()` Return the list of names of PipelineSession attributes to try to find the shopping cart at.
`protected String` | `getShoppingCartNamespace(Object session)` Return the PipelineSession namespace to check for the shopping cart in.
`protected String` | `getShoppingCartSetName()` Return the name of the attribute in the p13n Request to set the ShoppingCart to.
`void` | `loadAttributes(Request request, 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 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`, Constant Field Values

### SHOPPING_CART

    public static final String SHOPPING_CART

  Deprecated. Replaced by `DEF_SHOPPING_CART_SET_NAME`.

  The name of the attribute to set the ShoppingCart in the p13n Request.

  See Also:
    Constant Field Values

### DEF_SHOPPING_CART_GET_NAMES

    public static final 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,
                               HttpServletRequest origRequest)

  Load the shopping cart from the original request to the new request.

  Specified by:
    `loadAttributes` in interface `Request.AttributeLoader`
  Parameters:
    `request` - the p13n destination request.
    `origRequest` - the http source request.
  See Also:
    `getShoppingCart(java.lang.Object)`

### getShoppingCartSetName

    protected 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 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 String getShoppingCartNamespace(Object session)
                                       throws Exception

  Return the PipelineSession namespace to check for the shopping cart in.

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

  Throws:
    `Exception`

### getPipelineSession

    public Object getPipelineSession(HttpServletRequest req)

  Get the PipelineSession from the http request.

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

### getShoppingCart

    public Object getShoppingCart(Object 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(java.lang.Object)` and return the first ShoppingCart found.

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

### getShoppingCart

    public Object getShoppingCart(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(Object)`

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