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