1 37 38 package com.sun.j2ee.blueprints.opc.otwebservice; 39 40 import javax.ejb.*; 41 import java.rmi.RemoteException ; 42 import com.sun.j2ee.blueprints.servicelocator.*; 43 import com.sun.j2ee.blueprints.servicelocator.ejb.*; 44 import com.sun.j2ee.blueprints.processmanager.ejb.*; 45 import com.sun.j2ee.blueprints.opc.JNDINames; 46 import com.sun.j2ee.blueprints.opc.purchaseorder.*; 47 import com.sun.j2ee.blueprints.opc.purchaseorder.ejb.*; 48 49 54 public class OtEndpointBean implements SessionBean { 55 56 private SessionContext sc; 57 private ProcessManagerLocal processManager = null; 58 private PurchaseOrderLocalHome poHome = null; 59 60 public OtEndpointBean(){} 61 62 public void ejbCreate() throws CreateException { 63 try { 64 ServiceLocator sl = new ServiceLocator(); 65 ProcessManagerLocalHome pmHome = 66 (ProcessManagerLocalHome)sl.getLocalHome(JNDINames.PM_EJB); 67 processManager = pmHome.create(); 68 poHome = (PurchaseOrderLocalHome) sl.getLocalHome(JNDINames.PO_EJB); 69 } catch (ServiceLocatorException se) { 70 throw new CreateException(se.getMessage()); 71 } 72 } 73 74 81 public OrderDetails getOrderDetails(String orderId) 82 throws OrderNotFoundException, RemoteException { 83 84 OrderDetails details = new OrderDetails(); 85 try { 86 String status = processManager.getOrderStatus(orderId); 87 details.setStatus(status); 88 PurchaseOrderLocal polocal = poHome.findByPrimaryKey(orderId); 89 details.setPO(polocal.getPO()); 90 } catch (FinderException fe) { 91 throw new OrderNotFoundException("Unable to locate order with id " + orderId + "; Please ensure that you entered the correcr order Id"); 92 } 93 return details; 94 } 95 96 public void setSessionContext(SessionContext sc) { 97 this.sc = sc; 98 } 99 100 public void ejbRemove() throws RemoteException {} 101 102 public void ejbActivate() {} 104 105 public void ejbPassivate() {} 107 108 } 109 | Popular Tags |