pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.component.shop
Class ShoppingCartController

java.lang.Object
  extended by org.torweg.pulse.bundle.Controller
      extended by org.torweg.pulse.component.shop.ShoppingCartController
All Implemented Interfaces:
DeprecatedConfigurable

public class ShoppingCartController
extends Controller
implements DeprecatedConfigurable

controls the ShoppingCart.

The methods displayCart(Bundle, ServiceRequest) and updateCart(Bundle, ServiceRequest) accept the Parameter named like MODE_PARAMETER_NAME, containing one of the values specified by ShoppingCartController.DisplayMode.

Version:
$Revision: 1979 $
Author:
Thomas Weber

Nested Class Summary
static class ShoppingCartController.DisplayMode
          the display modes for the ShoppingCart.
 
Nested classes/interfaces inherited from class org.torweg.pulse.bundle.Controller
Controller.AlwaysRun
 
Field Summary
static java.lang.String MODE_PARAMETER_NAME
          the name of the Parameter used to request a special DisplayMode.
 
Constructor Summary
ShoppingCartController()
           
 
Method Summary
 ShoppingCartResult addCartPosition(Bundle bundle, ServiceRequest request)
          adds the given ShoppingCartPosition and returns the changes honouring the display mode.
 ShoppingCartResult displayCart(Bundle bundle, ServiceRequest request)
          displays the current ShoppingCart except one of the AJAX actions of this Controller is called.
 void getPrice(Bundle bundle, ServiceRequest request)
          returns the Price for the given ShopItem and the given order size for the current User associated with the ServiceRequest via JSON.
 void init(ConfigBean c)
          configures the controller.
 void modifyCartPosition(Bundle bundle, ServiceRequest request)
          alters the given ShoppingCartPosition and returns the changes via JSON.
 ShoppingCartResult removeCartPosition(Bundle bundle, ServiceRequest request)
          removes the given ShoppingCartPosition and returns the changes honouring the display mode.
 ShoppingCartResult updateCart(Bundle bundle, ServiceRequest request)
          updates the complete ShoppingCart honouring the display mode.
 
Methods inherited from class org.torweg.pulse.bundle.Controller
getAlwaysRun, isAlwaysRun, setAlwaysRun
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_PARAMETER_NAME

public static final java.lang.String MODE_PARAMETER_NAME
the name of the Parameter used to request a special DisplayMode.

See Also:
Constant Field Values
Constructor Detail

ShoppingCartController

public ShoppingCartController()
Method Detail

displayCart

@AnyAction
@Action(value="displayCart", generate=true, stripSitemapID=false)
@Permission(value="useShoppingCart")
public final ShoppingCartResult displayCart(Bundle bundle, ServiceRequest request)
displays the current ShoppingCart except one of the AJAX actions of this Controller is called.

Parameters:
bundle - the current bundle
request - the current request
Returns:
the cart wrapped in a ShoppingCartResult or an null, if an AJAX action of this controller is called

updateCart

@Action(value="updateCart", generate=true, stripSitemapID=false)
@Permission(value="useShoppingCart")
public final ShoppingCartResult updateCart(Bundle bundle, ServiceRequest request)
updates the complete ShoppingCart honouring the display mode.

All positions of the cart have to be transmitted with valid shop-item-ids (ShopItem.getShopItemId()).

Parameters:
bundle - the current bundle
request - the current request
Returns:
the updated cart wrapped in a ShoppingCartResult

removeCartPosition

@Action(value="removeCartPosition", generate=true, stripSitemapID=false)
@Permission(value="useShoppingCart")
public final ShoppingCartResult removeCartPosition(Bundle bundle, ServiceRequest request)
removes the given ShoppingCartPosition and returns the changes honouring the display mode.

Parameters:
bundle - the current bundle
request - the current request
Returns:
the updated cart wrapped in a ShoppingCartResult

addCartPosition

@Action(value="addCartPosition", generate=true, stripSitemapID=false)
@Permission(value="useShoppingCart")
public final ShoppingCartResult addCartPosition(Bundle bundle, ServiceRequest request)
adds the given ShoppingCartPosition and returns the changes honouring the display mode.

Parameters:
bundle - the current bundle
request - the current request
Returns:
the updated cart wrapped in a ShoppingCartResult

modifyCartPosition

@Action(value="modifyCartPosition", generate=true)
@Permission(value="useShoppingCart")
public final void modifyCartPosition(Bundle bundle, ServiceRequest request)
alters the given ShoppingCartPosition and returns the changes via JSON.

Parameters:
bundle - the current bundle
request - the current request

getPrice

@Action(value="getPrice", generate=true)
@Permission(value="useShoppingCart")
public final void getPrice(Bundle bundle, ServiceRequest request)
returns the Price for the given ShopItem and the given order size for the current User associated with the ServiceRequest via JSON.

Parameters:
bundle - the current bundle
request - the current request

init

public void init(ConfigBean c)
configures the controller.

Specified by:
init in interface DeprecatedConfigurable
Parameters:
c - the configuration
See Also:
DeprecatedConfigurable.init(org.torweg.pulse.configuration.ConfigBean)