KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnProjectInterHookBean


1 package hero.entity;
2
3 import hero.interfaces.BnProjectInterHookPK;
4 import hero.interfaces.BnProjectInterHookValue;
5 import hero.interfaces.BnProjectLocal;
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.6 $
21  *
22  * @ejb:bean name="BnProjectInterHook"
23  * display-name="BnNode Interactive Hook Entity"
24  * type="CMP"
25  * jndi-name="ejb/hero/BnProjectInterHook"
26  * local-jndi-name="ejb/hero/BnProjectInterHook_L"
27  * view-type="both"
28  * cmp-version="2.x"
29  * reentrant="true"
30  *
31  *
32  * @ejb:transaction type="Supports"
33  *
34  *
35  * @ejb.pk generate="true" method-intf="both"
36  *
37  * @jonas.bean
38  * ejb-name="BnProjectInterHook"
39  * jndi-name="ejb/hero/BnProjectInterHook"
40  * lock-policy="container-read-committed"
41  * @jonas.jdbc-mapping
42  * jndi-name="bonita"
43  * jdbc-table-name="BnProjectInterHook"
44  * @jonas.shared false
45  *
46  * @ejb:finder signature="java.util.Collection findAll()"
47  * query="SELECT object(p) FROM BnProjectInterHook p"
48  * transaction-type="Supports"
49  * @ejb:finder signature="java.util.Collection findByProject(java.lang.String projectId)" view-type="local"
50  * query="SELECT OBJECT(p) From BnProjectInterHook p Where p.bnProject.id = ?1"
51  * transaction-type="Supports"
52  * @ejb:finder signature="hero.interfaces.BnProjectInterHookLocal findByName(java.lang.String projectId, java.lang.String name)" view-type="local"
53  * query="SELECT OBJECT(p) From BnProjectInterHook p Where p.bnProject.id = ?1 AND p.name = ?2"
54  * transaction-type="Supports"
55  *
56  *
57  * @ejb.value-object
58  * match="*"
59  * name="BnProjectInterHook"
60  * @ejb.value-object
61  * match="light"
62  * name="BnProjectInterHookLight"
63  *
64  * @jboss:table-name table-name="BnProjectInterHook"
65  *
66  * @jboss:create-table create="true"
67  *
68  * @jboss:remove-table remove="false"
69  **/

70 public abstract class BnProjectInterHookBean
71    implements EntityBean JavaDoc
72 {
73    
74    // -------------------------------------------------------------------------
75
// Members
76
// -------------------------------------------------------------------------
77

78    public EntityContext JavaDoc mContext;
79    
80    // -------------------------------------------------------------------------
81
// Methods
82
// -------------------------------------------------------------------------
83

84
85    // -------------------------------------------------------------------------
86
// Properties (Getters/Setters)
87
// -------------------------------------------------------------------------
88

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

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

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

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

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

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

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

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

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

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

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

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

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

226     public abstract BnProjectInterHookValue getBnProjectInterHookValue();
227     
228     /**
229      * @ejb.interface-method
230      * @ejb:transaction type="Required"
231      */

232     public abstract void setBnProjectInterHookValue(BnProjectInterHookValue v);
233
234
235
236    // -------------------------------------------------------------------------
237
// Framework Callbacks
238
// -------------------------------------------------------------------------
239

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

255    public BnProjectInterHookPK ejbCreate(BnProjectInterHookValue prp )
256       throws
257          InvalidValueException,
258          EJBException JavaDoc,
259          CreateException JavaDoc
260    {
261        setBnProjectInterHookValue(prp);
262        this.setId(hero.interfaces.BnProjectInterHookUtil.generateGUID(this));
263       // This is only possible in CMPs. Otherwise return a valid PK.
264
return null;
265    }
266
267    /**
268    * Create a Hook based on the supplied parameters.
269    *
270    *
271    * @throws InvalidValueException If one of the values are not correct,
272    * this will not roll back the transaction
273    * because the caller has the chance to
274    * fix the problem and try again
275    * @throws EJBException If no new unique ID could be retrieved this will
276    * rollback the transaction because there is no
277    * hope to try again
278    * @throws CreateException Because we have to do so (EJB spec.)
279    *
280    * @ejb:create-method view-type="both"
281    **/

282    public BnProjectInterHookPK ejbCreate(String JavaDoc hookName, String JavaDoc hookEvent, int hookType, String JavaDoc script )
283       throws
284          InvalidValueException,
285          EJBException JavaDoc,
286          CreateException JavaDoc
287    {
288        this.setName(hookName);
289        this.setEvent(hookEvent);
290        this.setType(hookType);
291        this.setScript(script);
292        this.setId(hero.interfaces.BnProjectInterHookUtil.generateGUID(this));
293       // This is only possible in CMPs. Otherwise return a valid PK.
294
return null;
295    }
296
297    public void setEntityContext( EntityContext JavaDoc lContext )
298    {
299       mContext = lContext;
300    }
301    
302    public void unsetEntityContext()
303    {
304       mContext = null;
305    }
306    
307    public void ejbActivate()
308    {
309    }
310    
311    public void ejbPassivate()
312    {
313    }
314    
315    public void ejbLoad()
316    {
317    }
318    
319    public void ejbStore()
320    {
321    }
322    
323    public void ejbRemove()
324       throws
325          RemoveException JavaDoc
326    {
327    }
328    
329 }
330
Popular Tags