001: package hero.entity;
002:
003: import hero.interfaces.BnProjectInterHookPK;
004: import hero.interfaces.BnProjectInterHookValue;
005: import hero.interfaces.BnProjectLocal;
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.12 $
019: *
020: * @ejb:bean name="BnProjectInterHook"
021: * display-name="BnNode Interactive Hook Entity"
022: * type="CMP"
023: * jndi-name="ejb/hero/BnProjectInterHook"
024: * local-jndi-name="ejb/hero/BnProjectInterHook_L"
025: * view-type="both"
026: * cmp-version="2.x"
027: * reentrant="true"
028: *
029: *
030: * @ejb:transaction type="Supports"
031: *
032: *
033: * @ejb.pk generate="true" method-intf="both"
034: *
035: * @jonas.bean
036: * lock-policy="container-read-committed"
037: * @jonas.jdbc-mapping
038: * jndi-name="bonita"
039: * jdbc-table-name="BnProjectInterHook"
040: * @jonas.shared false
041: *
042: * @ejb:finder signature="java.util.Collection findAll()"
043: * query="SELECT object(p) FROM BnProjectInterHook p"
044: * transaction-type="Supports"
045: * @ejb:finder signature="java.util.Collection findByProject(java.lang.String projectId)" view-type="local"
046: * query="SELECT OBJECT(p) From BnProjectInterHook p Where p.bnProject.id = ?1"
047: * transaction-type="Supports"
048: * @ejb:finder signature="hero.interfaces.BnProjectInterHookLocal findByName(java.lang.String projectId, java.lang.String name)" view-type="local"
049: * query="SELECT OBJECT(p) From BnProjectInterHook p Where p.bnProject.id = ?1 AND p.name = ?2"
050: * transaction-type="Supports"
051: *
052: *
053: * @ejb.value-object
054: * match="*"
055: * name="BnProjectInterHook"
056: * @ejb.value-object
057: * match="light"
058: * name="BnProjectInterHookLight"
059: *
060: * @jboss.persistence
061: * table-name="BnProjectInterHook"
062: * create-table="true"
063: * remove-table="false"
064: *
065: * @jboss.container-configuration name="Standard CMP 2.x EntityBean for Bonita"
066: **/
067: public abstract class BnProjectInterHookBean implements EntityBean {
068:
069: // -------------------------------------------------------------------------
070: // Members
071: // -------------------------------------------------------------------------
072:
073: public EntityContext mContext;
074:
075: // -------------------------------------------------------------------------
076: // Methods
077: // -------------------------------------------------------------------------
078:
079: // -------------------------------------------------------------------------
080: // Properties (Getters/Setters)
081: // -------------------------------------------------------------------------
082:
083: /**
084: * Retrieve the BnProjectInterHook's id.
085: *
086: * @return Returns an int representing the id of this BnProjectInterHook.
087: *
088: * @ejb:pk-field
089: * @ejb.value-object
090: * match="light"
091: * @ejb:persistence column-name="id"
092: * @jonas.cmp-field-jdbc-mapping
093: * field-name="id"
094: * jdbc-field-name="id"
095: * @ejb:transaction type="Supports"
096: **/
097: public abstract String getId();
098:
099: /**
100: * Set the Hook's id.
101: *
102: * @param pId The id of this Hook. Is set at creation time.
103: * @ejb:transaction type="Required"
104: **/
105: public abstract void setId(String pId);
106:
107: /** Retrieve the BnNode.
108: *
109: * @return Returns a BnNodeLocal.
110: * @ejb:interface-method view-type="both"
111: * @ejb:relation name="projectinterhook" role-name="interhook-by" cascade-delete="yes"
112: * @ejb:transaction type="Supports"
113: * @jboss.relation
114: * related-pk-field = "id"
115: * fk-column = "projectInterHookIdFK"
116: **/
117: public abstract BnProjectLocal getBnProject();
118:
119: /**
120: * Set the BnNode.
121: *
122: * @ejb:interface-method view-type="local"
123: * @param pNode The BnNode of this Hook.
124: * @ejb:transaction type="Required"
125: **/
126: public abstract void setBnProject(BnProjectLocal project);
127:
128: /**
129: * Retrieve the Name value.
130: *
131: * @return Returns an String representing the Hook Name value.
132: * @ejb.value-object
133: * match="light"
134: * @ejb:interface-method view-type="both"
135: *
136: * @ejb:persistence column-name="name"
137: * @ejb:transaction type="Supports"
138: **/
139: public abstract String getName();
140:
141: /**
142: * Set the Name value.
143: * @ejb:interface-method view-type="both"
144: * @param key The Name of this Hook.
145: * @ejb:transaction type="Required"
146: **/
147: public abstract void setName(String hookName);
148:
149: /**
150: * Retrieve the Event value.
151: *
152: * @return Returns an String representing the Event value.
153: * @ejb.value-object
154: * match="light"
155: * @ejb:interface-method view-type="both"
156: *
157: * @ejb:persistence column-name="event"
158: * @ejb:transaction type="Supports"
159: **/
160: public abstract String getEvent();
161:
162: /**
163: * Set the Event value.
164: * @ejb:interface-method view-type="both"
165: * @param value The Event value of this Hook.
166: * @ejb:transaction type="Required"
167: **/
168: public abstract void setEvent(String hookEvent);
169:
170: /**
171: * Retrieve the Type value.
172: *
173: * @return Returns an int representing the Type value.
174: * @ejb.value-object
175: * match="light"
176: * @ejb:interface-method view-type="both"
177: *
178: * @ejb:persistence column-name="type"
179: * @ejb:transaction type="Supports"
180: **/
181: public abstract int getType();
182:
183: /**
184: * Set the Type value.
185: * @ejb:interface-method view-type="both"
186: * @param value The Type value of this Hook.
187: * @ejb:transaction type="Required"
188: **/
189: public abstract void setType(int hookType);
190:
191: /**
192: * Retrieve the script value.
193: *
194: * @return Returns an String.
195: * @ejb.value-object
196: * match="light"
197: * @ejb:interface-method view-type="both"
198: *
199: *
200: * @ejb:persistence column-name="script"
201: * @ejb:transaction type="Supports"
202: **/
203: public abstract String getScript();
204:
205: /**
206: * Set the hook script value.
207: * @ejb:interface-method view-type="both"
208: * @param key The script value of this hook.
209: * @ejb:transaction type="Required"
210: **/
211: public abstract void setScript(String script);
212:
213: /**
214: * @ejb.interface-method
215: * @ejb:transaction type="Supports"
216: */
217: public abstract BnProjectInterHookValue getBnProjectInterHookValue();
218:
219: /**
220: * @ejb.interface-method
221: * @ejb:transaction type="Required"
222: */
223: public abstract void setBnProjectInterHookValue(
224: BnProjectInterHookValue 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 BnProjectInterHookPK ejbCreate(BnProjectInterHookValue prp)
246: throws InvalidValueException, EJBException, CreateException {
247: this .setId(hero.interfaces.BnProjectInterHookUtil
248: .generateGUID(this ));
249: // This is only possible in CMPs. Otherwise return a valid PK.
250: return null;
251: }
252:
253: public void ejbPostCreate(BnProjectInterHookValue 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 .setBnProjectInterHookValue(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 BnProjectInterHookPK 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.BnProjectInterHookUtil
283: .generateGUID(this ));
284: // This is only possible in CMPs. Otherwise return a valid PK.
285: return null;
286: }
287:
288: public void setEntityContext(EntityContext lContext) {
289: mContext = lContext;
290: }
291:
292: public void unsetEntityContext() {
293: mContext = null;
294: }
295:
296: public void ejbActivate() {
297: }
298:
299: public void ejbPassivate() {
300: }
301:
302: public void ejbLoad() {
303: }
304:
305: public void ejbStore() {
306: }
307:
308: public void ejbRemove() throws RemoveException {
309: }
310:
311: }
|