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