KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnUserBean


1 package hero.entity;
2
3 import hero.interfaces.BnUserLightValue;
4 import hero.interfaces.BnUserPK;
5 import hero.interfaces.BnUserValue;
6 import hero.interfaces.InvalidValueException;
7 import hero.util.BonitaServiceLocator;
8 import hero.util.BonitaServiceException;
9
10 import java.sql.Date JavaDoc;
11 import java.util.Collection JavaDoc;
12
13 import javax.ejb.CreateException JavaDoc;
14 import javax.ejb.EJBException JavaDoc;
15 import javax.ejb.EntityBean JavaDoc;
16 import javax.ejb.EntityContext JavaDoc;
17 import javax.ejb.RemoveException JavaDoc;
18
19 /**
20  * The Entity bean represents a BnUser
21  *
22  * @author François Charoy
23  * @version $Revision: 1.6 $
24  *
25  * @ejb:bean name="BnUser"
26  * display-name="BnUser Entity"
27  * type="CMP"
28  * jndi-name="ejb/hero/BnUser"
29  * local-jndi-name="ejb/hero/BnUser_L"
30  * view-type="both"
31  * cmp-version="2.x"
32  * reentrant="true"
33  *
34  * @ejb:transaction type="Supports"
35  *
36  *
37  * @ejb:data-object extends="hero.interfaces.AbstractData"
38  * setdata="false"
39  *
40  * @ejb.pk generate="true" method-intf="remote"
41  *
42  * @jonas.bean
43  * ejb-name="BnUser"
44  * jndi-name="ejb/hero/BnUser"
45  * lock-policy="container-read-committed"
46  * @jonas.jdbc-mapping
47  * jndi-name="bonita"
48  * jdbc-table-name="BnUser"
49  *
50  * @jonas.shared false
51  *
52  * @ejb:finder signature="java.util.Collection findAll()"
53  * query="SELECT object(u) FROM BnUser u"
54  * transaction-type="Supports"
55  *
56  * @ejb:finder signature="hero.interfaces.BnUser findByName(java.lang.String pName )" result-type-mapping="Remote"
57  * query="SELECT Object(u) From BnUser as u Where u.name = ?1"
58  * transaction-type="Supports"
59  * @ejb:finder signature="hero.interfaces.BnUserLocal findByName(java.lang.String pName )" result-type-mapping="Local"
60  * query="SELECT Object(u) From BnUser as u Where u.name = ?1"
61  * transaction-type="Supports"
62  *
63  *
64  * @ejb.value-object
65  * match="*"
66  * name="BnUser"
67  *
68  * @ejb.value-object
69  * match="light"
70  * name="BnUserLight"
71  *
72  * @jboss:table-name table-name="BnUser"
73  *
74  * @jboss:create-table create="true"
75  *
76  * @jboss:remove-table remove="false"
77  *
78  **/

79
80 public abstract class BnUserBean
81    implements EntityBean JavaDoc
82 {
83    
84    // -------------------------------------------------------------------------
85
// Members
86
// -------------------------------------------------------------------------
87

88    public EntityContext JavaDoc mContext;
89    
90    
91    // -------------------------------------------------------------------------
92
// Properties (Getters/Setters)
93
// -------------------------------------------------------------------------
94

95    /**
96    * Retrieve the BnUser's id.
97    *
98    * @return Returns an int representing the id of this BnUser.
99    *
100    * @ejb:pk-field
101    * @ejb:interface-method view-type="both"
102    * @ejb.value-object
103    * match="light"
104    * @ejb:persistence column-name="id"
105    * @jonas.cmp-field-jdbc-mapping
106    * field-name="id"
107    * jdbc-field-name="id"
108    * @ejb:transaction type="Supports"
109    **/

110    public abstract String JavaDoc getId();
111    
112    /**
113    * Set the BnUser's id.
114    *
115    * @param pId The id of this BnUser. Is set at creation time.
116    * @ejb:transaction type="Required"
117    **/

118    public abstract void setId( String JavaDoc pId );
119    
120    /**
121    * Retrieve the BnUser's Name.
122    *
123    * @return Returns an int representing the Name of this BnUser.
124    * @ejb:interface-method view-type="both"
125    * @ejb.value-object
126    * match="light"
127    *
128    * @ejb:persistence column-name="name"
129    * @ejb:transaction type="Supports"
130    **/

131    public abstract String JavaDoc getName();
132    
133    /**
134    * Set the BnUser's Name.
135    *
136    * @param uName The Name of this BnUser. Is set at creation time.
137    * @ejb:transaction type="Required"
138    **/

139    public abstract void setName( String JavaDoc uName );
140    
141    /**
142    * Retrieve the BnUser's Password.
143    *
144    * @return Returns an int representing the Password of this BnUser.
145    *
146    * @ejb:interface-method view-type="local"
147    * @ejb.value-object
148    * match="light"
149    * @ejb:persistence column-name="password"
150    * @ejb:transaction type="Supports"
151    **/

152    public abstract String JavaDoc getPassword();
153    
154    /**
155    * Set the BnUser's Password.
156    *
157    * @param pPassword The Password of this BnUser
158    * @ejb:transaction type="Required"
159    **/

160    public abstract void setPassword( String JavaDoc pPassword );
161    
162    /**
163    * Retrieve the BnUser's Email.
164    *
165    * @return Returns an String representing the Email of this BnUser.
166    * @ejb:interface-method view-type="both"
167    *
168    * @ejb.value-object
169    * match="light"
170    * @ejb:persistence column-name="email"
171    * @ejb:transaction type="Supports"
172    **/

173    public abstract String JavaDoc getEmail();
174    
175    /**
176    * Set the BnUser's Email.
177    *
178    * @param pEmail The Email of this BnUser. Is set at creation time.
179    * @ejb:persistence column-name="email"
180    * @ejb:interface-method view-type="local"
181    * @ejb:transaction type="Required"
182    **/

183    public abstract void setEmail( String JavaDoc pEmail );
184    
185    /**
186    * Retrieve the BnUser's Jabber address.
187    *
188    * @return Returns an String representing the Jabber address of this BnUser.
189    * @ejb:interface-method view-type="both"
190    *
191    * @ejb.value-object
192    * match="light"
193    *
194    * @ejb:persistence column-name="jabber"
195    * @ejb:transaction type="Supports"
196    **/

197    public abstract String JavaDoc getJabber();
198    
199    /**
200    * Set the BnUser's Jabber address.
201    *
202    * @param pJabber The Jabber address of this BnUser. Is set at creation time.
203    * @ejb:transaction type="Required"
204    **/

205    public abstract void setJabber( String JavaDoc pJabber );
206    
207     /**
208      * @return Returns the creation date of this BnUser
209      *
210      * @ejb:interface-method view-type="local"
211      * @ejb.value-object
212      * match="light"
213      *
214      * @ejb:persistence column-name="creationdate"
215      * @ejb:transaction type="Supports"
216      **/

217     public abstract Date JavaDoc getCreationDate();
218     
219     /**
220      * Specify the creation date of this BnUser
221      *
222      * @param pCreationDate Date of the creation of this BnUser
223      * @ejb:interface-method view-type="local"
224      * @ejb:transaction type="Required"
225      **/

226     public abstract void setCreationDate( Date JavaDoc pCreationDate );
227     
228     /**
229      * @return Returns the modification date of this BnUser
230      *
231      * @ejb.value-object
232      * match="light"
233      * @ejb:persistence column-name="modificationdate"
234      * @ejb:interface-method view-type="local"
235      * @ejb:transaction type="Supports"
236      **/

237     public abstract Date JavaDoc getModificationDate();
238     
239     /**
240      * Specify the modification date of this BnUser
241      *
242      * @param pModificationDate Date of the modification of this BnUser
243      * @ejb:interface-method view-type="local"
244      * @ejb:transaction type="Required"
245      **/

246     public abstract void setModificationDate( Date JavaDoc pModificationDate );
247     
248     /**
249      * @returns the project on which this user works
250      * @ejb:interface-method view-type="local"
251      * @ejb:relation name="Users" role-name="is-user-of" target-multiple="yes"
252      * @jboss.relation-table table-name="BnUserProject" create-table="true" remove-table="false"
253      * @jboss:auto-key-fields
254      * @jonas:automatic-pk="true"
255      *
256      * @ejb.value-object
257      * match="normal"
258      * type="Collection"
259      * relation="external"
260      * aggregate="hero.interfaces.BnProjectLightValue"
261      * aggregate-name="BnProject"
262      * members="hero.interfaces.BnProjectLocal"
263      * members-name="BnProject"
264      * @ejb:transaction type="Supports"
265      */

266     public abstract Collection JavaDoc getBnProjects() ;
267
268    
269     /**
270      * Set the Users of this project
271      *
272      * @param pProjects projects of the user
273      * @ejb:transaction type="Required"
274      **/

275     public abstract void setBnProjects( Collection JavaDoc pProjects);
276     
277     /**
278      * @returns the roles of the user
279      * @ejb:interface-method view-type="local"
280      * @ejb:relation name="Roles" role-name="has-role" multiple="no"
281      * @jboss:auto-key-fields
282      * @jonas:automatic-pk="true"
283      * @jboss.relation-table create-table="true" remove-table="false"
284      *
285      * @ejb.value-object
286      * match="normal"
287      * type="Collection"
288      * relation="external"
289      * aggregate="hero.interfaces.BnRoleValue"
290      * aggregate-name="BnRole"
291      * members="hero.interfaces.BnRoleLocal"
292      * members-name="BnRole"
293      * @ejb:transaction type="Supports"
294      */

295     public abstract Collection JavaDoc getBnRoles() ;
296     
297     /**
298      * Set the roles of the user
299      *
300      * @param pRoles roles of the user
301      * @ejb:transaction type="Required"
302      **/

303     public abstract void setBnRoles( Collection JavaDoc pRoles);
304
305     /**
306      * @returns the authorisation roles of the user (for ejb security)
307      * @ejb:interface-method view-type="local"
308      * @ejb:relation name="AuthRoles" role-name="has-authrole" multiple="yes"
309      * @jboss:auto-key-fields
310      * @jonas:automatic-pk="true"
311      * @jboss.relation-table table-name="BnUserAuthRole" create-table="true" remove-table="false"
312      *
313      * @ejb.value-object
314      * match="normal"
315      * type="Collection"
316      * relation="external"
317      * aggregate="hero.interfaces.BnAuthRoleValue"
318      * aggregate-name="BnAuthRole"
319      * members="hero.interfaces.BnAuthRoleLocal"
320      * members-name="BnAuthRole"
321      * @ejb:transaction type="Supports"
322      */

323     public abstract Collection JavaDoc getBnAuthRoles() ;
324     
325     /**
326      * Set the authorisation roles of the user (for ejb security)
327      *
328      * @param pRoles roles of the user
329      * @ejb:transaction type="Required"
330      **/

331     public abstract void setBnAuthRoles( Collection JavaDoc pRoles);
332
333     /**
334      * @returns the nodes created by the user
335      * @ejb:interface-method view-type="local"
336      * @ejb:relation name="AgentCreator" role-name="is-node-creator" multiple="yes"
337      * @jboss:auto-key-fields
338      * @jonas:automatic-pk="true"
339      * @ejb:transaction type="Supports"
340      */

341     public abstract Collection JavaDoc getCreatedBnAgents() ;
342
343     /**
344      * Set the user created agents
345      *
346      * @param pAgents Agents created by the user
347      * @ejb:transaction type="Required"
348      **/

349     public abstract void setCreatedBnAgents( Collection JavaDoc pAgents);
350
351     /**
352      * @ejb.interface-method
353      * @ejb:transaction type="Supports"
354      */

355     public abstract BnUserValue getBnUserValue();
356     
357     /**
358      *
359      * @ejb.interface-method
360      * @ejb:transaction type="Required"
361      */

362     public abstract void setBnUserValue(BnUserValue v);
363     
364     /**
365      * @returns the light value of the bean (without relationships)
366      * @ejb.interface-method view-type=both
367      * @ejb:transaction type="Supports"
368      */

369     public abstract BnUserLightValue getBnUserLightValue();
370
371     /**
372      * @return the properties of the user
373      * @ejb:interface-method view-type="both"
374      * @ejb:relation name="userprp" role-name="is-property-of"
375      * @jboss:auto-key-fields
376      * @jonas:automatic-pk="true"
377      * @ejb:transaction type="Supports"
378      *
379      **/

380     public abstract Collection JavaDoc getBnProperties();
381     
382     /**
383      * Set the properties of the user
384      * @ejb:interface-method view-type="both"
385      * @param pPrp the properties of the user
386      * @ejb:transaction type="Required"
387      **/

388     public abstract void setBnProperties(Collection JavaDoc pPrp);
389
390     
391     
392
393    // -------------------------------------------------------------------------
394
// Framework Callbacks
395
// -------------------------------------------------------------------------
396

397    /**
398    * Create a BnUser based on the supplied BnUser Value Object.
399    *
400    * @param pUser The data used to create the BnUser.
401    *
402    * @throws InvalidValueException If one of the values are not correct,
403    * this will not roll back the transaction
404    * because the caller has the chance to
405    * fix the problem and try again
406    * @throws EJBException If no new unique ID could be retrieved this will
407    * rollback the transaction because there is no
408    * hope to try again
409    * @throws CreateException Because we have to do so (EJB spec.)
410    *
411    * @ejb:create-method view-type="both"
412    **/

413    public BnUserPK ejbCreate( BnUserValue pUser )
414       throws
415          InvalidValueException,
416          EJBException JavaDoc,
417          CreateException JavaDoc
418    {
419       // This is only possible in CMPs. Otherwise return a valid PK.
420
this.setBnUserValue(pUser);
421        this.setId(hero.interfaces.BnUserUtil.generateGUID(this));
422        
423        this.setCreationDate(new java.sql.Date JavaDoc(new java.util.Date JavaDoc().getTime()));
424        this.setModificationDate(new java.sql.Date JavaDoc(new java.util.Date JavaDoc().getTime() ));
425       return null;
426    }
427    
428    public void ejbPostCreate( BnUserValue pUser )
429    {
430    }
431    
432    public void setEntityContext( EntityContext JavaDoc lContext )
433    {
434       mContext = lContext;
435    }
436    
437    public void unsetEntityContext()
438    {
439       mContext = null;
440    }
441    
442    public void ejbActivate()
443    {
444    }
445    
446    public void ejbPassivate()
447    {
448    }
449    
450    public void ejbLoad()
451    {
452    }
453    
454    public void ejbStore()
455    {
456    }
457    
458    public void ejbRemove()
459       throws
460          RemoveException JavaDoc
461    {
462    }
463 }
464
Popular Tags