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