KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnRoleBean


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

78 public abstract class BnRoleBean
79    implements EntityBean JavaDoc
80 {
81    
82    // -------------------------------------------------------------------------
83
// Members
84

85    public EntityContext JavaDoc mContext;
86    
87    // -------------------------------------------------------------------------
88
// Properties (Getters/Setters)
89
// -------------------------------------------------------------------------
90

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

105    public abstract String JavaDoc getId();
106    
107    /**
108    * Set the BnRole's id.
109    *
110    * @param pId The id of this BnRole. Is set at creation time.
111    * @ejb:transaction type="Required"
112    **/

113    public abstract void setId( String JavaDoc pId );
114    
115    /**
116    * Retrieve the BnRole's Description.
117    *
118    * @return Returns an int representing the Name of this BnRole.
119    * @ejb:interface-method view-type="both"
120    * @ejb.value-object
121    * match="light"
122    * @ejb:persistence column-name="description"
123    * @ejb:transaction type="Supports"
124    **/

125    public abstract String JavaDoc getDescription();
126    
127    /**
128    * Set the BnRole's Description.
129    *
130    * @param pDescription The Description of this BnRole. Is set at creation time.
131    * @ejb:transaction type="Required"
132    **/

133    public abstract void setDescription( String JavaDoc pDescription );
134
135    /**
136    * Retrieve the BnRole's Name.
137    *
138    * @return Returns an int representing the Name of this BnRole.
139    * @ejb:interface-method view-type="both"
140    * @ejb.value-object
141    * match="light"
142    * @ejb:persistence column-name="name"
143    * @ejb:transaction type="Supports"
144    **/

145    public abstract String JavaDoc getName();
146    
147    /**
148    * Set the BnRole's Name.
149    *
150    * @param pName The Name of this BnRole. Is set at creation time.
151    * @ejb:transaction type="Required"
152    **/

153    public abstract void setName( String JavaDoc pName );
154    
155
156     /**
157      * @returns the users of the role
158      * @ejb:interface-method view-type="local"
159      * @ejb:relation name="Roles" role-name="is-role-of" multiple="yes"
160      * @jboss:auto-key-fields
161      * @jonas:automatic-pk="true"
162      * @jboss.relation-table table-name="UserRole" create-table="true" remove-table="false"
163      * @ejb:transaction type="Supports"
164       */

165     public abstract Collection JavaDoc getBnUsers() ;
166
167     /**
168      * Set the Roles of this project
169      *
170      * @param pUsers users of the role
171      * @ejb:interface-method view-type="local"
172      * @ejb:transaction type="Required"
173      **/

174     public abstract void setBnUsers( Collection JavaDoc pUsers);
175
176     /**
177      * @returns the nodes of the role
178      * @ejb:interface-method view-type="local"
179      * @ejb:relation name="NodeRole" role-name="is-role-of-node" multiple="yes"
180      * @jboss:auto-key-fields
181      * @jonas:automatic-pk="true"
182      * @ejb:transaction type="Supports"
183       */

184     public abstract Collection JavaDoc getBnNodes() ;
185
186     /**
187      * Set the Roles of this project
188      *
189      * @param pNodes nodes of the role
190      * @ejb:transaction type="Required"
191      **/

192     public abstract void setBnNodes( Collection JavaDoc pNodes);
193
194     /**
195      * @returns the project of the role
196      * @ejb:interface-method view-type="local"
197      * @ejb:relation name="ProjectRoles" role-name="is-role-of-project" cascade-delete="yes"
198      * @jboss:auto-key-fields
199      * @jonas:automatic-pk="true"
200      * @ejb:transaction type="Supports"
201       */

202     public abstract BnProjectLocal getBnProject() ;
203     
204     /**
205      * Set the Roles of this project
206      *
207      * @param pProject project of the role
208      * @ejb:interface-method view-type="local"
209      * @ejb:transaction type="Required"
210      **/

211     public abstract void setBnProject( BnProjectLocal pProject);
212
213     /** Retrieve the RoleMapper for the role.
214      *
215      * @return Returns the role mapper.
216      * @ejb:interface-method view-type="both"
217      * @ejb:relation name="mapper-role" role-name="role2mapper"
218      * @jboss:auto-key-fields
219      * @ejb:value-object match="*"
220      * relation="external"
221      * aggregate="hero.interfaces.BnRoleMapperValue"
222      * aggregate-name="BnRoleMapper"
223      * @ejb:transaction type="Supports"
224      **/

225    public abstract BnRoleMapperLocal getBnRoleMapper() ;
226
227    /**
228     * Set the Roles of this mapper
229     *
230     * @param pMapper mapper of the role
231     * @ejb:transaction type="Required"
232     **/

233    public abstract void setBnRoleMapper( BnRoleMapperLocal pMapper);
234
235
236
237     /**
238      * @ejb.interface-method
239      * @ejb:transaction type="Supports"
240      */

241     public abstract BnRoleValue getBnRoleValue();
242     
243     /**
244      * @ejb.interface-method
245      * @ejb:transaction type="Required"
246      */

247     public abstract void setBnRoleValue(BnRoleValue v);
248
249    // -------------------------------------------------------------------------
250
// Framework Callbacks
251
// -------------------------------------------------------------------------
252

253    /**
254    * Create a BnRole based on the supplied BnRole Value Object.
255    *
256    * @param pRole The data used to create the BnRole.
257    *
258    * @throws InvalidValueException If one of the values are not correct,
259    * this will not roll back the transaction
260    * because the caller has the chance to
261    * fix the problem and try again
262    * @throws EJBException If no new unique ID could be retrieved this will
263    * rollback the transaction because there is no
264    * hope to try again
265    * @throws CreateException Because we have to do so (EJB spec.)
266    *
267    * @ejb:create-method view-type="both"
268    **/

269    public BnRolePK ejbCreate( BnRoleValue pRole )
270       throws
271          EJBException JavaDoc,
272          CreateException JavaDoc
273    {
274
275        setBnRoleValue(pRole);
276        this.setId(hero.interfaces.BnRoleUtil.generateGUID(this));
277        return null;
278    }
279    
280    public void ejbPostCreate( BnRoleData pRole )
281    {
282    }
283    
284    public void setEntityContext( EntityContext JavaDoc lContext )
285    {
286       mContext = lContext;
287    }
288    
289    public void unsetEntityContext()
290    {
291       mContext = null;
292    }
293    
294    public void ejbActivate()
295    {
296    }
297    
298    public void ejbPassivate()
299    {
300    }
301    
302    public void ejbLoad()
303    {
304    }
305    
306    public void ejbStore()
307    {
308    }
309    
310    public void ejbRemove()
311       throws
312          RemoveException JavaDoc
313    {
314    }
315 }
316
Popular Tags