KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnNodeHookBean


1 package hero.entity;
2
3 import hero.interfaces.BnNodeHookPK;
4 import hero.interfaces.BnNodeHookValue;
5 import hero.interfaces.BnNodeLocal;
6 import hero.interfaces.InvalidValueException;
7 import hero.util.BonitaServiceLocator;
8 import hero.util.BonitaServiceException;
9
10 import javax.ejb.CreateException JavaDoc;
11 import javax.ejb.EJBException JavaDoc;
12 import javax.ejb.EntityBean JavaDoc;
13 import javax.ejb.EntityContext JavaDoc;
14 import javax.ejb.RemoveException JavaDoc;
15
16 /**
17  * The Entity bean represents a BnProjectHook
18  *
19  * @author Oriol Montala
20  * @version $Revision: 1.3 $
21  *
22  * @ejb:bean name="BnNodeHook"
23  * display-name="BnNode Hook Entity"
24  * type="CMP"
25  * jndi-name="ejb/hero/BnNodeHook"
26  * local-jndi-name="ejb/hero/BnNodeHook_L"
27  * view-type="both"
28  * cmp-version="2.x"
29  * reentrant="true"
30  *
31  * @ejb:transaction type="Supports"
32  *
33  *
34  * @ejb.pk generate="true" method-intf="both"
35  *
36  * @jonas.bean
37  * ejb-name="BnNodeHook"
38  * jndi-name="ejb/hero/BnNodeHook"
39  * lock-policy="container-read-committed"
40  * @jonas.jdbc-mapping
41  * jndi-name="bonita"
42  * jdbc-table-name="BnNodeHook"
43  *
44  * @jonas.shared false
45  *
46  * @ejb:finder signature="java.util.Collection findAll()"
47  * query="SELECT object(n) FROM BnNodeHook n"
48  * transaction-type="Supports"
49  *
50  * @ejb:finder signature="java.util.Collection findByNode(java.lang.String nodeId)" view-type="local"
51  * query="SELECT OBJECT(p) From BnNodeHook p Where p.bnNode.id = ?1"
52  * transaction-type="Supports"
53  * @ejb:finder signature="hero.interfaces.NodeHookLocal findByName(java.lang.String nodeId,java.lang.String name)" view-type="local"
54  * query="SELECT OBJECT(p) From BnNodeHook p Where p.bnNode.id = ?1 AND p.name = ?2"
55  * transaction-type="Supports"
56  *
57  *
58  * @ejb.value-object
59  * match="*"
60  * name="BnNodeHook"
61  *
62  * @ejb.value-object
63  * match="light"
64  * name="BnNodeHookLight"
65  *
66  *
67  * @jboss:table-name table-name="BnNodeHook"
68  *
69  * @jboss:create-table create="true"
70  *
71  * @jboss:remove-table remove="false"
72  **/

73 public abstract class BnNodeHookBean
74    implements EntityBean JavaDoc
75 {
76    
77    // -------------------------------------------------------------------------
78
// Members
79
// -------------------------------------------------------------------------
80

81    public EntityContext JavaDoc mContext;
82    
83    // -------------------------------------------------------------------------
84
// Methods
85
// -------------------------------------------------------------------------
86

87
88    // -------------------------------------------------------------------------
89
// Properties (Getters/Setters)
90
// -------------------------------------------------------------------------
91

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

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

114    public abstract void setId( String JavaDoc pId );
115    
116    
117     /** Retrieve the BnNode.
118      *
119      * @return Returns a BnNodeLocal.
120      * @ejb:interface-method view-type="both"
121      * @ejb:relation name="nodehook" role-name="hook-by" cascade-delete="yes"
122      * @jboss:auto-key-fields
123      * @jonas:automatic-pk="true"
124      * @ejb:transaction type="Supports"
125      **/

126     public abstract BnNodeLocal getBnNode();
127     
128     /**
129      * Set the BnNode.
130      *
131      * @ejb:interface-method view-type="local"
132      * @param pNode The BnNode of this Hook.
133      * @ejb:transaction type="Required"
134      **/

135     public abstract void setBnNode( BnNodeLocal pNode );
136
137
138
139    /**
140    * Retrieve the Name value.
141    *
142    * @return Returns an String representing the Hook Name value.
143    * @ejb.value-object
144    * match="light"
145    * @ejb:interface-method view-type="both"
146    *
147    * @ejb:persistence column-name="name"
148    * @ejb:transaction type="Supports"
149    **/

150    public abstract String JavaDoc getName();
151    
152    /**
153    * Set the Name value.
154    * @ejb:interface-method view-type="both"
155    * @param key The Name of this Hook.
156    * @ejb:transaction type="Required"
157    **/

158    public abstract void setName( String JavaDoc hookName );
159
160    /**
161    * Retrieve the Event value.
162    *
163    * @return Returns an String representing the Event value.
164    * @ejb.value-object
165    * match="light"
166    * @ejb:interface-method view-type="both"
167    *
168    * @ejb:persistence column-name="event"
169    * @ejb:transaction type="Supports"
170    **/

171    public abstract String JavaDoc getEvent();
172    
173    /**
174    * Set the Event value.
175    * @ejb:interface-method view-type="both"
176    * @param value The Event value of this Hook.
177    * @ejb:transaction type="Required"
178    **/

179    public abstract void setEvent( String JavaDoc hookEvent );
180
181
182    /**
183    * Retrieve the Type value.
184    *
185    * @return Returns an int representing the Type value.
186    * @ejb.value-object
187    * match="light"
188    * @ejb:interface-method view-type="both"
189    *
190    * @ejb:persistence column-name="type"
191    * @ejb:transaction type="Supports"
192    **/

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

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

207     public abstract BnNodeHookValue getBnNodeHookValue();
208     
209     /**
210      * @ejb.interface-method
211      * @ejb:transaction type="Required"
212      */

213     public abstract void setBnNodeHookValue(BnNodeHookValue v);
214
215
216
217    // -------------------------------------------------------------------------
218
// Framework Callbacks
219
// -------------------------------------------------------------------------
220

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

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

263    public BnNodeHookPK ejbCreate(String JavaDoc hookName, String JavaDoc hookEvent, int hookType)
264       throws
265          InvalidValueException,
266          EJBException JavaDoc,
267          CreateException JavaDoc
268    {
269        this.setName(hookName);
270        this.setEvent(hookEvent);
271        this.setType(hookType);
272        this.setId(hero.interfaces.BnNodeHookUtil.generateGUID(this));
273
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
311    
312    
313 }
314
Popular Tags