1 37 38 package com.sun.j2ee.blueprints.opc.powebservice; 39 40 import java.util.*; 41 import java.rmi.*; 42 43 import javax.ejb.*; 44 import javax.jms.*; 45 46 import com.sun.j2ee.blueprints.servicelocator.*; 47 import com.sun.j2ee.blueprints.servicelocator.ejb.*; 48 import com.sun.j2ee.blueprints.opc.purchaseorder.*; 49 import com.sun.j2ee.blueprints.opc.JNDINames; 50 import com.sun.j2ee.blueprints.opc.utils.*; 51 import com.sun.j2ee.blueprints.opc.serviceexceptions.*; 52 53 58 public class PoEndpointBean implements SessionBean { 59 60 private SessionContext sc; 61 62 public PoEndpointBean(){} 63 64 public void ejbCreate() throws CreateException {} 65 66 70 public String submitPurchaseOrder(PurchaseOrder po) 71 throws InvalidPOException, ProcessingException, RemoteException { 72 73 if (po == null) { 75 throw new InvalidPOException("The Purchase Order received was empty!!!!"); 76 } else if ( po.getUserId() == null || 77 po.getEmailId() == null || 78 po.getLocale() == null || 79 po.getOrderDate() == null || 80 po.getShippingInfo() == null || 81 po.getBillingInfo() == null || 82 po.getTotalPrice() == 0 || 83 po.getCreditCard() == null || 84 po.getHeadCount() == 0 || 85 po.getStartDate() == null || 86 po.getEndDate() == null || 87 po.getDepartureCity()== null ) { 88 throw new InvalidPOException("No field in the purchase order can be null!"); 89 } 90 if(JMSUtils.sendMessage(JNDINames.WORKFLOW_MGR_MDB_QUEUE, 91 JNDINames.DOC_TYPE, JNDINames.PO_DOCUMENT, 92 (Object )po) == false) 93 throw new ProcessingException("Irrecoverable error while submitting the order for processing"); 94 return po.getPoId(); 95 } 96 97 public void setSessionContext(SessionContext sc) { 98 this.sc = sc; 99 } 100 101 public void ejbRemove() throws RemoteException {} 102 103 public void ejbActivate() {} 105 106 public void ejbPassivate() {} 108 109 } 110 | Popular Tags |