KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnProjectPropertyBean


1 package hero.entity;
2
3 import hero.interfaces.BnProjectLocal;
4 import hero.interfaces.BnProjectPropertyPK;
5 import hero.interfaces.BnProjectPropertyValue;
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 import java.util.Collection JavaDoc;
17
18 /**
19  * The Entity bean represents a BnProjectProperty
20  *
21  * @author Oriol Montala
22  * @version $Revision: 1.4 $
23  *
24  * @ejb:bean name="BnProjectProperty"
25  * display-name="Property Entity"
26  * type="CMP"
27  * jndi-name="ejb/hero/BnProjectProperty"
28  * local-jndi-name="ejb/hero/BnProjectProperty_L"
29  * view-type="both"
30  * cmp-version="2.x"
31  * reentrant="true"
32  *
33  *
34  * @ejb:transaction type="Supports"
35  *
36  *
37  * @ejb.pk generate="true" method-intf="both"
38  *
39  * @jonas.bean
40  * ejb-name="BnProjectProperty"
41  * jndi-name="ejb/hero/BnProjectProperty"
42  * lock-policy="container-read-committed"
43  * @jonas.jdbc-mapping
44  * jndi-name="bonita"
45  * jdbc-table-name="BnProjectProperty"
46  *
47  * @jonas.shared false
48  *
49  * @ejb:finder signature="java.util.Collection findAll()"
50  * query="SELECT object(p) FROM BnProjectProperty p"
51  * transaction-type="Supports"
52  * @ejb:finder signature="java.util.Collection findByProject(java.lang.String projectId)" view-type="local"
53  * query="SELECT OBJECT(p) From BnProjectProperty p Where p.bnProject.id = ?1"
54  * transaction-type="Supports"
55  * @ejb:finder signature="java.util.Collection findByTheKey(java.lang.String projectId, java.lang.String pkey)" view-type="local"
56  * query="SELECT OBJECT(p) From BnProjectProperty p Where p.bnProject.id = ?1 AND p.theKey=?2"
57  * transaction-type="Supports"
58  *
59  *
60  *
61  * @ejb.value-object
62  * match="*"
63  * name="BnProjectProperty"
64  *
65  * @ejb.value-object
66  * match="light"
67  * name="BnProjectPropertyLight"
68  *
69  *
70  * @jboss:table-name table-name="BnProjectProperty"
71  *
72  * @jboss:create-table create="true"
73  *
74  * @jboss:remove-table remove="false"
75  **/

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

84    public EntityContext JavaDoc mContext;
85    
86    // -------------------------------------------------------------------------
87
// Methods
88
// -------------------------------------------------------------------------
89

90
91    // -------------------------------------------------------------------------
92
// Properties (Getters/Setters)
93
// -------------------------------------------------------------------------
94

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

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

117    public abstract void setId( String JavaDoc pId );
118    
119
120     
121     /** Retrieve the BnProject.
122      *
123      * @return Returns a BnProjectLocal.
124      * @ejb:interface-method view-type="both"
125      * @ejb:relation name="projectprp" role-name="property-by" cascade-delete="yes"
126      * @jboss:auto-key-fields
127      * @jonas:automatic-pk="true"
128      * @ejb:transaction type="Supports"
129      **/

130     public abstract BnProjectLocal getBnProject();
131     
132     /**
133      * Set the BnProject.
134      *
135      * @ejb:interface-method view-type="local"
136      * @param pProject The BnProject of this Property.
137      * @ejb:transaction type="Required"
138      **/

139     public abstract void setBnProject( BnProjectLocal pProject );
140
141    /**
142    * Retrieve the Key value.
143    *
144    * @return Returns an String representing the Key value of this Property.
145    * @ejb.value-object
146    * match="light"
147    * @ejb:interface-method view-type="both"
148    *
149    * @ejb:persistence column-name="thekey"
150    * @ejb:transaction type="Supports"
151    **/

152    public abstract String JavaDoc getTheKey();
153    
154    /**
155    * Set the key value.
156    * @ejb:interface-method view-type="both"
157    * @param key The Key of this Property.
158    * @ejb:transaction type="Required"
159    **/

160    public abstract void setTheKey( String JavaDoc key );
161
162    /**
163    * Retrieve the Value value.
164    *
165    * @return Returns an String representing the Value value of this Property.
166    * @ejb.value-object
167    * match="light"
168    * @ejb:interface-method view-type="both"
169    *
170    * @ejb:persistence column-name="thevalue"
171    * @ejb:transaction type="Supports"
172    **/

173    public abstract String JavaDoc getTheValue();
174    
175    /**
176    * Set the Value value.
177    * @ejb:interface-method view-type="both"
178    * @param value The Value value of this Property.
179    * @ejb:transaction type="Required"
180    **/

181    public abstract void setTheValue( String JavaDoc value );
182
183    /**
184     * Retrieve the Value value.
185     *
186     * @return Returns a Collection representing possibles values of Property.
187     * @ejb.value-object
188     * match="light"
189     * @ejb:interface-method view-type="both"
190     *
191     * @ejb:persistence column-name="possiblevalues"
192     * @ejb:transaction type="Supports"
193     **/

194     public abstract Collection JavaDoc getPossibleValues();
195     
196     /**
197     * Set the possible values of the property
198     * @ejb:interface-method view-type="both"
199     * @param values possibles values of the property
200     * @ejb:transaction type="Required"
201     **/

202     public abstract void setPossibleValues( Collection JavaDoc value );
203    
204     /**
205      * @ejb.interface-method
206      * @ejb:transaction type="Supports"
207      */

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

214     public abstract void setBnProjectPropertyValue(BnProjectPropertyValue v);
215
216
217
218    // -------------------------------------------------------------------------
219
// Framework Callbacks
220
// -------------------------------------------------------------------------
221

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

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

264    public BnProjectPropertyPK ejbCreate(String JavaDoc key, String JavaDoc value )
265       throws
266          InvalidValueException,
267          EJBException JavaDoc,
268          CreateException JavaDoc
269    {
270        this.setTheKey(key);
271        this.setTheValue(value);
272        this.setId(hero.interfaces.BnProjectPropertyUtil.generateGUID(this));
273
274       // This is only possible in CMPs. Otherwise return a valid PK.
275
return null;
276    }
277    
278    /**
279     * Create a Property based on the supplied key and value.
280     *
281     *
282     * @throws InvalidValueException If one of the values are not correct,
283     * this will not roll back the transaction
284     * because the caller has the chance to
285     * fix the problem and try again
286     * @throws EJBException If no new unique ID could be retrieved this will
287     * rollback the transaction because there is no
288     * hope to try again
289     * @throws CreateException Because we have to do so (EJB spec.)
290     *
291     * @ejb:create-method view-type="both"
292     **/

293     public BnProjectPropertyPK ejbCreate(String JavaDoc key, Collection JavaDoc values )
294        throws
295           InvalidValueException,
296           EJBException JavaDoc,
297           CreateException JavaDoc
298     {
299         this.setTheKey(key);
300         this.setPossibleValues(values);
301         this.setId(hero.interfaces.BnProjectPropertyUtil.generateGUID(this));
302
303        // This is only possible in CMPs. Otherwise return a valid PK.
304
return null;
305     }
306
307    public void setEntityContext( EntityContext JavaDoc lContext )
308    {
309       mContext = lContext;
310    }
311    
312    public void unsetEntityContext()
313    {
314       mContext = null;
315    }
316    
317    public void ejbActivate()
318    {
319    }
320    
321    public void ejbPassivate()
322    {
323    }
324    
325    public void ejbLoad()
326    {
327    }
328    
329    public void ejbStore()
330    {
331    }
332    
333    public void ejbRemove()
334       throws
335          RemoveException JavaDoc
336    {
337    }
338    
339 }
340
Popular Tags