001: package hero.entity;
002:
003: import hero.interfaces.BnProjectLocal;
004: import hero.interfaces.BnProjectPropertyPK;
005: import hero.interfaces.BnProjectPropertyValue;
006: import hero.interfaces.InvalidValueException;
007:
008: import javax.ejb.CreateException;
009: import javax.ejb.EJBException;
010: import javax.ejb.EntityBean;
011: import javax.ejb.EntityContext;
012: import javax.ejb.RemoveException;
013:
014: import java.util.Collection;
015:
016: /**
017: * The Entity bean represents a BnProjectProperty
018: *
019: * @author Oriol Montala
020: * @version $Revision: 1.10 $
021: *
022: * @ejb:bean name="BnProjectProperty"
023: * display-name="Property Entity"
024: * type="CMP"
025: * jndi-name="ejb/hero/BnProjectProperty"
026: * local-jndi-name="ejb/hero/BnProjectProperty_L"
027: * view-type="both"
028: * cmp-version="2.x"
029: * reentrant="true"
030: *
031: *
032: * @ejb:transaction type="Supports"
033: *
034: *
035: * @ejb.pk generate="true" method-intf="both"
036: *
037: * @jonas.bean
038: * lock-policy="container-read-committed"
039: * @jonas.jdbc-mapping
040: * jndi-name="bonita"
041: * jdbc-table-name="BnProjectProperty"
042: *
043: * @jonas.shared false
044: *
045: * @ejb:finder signature="java.util.Collection findAll()"
046: * query="SELECT object(p) FROM BnProjectProperty p"
047: * transaction-type="Supports"
048: * @ejb:finder signature="java.util.Collection findByProject(java.lang.String projectId)" view-type="local"
049: * query="SELECT OBJECT(p) From BnProjectProperty p Where p.bnProject.id = ?1"
050: * transaction-type="Supports"
051: * @ejb:finder signature="java.util.Collection findByTheKey(java.lang.String projectId, java.lang.String pkey)" view-type="local"
052: * query="SELECT OBJECT(p) From BnProjectProperty p Where p.bnProject.id = ?1 AND p.theKey=?2"
053: * transaction-type="Supports"
054: *
055: *
056: *
057: * @ejb.value-object
058: * match="*"
059: * name="BnProjectProperty"
060: *
061: * @ejb.value-object
062: * match="light"
063: * name="BnProjectPropertyLight"
064: *
065: * @jboss.persistence
066: * table-name="BnProjectProperty"
067: * create-table="true"
068: * remove-table="false"
069: *
070: * @jboss.container-configuration name="Standard CMP 2.x EntityBean for Bonita"
071: **/
072: public abstract class BnProjectPropertyBean implements EntityBean {
073:
074: // -------------------------------------------------------------------------
075: // Members
076: // -------------------------------------------------------------------------
077:
078: public EntityContext mContext;
079:
080: // -------------------------------------------------------------------------
081: // Methods
082: // -------------------------------------------------------------------------
083:
084: // -------------------------------------------------------------------------
085: // Properties (Getters/Setters)
086: // -------------------------------------------------------------------------
087:
088: /**
089: * Retrieve the BnProjectProperty's id.
090: *
091: * @return Returns an int representing the id of this BnProjectProperty.
092: *
093: * @ejb:pk-field
094: * @ejb.value-object
095: * match="light"
096: * @ejb:persistence column-name="id"
097: * @jonas.cmp-field-jdbc-mapping
098: * field-name="id"
099: * jdbc-field-name="id"
100: * @ejb:transaction type="Supports"
101: **/
102: public abstract String getId();
103:
104: /**
105: * Set the Property's id.
106: *
107: * @param pId The id of this Property. Is set at creation time.
108: * @ejb:transaction type="Required"
109: **/
110: public abstract void setId(String pId);
111:
112: /** Retrieve the BnProject.
113: *
114: * @return Returns a BnProjectLocal.
115: * @ejb:interface-method view-type="both"
116: * @ejb:relation name="projectprp" role-name="property-by" cascade-delete="yes"
117: * @ejb:transaction type="Supports"
118: * @jboss.relation
119: * related-pk-field = "id"
120: * fk-column = "projectPropertyIdFK"
121: **/
122: public abstract BnProjectLocal getBnProject();
123:
124: /**
125: * Set the BnProject.
126: *
127: * @ejb:interface-method view-type="local"
128: * @param pProject The BnProject of this Property.
129: * @ejb:transaction type="Required"
130: **/
131: public abstract void setBnProject(BnProjectLocal pProject);
132:
133: /**
134: * Retrieve the Key value.
135: *
136: * @return Returns an String representing the Key value of this Property.
137: * @ejb.value-object
138: * match="light"
139: * @ejb:interface-method view-type="both"
140: *
141: * @ejb:persistence column-name="thekey"
142: * @ejb:transaction type="Supports"
143: **/
144: public abstract String getTheKey();
145:
146: /**
147: * Set the key value.
148: * @ejb:interface-method view-type="both"
149: * @param key The Key of this Property.
150: * @ejb:transaction type="Required"
151: **/
152: public abstract void setTheKey(String key);
153:
154: /**
155: * Retrieve the Value value.
156: *
157: * @return Returns an String representing the Value value of this Property.
158: * @ejb.value-object
159: * match="light"
160: * @ejb:interface-method view-type="both"
161: *
162: * @ejb:persistence column-name="thevalue"
163: * @ejb:transaction type="Supports"
164: **/
165: public abstract String getTheValue();
166:
167: /**
168: * Set the Value value.
169: * @ejb:interface-method view-type="both"
170: * @param value The Value value of this Property.
171: * @ejb:transaction type="Required"
172: **/
173: public abstract void setTheValue(String value);
174:
175: /**
176: * Retrieve the Value value.
177: *
178: * @return Returns a Collection representing possibles values of Property.
179: * @ejb.value-object
180: * match="light"
181: * @ejb:interface-method view-type="both"
182: *
183: * @ejb:persistence column-name="possiblevalues"
184: * @ejb:transaction type="Supports"
185: *
186: * @jboss.relation-table create-table="true" remove-table="false"
187: **/
188: public abstract Collection getPossibleValues();
189:
190: /**
191: * Set the possible values of the property
192: * @ejb:interface-method view-type="both"
193: * @param values possibles values of the property
194: * @ejb:transaction type="Required"
195: **/
196: public abstract void setPossibleValues(Collection value);
197:
198: /**
199: * @ejb.interface-method
200: * @ejb:transaction type="Supports"
201: */
202: public abstract BnProjectPropertyValue getBnProjectPropertyValue();
203:
204: /**
205: * @ejb.interface-method
206: * @ejb:transaction type="Required"
207: */
208: public abstract void setBnProjectPropertyValue(
209: BnProjectPropertyValue v);
210:
211: // -------------------------------------------------------------------------
212: // Framework Callbacks
213: // -------------------------------------------------------------------------
214:
215: /**
216: * Create a Property based on the supplied Property Value Object.
217: *
218: *
219: * @throws InvalidValueException If one of the values are not correct,
220: * this will not roll back the transaction
221: * because the caller has the chance to
222: * fix the problem and try again
223: * @throws EJBException If no new unique ID could be retrieved this will
224: * rollback the transaction because there is no
225: * hope to try again
226: * @throws CreateException Because we have to do so (EJB spec.)
227: *
228: * @ejb:create-method view-type="both"
229: **/
230: public BnProjectPropertyPK ejbCreate(BnProjectPropertyValue prp)
231: throws InvalidValueException, EJBException, CreateException {
232: this .setId(hero.interfaces.BnProjectPropertyUtil
233: .generateGUID(this ));
234: // This is only possible in CMPs. Otherwise return a valid PK.
235: return null;
236: }
237:
238: public void ejbPostCreate(BnProjectPropertyValue prp) {
239: // Assign value object in ejbPostCreate to apply XDoclet best
240: // practice. If not done, there will be an error in JBoss if
241: // the Value Object has relations.
242: this .setBnProjectPropertyValue(prp);
243: }
244:
245: /**
246: * Create a Property based on the supplied key and value.
247: *
248: *
249: * @throws InvalidValueException If one of the values are not correct,
250: * this will not roll back the transaction
251: * because the caller has the chance to
252: * fix the problem and try again
253: * @throws EJBException If no new unique ID could be retrieved this will
254: * rollback the transaction because there is no
255: * hope to try again
256: * @throws CreateException Because we have to do so (EJB spec.)
257: *
258: * @ejb:create-method view-type="both"
259: **/
260: public BnProjectPropertyPK ejbCreate(String key, String value)
261: throws InvalidValueException, EJBException, CreateException {
262: this .setTheKey(key);
263: this .setTheValue(value);
264: this .setId(hero.interfaces.BnProjectPropertyUtil
265: .generateGUID(this ));
266:
267: // This is only possible in CMPs. Otherwise return a valid PK.
268: return null;
269: }
270:
271: /**
272: * Create a Property based on the supplied key and value.
273: *
274: *
275: * @throws InvalidValueException If one of the values are not correct,
276: * this will not roll back the transaction
277: * because the caller has the chance to
278: * fix the problem and try again
279: * @throws EJBException If no new unique ID could be retrieved this will
280: * rollback the transaction because there is no
281: * hope to try again
282: * @throws CreateException Because we have to do so (EJB spec.)
283: *
284: * @ejb:create-method view-type="both"
285: **/
286: public BnProjectPropertyPK ejbCreate(String key, Collection values)
287: throws InvalidValueException, EJBException, CreateException {
288: this .setTheKey(key);
289: this .setPossibleValues(values);
290: this .setId(hero.interfaces.BnProjectPropertyUtil
291: .generateGUID(this ));
292:
293: // This is only possible in CMPs. Otherwise return a valid PK.
294: return null;
295: }
296:
297: public void setEntityContext(EntityContext lContext) {
298: mContext = lContext;
299: }
300:
301: public void unsetEntityContext() {
302: mContext = null;
303: }
304:
305: public void ejbActivate() {
306: }
307:
308: public void ejbPassivate() {
309: }
310:
311: public void ejbLoad() {
312: }
313:
314: public void ejbStore() {
315: }
316:
317: public void ejbRemove() throws RemoveException {
318: }
319:
320: }
|