Source Code Cross Referenced for CustomerPortlet.java in  » Portal » jetspeed-2.1.3 » org » apache » jetspeed » demo » customerInfo » 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 » Portal » jetspeed 2.1.3 » org.apache.jetspeed.demo.customerInfo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.jetspeed.demo.customerInfo;
018:
019:        import java.io.IOException;
020:        import java.util.ArrayList;
021:        import java.util.GregorianCalendar;
022:        import java.util.List;
023:
024:        import javax.portlet.ActionRequest;
025:        import javax.portlet.ActionResponse;
026:        import javax.portlet.PortletException;
027:        import javax.portlet.PortletSession;
028:        import javax.portlet.RenderRequest;
029:        import javax.portlet.RenderResponse;
030:
031:        /**
032:         * @author <a href="mailto:paulsp@apache.org">Paul Spencer</a>
033:         * @version $Id: CustomerPortlet.java 516448 2007-03-09 16:25:47Z ate $
034:         */
035:        public class CustomerPortlet extends
036:                org.apache.portals.bridges.common.GenericServletPortlet {
037:
038:            private List defaultCustomers = new ArrayList();
039:
040:            /** Creates a new instance of CustomerPortlet */
041:            public CustomerPortlet() {
042:            }
043:
044:            public void init() throws javax.portlet.PortletException {
045:                CustomerInfo newCustomer = null;
046:                Address newAddress = null;
047:
048:                // Initialize the defaultCustomer
049:                newCustomer = new CustomerInfo();
050:                newCustomer.setName("Jane Doe");
051:
052:                newCustomer.setLastOrdered(new GregorianCalendar(2002, 05, 15));
053:                newAddress = new Address();
054:                newAddress.setName(newCustomer.getName());
055:                newAddress.setStreet("124 Main Street");
056:                newAddress.setCity("AnyTown");
057:                newAddress.setState("ME");
058:                newAddress.setCountry("U.S.A.");
059:                newCustomer.setBillingAddress(newAddress);
060:                newAddress.setName(newCustomer.getName());
061:                newAddress.setStreet("1862 Elm Drive");
062:                newAddress.setCity("AnyTown");
063:                newAddress.setState("ME");
064:                newAddress.setCountry("U.S.A.");
065:                newCustomer.setShippingAddress(newAddress);
066:                this .defaultCustomers.add(newCustomer);
067:
068:                newCustomer = new CustomerInfo();
069:                newCustomer.setName("Fred Smith");
070:                newCustomer.setLastOrdered(new GregorianCalendar(2002, 9, 15));
071:                newAddress = new Address();
072:                newAddress.setName(newCustomer.getName());
073:                newAddress.setStreet("1 Bearch Way");
074:                newAddress.setCity("AnyTown");
075:                newAddress.setState("ME");
076:                newAddress.setCountry("U.S.A.");
077:                newCustomer.setBillingAddress(newAddress);
078:                newAddress.setName(newCustomer.getName());
079:                newAddress.setStreet("1862 Elm Drive");
080:                newAddress.setCity("AnyTown");
081:                newAddress.setState("ME");
082:                newAddress.setCountry("U.S.A.");
083:                newCustomer.setShippingAddress(newAddress);
084:                this .defaultCustomers.add(newCustomer);
085:
086:                newCustomer = new CustomerInfo();
087:                newCustomer.setName("Wallace George");
088:                newCustomer.setLastOrdered(new GregorianCalendar(2003, 1, 1));
089:                newAddress = new Address();
090:                newAddress.setName(newCustomer.getName());
091:                newAddress.setStreet("73 Wamack Drive");
092:                newAddress.setCity("AnyTown");
093:                newAddress.setState("ME");
094:                newAddress.setCountry("U.S.A.");
095:                newCustomer.setBillingAddress(newAddress);
096:                newAddress.setName(newCustomer.getName());
097:                newAddress.setStreet("73 Wamack Drive");
098:                newAddress.setCity("AnyTown");
099:                newAddress.setState("ME");
100:                newAddress.setCountry("U.S.A.");
101:                newCustomer.setShippingAddress(newAddress);
102:                this .defaultCustomers.add(newCustomer);
103:            }
104:
105:            /**
106:             * Execute the servlet as define by the init parameter or preference PARAM_ACTION_PAGE.  The value
107:             * if the parameter is a relative URL, i.e. /actionPage.jsp will execute the
108:             * JSP editPage.jsp in the portlet application's web app.  The action should
109:             * not generate any content.  The content will be generate by doCustom(),
110:             * doHelp() , doEdit(), or doView().
111:             *
112:             * See section PLT.16.2 of the JSR 168 Portlet Spec for more information
113:             * around executing a servlet or JSP in processAction()
114:             *
115:             * @see javax.portlet.GenericPortlet#processAction
116:             *
117:             * @task Need to be able to execute a servlet for the action
118:             * @task Need to set current customer and customer detail item
119:             *       in the session.
120:             *
121:             */
122:            public void processAction(ActionRequest request,
123:                    ActionResponse actionResponse) throws PortletException,
124:                    IOException {
125:
126:            }
127:
128:            /**
129:             * Execute the servlet as define by the init parameter or preference PARAM_VIEW_PAGE.
130:             * The value if the parameter is a relative URL, i.e. /viewPage.jsp will execute the
131:             * JSP viewPage.jsp in the portlet application's web app.
132:             *
133:             * @see javax.portlet.GenericPortlet#doView
134:             *
135:             */
136:            public void doView(RenderRequest request, RenderResponse response)
137:                    throws PortletException, IOException {
138:                List customerList = null;
139:                // Get the current customer list from the session
140:                PortletSession portletSession = request.getPortletSession();
141:                if (portletSession != null) {
142:                    customerList = (List) portletSession.getAttribute(
143:                            "CustomerList", PortletSession.APPLICATION_SCOPE);
144:                    if (customerList == null) {
145:                        customerList = this .defaultCustomers;
146:                        portletSession.setAttribute("CustomerList",
147:                                this .defaultCustomers,
148:                                PortletSession.APPLICATION_SCOPE);
149:                    }
150:                }
151:
152:                else {
153:                    // TODO:  the portletSession == null?
154:                    System.out
155:                            .println("In org.apache.demo.customerInfo.CustomerPortlet.doView() - The portletSession == null !!!!");
156:                }
157:
158:                // If no customer list exists, use the default.
159:                if (customerList == null) {
160:                    customerList = this .defaultCustomers;
161:                }
162:
163:                // Place the customer list in the request context.
164:                request.setAttribute("CustomerList", customerList);
165:                super.doView(request, response);
166:            }
167:
168:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.