KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > store > orders > ElectronicGoodsOrderArchive


1 /*
2  * Created on Apr 4, 2005
3  */

4 package com.openedit.store.orders;
5
6 import java.util.Iterator JavaDoc;
7
8 import org.apache.commons.logging.Log;
9 import org.apache.commons.logging.LogFactory;
10
11 import com.openedit.ModuleManager;
12 import com.openedit.WebPageRequest;
13 import com.openedit.page.manage.PageManager;
14 import com.openedit.store.BaseOrderArchive;
15 import com.openedit.store.CartItem;
16 import com.openedit.store.Order;
17 import com.openedit.store.Product;
18 import com.openedit.store.Store;
19 import com.openedit.store.StoreException;
20
21 /**
22  * @author cburkey
23  *
24  */

25 public class ElectronicGoodsOrderArchive extends BaseOrderArchive
26 {
27     protected PageManager fieldPageManager;
28     protected ModuleManager fieldModuleManager;
29     private static final Log log = LogFactory.getLog(ElectronicGoodsOrderArchive.class);
30
31     /* (non-javadoc)
32      * @see com.openedit.store.OrderArchive#exportNewOrder(com.openedit.WebPageRequest, com.openedit.store.Store, com.openedit.store.Order)
33      */

34     public void exportNewOrder(WebPageRequest inContext, Store inStore, Order inOrder)
35         throws StoreException
36     {
37         log.info("Check for electronic delivery");
38         //look for products that are electronic delivery
39
for (Iterator JavaDoc iter = inOrder.getItems().iterator(); iter.hasNext();)
40         {
41             CartItem item = (CartItem) iter.next();
42             Product product = item.getProduct();
43             if ( product != null)
44             {
45                 
46                 //TODO: Move to using a property not a keyword
47
String JavaDoc keywords = item.getProduct().getShippingMethodId();
48                 
49                 if ( keywords != null )
50                 {
51                     log.info("Found keywords");
52                     inContext.putSessionValue("order",inOrder);
53                     inContext.putSessionValue("customer",inOrder.getCustomer());
54                     try
55                     {
56                         if ( keywords.indexOf("classified") >= 0 )
57                         {
58                             inContext.forward(inStore.getStoreHome() +"/electronic/classified.html");
59                             //Page page = getPageManager().getPage( inStore.getStoreHome() +"/electronic/classified.html");
60
//inContext.forward(path, inReq)redirect( inStore.getStoreHome() +"/electronic/classified.html");
61

62                         }
63                         else if ( keywords.indexOf("electronic-delivery") >= 0 )
64                         {
65                             log.info("forward to electronic");
66                             inContext.forward( inStore.getStoreHome() + "/electronic/electronic-delivery.html");
67 // Page page = getPageManager().getPage( inStore.getStoreHome() + "/electronic/electronic-delivery.html");
68
// getModuleManager().executePathActions(page, inContext);
69
// getModuleManager().executePageActions(page, inContext);
70
}
71                     }
72                     catch ( Exception JavaDoc ex)
73                     {
74                         throw new StoreException(ex);
75                     }
76                 }
77                 //TODO: Move to new Options API with the value being the Path to the delivery
78
}
79         }
80     }
81
82     public PageManager getPageManager()
83     {
84         return fieldPageManager;
85     }
86
87     public void setPageManager(PageManager inPageManager)
88     {
89         fieldPageManager = inPageManager;
90     }
91
92     public ModuleManager getModuleManager()
93     {
94         return fieldModuleManager;
95     }
96
97     public void setModuleManager(ModuleManager inModuleManager)
98     {
99         fieldModuleManager = inModuleManager;
100     }
101 }
102
Popular Tags