KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnNodePropertyBean


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

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

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

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

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

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

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

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

137     public abstract void setBnNode( BnNodeLocal pNode );
138
139
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    * Retrieve the propagation value
206    * @ejb.value-object
207    * match="light"
208    * @return Returns a boolean
209    *
210    * @ejb:interface-method view-type="both"
211    *
212    * @ejb:persistence column-name="propagate"
213    * @ejb:transaction type="Supports"
214    **/

215    public abstract boolean getPropagate();
216    
217    /**
218    * Set the propagation value.
219    * @ejb:interface-method view-type="both"
220    * @param prop if the property is propagateable
221    * @ejb:transaction type="Required"
222    **/

223    public abstract void setPropagate(boolean prop );
224
225     /**
226      * @ejb.interface-method
227      * @ejb:transaction type="Supports"
228      */

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

235     public abstract void setBnNodePropertyValue(BnNodePropertyValue v);
236
237
238
239    // -------------------------------------------------------------------------
240
// Framework Callbacks
241
// -------------------------------------------------------------------------
242

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

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

285    public BnNodePropertyPK ejbCreate(String JavaDoc key, String JavaDoc value )
286       throws
287          InvalidValueException,
288          EJBException JavaDoc,
289          CreateException JavaDoc
290    {
291        this.setTheKey(key);
292        this.setTheValue(value);
293        this.setPropagate(true);
294        this.setId(hero.interfaces.BnNodePropertyUtil.generateGUID(this));
295
296       // This is only possible in CMPs. Otherwise return a valid PK.
297
return null;
298    }
299    
300    /**
301     * Create a Property based on the supplied key and value.
302     *
303     *
304     * @throws InvalidValueException If one of the values are not correct,
305     * this will not roll back the transaction
306     * because the caller has the chance to
307     * fix the problem and try again
308     * @throws EJBException If no new unique ID could be retrieved this will
309     * rollback the transaction because there is no
310     * hope to try again
311     * @throws CreateException Because we have to do so (EJB spec.)
312     *
313     * @ejb:create-method view-type="both"
314     **/

315     public BnNodePropertyPK ejbCreate(String JavaDoc key, Collection JavaDoc values )
316        throws
317           InvalidValueException,
318           EJBException JavaDoc,
319           CreateException JavaDoc
320     {
321         this.setTheKey(key);
322         this.setPossibleValues(values);
323         this.setPropagate(true);
324         this.setId(hero.interfaces.BnNodePropertyUtil.generateGUID(this));
325
326        // This is only possible in CMPs. Otherwise return a valid PK.
327
return null;
328     }
329
330
331    public void setEntityContext( EntityContext JavaDoc lContext )
332    {
333       mContext = lContext;
334    }
335    
336    public void unsetEntityContext()
337    {
338       mContext = null;
339    }
340    
341    public void ejbActivate()
342    {
343    }
344    
345    public void ejbPassivate()
346    {
347    }
348    
349    public void ejbLoad()
350    {
351    }
352    
353    public void ejbStore()
354    {
355    }
356    
357    public void ejbRemove()
358       throws
359          RemoveException JavaDoc
360    {
361    }
362    
363 }
364
Popular Tags