KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnUserPropertyBean


1 package hero.entity;
2
3 import hero.interfaces.BnUserLocal;
4 import hero.interfaces.BnUserPropertyPK;
5 import hero.interfaces.BnUserPropertyValue;
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 BnUserProperty
18  *
19  * @author Oriol Montala
20  * @version $Revision: 1.3 $
21  *
22  * @ejb:bean name="BnUserProperty"
23  * display-name="BnUser Entity"
24  * type="CMP"
25  * jndi-name="ejb/hero/BnUserProperty"
26  * local-jndi-name="ejb/hero/BnUserProperty_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="BnUserProperty"
39  * jndi-name="ejb/hero/BnUserProperty"
40  * lock-policy="container-read-committed"
41  * @jonas.jdbc-mapping
42  * jndi-name="bonita"
43  * jdbc-table-name="BnUserProperty"
44  *
45  * @jonas.shared false
46  *
47  * @ejb:finder signature="java.util.Collection findAll()"
48  * query="SELECT object(u) FROM BnUserProperty u"
49  * transaction-type="Supports"
50  * @ejb:finder signature="java.util.Collection findByUser(java.lang.String userId)" view-type="local"
51  * query="SELECT OBJECT(p) From BnUserProperty p Where p.bnUser.id = ?1"
52  * transaction-type="Supports"
53  * @ejb:finder signature="java.util.Collection findByTheKey(java.lang.String userId, java.lang.String pkey)" view-type="local"
54  * query="SELECT OBJECT(p) From BnUserProperty p Where p.bnUser.id = ?1 AND p.theKey=?2"
55  * transaction-type="Supports"
56  *
57  *
58  * @ejb.value-object
59  * match="*"
60  * name="BnUserProperty"
61  *
62  * @ejb.value-object
63  * match="light"
64  * name="BnUserPropertyLight"
65  *
66  *
67  * @jboss:table-name table-name="BnUserProperty"
68  *
69  * @jboss:create-table create="true"
70  *
71  * @jboss:remove-table remove="false"
72  **/

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

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

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

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

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

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

127     public abstract BnUserLocal getBnUser();
128     
129     /**
130      * Set the BnUser.
131      *
132      * @ejb:interface-method view-type="local"
133      * @param pUser The BnUser of this Property.
134      * @ejb:transaction type="Required"
135      **/

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

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

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

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

180    public abstract void setTheValue( String JavaDoc value );
181
182     /**
183      * @ejb.interface-method
184      * @ejb:transaction type="Supports"
185      */

186     public abstract BnUserPropertyValue getBnUserPropertyValue();
187     
188     /**
189      * @ejb.interface-method
190      */

191     public abstract void setBnUserPropertyValue(BnUserPropertyValue v);
192
193
194
195    // -------------------------------------------------------------------------
196
// Framework Callbacks
197
// -------------------------------------------------------------------------
198

199    /**
200    * Create a Property based on the supplied Property Value Object.
201    *
202    *
203    * @throws InvalidValueException If one of the values are not correct,
204    * this will not roll back the transaction
205    * because the caller has the chance to
206    * fix the problem and try again
207    * @throws EJBException If no new unique ID could be retrieved this will
208    * rollback the transaction because there is no
209    * hope to try again
210    * @throws CreateException Because we have to do so (EJB spec.)
211    *
212    * @ejb:create-method view-type="both"
213    **/

214    public BnUserPropertyPK ejbCreate(BnUserPropertyValue prp )
215       throws
216          InvalidValueException,
217          EJBException JavaDoc,
218          CreateException JavaDoc
219    {
220        setBnUserPropertyValue(prp);
221        this.setId(hero.interfaces.BnUserPropertyUtil.generateGUID(this));
222       // This is only possible in CMPs. Otherwise return a valid PK.
223
return null;
224    }
225
226    /**
227    * Create a Property based on the supplied key and value.
228    *
229    *
230    * @throws InvalidValueException If one of the values are not correct,
231    * this will not roll back the transaction
232    * because the caller has the chance to
233    * fix the problem and try again
234    * @throws EJBException If no new unique ID could be retrieved this will
235    * rollback the transaction because there is no
236    * hope to try again
237    * @throws CreateException Because we have to do so (EJB spec.)
238    *
239    * @ejb:create-method view-type="both"
240    **/

241    public BnUserPropertyPK ejbCreate(String JavaDoc key, String JavaDoc value )
242       throws
243          InvalidValueException,
244          EJBException JavaDoc,
245          CreateException JavaDoc
246    {
247        this.setTheKey(key);
248        this.setTheValue(value);
249        this.setId(hero.interfaces.BnUserPropertyUtil.generateGUID(this));
250
251       // This is only possible in CMPs. Otherwise return a valid PK.
252
return null;
253    }
254
255    public void setEntityContext( EntityContext JavaDoc lContext )
256    {
257       mContext = lContext;
258    }
259    
260    public void unsetEntityContext()
261    {
262       mContext = null;
263    }
264    
265    public void ejbActivate()
266    {
267    }
268    
269    public void ejbPassivate()
270    {
271    }
272    
273    public void ejbLoad()
274    {
275    }
276    
277    public void ejbStore()
278    {
279    }
280    
281    public void ejbRemove()
282       throws
283          RemoveException JavaDoc
284    {
285    }
286
287 }
288
Popular Tags