KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnNodeInterHookBean


1 package hero.entity;
2
3 import hero.interfaces.BnNodeInterHookPK;
4 import hero.interfaces.BnNodeInterHookValue;
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 an Interactive Hook
18  *
19  * @author Miguel Valdes Faura
20  * @version $Revision: 1.5 $
21  *
22  * @ejb:bean name="BnNodeInterHook"
23  * display-name="BnNode Interactive Hook Entity"
24  * type="CMP"
25  * jndi-name="ejb/hero/BnNodeInterHook"
26  * local-jndi-name="ejb/hero/BnNodeInterHook_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="BnNodeInterHook"
38  * jndi-name="ejb/hero/BnNodeInterHook"
39  * lock-policy="container-read-committed"
40  * @jonas.jdbc-mapping
41  * jndi-name="bonita"
42  * jdbc-table-name="BnNodeInterHook"
43  *
44  * @jonas.shared false
45  *
46  * @ejb:finder signature="java.util.Collection findAll()"
47  * query="SELECT object(n) FROM BnNodeInterHook n"
48  * transaction-type="Supports"
49  * @ejb:finder signature="java.util.Collection findByNode(java.lang.String nodeId)" view-type="local"
50  * query="SELECT OBJECT(p) From BnNodeInterHook p Where p.bnNode.id = ?1"
51  * transaction-type="Supports"
52  * @ejb:finder signature="hero.interfaces.BnNodeInterHookLocal findByName(java.lang.String nodeId,java.lang.String name)" view-type="local"
53  * query="SELECT OBJECT(p) From BnNodeInterHook p Where p.bnNode.id = ?1 AND p.name = ?2"
54  * transaction-type="Supports"
55  *
56  *
57  * @ejb.value-object
58  * match="*"
59  * name="BnNodeInterHook"
60  *
61  * @ejb.value-object
62  * match="light"
63  * name="BnNodeInterHookLight"
64  *
65  *
66  * @jboss:table-name table-name="BnNodeInterHook"
67  *
68  * @jboss:create-table create="true"
69  *
70  * @jboss:remove-table remove="false"
71  **/

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

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

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

91    /**
92    * Retrieve the BnNodeInterHook's id.
93    *
94    * @return Returns an int representing the id of this BnNodeInterHook.
95    *
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 Hook's id.
109    *
110    * @param pId The id of this Hook. Is set at creation time.
111    * @ejb:transaction type="Required"
112    **/

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

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

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

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

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

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

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

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

198    public abstract void setType( int hookType );
199
200
201    /**
202    * Retrieve the script value.
203    * @ejb.value-object
204    * match="light"
205    * @return Returns an String.
206    *
207    *
208    * @ejb:interface-method view-type="both"
209    *
210    * @ejb:persistence column-name="script"
211    * @ejb:transaction type="Supports"
212    **/

213    public abstract String JavaDoc getScript();
214    
215    /**
216    * Set the hook script value.
217    * @ejb:interface-method view-type="both"
218    * @param key The script value of this hook.
219    * @ejb:transaction type="Required"
220    **/

221    public abstract void setScript( String JavaDoc script );
222
223
224     /**
225      * @ejb.interface-method
226      * @ejb:transaction type="Supports"
227      */

228     public abstract BnNodeInterHookValue getBnNodeInterHookValue();
229     
230     /**
231      * @ejb.interface-method
232      * @ejb:transaction type="Required"
233      */

234     public abstract void setBnNodeInterHookValue(BnNodeInterHookValue v);
235
236
237
238    // -------------------------------------------------------------------------
239
// Framework Callbacks
240
// -------------------------------------------------------------------------
241

242    /**
243    * Create a Hook based on the supplied Hook Value Object.
244    *
245    *
246    * @throws InvalidValueException If one of the values are not correct,
247    * this will not roll back the transaction
248    * because the caller has the chance to
249    * fix the problem and try again
250    * @throws EJBException If no new unique ID could be retrieved this will
251    * rollback the transaction because there is no
252    * hope to try again
253    * @throws CreateException Because we have to do so (EJB spec.)
254    *
255    * @ejb:create-method view-type="both"
256    **/

257    public BnNodeInterHookPK ejbCreate(BnNodeInterHookValue prp )
258       throws
259          InvalidValueException,
260          EJBException JavaDoc,
261          CreateException JavaDoc
262    {
263        setBnNodeInterHookValue(prp);
264        this.setId(hero.interfaces.BnNodeInterHookUtil.generateGUID(this));
265       // This is only possible in CMPs. Otherwise return a valid PK.
266
return null;
267    }
268
269    /**
270    * Create a Hook based on the supplied parameters.
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 BnNodeInterHookPK ejbCreate(String JavaDoc hookName, String JavaDoc hookEvent, int hookType, String JavaDoc script )
285       throws
286          InvalidValueException,
287          EJBException JavaDoc,
288          CreateException JavaDoc
289    {
290        this.setName(hookName);
291        this.setEvent(hookEvent);
292        this.setType(hookType);
293        this.setScript(script);
294        this.setId(hero.interfaces.BnNodeInterHookUtil.generateGUID(this));
295        
296       // This is only possible in CMPs. Otherwise return a valid PK.
297
return null;
298    }
299
300    public void setEntityContext( EntityContext JavaDoc lContext )
301    {
302       mContext = lContext;
303    }
304    
305    public void unsetEntityContext()
306    {
307       mContext = null;
308    }
309    
310    public void ejbActivate()
311    {
312    }
313    
314    public void ejbPassivate()
315    {
316    }
317    
318    public void ejbLoad()
319    {
320    }
321    
322    public void ejbStore()
323    {
324    }
325    
326    public void ejbRemove()
327       throws
328          RemoveException JavaDoc
329    {
330    }
331
332 }
333
Popular Tags