001: /**
002: *
003: * Bonita
004: * Copyright (C) 1999 Bull S.A.
005: * Bull 68 route de versailles 78434 Louveciennes Cedex France
006: * Further information: bonita@objectweb.org
007: *
008: * This library is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Lesser General Public
010: * License as published by the Free Software Foundation; either
011: * version 2.1 of the License, or any later version.
012: *
013: * This library is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public
019: * License along with this library; if not, write to the Free Software
020: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
021: * USA
022: *
023: *
024: --------------------------------------------------------------------------
025: * $Id: BnIterationBean.java,v 1.12 2006/08/21 09:56:42 brice Exp $
026: *
027: --------------------------------------------------------------------------
028: */package hero.entity;
029:
030: import hero.interfaces.BnProjectLocal;
031: import hero.interfaces.BnIterationPK;
032: import hero.interfaces.BnIterationValue;
033: import hero.interfaces.BnIterationLightValue;
034: import hero.interfaces.InvalidValueException;
035:
036: import javax.ejb.CreateException;
037: import javax.ejb.EJBException;
038: import javax.ejb.EntityBean;
039: import javax.ejb.EntityContext;
040: import javax.ejb.RemoveException;
041:
042: /**
043: * The Entity bean represents a BnIteration
044: *
045: * @ejb:bean name="BnIteration"
046: * display-name="Iteration"
047: * type="CMP"
048: * jndi-name="ejb/hero/BnIteration"
049: * local-jndi-name="ejb/hero/BnIteration_L"
050: * view-type="both"
051: * cmp-version="2.x"
052: * reentrant="true"
053: *
054: * @ejb:transaction type="Supports"
055: *
056: *
057: * @ejb.pk generate="true" method-intf="both"
058: *
059: * @jonas.bean
060: * lock-policy="container-read-committed"
061: * @jonas.jdbc-mapping
062: * jndi-name="bonita"
063: * jdbc-table-name="BnIteration"
064: *
065: * @jonas.shared false
066: *
067: * @ejb:finder signature="java.util.Collection findAll()"
068: * query="SELECT object(p) FROM BnIteration p"
069: * transaction-type="Supports"
070: *
071: * @ejb:finder signature="java.util.Collection findByProject(java.lang.String projectId)" view-type="local"
072: * query="SELECT OBJECT(p) From BnIteration p Where p.bnProject.id = ?1"
073: * transaction-type="Supports"
074: *
075: * @ejb:finder signature="hero.interfaces.BnIterationLocal findByFromTo(java.lang.String from, java.lang.String to, java.lang.String projectId)" view-type="local"
076: * query="SELECT OBJECT(p) From BnIteration p Where p.bnProject.id = ?3 AND p.fromNode=?1 AND p.toNode=?2"
077: * transaction-type="Supports"
078: *
079: * @ejb:finder signature="java.util.Collection findByFrom(java.lang.String projectId, java.lang.String from)" view-type="local"
080: * query="SELECT OBJECT(p) From BnIteration p Where p.bnProject.id = ?1 AND p.fromNode=?2"
081: * transaction-type="Supports"
082: *
083: * @ejb:finder signature="java.util.Collection findByTo(java.lang.String projectId, java.lang.String to)" view-type="local"
084: * query="SELECT OBJECT(p) From BnIteration p Where p.bnProject.id = ?1 AND p.toNode=?2"
085: * transaction-type="Supports"
086: *
087: *
088: * @ejb.value-object
089: * match="*"
090: * name="BnIteration"
091: *
092: * @ejb.value-object
093: * match="light"
094: * name="BnIterationLight"
095: *
096: * @jboss.persistence
097: * table-name="BnIteration"
098: * create-table="true"
099: * remove-table="false"
100: *
101: * @jboss.container-configuration name="Standard CMP 2.x EntityBean for Bonita"
102: **/
103: public abstract class BnIterationBean implements EntityBean {
104:
105: // -------------------------------------------------------------------------
106: // Members
107: // -------------------------------------------------------------------------
108:
109: public EntityContext mContext;
110:
111: // -------------------------------------------------------------------------
112: // Methods
113: // -------------------------------------------------------------------------
114:
115: // -------------------------------------------------------------------------
116: // Properties (Getters/Setters)
117: // -------------------------------------------------------------------------
118:
119: /**
120: * Retrieve the BnIteration id.
121: *
122: * @return Returns an int representing the id of this BnIteration.
123: *
124: * @ejb:pk-field
125: * @ejb.value-object
126: * match="light"
127: * @ejb:persistence column-name="id"
128: * @jonas.cmp-field-jdbc-mapping
129: * field-name="id"
130: * jdbc-field-name="id"
131: * @ejb:transaction type="Supports"
132: **/
133: public abstract String getId();
134:
135: /**
136: * Set the Iteration id.
137: *
138: * @param pId The id of this NodeIteration. Is set at creation time.
139: * @ejb:transaction type="Required"
140: **/
141: public abstract void setId(String pId);
142:
143: /** Retrieve the BnProject.
144: *
145: * @return Returns a BnProjectLocal.
146: * @ejb:interface-method view-type="both"
147: * @ejb:relation name="projectIte" role-name="iteration-by" cascade-delete="yes"
148: * @ejb:transaction type="Supports"
149: * @jboss.relation
150: * related-pk-field = "id"
151: * fk-column = "projectIterationIdFK"
152: **/
153: public abstract BnProjectLocal getBnProject();
154:
155: /**
156: * Set the BnProject.
157: *
158: * @ejb:interface-method view-type="local"
159: * @param pProject The BnProject of this Property.
160: * @ejb:transaction type="Required"
161: **/
162: public abstract void setBnProject(BnProjectLocal pProject);
163:
164: /**
165: * Retrieve the from node.
166: *
167: * @return Returns an String representing the from node value of this Iteration.
168: * @ejb.value-object
169: * match="light"
170: * @ejb:interface-method view-type="both"
171: *
172: * @ejb:persistence column-name="fromnode"
173: * @ejb:transaction type="Supports"
174: **/
175: public abstract String getFromNode();
176:
177: /**
178: * Set the from node value.
179: * @ejb:interface-method view-type="both"
180: * @param from The from node of this Iteration.
181: * @ejb:transaction type="Required"
182: **/
183: public abstract void setFromNode(String from);
184:
185: /**
186: * Retrieve the to node.
187: *
188: * @return Returns an String representing the to node value of this Iteration.
189: * @ejb.value-object
190: * match="light"
191: * @ejb:interface-method view-type="both"
192: *
193: * @ejb:persistence column-name="tonode"
194: * @ejb:transaction type="Supports"
195: **/
196: public abstract String getToNode();
197:
198: /**
199: * Set the to node value.
200: * @ejb:interface-method view-type="both"
201: * @param to The to node value of this Iteration.
202: * @ejb:transaction type="Required"
203: **/
204: public abstract void setToNode(String to);
205:
206: /**
207: * Retrieve the condition value.
208: *
209: * @return Returns an String representing the condition value of this Iteration.
210: * @ejb.value-object
211: * match="light"
212: * @ejb:interface-method view-type="both"
213: *
214: * @ejb:persistence column-name="iterationcondition"
215: * @ejb:transaction type="Supports"
216: **/
217: public abstract String getCondition();
218:
219: /**
220: * Set the condition value.
221: * @ejb:interface-method view-type="both"
222: * @param condition The condition value of this Iteration.
223: * @ejb:transaction type="Required"
224: **/
225: public abstract void setCondition(String condition);
226:
227: /**
228: * @ejb.interface-method
229: * @ejb:transaction type="Supports"
230: */
231: public abstract BnIterationValue getBnIterationValue();
232:
233: /**
234: * @ejb.interface-method
235: * @ejb:transaction type="Supports"
236: */
237: public abstract BnIterationLightValue getBnIterationLightValue();
238:
239: /**
240: * @ejb.interface-method
241: * @ejb:transaction type="Required"
242: */
243: public abstract void setBnIterationValue(BnIterationValue v);
244:
245: /**
246: * @ejb.interface-method
247: * @ejb:transaction type="Required"
248: */
249: public abstract void setBnIterationLightValue(
250: BnIterationLightValue v);
251:
252: // -------------------------------------------------------------------------
253: // Framework Callbacks
254: // -------------------------------------------------------------------------
255:
256: /**
257: * Create a NodeIteration based on the supplied Property Value Object.
258: *
259: *
260: * @throws InvalidValueException If one of the values are not correct,
261: * this will not roll back the transaction
262: * because the caller has the chance to
263: * fix the problem and try again
264: * @throws EJBException If no new unique ID could be retrieved this will
265: * rollback the transaction because there is no
266: * hope to try again
267: * @throws CreateException Because we have to do so (EJB spec.)
268: *
269: * @ejb:create-method view-type="both"
270: **/
271: public BnIterationPK ejbCreate(BnIterationLightValue nd)
272: throws InvalidValueException, EJBException, CreateException {
273: this .setId(hero.interfaces.BnIterationUtil.generateGUID(this ));
274: // This is only possible in CMPs. Otherwise return a valid PK.
275: return null;
276: }
277:
278: public void ejbPostCreate(BnIterationLightValue nd) {
279: // Assign value object in ejbPostCreate to apply XDoclet best
280: // practice. If not done, there will be an error in JBoss if
281: // the Value Object has relations.
282: this .setBnIterationLightValue(nd);
283: }
284:
285: /**
286: * Create a NodeIteration based on the supplied key and value.
287: *
288: *
289: * @throws InvalidValueException If one of the values are not correct,
290: * this will not roll back the transaction
291: * because the caller has the chance to
292: * fix the problem and try again
293: * @throws EJBException If no new unique ID could be retrieved this will
294: * rollback the transaction because there is no
295: * hope to try again
296: * @throws CreateException Because we have to do so (EJB spec.)
297: *
298: * @ejb:create-method view-type="both"
299: **/
300: public BnIterationPK ejbCreate(String from, String to,
301: String condition) throws InvalidValueException,
302: EJBException, CreateException {
303: this .setFromNode(from);
304: this .setToNode(to);
305: this .setCondition(condition);
306: this .setId(hero.interfaces.BnIterationUtil.generateGUID(this ));
307:
308: // This is only possible in CMPs. Otherwise return a valid PK.
309: return null;
310: }
311:
312: public void setEntityContext(EntityContext lContext) {
313: mContext = lContext;
314: }
315:
316: public void unsetEntityContext() {
317: mContext = null;
318: }
319:
320: public void ejbActivate() {
321: }
322:
323: public void ejbPassivate() {
324: }
325:
326: public void ejbLoad() {
327: }
328:
329: public void ejbStore() {
330: }
331:
332: public void ejbRemove() throws RemoveException {
333: }
334:
335: }
|