KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ent > OrdersBean


1 package ent;
2
3 import java.math.BigDecimal JavaDoc;
4 import java.sql.Date JavaDoc;
5 import javax.ejb.*;
6
7 /**
8  * This is the bean class for the OrdersBean enterprise bean.
9  * Created 12.1.2006 17:52:53
10  * @author jungi
11  */

12 public abstract class OrdersBean implements EntityBean, OrdersLocalBusiness {
13     private EntityContext context;
14     
15     // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click on the + sign on the left to edit the code.">
16
// TODO Consider creating Transfer Object to encapsulate data
17
// TODO Review finder methods
18
/**
19      * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
20      */

21     public void setEntityContext(EntityContext aContext) {
22         context = aContext;
23     }
24     
25     /**
26      * @see javax.ejb.EntityBean#ejbActivate()
27      */

28     public void ejbActivate() {
29         
30     }
31     
32     /**
33      * @see javax.ejb.EntityBean#ejbPassivate()
34      */

35     public void ejbPassivate() {
36         
37     }
38     
39     /**
40      * @see javax.ejb.EntityBean#ejbRemove()
41      */

42     public void ejbRemove() {
43         
44     }
45     
46     /**
47      * @see javax.ejb.EntityBean#unsetEntityContext()
48      */

49     public void unsetEntityContext() {
50         context = null;
51     }
52     
53     /**
54      * @see javax.ejb.EntityBean#ejbLoad()
55      */

56     public void ejbLoad() {
57         
58     }
59     
60     /**
61      * @see javax.ejb.EntityBean#ejbStore()
62      */

63     public void ejbStore() {
64         
65     }
66     // </editor-fold>
67

68     
69     public abstract Integer JavaDoc getOrderNum();
70     public abstract void setOrderNum(Integer JavaDoc orderNum);
71     
72     public abstract Integer JavaDoc getQuantity();
73     public abstract void setQuantity(Integer JavaDoc quantity);
74     
75     public abstract BigDecimal JavaDoc getShippingCost();
76     public abstract void setShippingCost(BigDecimal JavaDoc shippingCost);
77     
78     public abstract Date JavaDoc getSalesDate();
79     public abstract void setSalesDate(Date JavaDoc salesDate);
80     
81     public abstract Date JavaDoc getShippingDate();
82     public abstract void setShippingDate(Date JavaDoc shippingDate);
83     
84     public abstract String JavaDoc getFreightCompany();
85     public abstract void setFreightCompany(String JavaDoc freightCompany);
86     
87     public abstract ent.CustomerLocal getCustomerId();
88     public abstract void setCustomerId(ent.CustomerLocal customerId);
89     
90     public abstract ProductLocal getProductId();
91     public abstract void setProductId(ProductLocal productId);
92     
93     
94     public Integer JavaDoc ejbCreate(Integer JavaDoc orderNum, Integer JavaDoc quantity, BigDecimal JavaDoc shippingCost, Date JavaDoc salesDate, Date JavaDoc shippingDate, String JavaDoc freightCompany, ent.CustomerLocal customerId, ProductLocal productId) throws CreateException {
95         if (orderNum == null) {
96             throw new CreateException("The field \"orderNum\" must not be null");
97         }
98         if (customerId == null) {
99             throw new CreateException("The field \"customerId\" must not be null");
100         }
101         if (productId == null) {
102             throw new CreateException("The field \"productId\" must not be null");
103         }
104         
105         // TODO add additional validation code, throw CreateException if data is not valid
106
setOrderNum(orderNum);
107         setQuantity(quantity);
108         setShippingCost(shippingCost);
109         setSalesDate(salesDate);
110         setShippingDate(shippingDate);
111         setFreightCompany(freightCompany);
112         
113         return null;
114     }
115     
116     public void ejbPostCreate(Integer JavaDoc orderNum, Integer JavaDoc quantity, BigDecimal JavaDoc shippingCost, Date JavaDoc salesDate, Date JavaDoc shippingDate, String JavaDoc freightCompany, ent.CustomerLocal customerId, ProductLocal productId) {
117         // TODO populate relationships here if appropriate
118
setCustomerId(customerId);
119         setProductId(productId);
120         
121     }
122 }
123
Popular Tags