Source Code Cross Referenced for CartUtils.java in  » J2EE » Enhydra-Demos » golfShop » presentation » xmlc » utilities » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Enhydra Demos » golfShop.presentation.xmlc.utilities 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * Enhydra Java Application Server 
03:         * The Initial Developer of the Original Code is Lutris Technologies Inc. 
04:         * Portions created by Lutris are Copyright (C) 1997-2000 Lutris Technologies
05:         * Inc. 
06:         * All Rights Reserved. 
07:         *
08:         * The contents of this file are subject to the Enhydra Public License Version
09:         * 1.0 (the "License"); you may not use this file except in compliance with the
10:         * License. You may obtain a copy of the License at
11:         * http://www.enhydra.org/software/license/epl.html 
12:         *
13:         * Software distributed under the License is distributed on an "AS IS" basis,
14:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
15:         * License for the specific language governing rights and limitations under the
16:         * License. 
17:         *
18:         * 
19:         */
20:
21:        package golfShop.presentation.xmlc.utilities;
22:
23:        import java.math.BigDecimal;
24:        import java.util.Enumeration;
25:
26:        import golfShop.spec.cart.*;
27:
28:        import com.lutris.util.*;
29:        import com.lutris.appserver.server.session.*;
30:        import com.lutris.appserver.server.httpPresentation.*;
31:
32:        /**
33:         * This class provides static functions for formatted output of the
34:         * cart contents.
35:         */
36:        public class CartUtils {
37:
38:            private static String FF = "<FONT FACE=\"Arial,Helvetica,C Univers 57 Condensed,Futura Book\" SIZE=\"2\">";
39:
40:            /**
41:             * A CartUtils constructor.  Prevent instantiation with a private
42:             * constructor.
43:             */
44:            private CartUtils() {
45:            }
46:
47:            /**
48:             * Find the cart object in session.  Creating it if it doesn't
49:             * exist.
50:             */
51:            public static Cart getCart(Session session)
52:                    throws HttpPresentationException {
53:                try {
54:                    Cart cart = (Cart) session.getSessionData().get("cart");
55:                    if (cart == null) {
56:
57:                        Cart car = CartFactory
58:                                .getCart("golfShop.business.cart.CartImpl");
59:
60:                        session.getSessionData().set("cart", car);
61:
62:                    }
63:                    return cart;
64:                    /*
65:                     * Catch Null pointer exception ( we canot make a instances of classes from business layer  when we run GolfShop_pres )
66:                     * We need  to allow GolfShop_pres to be functional 
67:                     * so the cart will be null
68:                     */
69:
70:                } catch (NullPointerException ex) {
71:                    return null;
72:                } catch (KeywordValueException except) {
73:                    throw new HttpPresentationException(except);
74:                }
75:            }
76:
77:            /**
78:             * Add an item to the cart.
79:             */
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:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.