KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > ejb > PersonBean


1 package test.ejb;
2
3 import test.interfaces.PersonData;
4
5 import javax.ejb.*;
6 import java.util.Collection JavaDoc;
7
8 /**
9  * This is a person bean. It is an example of how to use the XDoclet tags.
10  *
11  * @ejb.finder
12  * role-name="Teller"
13  * signature="Collection findAll()"
14  * transaction-type="NotSupported"
15  *
16  * @ejb.transaction
17  * type="Required"
18  *
19  * @ejb.data-object
20  * equals="true"
21  * implements="test.interfaces.Identifiable"
22  * ver-uid="7523967970034398950L"
23  *
24  * @ejb.pk
25  * generate="false"
26  *
27  * @ejb.env-entry
28  * name="blabla"
29  * type="java.lang.Integer"
30  * value="12345"
31  *
32  * @ejb.env-entry
33  * description="test value with description"
34  * name="foo"
35  * type="java.lang.String"
36  * value="bar"
37  *
38  * @ejb.persistence
39  * table-name="person"
40  * @jboss.create-table "true"
41  * @jboss.remove-table "true"
42  * @jboss.tuned-updates "true"
43  * @jboss.read-only "false" Struts form bean specific
44  * @struts.form
45  * name="Names"
46  * @struts.form
47  * include-pk="false"
48  * name="Contact"
49  * @struts.form
50  * include-all="true"
51  * name="Full"
52  *
53  * @jonas.bean
54  * ejb-name="Person"
55  * jndi-name="PersonHome"
56  * @jonas.shared true
57  * @jonas.jdbc-mapping
58  * jndi-name="jdbc_1"
59  * jdbc-table-name="person"
60  * @jonas.finder-method-jdbc-mapping
61  * method-name="findAll"
62  * jdbc-where-clause=""
63  */

64
65 public abstract class PersonBean
66         extends BaseEntityBean
67         implements EntityBean {
68     private EntityContext ctx;
69
70     /**
71      * Id of this person.
72      *
73      * @ejb.pk-field
74      * @ejb.persistent-field
75      * @ejb.persistence
76      * column-name="id"
77      * @ejb.value-object
78      * match="*"
79      *
80      * @jonas.cmp-field-jdbc-mapping
81      * field-name="id"
82      * jdbc-field-name="id"
83      */

84     public abstract String JavaDoc getId();
85
86     /**
87      * @ejb.interface-method
88      * @ejb.permission
89      * role-name="Administrator"
90      */

91     public abstract void setId(String JavaDoc id);
92
93     /**
94      * Name of the person.
95      *
96      * @ejb.interface-method
97      * @ejb.transaction
98      * type="Supports"
99      * @ejb.permission
100      * role-name="Customer"
101      * @ejb.permission
102      * role-name="Administrator"
103      * @ejb.persistent-field
104      * @ejb.persistence
105      * column-name="name"
106      * @struts.form-field
107      * form-name="Names"
108      * @struts.validator
109      * type="required"
110      * @ejb.value-object
111      * match="normal"
112      *
113      * @jonas.cmp-field-jdbc-mapping
114      * field-name="name"
115      * jdbc-field-name="name"
116      */

117     public abstract String JavaDoc getName();
118
119     /**
120      * Name of the customer.
121      *
122      */

123     public abstract void setName(String JavaDoc name);
124
125     /**
126      * FirstName of the person.
127      *
128      * @ejb.interface-method
129      * @ejb.transaction
130      * type="Supports"
131      * @ejb.permission
132      * role-name="Customer"
133      * @ejb.permission
134      * role-name="Administrator"
135      * @ejb.persistent-field
136      * @ejb.persistence
137      * column-name="first_name"
138      * @struts.form-field
139      * form-name="Names"
140      * @ejb.value-object
141      * match="normal"
142      *
143      * @jonas.cmp-field-jdbc-mapping
144      * field-name="firstName"
145      * jdbc-field-name="first_name"
146      */

147     public abstract String JavaDoc getFirstName();
148
149     /**
150      * @ejb.interface-method
151      * @ejb.permission
152      * role-name="Administrator"
153      */

154     public abstract void setFirstName(String JavaDoc firstName);
155
156     /**
157      * phone of the person.
158      *
159      * @ejb.interface-method
160      * @ejb.transaction
161      * type="Supports"
162      * @ejb.permission
163      * role-name="Customer"
164      * @ejb.permission
165      * role-name="Administrator"
166      * @ejb.persistent-field
167      * @ejb.persistence
168      * column-name="phone"
169      * @struts.form-field
170      * form-name="Contact"
171      *
172      * @jonas.cmp-field-jdbc-mapping
173      * field-name="phone"
174      * jdbc-field-name="phone"
175      */

176     public abstract String JavaDoc getPhone();
177
178     /**
179      * @ejb.interface-method
180      * @ejb.permission
181      * role-name="Administrator"
182      */

183     public abstract void setPhone(String JavaDoc phone);
184
185     /**
186      * fax of the person.
187      *
188      * @ejb.interface-method
189      * @ejb.transaction
190      * type="Supports"
191      * @ejb.permission
192      * role-name="Customer"
193      * @ejb.permission
194      * role-name="Administrator"
195      * @ejb.persistent-field
196      * @ejb.persistence
197      * column-name="fax"
198      * @struts.form-field
199      * form-name="Contact"
200      *
201      * @jonas.cmp-field-jdbc-mapping
202      * field-name="fax"
203      * jdbc-field-name="fax"
204      */

205     public abstract String JavaDoc getFax();
206
207     /**
208      * @ejb.interface-method
209      * @ejb.permission
210      * role-name="Administrator"
211      */

212     public abstract void setFax(String JavaDoc fax);
213
214     /**
215      * This field will be included in the PersonFullForm,
216      * even if it's not a persistent field. Note the absence
217      * of the form-name attribute, indicating it will be
218      * included only in forms marked with include-all="true"
219      *
220      * @struts.form-field
221      */

222     public Integer JavaDoc getNonPersistentFormField()
223     {
224         return new Integer JavaDoc(0);
225     }
226
227     public void setNonPersistentFormField(Integer JavaDoc i)
228     {
229
230     }
231
232     /**
233      * Generated bulk accessor. Not remote, but could be.
234      *
235      */

236     public void setData(PersonData data) {
237         setId(data.getId());
238         setName(data.getName());
239     }
240
241     /**
242      * @ejb.interface-method
243      */

244     public void talkTo() {
245         ;
246     }
247
248     /**
249      * Create person.
250      *
251      */

252     public void ejbPostCreate(PersonData data)
253             throws CreateException {
254     }
255
256     /**
257      * Custom Finders
258      *
259      */

260     public Collection JavaDoc ejbFindCustomFinder(int a, String JavaDoc b) {
261         return null;
262     }
263
264     /**
265      */

266     public java.util.Collection JavaDoc ejbFindCustomFinderInSuper() {
267         return null;
268     }
269
270     /**
271      * WLS 6.0+ EJB 1.1 finder
272      *
273      * @weblogic.finder
274      * find-for-update="true"
275      * finder-query="(== phone $0)"
276      */

277     public java.util.Collection JavaDoc ejbFindByPhone(String JavaDoc phone) {
278         return null;
279     }
280
281     /**
282      * @struts.form-field
283      * form-name="Names"
284      */

285     public String JavaDoc getComputedField() {
286         return "abc";
287     }
288
289 }
290
Popular Tags