KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnProjectHookBean


1 package hero.entity;
2
3 import hero.interfaces.BnProjectHookPK;
4 import hero.interfaces.BnProjectHookValue;
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 a BnProjectHook
18  *
19  * @author Oriol Montala
20  * @version $Revision: 1.3 $
21  *
22  * @ejb:bean name="BnProjectHook"
23  * display-name="BnProject Hook Entity"
24  * type="CMP"
25  * jndi-name="ejb/hero/BnProjectHook"
26  * local-jndi-name="ejb/hero/BnProjectHook_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="BnProjectHook"
38  * jndi-name="ejb/hero/BnProjectHook"
39  * lock-policy="container-read-committed"
40  * @jonas.jdbc-mapping
41  * jndi-name="bonita"
42  * jdbc-table-name="BnProjectHook"
43  *
44  * @jonas.shared false
45  *
46  * @ejb:finder signature="java.util.Collection findAll()"
47  * query="SELECT object(p) FROM BnProjectHook 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 BnProjectHook p Where p.bnProject.id = ?1"
51  * transaction-type="Supports"
52  * @ejb:finder signature="hero.interfaces.BnProjectHookLocal findByName(java.lang.String projectId, java.lang.String name)" view-type="local"
53  * query="SELECT OBJECT(p) From BnProjectHook p Where p.bnProject.id = ?1 AND p.name = ?2"
54  * transaction-type="Supports"
55  *
56  * @ejb.value-object
57  * match="*"
58  * name="BnProjectHook"
59  *
60  * @ejb.value-object
61  * match="light"
62  * name="BnProjectHookLight"
63  *
64  * @jboss:table-name table-name="BnProjectHook"
65  *
66  * @jboss:create-table create="true"
67  *
68  * @jboss:remove-table remove="false"
69  **/

70 public abstract class BnProjectHookBean
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 BnProjectProperty's id.
91    *
92    * @return Returns an int representing the id of this BnProjectProperty.
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 Property's id.
107    *
108    * @param pId The id of this Property. Is set at creation time.
109    * @ejb:transaction type="Required"
110    **/

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

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

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

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

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

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

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

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

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

205     public abstract BnProjectHookValue getBnProjectHookValue();
206     
207     /**
208      * @ejb.interface-method
209      * @ejb:transaction type="Required"
210      */

211     public abstract void setBnProjectHookValue(BnProjectHookValue v);
212
213
214
215    // -------------------------------------------------------------------------
216
// Framework Callbacks
217
// -------------------------------------------------------------------------
218

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

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

262    public BnProjectHookPK ejbCreate(String JavaDoc hookName, String JavaDoc hookEvent, int hookType )
263       throws
264          InvalidValueException,
265          EJBException JavaDoc,
266          CreateException JavaDoc
267    {
268        this.setName(hookName);
269        this.setEvent(hookEvent);
270        this.setType(hookType);
271        this.setId(hero.interfaces.BnProjectHookUtil.generateGUID(this));
272
273       // This is only possible in CMPs. Otherwise return a valid PK.
274
return null;
275    }
276
277    public void setEntityContext( EntityContext JavaDoc lContext )
278    {
279       mContext = lContext;
280    }
281    
282    public void unsetEntityContext()
283    {
284       mContext = null;
285    }
286    
287    public void ejbActivate()
288    {
289    }
290    
291    public void ejbPassivate()
292    {
293    }
294    
295    public void ejbLoad()
296    {
297    }
298    
299    public void ejbStore()
300    {
301    }
302    
303    public void ejbRemove()
304       throws
305          RemoveException JavaDoc
306    {
307    }
308    
309 }
310
Popular Tags