KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnIterationBean


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: BnIterationBean.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.BnProjectLocal;
33 import hero.interfaces.BnIterationPK;
34 import hero.interfaces.BnIterationValue;
35 import hero.interfaces.BnIterationLightValue;
36 import hero.interfaces.InvalidValueException;
37 import hero.util.BonitaServiceLocator;
38 import hero.util.BonitaServiceException;
39
40 import javax.ejb.CreateException JavaDoc;
41 import javax.ejb.EJBException JavaDoc;
42 import javax.ejb.EntityBean JavaDoc;
43 import javax.ejb.EntityContext JavaDoc;
44 import javax.ejb.RemoveException JavaDoc;
45
46
47  /**
48  * The Entity bean represents a BnIteration
49  *
50  * @ejb:bean name="BnIteration"
51  * display-name="Iteration"
52  * type="CMP"
53  * jndi-name="ejb/hero/BnIteration"
54  * local-jndi-name="ejb/hero/BnIteration_L"
55  * view-type="both"
56  * cmp-version="2.x"
57  * reentrant="true"
58  *
59  * @ejb:transaction type="Supports"
60  *
61  *
62  * @ejb.pk generate="true" method-intf="both"
63  *
64  * @jonas.bean
65  * ejb-name="BnIteration"
66  * jndi-name="ejb/hero/BnIteration"
67  * lock-policy="container-read-committed"
68  * @jonas.jdbc-mapping
69  * jndi-name="bonita"
70  * jdbc-table-name="BnIteration"
71  *
72  * @jonas.shared false
73  *
74  * @ejb:finder signature="java.util.Collection findAll()"
75  * query="SELECT object(p) FROM BnIteration p"
76  * transaction-type="Supports"
77  * @ejb:finder signature="java.util.Collection findByProject(java.lang.String projectId)" view-type="local"
78  * query="SELECT OBJECT(p) From BnIteration p Where p.bnProject.id = ?1"
79  * transaction-type="Supports"
80  *
81  * @ejb:finder signature="hero.interfaces.BnIterationLocal findByFromTo(java.lang.String from, java.lang.String to, java.lang.String projectId)" view-type="local"
82  * query="SELECT OBJECT(p) From BnIteration p Where p.bnProject.id = ?3 AND p.fromNode=?1 AND p.toNode=?2"
83  * transaction-type="Supports"
84  *
85  * @ejb:finder signature="hero.interfaces.BnIterationLocal findByFrom(java.lang.String projectId, java.lang.String from)" view-type="local"
86  * query="SELECT OBJECT(p) From BnIteration p Where p.bnProject.id = ?1 AND p.fromNode=?2"
87  * transaction-type="Supports"
88  *
89  * @ejb:finder signature="hero.interfaces.BnIterationLocal findByTo(java.lang.String projectId, java.lang.String to)" view-type="local"
90  * query="SELECT OBJECT(p) From BnIteration p Where p.bnProject.id = ?1 AND p.toNode=?2"
91  * transaction-type="Supports"
92  *
93  *
94  * @ejb.value-object
95  * match="*"
96  * name="BnIteration"
97  *
98  * @ejb.value-object
99  * match="light"
100  * name="BnIterationLight"
101  *
102  *
103  * @jboss:table-name table-name="BnIteration"
104  *
105  * @jboss:create-table create="true"
106  *
107  * @jboss:remove-table remove="false"
108  **/

109 public abstract class BnIterationBean
110    implements EntityBean JavaDoc
111 {
112    
113    // -------------------------------------------------------------------------
114
// Members
115
// -------------------------------------------------------------------------
116

117    public EntityContext JavaDoc mContext;
118    
119    // -------------------------------------------------------------------------
120
// Methods
121
// -------------------------------------------------------------------------
122

123
124    // -------------------------------------------------------------------------
125
// Properties (Getters/Setters)
126
// -------------------------------------------------------------------------
127

128    /**
129    * Retrieve the BnIteration id.
130    *
131    * @return Returns an int representing the id of this BnIteration.
132    *
133    * @ejb:pk-field
134    * @ejb.value-object
135    * match="light"
136    * @ejb:persistence column-name="id"
137    * @jonas.cmp-field-jdbc-mapping
138    * field-name="id"
139    * jdbc-field-name="id"
140    * @ejb:transaction type="Supports"
141    **/

142    public abstract String JavaDoc getId();
143    
144    /**
145    * Set the Iteration id.
146    *
147    * @param pId The id of this NodeIteration. Is set at creation time.
148    * @ejb:transaction type="Required"
149    **/

150    public abstract void setId( String JavaDoc pId );
151    
152
153     /** Retrieve the BnProject.
154      *
155      * @return Returns a BnProjectLocal.
156      * @ejb:interface-method view-type="both"
157      * @ejb:relation name="projectIte" role-name="iteration-by" cascade-delete="yes"
158      * @jboss:auto-key-fields
159      * @jonas:automatic-pk="true"
160      * @ejb:transaction type="Supports"
161      **/

162     public abstract BnProjectLocal getBnProject();
163     
164     /**
165      * Set the BnProject.
166      *
167      * @ejb:interface-method view-type="local"
168      * @param pProject The BnProject of this Property.
169      * @ejb:transaction type="Required"
170      **/

171     public abstract void setBnProject( BnProjectLocal pProject );
172
173
174    /**
175    * Retrieve the from node.
176    *
177    * @return Returns an String representing the from node value of this Iteration.
178    * @ejb.value-object
179    * match="light"
180    * @ejb:interface-method view-type="both"
181    *
182    * @ejb:persistence column-name="fromnode"
183    * @ejb:transaction type="Supports"
184    **/

185    public abstract String JavaDoc getFromNode();
186    
187    /**
188    * Set the from node value.
189    * @ejb:interface-method view-type="both"
190    * @param from The from node of this Iteration.
191    * @ejb:transaction type="Required"
192    **/

193    public abstract void setFromNode( String JavaDoc from );
194
195    /**
196    * Retrieve the to node.
197    *
198    * @return Returns an String representing the to node value of this Iteration.
199    * @ejb.value-object
200    * match="light"
201    * @ejb:interface-method view-type="both"
202    *
203    * @ejb:persistence column-name="tonode"
204    * @ejb:transaction type="Supports"
205    **/

206    public abstract String JavaDoc getToNode();
207    
208    /**
209    * Set the to node value.
210    * @ejb:interface-method view-type="both"
211    * @param to The to node value of this Iteration.
212    * @ejb:transaction type="Required"
213    **/

214    public abstract void setToNode( String JavaDoc to );
215    
216    /**
217    * Retrieve the condition value.
218    *
219    * @return Returns an String representing the condition value of this Iteration.
220    * @ejb.value-object
221    * match="light"
222    * @ejb:interface-method view-type="both"
223    *
224    * @ejb:persistence column-name="condition"
225    * @ejb:transaction type="Supports"
226    **/

227    public abstract String JavaDoc getCondition();
228    
229    /**
230    * Set the condition value.
231    * @ejb:interface-method view-type="both"
232    * @param condition The condition value of this Iteration.
233    * @ejb:transaction type="Required"
234    **/

235    public abstract void setCondition( String JavaDoc condition );
236
237     /**
238      * @ejb.interface-method
239      * @ejb:transaction type="Supports"
240      */

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

247     public abstract BnIterationLightValue getBnIterationLightValue();
248     
249     
250     /**
251      * @ejb.interface-method
252      * @ejb:transaction type="Required"
253      */

254     public abstract void setBnIterationValue(BnIterationValue v);
255     
256     /**
257      * @ejb.interface-method
258      * @ejb:transaction type="Required"
259      */

260     public abstract void setBnIterationLightValue(BnIterationLightValue v);
261
262
263
264
265    // -------------------------------------------------------------------------
266
// Framework Callbacks
267
// -------------------------------------------------------------------------
268

269    /**
270    * Create a NodeIteration based on the supplied Property Value Object.
271    *
272    *
273    * @throws InvalidValueException If one of the values are not correct,
274    * this will not roll back the transaction
275    * because the caller has the chance to
276    * fix the problem and try again
277    * @throws EJBException If no new unique ID could be retrieved this will
278    * rollback the transaction because there is no
279    * hope to try again
280    * @throws CreateException Because we have to do so (EJB spec.)
281    *
282    * @ejb:create-method view-type="both"
283    **/

284    public BnIterationPK ejbCreate(BnIterationLightValue nd )
285       throws
286          InvalidValueException,
287          EJBException JavaDoc,
288          CreateException JavaDoc
289    {
290        setBnIterationLightValue(nd);
291        this.setId(hero.interfaces.BnIterationUtil.generateGUID(this));
292       // This is only possible in CMPs. Otherwise return a valid PK.
293
return null;
294    }
295
296    /**
297    * Create a NodeIteration based on the supplied key and value.
298    *
299    *
300    * @throws InvalidValueException If one of the values are not correct,
301    * this will not roll back the transaction
302    * because the caller has the chance to
303    * fix the problem and try again
304    * @throws EJBException If no new unique ID could be retrieved this will
305    * rollback the transaction because there is no
306    * hope to try again
307    * @throws CreateException Because we have to do so (EJB spec.)
308    *
309    * @ejb:create-method view-type="both"
310    **/

311    public BnIterationPK ejbCreate(String JavaDoc from, String JavaDoc to, String JavaDoc condition)
312       throws
313          InvalidValueException,
314          EJBException JavaDoc,
315          CreateException JavaDoc
316    {
317        this.setFromNode(from);
318        this.setToNode(to);
319        this.setCondition(condition);
320        this.setId(hero.interfaces.BnIterationUtil.generateGUID(this));
321
322       // This is only possible in CMPs. Otherwise return a valid PK.
323
return null;
324    }
325
326    public void setEntityContext( EntityContext JavaDoc lContext )
327    {
328       mContext = lContext;
329    }
330    
331    public void unsetEntityContext()
332    {
333       mContext = null;
334    }
335    
336    public void ejbActivate()
337    {
338    }
339    
340    public void ejbPassivate()
341    {
342    }
343    
344    public void ejbLoad()
345    {
346    }
347    
348    public void ejbStore()
349    {
350    }
351    
352    public void ejbRemove()
353       throws
354          RemoveException JavaDoc
355    {
356    }
357    
358 }
359
Popular Tags