KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnEdgeBean


1 package hero.entity;
2
3 import hero.interfaces.BnEdgePK;
4 import hero.interfaces.BnEdgeValue;
5 import hero.interfaces.BnEdgeLightValue;
6 import hero.interfaces.BnNodeLocal;
7 import hero.interfaces.BnProjectLocal;
8 import hero.interfaces.InvalidValueException;
9 import hero.util.BonitaServiceLocator;
10 import hero.util.BonitaServiceException;
11
12 import java.sql.Date 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 BnEdge
22  *
23  * @author François Charoy
24  * @version $Revision: 1.6 $
25  *
26  * @ejb:bean name="BnEdge"
27  * display-name="BnEdge Entity"
28  * type="CMP"
29  * jndi-name="ejb/hero/BnEdge"
30  * local-jndi-name="ejb/hero/BnEdge_L"
31  * view-type="both"
32  * cmp-version="2.x"
33  * reentrant="true"
34  *
35  *
36  * @ejb:transaction type="Supports"
37  *
38  * @jonas.bean
39  * ejb-name="BnEdge"
40  * jndi-name="ejb/hero/BnEdge"
41  * lock-policy="container-read-committed"
42  *
43  * @jonas.jdbc-mapping
44  * jndi-name="bonita"
45  * jdbc-table-name="BnEdge"
46  *
47  * @jonas.shared false
48  *
49  * @ejb:finder signature="java.util.Collection findAll()"
50  * query="SELECT object(a) FROM BnEdge a"
51  * transaction-type="Supports"
52  *
53  * @ejb:finder signature="hero.interfaces.BnEdge findByName(java.lang.String pName, java.lang.String projectId )" view-type="both" result-type-mapping="Remote"
54  * query="SELECT OBJECT(n) FROM BnEdge n WHERE n.name = ?1 AND n.bnProject.id = ?2"
55  * transaction-type="Supports"
56  * @ejb:finder signature="hero.interfaces.BnEdgeLocal findByName(java.lang.String pName, java.lang.String projectId )" view-type="both" result-type-mapping="Local"
57  * query="SELECT OBJECT(e) FROM BnEdge e WHERE e.name = ?1 AND e.bnProject.id = ?2"
58  * transaction-type="Supports"
59  *
60  * @ejb.value-object
61  * match="*"
62  * name="BnEdge"
63  *
64   * @ejb.value-object
65  * match="light"
66  * name="BnEdgeLight"
67  *
68  *
69  * @jboss:table-name table-name="BnEdge"
70  *
71  * @jboss:create-table create="true"
72  *
73  * @jboss:remove-table remove="false"
74  *
75  **/

76 public abstract class BnEdgeBean
77    implements EntityBean JavaDoc
78 {
79    
80    // -------------------------------------------------------------------------
81
// Members
82
// -------------------------------------------------------------------------
83

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

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

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

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

129    public abstract String JavaDoc getName();
130    
131    /**
132    * Set the BnEdge's name.
133    *
134    * @param pName The name of this BnEdge. Is set at creation time.
135    * @ejb:transaction type="Required"
136   **/

137    public abstract void setName( String JavaDoc pName );
138
139     /**
140      * @return the project of the BnEdge
141      * @ejb:interface-method view-type="local"
142      * @ejb:relation name="Edges" role-name="is-edge-of" target-ejb="BnProject" cascade-delete="yes"
143      * @jboss:auto-key-fields
144      * @jonas:automatic-pk="true"
145      * @ejb:transaction type="Supports"
146      *
147      **/

148     public abstract BnProjectLocal getBnProject();
149     
150     /**
151      * Set the BnProject Name.
152      *
153      * @param pName The Name of this BnEdge. Is set at creation time.
154      * @ejb:interface-method view-type="local"
155      * @ejb:transaction type="Required"
156      **/

157     public abstract void setBnProject(BnProjectLocal pProject);
158     
159     /**
160      * @ejb.value-object
161      * match="light"
162      * @return the state of the BnEdge
163      * @ejb:interface-method view-type="local"
164      * @ejb:persistence column-name="state"
165      * @ejb:transaction type="Supports"
166      *
167      **/

168     public abstract int getState();
169     
170     /**
171      * Set the State value.
172      *
173      * @param pstate The new state of this BnEdge.
174      * @ejb:interface-method view-type="local"
175      * @ejb:transaction type="Required"
176      **/

177     public abstract void setState(int state);
178
179     /**
180      * @ejb.value-object
181      * match="light"
182      * @return the condition of the BnEdge
183      * @ejb:interface-method view-type="local"
184      * @ejb:persistence column-name="condition"
185      * @ejb:transaction type="Supports"
186      *
187      **/

188     public abstract String JavaDoc getCondition();
189     
190     /**
191      * Set the Condition value.
192      *
193      * @param condition The new state of this BnEdge.
194      * @ejb:interface-method view-type="local"
195      * @ejb:transaction type="Required"
196      **/

197     public abstract void setCondition(String JavaDoc condition);
198
199     /**
200      * @return the In BnNode of the BnEdge
201      * @ejb:interface-method view-type="local"
202      * @ejb:relation name="InBnNode" role-name="has-node-in" target-ejb="BnNode" cascade-delete="yes"
203      * @ejb:value-object match="*"
204      * relation="external"
205      * aggregate="hero.interfaces.BnNodeValue"
206      * aggregate-name="InBnNode"
207      * @jboss:auto-key-fields
208      * @ejb:transaction type="Supports"
209      *
210      * @jonas.ejb-relation
211      * pk-composite="true"
212      * ejb-relation-name="InBnNode"
213      * ejb-relationship-role-name1="has-node-in"
214      * foreign-key-jdbc-name1="fk_innode"
215      **/

216     public abstract BnNodeLocal getInBnNode();
217     
218    /**
219    * Set the BnProject Name.
220    *
221    * @param pNode The Name of this BnEdge. Is set at creation time.
222    * @ejb:interface-method view-type="local"
223    * @ejb:transaction type="Required"
224    **/

225     public abstract void setInBnNode(BnNodeLocal pNode);
226
227     /**
228      * @return the Out BnNode of the BnEdge
229      * @ejb:interface-method view-type="local"
230      * @ejb:relation name="OutBnNode" role-name="has-node-out" target-ejb="BnNode" cascade-delete="yes"
231      * @ejb:value-object match="*"
232      * relation="external"
233      * aggregate="hero.interfaces.BnNodeValue"
234      * aggregate-name="OutBnNode"
235      * @jboss:auto-key-fields
236      * @ejb:transaction type="Supports"
237      *
238      **/

239     public abstract BnNodeLocal getOutBnNode();
240
241    /**
242    * Set the BnProject Name.
243    *
244    * @param pNode The Name of this BnEdge. Is set at creation time.
245    * @ejb:interface-method view-type="local"
246    * @ejb:transaction type="Required"
247    **/

248     public abstract void setOutBnNode(BnNodeLocal pNode);
249     /**
250      * @return Return the creation date of the BnEdge
251      * @ejb:interface-method view-type="both"
252      * @ejb:persistence column-name="creationdate"
253      * @ejb:transaction type="Supports"
254      *
255      **/

256
257     public abstract Date JavaDoc getCreationDate();
258
259     /**
260      * @param pDate the creation date of the BnEdge
261      * @ejb:interface-method view-type="both"
262      * @ejb:transaction type="Required"
263      *
264      **/

265     public abstract void setCreationDate(Date JavaDoc pDate);
266
267     /**
268      * @ejb.value-object
269      * match="light"
270      * @return Return the modification date of the BnEdge
271      * @ejb:interface-method view-type="both"
272      * @ejb:persistence column-name="modificationdate"
273      * @ejb:transaction type="Supports"
274      *
275      **/

276     public abstract Date JavaDoc getModificationDate();
277
278     /**
279      * @param pDate the creation date of the BnEdge
280      * @ejb:interface-method view-type="both"
281      * @ejb:transaction type="Required"
282      *
283      **/

284     public abstract void setModificationDate(Date JavaDoc pDate);
285
286     /**
287      * @ejb.interface-method
288      * @ejb:transaction type="Supports"
289      */

290     public abstract BnEdgeValue getBnEdgeValue();
291     
292     /**
293      * @ejb.interface-method
294      * @ejb:transaction type="Required"
295      */

296     public abstract void setBnEdgeValue(BnEdgeValue v);
297     
298     /**
299       * @ejb.interface-method
300       * @ejb:transaction type="Supports"
301       */

302      public abstract BnEdgeLightValue getBnEdgeLightValue();
303     
304      /**
305       * @ejb.interface-method
306       * @ejb:transaction type="Required"
307       */

308      public abstract void setBnEdgeLightValue(BnEdgeLightValue v);
309    
310    // -------------------------------------------------------------------------
311
// Framework Callbacks
312
// -------------------------------------------------------------------------
313

314    /**
315    * Create a BnEdge based on the supplied BnEdge Value Object.
316    *
317    *
318    * @throws InvalidValueException If one of the values are not correct,
319    * this will not roll back the transaction
320    * because the caller has the chance to
321    * fix the problem and try again
322    * @throws EJBException If no new unique ID could be retrieved this will
323    * rollback the transaction because there is no
324    * hope to try again
325    * @throws CreateException Because we have to do so (EJB spec.)
326    *
327    * @ejb:create-method view-type="both"
328    **/

329    public BnEdgePK ejbCreate()
330       throws
331          InvalidValueException,
332          EJBException JavaDoc,
333          CreateException JavaDoc
334    {
335     this.setId(hero.interfaces.BnEdgeUtil.generateGUID(this));
336     this.setName("edge"+this.getId());
337     return null;
338    }
339
340    /**
341    * Create a BnEdge based on the supplied BnEdge Value Object. (c'est merdique)
342    *
343    *
344    * @throws InvalidValueException If one of the values are not correct,
345    * this will not roll back the transaction
346    * because the caller has the chance to
347    * fix the problem and try again
348    * @throws EJBException If no new unique ID could be retrieved this will
349    * rollback the transaction because there is no
350    * hope to try again
351    * @throws CreateException Because we have to do so (EJB spec.)
352    *
353    * @ejb:create-method view-type="both"
354    **/

355    public BnEdgePK ejbCreate(BnEdgeValue pEdge)
356       throws
357          CreateException JavaDoc
358    {
359        this.setBnEdgeValue(pEdge);
360        this.setId(hero.interfaces.BnEdgeUtil.generateGUID(this));
361
362        return null;
363    }
364
365    
366    public void ejbPostCreate( )
367    {
368    }
369    
370    public void setEntityContext( EntityContext JavaDoc lContext )
371    {
372       mContext = lContext;
373    }
374    
375    public void unsetEntityContext()
376    {
377       mContext = null;
378    }
379    
380    public void ejbActivate()
381    {
382    }
383    
384    public void ejbPassivate()
385    {
386    }
387    
388    public void ejbLoad()
389    {
390    }
391    
392    public void ejbStore()
393    {
394    }
395    
396    public void ejbRemove()
397       throws
398          RemoveException JavaDoc
399    {
400    }
401
402 }
403
Popular Tags