Source Code Cross Referenced for OrderModule.java in  » Content-Management-System » openedit » org » openedit » store » modules » 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 » Content Management System » openedit » org.openedit.store.modules 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on Jan 17, 2005
003:         */
004:        package org.openedit.store.modules;
005:
006:        import java.io.File;
007:        import java.util.Iterator;
008:        import java.util.List;
009:
010:        import org.openedit.store.Store;
011:        import org.openedit.store.orders.OrderArchive;
012:        import org.openedit.store.orders.OrderId;
013:        import org.openedit.store.orders.OrderSearcher;
014:        import org.openedit.store.orders.OrderState;
015:        import org.openedit.store.orders.SubmittedOrder;
016:
017:        import com.openedit.WebPageRequest;
018:        import com.openedit.hittracker.HitTracker;
019:        import com.openedit.modules.BaseModule;
020:
021:        /**
022:         * @author dbrown
023:         *
024:         */
025:        public class OrderModule extends BaseModule {
026:            protected static final String ORDERMODULE = "ordermodule";
027:            protected static final String ORDERLIST = "orderlist";
028:            protected static final String ORDERIDLIST = "orderidlist";
029:            protected static final String ORDERLISTLASTMODIFIED = "orderlistlastmodified";
030:            protected static final String CUSTOMERLIST = "customerlist";
031:            protected static final String ITEMLIST = "itemlist";
032:            protected OrderSearcher fieldOrderSearcher;
033:
034:            /*	public List getCustomerList( WebPageRequest inContext ) throws Exception
035:             {
036:             getOrderList( inContext );
037:             List orderList = (List)inContext.getPageValue( ORDERLIST );
038:             List customerList = new ArrayList();
039:             List idList = new ArrayList();
040:             for ( Iterator iter = orderList.iterator(); iter.hasNext(); )
041:             {
042:             SubmittedOrder order = (SubmittedOrder) iter.next();
043:             String id = order.getCustomer().getUserName();
044:             if ( idList.contains( id ) )
045:             {
046:             continue;
047:             }
048:             idList.add(id);
049:             customerList.add( order.getCustomer() );
050:             }
051:             inContext.putPageValue( CUSTOMERLIST, customerList );
052:             return customerList;
053:             }
054:             */
055:
056:            public SubmittedOrder getOrderFromNumber(WebPageRequest inContext,
057:                    List inOrderIdList, String inOrderNumber) throws Exception {
058:                Store store = getStore(inContext);
059:                if (inOrderNumber != null) {
060:                    for (Iterator it = inOrderIdList.iterator(); it.hasNext();) {
061:                        OrderId orderid = (OrderId) it.next();
062:                        if (inOrderNumber.equals(orderid.getOrderId())) {
063:                            return store.getOrderArchive().loadSubmittedOrder(
064:                                    store, orderid.getUsername(),
065:                                    orderid.getOrderId());
066:                        }
067:                    }
068:                }
069:                return null;
070:            }
071:
072:            public HitTracker getOrdersForUser(WebPageRequest inReq)
073:                    throws Exception {
074:                String pagenum = inReq.getRequestParameter("page");
075:                Store store = getStore(inReq);
076:                if (pagenum == null) {
077:                    HitTracker orders = getOrderSearcher().fieldSearchForUser(
078:                            inReq, store, inReq.getUser());
079:                    inReq.putPageValue(ORDERIDLIST, orders);
080:                    return orders;
081:                } else {
082:                    return getOrderSearcher().loadPageOfSearch(inReq,
083:                            store.getCatalogId(), store.getOrderSearch());
084:                }
085:            }
086:
087:            public HitTracker getOrdersForAll(WebPageRequest inReq)
088:                    throws Exception {
089:                Store store = getStore(inReq);
090:                HitTracker orders = getOrderSearcher()
091:                        .fieldSearch(inReq, store);
092:                inReq.putPageValue(ORDERIDLIST, orders);
093:                return orders;
094:
095:            }
096:
097:            public List getOrderIdList(WebPageRequest inReq) throws Exception {
098:                Store store = getStore(inReq);
099:                List orderIds = store.getOrderSearch().listOrders(store, inReq);
100:
101:                inReq.putPageValue(ORDERIDLIST, orderIds);
102:                return orderIds;
103:
104:            }
105:
106:            public void changeOrderStatus(WebPageRequest inContext)
107:                    throws Exception {
108:                String id = inContext.getRequestParameter("orderstatus");
109:                String orderNumber = inContext
110:                        .getRequestParameter("ordernumber");
111:                if (id != null && orderNumber != null) {
112:                    SubmittedOrder order = getOrderFromNumber(inContext,
113:                            getOrderIdList(inContext), orderNumber);
114:                    Store store = getStore(inContext);
115:
116:                    OrderState state = new OrderState();
117:                    state.setId(id);
118:
119:                    OrderArchive archive = store.getOrderArchive();
120:                    archive.changeOrderStatus(state, store, order);
121:                    order.setOrderState(state);
122:                    store.getOrderSearch().updateIndex(order);
123:                }
124:
125:            }
126:
127:            public void captureOrder(WebPageRequest inContext) throws Exception {
128:                String orderNumber = inContext
129:                        .getRequestParameter("ordernumber");
130:                SubmittedOrder order = getOrderFromNumber(inContext,
131:                        getOrderIdList(inContext), orderNumber);
132:                Store store = getStore(inContext);
133:
134:                OrderArchive archive = store.getOrderArchive();
135:                archive.captureOrder(inContext, store, order);
136:                inContext.putPageValue("order", order);
137:            }
138:
139:            protected Store getStore(WebPageRequest inContext) throws Exception {
140:                CartModule cartm = (CartModule) getModuleManager().getModule(
141:                        "CartModule");
142:                return cartm.getStore(inContext);
143:            }
144:
145:            protected File getOrdersDirectory(Store inStore) {
146:                return new File(inStore.getStoreDirectory(), "orders");
147:            }
148:
149:            public void loadOrder(WebPageRequest inRequest) throws Exception {
150:                String path = inRequest.getPath();
151:                if (path.endsWith(".html")) {
152:                    List orderIdList = (List) inRequest
153:                            .getPageValue("orderlist");
154:                    if (orderIdList == null) {
155:                        orderIdList = getOrderIdList(inRequest);
156:                    }
157:                    String orderNumber = path.substring(
158:                            path.lastIndexOf("/") + 1, path
159:                                    .lastIndexOf(".html"));
160:                    SubmittedOrder order = getOrderFromNumber(inRequest,
161:                            orderIdList, orderNumber);
162:                    inRequest.putPageValue("order", order);
163:                }
164:            }
165:
166:            public OrderSearcher getOrderSearcher() {
167:                if (fieldOrderSearcher == null) {
168:                    setOrderSearcher(new OrderSearcher());
169:                }
170:                return fieldOrderSearcher;
171:
172:            }
173:
174:            public void setOrderSearcher(OrderSearcher inOrderSearcher) {
175:                fieldOrderSearcher = inOrderSearcher;
176:            }
177:
178:            public void reIndexOrders(WebPageRequest inReq) throws Exception {
179:                Store store = getStore(inReq);
180:                store.getOrderSearch().reIndexAll();
181:            }
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.