KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ent > CustomerBean


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

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

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

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

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

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

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

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

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

67     
68     public abstract Integer JavaDoc getCustomerId();
69     public abstract void setCustomerId(Integer JavaDoc customerId);
70     
71     public abstract String JavaDoc getZip();
72     public abstract void setZip(String JavaDoc zip);
73     
74     public abstract String JavaDoc getName();
75     public abstract void setName(String JavaDoc name);
76     
77     public abstract String JavaDoc getAddressline1();
78     public abstract void setAddressline1(String JavaDoc addressline1);
79     
80     public abstract String JavaDoc getAddressline2();
81     public abstract void setAddressline2(String JavaDoc addressline2);
82     
83     public abstract String JavaDoc getCity();
84     public abstract void setCity(String JavaDoc city);
85     
86     public abstract String JavaDoc getState();
87     public abstract void setState(String JavaDoc state);
88     
89     public abstract String JavaDoc getPhone();
90     public abstract void setPhone(String JavaDoc phone);
91     
92     public abstract String JavaDoc getFax();
93     public abstract void setFax(String JavaDoc fax);
94     
95     public abstract String JavaDoc getEmail();
96     public abstract void setEmail(String JavaDoc email);
97     
98     public abstract Integer JavaDoc getCreditLimit();
99     public abstract void setCreditLimit(Integer JavaDoc creditLimit);
100     
101     public abstract Collection JavaDoc getOrdersBean();
102     public abstract void setOrdersBean(Collection JavaDoc ordersBean);
103     
104     public abstract DiscountCodeLocal getDiscountCode();
105     public abstract void setDiscountCode(DiscountCodeLocal discountCode);
106     
107     
108     public Integer JavaDoc ejbCreate(Integer JavaDoc customerId, String JavaDoc zip, String JavaDoc name, String JavaDoc addressline1, String JavaDoc addressline2, String JavaDoc city, String JavaDoc state, String JavaDoc phone, String JavaDoc fax, String JavaDoc email, Integer JavaDoc creditLimit, DiscountCodeLocal discountCode) throws CreateException {
109         if (customerId == null) {
110             throw new CreateException("The field \"customerId\" must not be null");
111         }
112         if (zip == null) {
113             throw new CreateException("The field \"zip\" must not be null");
114         }
115         if (discountCode == null) {
116             throw new CreateException("The field \"discountCode\" must not be null");
117         }
118         
119         // TODO add additional validation code, throw CreateException if data is not valid
120
setCustomerId(customerId);
121         setZip(zip);
122         setName(name);
123         setAddressline1(addressline1);
124         setAddressline2(addressline2);
125         setCity(city);
126         setState(state);
127         setPhone(phone);
128         setFax(fax);
129         setEmail(email);
130         setCreditLimit(creditLimit);
131         
132         return null;
133     }
134     
135     public void ejbPostCreate(Integer JavaDoc customerId, String JavaDoc zip, String JavaDoc name, String JavaDoc addressline1, String JavaDoc addressline2, String JavaDoc city, String JavaDoc state, String JavaDoc phone, String JavaDoc fax, String JavaDoc email, Integer JavaDoc creditLimit, DiscountCodeLocal discountCode) {
136         // TODO populate relationships here if appropriate
137
setDiscountCode(discountCode);
138         
139     }
140 }
141
Popular Tags