KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnRoleMapperBean


1 /**
2  *
3  * Bonita
4  * Copyright (C) 1999 Bull S.A.
5  * Bull 68 route de versailles 78434 Louveciennes Cedex France
6  * Further information: bonita@objectweb.org
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21  * USA
22  *
23  *
24 --------------------------------------------------------------------------
25  * $Id: BnRoleMapperBean.java,v 1.4 2005/03/18 15:11:42 mvaldes Exp $
26  *
27 --------------------------------------------------------------------------
28  */

29
30 package hero.entity;
31
32 import hero.interfaces.BnRoleMapperPK;
33 import hero.interfaces.BnRoleMapperValue;
34 import hero.interfaces.BnRoleLocal;
35 import hero.interfaces.InvalidValueException;
36 import hero.util.BonitaServiceLocator;
37 import hero.util.BonitaServiceException;
38
39 import javax.ejb.CreateException JavaDoc;
40 import javax.ejb.EJBException JavaDoc;
41 import javax.ejb.EntityBean JavaDoc;
42 import javax.ejb.EntityContext JavaDoc;
43 import javax.ejb.RemoveException JavaDoc;
44
45 /**
46  * The Entity bean represents a BnRoleMapper
47  *
48  * @author Marc Blachon
49  * @version $Revision: 1.4 $
50  *
51  * @ejb:bean name="BnRoleMapper"
52  * display-name="BnRole Mapper Entity"
53  * type="CMP"
54  * jndi-name="ejb/hero/BnRoleMapper"
55  * local-jndi-name="ejb/hero/BnRoleMapper_L"
56  * view-type="both"
57  * cmp-version="2.x"
58  * reentrant="true"
59  *
60  * @ejb:transaction type="Supports"
61  *
62  *
63  * @ejb.pk generate="true" method-intf="both"
64  *
65  * @jonas.bean
66  * ejb-name="BnRoleMapper"
67  * jndi-name="ejb/hero/BnRoleMapper"
68  * lock-policy="container-read-committed"
69  * @jonas.jdbc-mapping
70  * jndi-name="bonita"
71  * jdbc-table-name="BnRoleMapper"
72  *
73  * @jonas.shared false
74  *
75  * @ejb:finder signature="java.util.Collection findAll()"
76  * query="SELECT object(n) FROM BnRoleMapper n"
77  * transaction-type="Supports"
78  *
79  * @ejb:finder signature="java.util.Collection findByRole(java.lang.String RoleId)" view-type="local"
80  * query="SELECT OBJECT(p) From BnRoleMapper p Where p.bnRole.id = ?1"
81  * transaction-type="Supports"
82  *
83  * @ejb:finder signature="hero.interfaces.RoleMapperLocal findByName(java.lang.String name)" view-type="local"
84  * query="SELECT OBJECT(p) From BnRoleMapper p Where p.name = ?1"
85  * transaction-type="Supports"
86  *
87  *
88  * @ejb.value-object
89  * match="*"
90  * name="BnRoleMapper"
91  *
92  * @jboss:table-name table-name="BnRoleMapper"
93  *
94  * @jboss:create-table create="true"
95  *
96  * @jboss:remove-table remove="false"
97  **/

98 public abstract class BnRoleMapperBean
99    implements EntityBean JavaDoc
100 {
101    
102    // -------------------------------------------------------------------------
103
// Members
104
// -------------------------------------------------------------------------
105

106    public EntityContext JavaDoc mContext;
107    
108    // -------------------------------------------------------------------------
109
// Methods
110
// -------------------------------------------------------------------------
111

112
113    // -------------------------------------------------------------------------
114
// Properties (Getters/Setters)
115
// -------------------------------------------------------------------------
116

117    /**
118    * Retrieve the BnRoleMapper's id.
119    *
120    * @return Returns an int representing the id of this BnRoleMapper.
121    *
122    * @ejb:pk-field
123    *
124    * @ejb:persistence column-name="id"
125    * @jonas.cmp-field-jdbc-mapping
126    * field-name="id"
127    * jdbc-field-name="id"
128    * @ejb:transaction type="Supports"
129    **/

130    public abstract String JavaDoc getId();
131    
132    /**
133    * Set the Mapper's id.
134    *
135    * @param pId The id of this Mapper. Is set at creation time.
136    * @ejb:transaction type="Required"
137    **/

138    public abstract void setId( String JavaDoc pId );
139    
140    
141    /** Retrieve the role associated with the mapper.
142     *
143     * @return Returns a String representing the Name of the role.
144     * @ejb:interface-method view-type="both"
145     * @ejb:relation name="mapper-role" role-name="mapper2role" cascade-delete="yes"
146     * @jboss:auto-key-fields
147     * @jonas:automatic-pk="true"
148     * @ejb:transaction type="Supports"
149     *
150     *
151     **/

152     public abstract BnRoleLocal getBnRole();
153     
154    
155     /**
156      * Set the BnRole.
157      *
158      * @ejb:interface-method view-type="local"
159      * @param pRole The BnRole of this Mapper.
160      * @ejb:transaction type="Required"
161      **/

162     public abstract void setBnRole( BnRoleLocal pRole );
163
164    /**
165    * Retrieve the Name value.
166    *
167    * @return Returns an String representing the Mapper Name value.
168    *
169    * @ejb:interface-method view-type="both"
170    *
171    * @ejb:persistence column-name="name"
172    * @ejb:transaction type="Supports"
173    **/

174    public abstract String JavaDoc getName();
175    
176    /**
177    * Set the Name value.
178    * @ejb:interface-method view-type="both"
179    * @param key The Name of this Mapper.
180    * @ejb:transaction type="Required"
181    **/

182    public abstract void setName( String JavaDoc mapperName );
183
184
185    /**
186    * Retrieve the Type value.
187    *
188    * @return Returns an int representing the Type value.
189    *
190    * @ejb:interface-method view-type="both"
191    *
192    * @ejb:persistence column-name="type"
193    * @ejb:transaction type="Supports"
194    **/

195    public abstract int getType();
196    
197    /**
198    * Set the Type value.
199    * @ejb:interface-method view-type="both"
200    * @param value The Type value of this Mapper.
201    * @ejb:transaction type="Required"
202    **/

203    public abstract void setType( int mapperType );
204
205     /**
206      * @ejb.interface-method
207      * @ejb:transaction type="Supports"
208      */

209     public abstract BnRoleMapperValue getBnRoleMapperValue();
210     
211     /**
212      * @ejb.interface-method
213      * @ejb:transaction type="Required"
214      */

215     public abstract void setBnRoleMapperValue(BnRoleMapperValue v);
216
217
218
219    // -------------------------------------------------------------------------
220
// Framework Callbacks
221
// -------------------------------------------------------------------------
222

223    /**
224    * Create a Mapper based on the supplied Mapper Value Object.
225    *
226    *
227    * @throws InvalidValueException If one of the values are not correct,
228    * this will not roll back the transaction
229    * because the caller has the chance to
230    * fix the problem and try again
231    * @throws EJBException If no new unique ID could be retrieved this will
232    * rollback the transaction because there is no
233    * hope to try again
234    * @throws CreateException Because we have to do so (EJB spec.)
235    *
236    * @ejb:create-method view-type="both"
237    **/

238    public BnRoleMapperPK ejbCreate(BnRoleMapperValue prp )
239       throws
240          InvalidValueException,
241          EJBException JavaDoc,
242          CreateException JavaDoc
243    {
244        setBnRoleMapperValue(prp);
245        this.setId(hero.interfaces.BnRoleMapperUtil.generateGUID(this));
246       // This is only possible in CMPs. Otherwise return a valid PK.
247
return null;
248    }
249
250    /**
251    * Create a Mapper based on the supplied parameters.
252    *
253    *
254    * @throws InvalidValueException If one of the values are not correct,
255    * this will not roll back the transaction
256    * because the caller has the chance to
257    * fix the problem and try again
258    * @throws EJBException If no new unique ID could be retrieved this will
259    * rollback the transaction because there is no
260    * hope to try again
261    * @throws CreateException Because we have to do so (EJB spec.)
262    *
263    * @ejb:create-method view-type="both"
264    **/

265    public BnRoleMapperPK ejbCreate(String JavaDoc mapperName, int mapperType)
266       throws
267          InvalidValueException,
268          EJBException JavaDoc,
269          CreateException JavaDoc
270    {
271        this.setName(mapperName);
272        this.setType(mapperType);
273        this.setId(hero.interfaces.BnRoleMapperUtil.generateGUID(this));
274       // This is only possible in CMPs. Otherwise return a valid PK.
275
return null;
276    }
277
278    public void setEntityContext( EntityContext JavaDoc lContext )
279    {
280       mContext = lContext;
281    }
282    
283    public void unsetEntityContext()
284    {
285       mContext = null;
286    }
287    
288    public void ejbActivate()
289    {
290    }
291    
292    public void ejbPassivate()
293    {
294    }
295    
296    public void ejbLoad()
297    {
298    }
299    
300    public void ejbStore()
301    {
302    }
303    
304    public void ejbRemove()
305       throws
306          RemoveException JavaDoc
307    {
308    }
309 }
310
Popular Tags