import tutorials.application.shoppingcart.ShoppingCartApplication;
import tutorials.application.shoppingcart.ShoppingCart;
public class
Cart
implements CartMBean
{
private ShoppingCart
cart = null;
public Integer getTotalItemCount()
throws Exception
{ ... }
public Integer getTotalPrice() throws Exception {
cart = ShoppingCartApplication.getShoppingCartReference ()
;
if
( cart == null )
throw new Exception
( "null reference got" )
;
return cart.getTotalPrice
() ;
}
public void addItem(
String petName , Integer quantity)
throws Exception
{
cart =
ShoppingCartApplication.getShoppingCartReference ()
;
if
( cart == null )
throw new Exception
( "null reference got" ) ;
cart.addItem
( petName , quantity ) ;
}
public void updateItem( String petName , Integer quantity )
throws Exception
{
...
}
public void deleteItem( String petName )
throws Exception
{ ... }
}
|
|
|