1 20 21 package golfShop.presentation.xmlc.utilities; 22 23 import java.math.BigDecimal ; 24 import java.util.Enumeration ; 25 26 27 import golfShop.spec.cart.*; 28 29 import com.lutris.util.*; 30 import com.lutris.appserver.server.session.*; 31 import com.lutris.appserver.server.httpPresentation.*; 32 33 37 public class CartUtils { 38 39 private static String FF = "<FONT FACE=\"Arial,Helvetica,C Univers 57 Condensed,Futura Book\" SIZE=\"2\">"; 40 41 45 private CartUtils() { 46 } 47 48 52 public static Cart getCart(Session session) 53 throws HttpPresentationException { 54 try { 55 Cart cart = (Cart)session.getSessionData().get("cart"); 56 if (cart == null) { 57 58 Cart car = CartFactory.getCart("golfShop.business.cart.CartImpl"); 59 60 session.getSessionData().set("cart", car); 61 62 } 63 return cart; 64 69 70 } catch(NullPointerException ex) { 71 return null; 72 } catch (KeywordValueException except) { 73 throw new HttpPresentationException(except); 74 } 75 } 76 77 80 public static void addItem(Session session, long objectId) 81 throws HttpPresentationException { 82 83 Cart cart = getCart(session); 84 cart.addItem(objectId); 85 cart.doneModifying(); 86 } 87 88 } 89 | Popular Tags |