1 4 package com.openedit.store.orders; 5 6 import java.util.Iterator ; 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 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 34 public void exportNewOrder(WebPageRequest inContext, Store inStore, Order inOrder) 35 throws StoreException 36 { 37 log.info("Check for electronic delivery"); 38 for (Iterator 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 String 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 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 } 71 } 72 catch ( Exception ex) 73 { 74 throw new StoreException(ex); 75 } 76 } 77 } 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 |