Source Code Cross Referenced for OrderPage1.java in  » J2EE » Enhydra-Demos » com » lutris » airsent » presentation » customer » 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 » com.lutris.airsent.presentation.customer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1999-2001 Lutris Technologies, Inc. All Rights
003:         * Reserved.
004:         * 
005:         * This source code file is distributed by Lutris Technologies, Inc. for
006:         * use only by licensed users of product(s) that include this source
007:         * file. Use of this source file or the software that uses it is covered
008:         * by the terms and conditions of the Lutris Enhydra Development License
009:         * Agreement included with this product.
010:         * 
011:         * This Software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
012:         * ANY KIND, either express or implied. See the License for the specific terms
013:         * governing rights and limitations under the License.
014:         * 
015:         * Contributor(s):
016:         * 
017:         * $Id: OrderPage1.java,v 1.1 2006-09-11 12:29:26 sinisa Exp $
018:         */
019:
020:        package com.lutris.airsent.presentation.customer;
021:
022:        import com.lutris.airsent.presentation.BasePO;
023:        import com.lutris.appserver.server.httpPresentation.*;
024:        import com.lutris.appserver.server.session.*;
025:        import com.lutris.util.*; //import com.lutris.xml.xmlc.*;
026:        //import com.lutris.xml.xmlc.html.*;
027:        import org.w3c.dom.*;
028:        import org.w3c.dom.html.*;
029:        import org.enhydra.xml.xmlc.XMLObject;
030:
031:        import com.lutris.airsent.spec.AirSentException;
032:
033:        import com.lutris.airsent.presentation.AirSentPresentationException;
034:        import com.lutris.airsent.presentation.AirSentConstants;
035:        import java.util.*;
036:        import com.lutris.airsent.spec.address.*;
037:        import com.lutris.airsent.spec.customer.*;
038:        import com.lutris.airsent.spec.*;
039:
040:        import com.lutris.airsent.spec.delivery.*;
041:
042:        /**
043:         * Presentation object for order page 1
044:         */
045:        public class OrderPage1 extends BasePO {
046:
047:            /**
048:             * Constants
049:             */
050:            private static final int AUTH_LEVEL = AirSentConstants.CUSTOMER_USER;
051:
052:            /**
053:             * Superclass method override.
054:             * returns the authorization level necessary to access this po.
055:             * 
056:             * @return int required authorization level
057:             */
058:            public int getRequiredAuthLevel() {
059:                return AUTH_LEVEL;
060:            }
061:
062:            /**
063:             * displays default page
064:             *
065:             * @return html page
066:             * @exception if an error occurs
067:             */
068:            public XMLObject handleDefault() throws HttpPresentationException {
069:                try {
070:                    String id = getComms().request
071:                            .getParameter(AirSentConstants.DELIVERYID);
072:                    OrderForm d = getOrder(id);
073:                    getSessionData().setOrderForm(d);
074:                    return showPage1(null, d);
075:                } catch (Exception e) {
076:                    throw new AirSentPresentationException(
077:                            "System error finding user", e);
078:                }
079:            }
080:
081:            /**
082:             * process the form submission
083:             *     
084:             * @return html page
085:             * @exception if an error occurs
086:             */
087:            public XMLObject handleOrder1() throws AirSentPresentationException {
088:                try {
089:                    String p;
090:                    OrderForm orderForm = getOrder(null);
091:
092:                    p = getComms().request
093:                            .getParameter(AirSentConstants.PICKUP_NAME);
094:                    if (checkField(p, Address.MAX_NAME) == false) {
095:                        return showPage1("Please provide a pickupname",
096:                                orderForm);
097:                    }
098:                    orderForm.setPickUpName(p);
099:
100:                    p = getComms().request
101:                            .getParameter(AirSentConstants.PICKUP_ADDRESS);
102:                    if (checkField(p, Address.MAX_ADDRESS) == false) {
103:                        return showPage1("Please provide a pickupaddress",
104:                                orderForm);
105:                    }
106:                    orderForm.setPickUpAddress1(p);
107:
108:                    p = getComms().request
109:                            .getParameter(AirSentConstants.PICKUP_PHONE);
110:                    if (checkField(p, Address.MAX_PHONE) == false) {
111:                        return showPage1("Please provide a pickupphone",
112:                                orderForm);
113:                    }
114:                    orderForm.setPickUpPhone(p);
115:
116:                    p = getComms().request
117:                            .getParameter(AirSentConstants.PICKUP_DIRECTIONS);
118:                    if (checkField(p, Address.MAX_DIRECTIONS) == false) {
119:                        return showPage1("Please provide a pickupdirections",
120:                                orderForm);
121:                    }
122:                    orderForm.setPickUpDirections(p);
123:
124:                    getSessionData().setOrderForm(orderForm);
125:                    throw new ClientPageRedirectException(
126:                            AirSentConstants.ORDERSTEP2_PO);
127:
128:                    //We need  to allow AirSent_pres to be functional , response will be default HTML page        
129:                } catch (NullPointerException e) {
130:                    OrderStep2HTML defaultPage = (OrderStep2HTML) myComms.xmlcFactory
131:                            .create(OrderStep2HTML.class);
132:                    defaultPage.setTextErrorText("This is a default HTML page");
133:                    return defaultPage;
134:                } catch (Exception e) {
135:                    throw new AirSentPresentationException(
136:                            "System error processing OrderStep1.", e);
137:                }
138:            }
139:
140:            /**
141:             * creates the html page
142:             *
143:             * @param errorMsg error message to display
144:             * @param orderData data to populate the page with
145:             * @exception if an error occurs
146:             */
147:            private XMLObject showPage1(String errorMsg, OrderForm orderForm)
148:                    throws AirSentPresentationException {
149:
150:                OrderStep1HTML page = (OrderStep1HTML) myComms.xmlcFactory
151:                        .create(OrderStep1HTML.class);
152:                try {
153:                    if (null != errorMsg
154:                            || null != (errorMsg = getSessionData()
155:                                    .getAndClearUserMessage())) {
156:                        page.setTextErrorText(errorMsg);
157:                    } else {
158:                        page.getElementErrorText().getParentNode().removeChild(
159:                                page.getElementErrorText());
160:                    }
161:                    if (orderForm.getOrderId() == null) {
162:                        Node n = page.getElementNavDestination()
163:                                .getParentNode();
164:                        n.removeChild(page.getElementNavDestination());
165:                        n.removeChild(page.getElementNavDetails());
166:                    }
167:                    populatePage1(page, orderForm);
168:                    //We need  to allow AirSent_pres to be functional , response will be default HTML page        
169:                } catch (NullPointerException e) {
170:
171:                    OrderStep1HTML defaultPage = (OrderStep1HTML) myComms.xmlcFactory
172:                            .create(OrderStep1HTML.class);
173:                    defaultPage.setTextErrorText("This is a default HTML page");
174:                    return defaultPage;
175:                } catch (Exception e) {
176:                    throw new AirSentPresentationException(
177:                            "System error showing page 1", e);
178:                }
179:                return page;
180:            }
181:
182:            /**
183:             * populates the page
184:             *
185:             * @param page to populate
186:             * @param orderData data to populate it with
187:             * @exception if an error occurs
188:             */
189:            private void populatePage1(OrderStep1HTML page, OrderForm orderForm)
190:                    throws AirSentPresentationException {
191:
192:                try {
193:                    if (orderForm.getOrderId() != null) {
194:                        page.setTextOrderHeader("Order");
195:                        page.setTextOrdernumber(orderForm.getOrderId());
196:                        page.getElementPickupname().setValue(
197:                                orderForm.getPickUpName());
198:                        page.getElementPickupaddress().setValue(
199:                                orderForm.getPickUpAddress1());
200:                        page.getElementPickupphone().setValue(
201:                                orderForm.getPickUpPhone());
202:                    } else {
203:                        page.setTextOrdernumber("");
204:                    }
205:                    //  page.getElementPickupname().setValue(orderForm.getPickUpName());
206:                    //  	    page.getElementPickupaddress().setValue(orderForm.getPickUpAddress1());
207:                    //  	    page.getElementPickupphone().setValue(orderForm.getPickUpPhone());
208:
209:                    if (orderForm.getPickUpDirections() != null) {
210:                        Text commentText = (page.getDocument())
211:                                .createTextNode(orderForm.getPickUpDirections());
212:                        page.getElementPickupdirections().appendChild(
213:                                commentText);
214:                    }
215:                } catch (Exception e) {
216:                    throw new AirSentPresentationException(
217:                            "System error populating page1", e);
218:                }
219:            }
220:
221:            /**
222:             * gets the order data from session or persisten store
223:             */
224:            private OrderForm getOrder(String id)
225:                    throws AirSentPresentationException {
226:                try {
227:                    OrderForm orderForm = getSessionData().getOrderForm();
228:                    if ((orderForm == null) && (id == null)) {
229:                        // new order session
230:                        // System.out.println("new order session");
231:
232:                        orderForm = OrderFormFactory
233:                                .getOrderForm("com.lutris.airsent.business.delivery.OrderFormImpl");
234:
235:                    } else if (id != null) {
236:                        // editing previous order session
237:                        // System.out.println("editing previous order session: id = " + id);
238:                        HomeManager homeManager = getApplication()
239:                                .getHomeManager();
240:                        Delivery d = homeManager.getDeliveryManager()
241:                                .findByHandle(id);
242:
243:                        orderForm = OrderFormFactory
244:                                .getOrderForm(
245:                                        "com.lutris.airsent.business.delivery.OrderFormImpl",
246:                                        d);
247:                    }
248:                    return orderForm;
249:
250:                } catch (Exception e) {
251:                    throw new AirSentPresentationException(
252:                            "System error getting order", e);
253:                }
254:            }
255:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.