001: package hero.entity;
002:
003: import hero.interfaces.BnProjectHookPK;
004: import hero.interfaces.BnProjectHookValue;
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 a BnProjectHook
016: *
017: * @author Oriol Montala
018: * @version $Revision: 1.9 $
019: *
020: * @ejb:bean name="BnProjectHook"
021: * display-name="BnProject Hook Entity"
022: * type="CMP"
023: * jndi-name="ejb/hero/BnProjectHook"
024: * local-jndi-name="ejb/hero/BnProjectHook_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="BnProjectHook"
039: *
040: * @jonas.shared false
041: *
042: * @ejb:finder signature="java.util.Collection findAll()"
043: * query="SELECT object(p) FROM BnProjectHook 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 BnProjectHook p Where p.bnProject.id = ?1"
047: * transaction-type="Supports"
048: * @ejb:finder signature="hero.interfaces.BnProjectHookLocal findByName(java.lang.String projectId, java.lang.String name)" view-type="local"
049: * query="SELECT OBJECT(p) From BnProjectHook p Where p.bnProject.id = ?1 AND p.name = ?2"
050: * transaction-type="Supports"
051: *
052: * @ejb.value-object
053: * match="*"
054: * name="BnProjectHook"
055: *
056: * @ejb.value-object
057: * match="light"
058: * name="BnProjectHookLight"
059: *
060: * @jboss.persistence
061: * table-name="BnProjectHook"
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 BnProjectHookBean 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 BnProjectProperty's id.
085: *
086: * @return Returns an int representing the id of this BnProjectProperty.
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 Property's id.
101: *
102: * @param pId The id of this Property. Is set at creation time.
103: * @ejb:transaction type="Required"
104: **/
105: public abstract void setId(String pId);
106:
107: /** Retrieve the BnProject.
108: *
109: * @return Returns a BnProjectLocal.
110: * @ejb:interface-method view-type="both"
111: * @ejb:relation name="projecthook" role-name="hook-by" cascade-delete="yes"
112: * @ejb:transaction type="Supports"
113: * @jboss.relation
114: * related-pk-field = "id"
115: * fk-column = "projectHookBeanIdFK"
116: **/
117: public abstract BnProjectLocal getBnProject();
118:
119: /**
120: * Set the BnProject.
121: *
122: * @ejb:interface-method view-type="local"
123: * @param pProject The BnProject of this Hook.
124: * @ejb:transaction type="Required"
125: **/
126: public abstract void setBnProject(BnProjectLocal pProject);
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: * @ejb.interface-method
193: * @ejb:transaction type="Supports"
194: */
195: public abstract BnProjectHookValue getBnProjectHookValue();
196:
197: /**
198: * @ejb.interface-method
199: * @ejb:transaction type="Required"
200: */
201: public abstract void setBnProjectHookValue(BnProjectHookValue v);
202:
203: // -------------------------------------------------------------------------
204: // Framework Callbacks
205: // -------------------------------------------------------------------------
206:
207: /**
208: * Create a Hook based on the supplied Hook Value Object.
209: *
210: *
211: * @throws InvalidValueException If one of the values are not correct,
212: * this will not roll back the transaction
213: * because the caller has the chance to
214: * fix the problem and try again
215: * @throws EJBException If no new unique ID could be retrieved this will
216: * rollback the transaction because there is no
217: * hope to try again
218: * @throws CreateException Because we have to do so (EJB spec.)
219: *
220: * @ejb:create-method view-type="both"
221: **/
222: public BnProjectHookPK ejbCreate(BnProjectHookValue prp)
223: throws InvalidValueException, EJBException, CreateException {
224: this
225: .setId(hero.interfaces.BnProjectHookUtil
226: .generateGUID(this ));
227:
228: // This is only possible in CMPs. Otherwise return a valid PK.
229: return null;
230: }
231:
232: public void ejbPostCreate(BnProjectHookValue prp) {
233: // Assign value object in ejbPostCreate to apply XDoclet best
234: // practice. If not done, there will be an error in JBoss if
235: // the Value Object has relations.
236: this .setBnProjectHookValue(prp);
237: }
238:
239: /**
240: * Create a Hook based on the supplied parameters.
241: *
242: *
243: * @throws InvalidValueException If one of the values are not correct,
244: * this will not roll back the transaction
245: * because the caller has the chance to
246: * fix the problem and try again
247: * @throws EJBException If no new unique ID could be retrieved this will
248: * rollback the transaction because there is no
249: * hope to try again
250: * @throws CreateException Because we have to do so (EJB spec.)
251: *
252: * @ejb:create-method view-type="both"
253: **/
254: public BnProjectHookPK ejbCreate(String hookName, String hookEvent,
255: int hookType) throws InvalidValueException, EJBException,
256: CreateException {
257: this .setName(hookName);
258: this .setEvent(hookEvent);
259: this .setType(hookType);
260: this
261: .setId(hero.interfaces.BnProjectHookUtil
262: .generateGUID(this ));
263:
264: // This is only possible in CMPs. Otherwise return a valid PK.
265: return null;
266: }
267:
268: public void setEntityContext(EntityContext lContext) {
269: mContext = lContext;
270: }
271:
272: public void unsetEntityContext() {
273: mContext = null;
274: }
275:
276: public void ejbActivate() {
277: }
278:
279: public void ejbPassivate() {
280: }
281:
282: public void ejbLoad() {
283: }
284:
285: public void ejbStore() {
286: }
287:
288: public void ejbRemove() throws RemoveException {
289: }
290:
291: }
|