001: package hero.entity;
002:
003: import hero.interfaces.BnEdgePK;
004: import hero.interfaces.BnEdgeValue;
005: import hero.interfaces.BnEdgeLightValue;
006: import hero.interfaces.BnNodeLocal;
007: import hero.interfaces.BnProjectLocal;
008: import hero.interfaces.InvalidValueException;
009: import hero.util.BonitaServiceLocator;
010: import hero.util.BonitaServiceException;
011:
012: import java.sql.Date;
013:
014: import javax.ejb.CreateException;
015: import javax.ejb.EJBException;
016: import javax.ejb.EntityBean;
017: import javax.ejb.EntityContext;
018: import javax.ejb.RemoveException;
019:
020: /**
021: * The Entity bean represents a BnEdge
022: *
023: * @author Fran?ois Charoy
024: * @version $Revision: 1.14 $
025: *
026: * @ejb:bean name="BnEdge"
027: * display-name="BnEdge Entity"
028: * type="CMP"
029: * jndi-name="ejb/hero/BnEdge"
030: * local-jndi-name="ejb/hero/BnEdge_L"
031: * view-type="both"
032: * cmp-version="2.x"
033: * reentrant="true"
034: *
035: * @ejb:transaction type="Supports"
036: *
037: * @jonas.bean
038: * lock-policy="container-read-committed"
039: *
040: * @jonas.jdbc-mapping
041: * jndi-name="bonita"
042: * jdbc-table-name="BnEdge"
043: *
044: * @jonas.shared false
045: *
046: * @ejb:finder signature="java.util.Collection findAll()"
047: * query="SELECT object(a) FROM BnEdge a"
048: * transaction-type="Supports"
049: *
050: * @ejb:finder signature="hero.interfaces.BnEdge findByName(java.lang.String pName, java.lang.String projectId )" view-type="both" result-type-mapping="Remote"
051: * query="SELECT OBJECT(n) FROM BnEdge n WHERE n.name = ?1 AND n.bnProject.id = ?2"
052: * transaction-type="Supports"
053: * @ejb:finder signature="hero.interfaces.BnEdgeLocal findByName(java.lang.String pName, java.lang.String projectId )" view-type="both" result-type-mapping="Local"
054: * query="SELECT OBJECT(e) FROM BnEdge e WHERE e.name = ?1 AND e.bnProject.id = ?2"
055: * transaction-type="Supports"
056: *
057: * @ejb.value-object
058: * match="*"
059: * name="BnEdge"
060: *
061: * @ejb.value-object
062: * match="light"
063: * name="BnEdgeLight"
064: *
065: * @jboss.persistence
066: * table-name="BnEdge"
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 BnEdgeBean implements EntityBean {
073:
074: // -------------------------------------------------------------------------
075: // Members
076: // -------------------------------------------------------------------------
077:
078: public EntityContext mContext;
079:
080: // -------------------------------------------------------------------------
081: // Properties (Getters/Setters)
082: // -------------------------------------------------------------------------
083:
084: /**
085: * Retrieve the BnEdge's id.
086: *
087: * @return Returns an int representing the id of this BnEdge.
088: *
089: * @ejb.value-object
090: * match="light"
091: * @ejb:pk-field
092: *
093: * @ejb:persistence column-name="id"
094: * @ejb:interface-method view-type="local"
095: * @jonas.cmp-field-jdbc-mapping
096: * field-name="id"
097: * jdbc-field-name="id"
098: * @ejb:transaction type="Supports"
099: **/
100: public abstract String getId();
101:
102: /**
103: * Set the BnEdge's id.
104: *
105: * @param pId The id of this BnEdge. Is set at creation time.
106: * @ejb:transaction type="Required"
107: **/
108: public abstract void setId(String pId);
109:
110: /**
111: * Retrieve the BnEdge's name.
112: *
113: * @return Returns a string representing the name of this BnEdge.
114: * @ejb.value-object
115: * match="light"
116: * @ejb:interface-method view-type="both"
117: *
118: * @ejb:persistence column-name="name"
119: * @ejb:transaction type="Supports"
120: **/
121: public abstract String getName();
122:
123: /**
124: * Set the BnEdge's name.
125: *
126: * @param pName The name of this BnEdge. Is set at creation time.
127: * @ejb:transaction type="Required"
128: **/
129: public abstract void setName(String pName);
130:
131: /**
132: * @return the project of the BnEdge
133: * @ejb:interface-method view-type="local"
134: * @ejb:relation name="Edges" role-name="is-edge-of" target-ejb="BnProject" cascade-delete="yes"
135: * @ejb:transaction type="Supports"
136: *
137: * @jboss.relation
138: * related-pk-field = "id"
139: * fk-column = "projectEdgeIdFK"
140: *
141: **/
142: public abstract BnProjectLocal getBnProject();
143:
144: /**
145: * Set the BnProject Name.
146: *
147: * @param pName The Name of this BnEdge. Is set at creation time.
148: * @ejb:interface-method view-type="local"
149: * @ejb:transaction type="Required"
150: **/
151: public abstract void setBnProject(BnProjectLocal pProject);
152:
153: /**
154: * @ejb.value-object
155: * match="light"
156: * @return the state of the BnEdge
157: * @ejb:interface-method view-type="local"
158: * @ejb:persistence column-name="state"
159: * @ejb:transaction type="Supports"
160: *
161: **/
162: public abstract int getState();
163:
164: /**
165: * Set the State value.
166: *
167: * @param pstate The new state of this BnEdge.
168: * @ejb:interface-method view-type="local"
169: * @ejb:transaction type="Required"
170: **/
171: public abstract void setState(int state);
172:
173: /**
174: * @ejb.value-object
175: * match="light"
176: * @return the condition of the BnEdge
177: * @ejb:interface-method view-type="local"
178: * @ejb:persistence column-name="edgecondition"
179: * @ejb:transaction type="Supports"
180: *
181: **/
182: public abstract String getCondition();
183:
184: /**
185: * Set the Condition value.
186: *
187: * @param condition The new state of this BnEdge.
188: * @ejb:interface-method view-type="local"
189: * @ejb:transaction type="Required"
190: **/
191: public abstract void setCondition(String condition);
192:
193: /**
194: * @return the In BnNode of the BnEdge
195: * @ejb:interface-method view-type="local"
196: * @ejb:relation name="InBnNode" role-name="has-node-in" target-ejb="BnNode" cascade-delete="yes"
197: * @ejb:value-object match="*"
198: * relation="external"
199: * aggregate="hero.interfaces.BnNodeValue"
200: * aggregate-name="InBnNode"
201: * @ejb:transaction type="Supports"
202: *
203: * @jonas.field-mapping
204: * foreign-key-jdbc-name="fk_innode"
205: * key-jdbc-name="id"
206: *
207: * @jboss.relation
208: * fk-column="fk_innode"
209: * related-pk-field="id"
210: *
211: **/
212: public abstract BnNodeLocal getInBnNode();
213:
214: /**
215: * Set the BnProject Name.
216: *
217: * @param pNode The Name of this BnEdge. Is set at creation time.
218: * @ejb:interface-method view-type="local"
219: * @ejb:transaction type="Required"
220: **/
221: public abstract void setInBnNode(BnNodeLocal pNode);
222:
223: /**
224: * @return the Out BnNode of the BnEdge
225: * @ejb:interface-method view-type="local"
226: * @ejb:relation name="OutBnNode" role-name="has-node-out" target-ejb="BnNode" cascade-delete="yes"
227: * @ejb:value-object match="*"
228: * relation="external"
229: * aggregate="hero.interfaces.BnNodeValue"
230: * aggregate-name="OutBnNode"
231: * @ejb:transaction type="Supports"
232: * @jboss.relation
233: * related-pk-field = "id"
234: * fk-column = "NodeEdgeIdFK"
235: **/
236: public abstract BnNodeLocal getOutBnNode();
237:
238: /**
239: * Set the BnProject Name.
240: *
241: * @param pNode The Name of this BnEdge. Is set at creation time.
242: * @ejb:interface-method view-type="local"
243: * @ejb:transaction type="Required"
244: **/
245: public abstract void setOutBnNode(BnNodeLocal pNode);
246:
247: /**
248: * @return Return the creation date of the BnEdge
249: * @ejb:interface-method view-type="both"
250: * @ejb:persistence column-name="creationdate"
251: * @ejb:transaction type="Supports"
252: *
253: **/
254:
255: public abstract Date getCreationDate();
256:
257: /**
258: * @param pDate the creation date of the BnEdge
259: * @ejb:interface-method view-type="both"
260: * @ejb:transaction type="Required"
261: *
262: **/
263: public abstract void setCreationDate(Date pDate);
264:
265: /**
266: * @ejb.value-object
267: * match="light"
268: * @return Return the modification date of the BnEdge
269: * @ejb:interface-method view-type="both"
270: * @ejb:persistence column-name="modificationdate"
271: * @ejb:transaction type="Supports"
272: *
273: **/
274: public abstract Date getModificationDate();
275:
276: /**
277: * @param pDate the creation date of the BnEdge
278: * @ejb:interface-method view-type="both"
279: * @ejb:transaction type="Required"
280: *
281: **/
282: public abstract void setModificationDate(Date pDate);
283:
284: /**
285: * @ejb.interface-method
286: * @ejb:transaction type="Supports"
287: */
288: public abstract BnEdgeValue getBnEdgeValue();
289:
290: /**
291: * @ejb.interface-method
292: * @ejb:transaction type="Required"
293: */
294: public abstract void setBnEdgeValue(BnEdgeValue v);
295:
296: /**
297: * @ejb.interface-method
298: * @ejb:transaction type="Supports"
299: */
300: public abstract BnEdgeLightValue getBnEdgeLightValue();
301:
302: /**
303: * @ejb.interface-method
304: * @ejb:transaction type="Required"
305: */
306: public abstract void setBnEdgeLightValue(BnEdgeLightValue v);
307:
308: // -------------------------------------------------------------------------
309: // Framework Callbacks
310: // -------------------------------------------------------------------------
311:
312: /**
313: * Create a BnEdge based on the supplied BnEdge Value Object.
314: *
315: *
316: * @throws InvalidValueException If one of the values are not correct,
317: * this will not roll back the transaction
318: * because the caller has the chance to
319: * fix the problem and try again
320: * @throws EJBException If no new unique ID could be retrieved this will
321: * rollback the transaction because there is no
322: * hope to try again
323: * @throws CreateException Because we have to do so (EJB spec.)
324: *
325: * @ejb:create-method view-type="both"
326: **/
327: public BnEdgePK ejbCreate() throws InvalidValueException,
328: EJBException, CreateException {
329: this .setId(hero.interfaces.BnEdgeUtil.generateGUID(this ));
330: this .setName("edge" + this .getId());
331: return null;
332: }
333:
334: /**
335: * Create a BnEdge based on the supplied BnEdge Value Object. (c'est merdique)
336: *
337: *
338: * @throws InvalidValueException If one of the values are not correct,
339: * this will not roll back the transaction
340: * because the caller has the chance to
341: * fix the problem and try again
342: * @throws EJBException If no new unique ID could be retrieved this will
343: * rollback the transaction because there is no
344: * hope to try again
345: * @throws CreateException Because we have to do so (EJB spec.)
346: *
347: * @ejb:create-method view-type="both"
348: **/
349: public BnEdgePK ejbCreate(BnEdgeValue pEdge) throws CreateException {
350: this .setId(hero.interfaces.BnEdgeUtil.generateGUID(this ));
351:
352: return null;
353: }
354:
355: public void ejbPostCreate(BnEdgeValue pEdge) {
356: // Assign value object in ejbPostCreate to apply XDoclet best
357: // practice. If not done, there will be an error in JBoss if
358: // the Value Object has relations.
359: this .setBnEdgeValue(pEdge);
360: }
361:
362: public void ejbPostCreate() {
363: }
364:
365: public void setEntityContext(EntityContext lContext) {
366: mContext = lContext;
367: }
368:
369: public void unsetEntityContext() {
370: mContext = null;
371: }
372:
373: public void ejbActivate() {
374: }
375:
376: public void ejbPassivate() {
377: }
378:
379: public void ejbLoad() {
380: }
381:
382: public void ejbStore() {
383: }
384:
385: public void ejbRemove() throws RemoveException {
386: }
387:
388: }
|