001: package hero.entity;
002:
003: import hero.interfaces.BnProjectLocal;
004: import hero.interfaces.BnRoleData;
005: import hero.interfaces.BnRolePK;
006: import hero.interfaces.BnRoleValue;
007: import hero.interfaces.BnRoleMapperLocal;
008:
009: import java.util.Collection;
010:
011: import javax.ejb.CreateException;
012: import javax.ejb.EJBException;
013: import javax.ejb.EntityBean;
014: import javax.ejb.EntityContext;
015: import javax.ejb.RemoveException;
016:
017: /**
018: * The Entity bean represents a BnRole
019: *
020: * @author Fran?ois Charoy
021: * @version $Revision: 1.13 $
022: *
023: * @ejb:bean name="BnRole"
024: * display-name="BnRole Entity"
025: * type="CMP"
026: * jndi-name="ejb/hero/BnRole"
027: * local-jndi-name="ejb/hero/BnRole_L"
028: * view-type="both"
029: * cmp-version="2.x"
030: * reentrant="true"
031: *
032: * @ejb:transaction type="Supports"
033: *
034: * @ejb:data-object extends="hero.interfaces.AbstractData"
035: * setdata="false"
036: *
037: * @jonas.bean
038: * lock-policy="container-read-committed"
039: * @jonas.jdbc-mapping
040: * jndi-name="bonita"
041: * jdbc-table-name="BnRole"
042: *
043: * @jonas.shared false
044: *
045: * @ejb:finder signature="java.util.Collection findAll()"
046: * query="SELECT object(r) FROM BnRole r"
047: * transaction-type="Supports"
048: *
049: * @ejb:finder signature="hero.interfaces.BnRole findByName(java.lang.String pName, java.lang.String pProjectId )" result-type-mapping="Remote"
050: * query="SELECT OBJECT(n) FROM BnRole n WHERE n.name = ?1 AND n.bnProject.id = ?2"
051: * transaction-type="Supports"
052: * @ejb:finder signature="hero.interfaces.BnRoleLocal findByName(java.lang.String pName, java.lang.String pProjectId )" result-type-mapping="Local"
053: * query="SELECT OBJECT(n) FROM BnRole n WHERE n.name = ?1 AND n.bnProject.id = ?2"
054: * transaction-type="Supports"
055: *
056: *
057: *
058: * @ejb.value-object
059: * match="*"
060: * name="BnRole"
061: *
062: * @ejb.value-object
063: * match="light"
064: * name="BnRoleLight"
065: *
066: * @jboss.persistence
067: * table-name="BnRole"
068: * create-table="true"
069: * remove-table="false"
070: *
071: * @jboss.container-configuration name="Standard CMP 2.x EntityBean for Bonita"
072: **/
073: public abstract class BnRoleBean implements EntityBean {
074:
075: // -------------------------------------------------------------------------
076: // Members
077:
078: public EntityContext mContext;
079:
080: // -------------------------------------------------------------------------
081: // Properties (Getters/Setters)
082: // -------------------------------------------------------------------------
083:
084: /**
085: * Retrieve the BnRole's id.
086: *
087: * @return Returns an int representing the id of this BnRole.
088: * @ejb:interface-method view-type="both"
089: * @ejb:pk-field
090: * @ejb.value-object
091: * match="light"
092: * @ejb:persistence column-name="id"
093: * @jonas.cmp-field-jdbc-mapping
094: * field-name="id"
095: * jdbc-field-name="id"
096: * @ejb:transaction type="Supports"
097: **/
098: public abstract String getId();
099:
100: /**
101: * Set the BnRole's id.
102: *
103: * @param pId The id of this BnRole. Is set at creation time.
104: * @ejb:transaction type="Required"
105: **/
106: public abstract void setId(String pId);
107:
108: /**
109: * Retrieve the BnRole's Description.
110: *
111: * @return Returns an int representing the Name of this BnRole.
112: * @ejb:interface-method view-type="both"
113: * @ejb.value-object
114: * match="light"
115: * @ejb:persistence column-name="description"
116: * @ejb:transaction type="Supports"
117: **/
118: public abstract String getDescription();
119:
120: /**
121: * Set the BnRole's Description.
122: *
123: * @param pDescription The Description of this BnRole. Is set at creation time.
124: * @ejb:transaction type="Required"
125: **/
126: public abstract void setDescription(String pDescription);
127:
128: /**
129: * Retrieve the BnRole's Name.
130: *
131: * @return Returns an int representing the Name of this BnRole.
132: * @ejb:interface-method view-type="both"
133: * @ejb.value-object
134: * match="light"
135: * @ejb:persistence column-name="name"
136: * @ejb:transaction type="Supports"
137: **/
138: public abstract String getName();
139:
140: /**
141: * Set the BnRole's Name.
142: *
143: * @param pName The Name of this BnRole. Is set at creation time.
144: * @ejb:transaction type="Required"
145: **/
146: public abstract void setName(String pName);
147:
148: /**
149: * @returns the users of the role
150: * @ejb:interface-method view-type="local"
151: * @ejb:relation name="Roles" role-name="is-role-of" multiple="yes"
152: * @jboss.relation-table create-table="true" remove-table="false"
153: * @ejb:transaction type="Supports"
154: *
155: * @jboss.relation-table create-table="true" remove-table="false"
156: * @jboss.relation
157: * related-pk-field = "id"
158: * fk-column = "userRoleIdFK"
159: */
160: public abstract Collection getBnUsers();
161:
162: /**
163: * Set the Roles of this project
164: *
165: * @param pUsers users of the role
166: * @ejb:interface-method view-type="local"
167: * @ejb:transaction type="Required"
168: **/
169: public abstract void setBnUsers(Collection pUsers);
170:
171: /**
172: * @returns the nodes of the role
173: * @ejb:interface-method view-type="local"
174: * @ejb:relation name="NodeRole" role-name="is-role-of-node" multiple="yes"
175: * @ejb:transaction type="Supports"
176: *
177: * @jboss.relation-table create-table="true" remove-table="false"
178: */
179: public abstract Collection getBnNodes();
180:
181: /**
182: * Set the Roles of this project
183: *
184: * @param pNodes nodes of the role
185: * @ejb:transaction type="Required"
186: **/
187: public abstract void setBnNodes(Collection pNodes);
188:
189: /**
190: * @returns the project of the role
191: * @ejb:interface-method view-type="local"
192: * @ejb:relation name="ProjectRoles" role-name="is-role-of-project" cascade-delete="yes"
193: * @ejb:transaction type="Supports"
194: * @jboss.relation
195: * related-pk-field = "id"
196: * fk-column = "projectRoleIdFK"
197: */
198: public abstract BnProjectLocal getBnProject();
199:
200: /**
201: * Set the Roles of this project
202: *
203: * @param pProject project of the role
204: * @ejb:interface-method view-type="local"
205: * @ejb:transaction type="Required"
206: **/
207: public abstract void setBnProject(BnProjectLocal pProject);
208:
209: /** Retrieve the RoleMapper for the role.
210: *
211: * @return Returns the role mapper.
212: * @ejb:interface-method view-type="both"
213: * @ejb:relation name="mapper-role" role-name="role2mapper"
214: * @ejb:value-object match="*"
215: * relation="external"
216: * aggregate="hero.interfaces.BnRoleMapperValue"
217: * aggregate-name="BnRoleMapper"
218: *
219: * @jonas.field-mapping
220: * key-jdbc-name="id"
221: *
222: * @ejb:transaction type="Supports"
223: * @jboss.relation
224: * related-pk-field = "id"
225: * fk-column = "roleMapperRoleIdFK"
226: **/
227: public abstract BnRoleMapperLocal getBnRoleMapper();
228:
229: /**
230: * Set the Roles of this mapper
231: *
232: * @param pMapper mapper of the role
233: * @ejb:transaction type="Required"
234: **/
235: public abstract void setBnRoleMapper(BnRoleMapperLocal pMapper);
236:
237: /**
238: * @ejb.interface-method
239: * @ejb:transaction type="Supports"
240: */
241: public abstract BnRoleValue getBnRoleValue();
242:
243: /**
244: * @ejb.interface-method
245: * @ejb:transaction type="Required"
246: */
247: public abstract void setBnRoleValue(BnRoleValue v);
248:
249: // -------------------------------------------------------------------------
250: // Framework Callbacks
251: // -------------------------------------------------------------------------
252:
253: /**
254: * Create a BnRole based on the supplied BnRole Value Object.
255: *
256: * @param pRole The data used to create the BnRole.
257: *
258: * @throws InvalidValueException If one of the values are not correct,
259: * this will not roll back the transaction
260: * because the caller has the chance to
261: * fix the problem and try again
262: * @throws EJBException If no new unique ID could be retrieved this will
263: * rollback the transaction because there is no
264: * hope to try again
265: * @throws CreateException Because we have to do so (EJB spec.)
266: *
267: * @ejb:create-method view-type="both"
268: **/
269: public BnRolePK ejbCreate(BnRoleValue pRole) throws EJBException,
270: CreateException {
271: this .setId(hero.interfaces.BnRoleUtil.generateGUID(this ));
272: return null;
273: }
274:
275: public void ejbPostCreate(BnRoleValue pRole) {
276: // Assign value object in ejbPostCreate to apply XDoclet best
277: // practice. If not done, there will be an error in JBoss if
278: // the Value Object has relations.
279: this .setBnRoleValue(pRole);
280: }
281:
282: public void setEntityContext(EntityContext lContext) {
283: mContext = lContext;
284: }
285:
286: public void unsetEntityContext() {
287: mContext = null;
288: }
289:
290: public void ejbActivate() {
291: }
292:
293: public void ejbPassivate() {
294: }
295:
296: public void ejbLoad() {
297: }
298:
299: public void ejbStore() {
300: }
301:
302: public void ejbRemove() throws RemoveException {
303: }
304: }
|