001: package hero.entity;
002:
003: import hero.interfaces.BnAuthRoleData;
004: import hero.interfaces.BnAuthRolePK;
005: import hero.interfaces.BnAuthRoleValue;
006:
007: import java.util.Collection;
008:
009: import javax.ejb.CreateException;
010: import javax.ejb.EJBException;
011: import javax.ejb.EntityBean;
012: import javax.ejb.EntityContext;
013: import javax.ejb.RemoveException;
014:
015: /**
016: * The Entity bean represents a BnAuthRole (for authorization of ejb method)
017: *
018: * @author Fran?ois Charoy
019: * @version $Revision: 1.11 $
020: *
021: * @ejb:bean name="BnAuthRole"
022: * display-name="BnAuthRole Entity"
023: * type="CMP"
024: * jndi-name="ejb/hero/BnAuthRole"
025: * local-jndi-name="ejb/hero/BnAuthRole_L"
026: * view-type="both"
027: * cmp-version="2.x"
028: * reentrant="true"
029: *
030: * The following tag is required to make JBoss guarantee database consistency
031: * when removing entities involved in relations.
032: * @ejb:transaction type="Required"
033: *
034: * @jonas.bean
035: * lock-policy="container-read-committed"
036: * @jonas.jdbc-mapping
037: * jndi-name="bonita"
038: * jdbc-table-name="BnAuthRole"
039: *
040: * @jonas.shared false
041: *
042: * @ejb:finder signature="java.util.Collection findAll()"
043: * query="SELECT object(a) FROM BnAuthRole a"
044: * transaction-type="Supports"
045: *
046: * @ejb:finder signature="hero.interfaces.BnAuthRole findByName(java.lang.String pName)" result-type-mapping="Remote"
047: * query="SELECT OBJECT(n) FROM BnAuthRole n WHERE n.name = ?1"
048: * transaction-type="Supports"
049: * @ejb:finder signature="hero.interfaces.BnAuthRoleLocal findByName(java.lang.String pName)" result-type-mapping="Local"
050: * query="SELECT OBJECT(n) FROM BnAuthRole n WHERE n.name = ?1"
051: * transaction-type="Supports"
052: *
053: *
054: * @ejb.value-object
055: * match="*"
056: * name="BnAuthRole"
057: *
058: * @jboss.persistence
059: * table-name="BnAuthRole"
060: * create-table="true"
061: * remove-table="false"
062: *
063: * @jboss.container-configuration name="Standard CMP 2.x EntityBean for Bonita"
064: **/
065: public abstract class BnAuthRoleBean implements EntityBean {
066:
067: // -------------------------------------------------------------------------
068: // Members
069: // -------------------------------------------------------------------------
070:
071: public EntityContext mContext;
072:
073: // -------------------------------------------------------------------------
074: // Properties (Getters/Setters)
075: // -------------------------------------------------------------------------
076:
077: /**
078: * Retrieve the BnAuthRole's id.
079: *
080: * @return Returns an int representing the id of this BnAuthRole.
081: *
082: * @ejb:pk-field
083: *
084: * @ejb:persistence column-name="id"
085: * @jonas.cmp-field-jdbc-mapping
086: * field-name="id"
087: * jdbc-field-name="id"
088: * key-jdbc-name="BnUser_id"
089: * @ejb:transaction type="Supports"
090: *
091: **/
092: public abstract String getId();
093:
094: /**
095: * Set the BnAuthRole's id.
096: *
097: * @param pId The id of this BnAuthRole. Is set at creation time.
098: * @ejb:transaction type="Required"
099: **/
100: public abstract void setId(String pId);
101:
102: /**
103: * Retrieve the BnAuthRole's Name.
104: *
105: * @return Returns an int representing the Name of this BnAuthRole.
106: * @ejb:interface-method view-type="both"
107: *
108: * @ejb:persistence column-name="name"
109: * @ejb:transaction type="Supports"
110: **/
111: public abstract String getName();
112:
113: /**
114: * Set the BnAuthRole's Name.
115: *
116: * @param pName The Name of this BnAuthRole. Is set at creation time.
117: * @ejb:transaction type="Required"
118: **/
119: public abstract void setName(String pName);
120:
121: /**
122: * Retrieve the BnAuthRole's Group.
123: *
124: * @return Returns an int representing the Group of this BnAuthRole.
125: *
126: * @ejb:persistence column-name="authrolegroup"
127: * @ejb:transaction type="Supports"
128: **/
129: public abstract String getBnRoleGroup();
130:
131: /**
132: * Set the BnAuthRole's Group.
133: *
134: * @param pGroup the Group of this BnAuthRole
135: * @ejb:transaction type="Required"
136: **/
137: public abstract void setBnRoleGroup(String pGroup);
138:
139: /**
140: * @returns the users of the role
141: * @ejb:interface-method view-type="local"
142: * @ejb:relation name="AuthRoles" role-name="is-authrole-of" multiple="yes"
143: * @ejb:transaction type="Supports"
144: *
145: * @jonas.ejb-relation
146: * pk-composite="true"
147: * ejb-relation-name="AuthRoles"
148: * ejb-relationship-role-name1="is-authrole-of"
149: * jdbc-table-name="BNAUTHROLE_BNUSER"
150: * foreign-key-jdbc-name1="BnUser_id"
151: *
152: * @jboss.relation-table
153: * table-name="BNAUTHROLE_BNUSER"
154: * create-table="true"
155: * remove-table="false"
156: * @jboss.relation
157: * related-pk-field = "id"
158: * fk-column = "BnUser_id"
159: */
160: public abstract Collection getBnUsers();
161:
162: /**
163: * Set the AuthRoles of this project
164: *
165: * @param pUsers users of the role
166: * @ejb:transaction type="Required"
167: **/
168: public abstract void setBnUsers(Collection pUsers);
169:
170: /**
171: * @ejb.interface-method
172: * @ejb:transaction type="Supports"
173: */
174: public abstract BnAuthRoleValue getBnAuthRoleValue();
175:
176: /**
177: * @ejb.interface-method
178: * @ejb:transaction type="Required"
179: */
180: public abstract void setBnAuthRoleValue(BnAuthRoleValue v);
181:
182: // -------------------------------------------------------------------------
183: // Framework Callbacks
184: // -------------------------------------------------------------------------
185:
186: /**
187: * Create a BnAuthRole based on the supplied BnAuthRole Value Object.
188: *
189: * @param pAuthRole The data used to create the BnAuthRole.
190: *
191: * @throws InvalidValueException If one of the values are not correct,
192: * this will not roll back the transaction
193: * because the caller has the chance to
194: * fix the problem and try again
195: * @throws EJBException If no new unique ID could be retrieved this will
196: * rollback the transaction because there is no
197: * hope to try again
198: * @throws CreateException Because we have to do so (EJB spec.)
199: *
200: * @ejb:create-method view-type="both"
201: **/
202: public BnAuthRolePK ejbCreate(BnAuthRoleValue pAuthRole)
203: throws EJBException, CreateException {
204: this .setId(hero.interfaces.BnAuthRoleUtil.generateGUID(this ));
205: return null;
206: }
207:
208: public void ejbPostCreate(BnAuthRoleValue pAuthRole) {
209: // Assign value object in ejbPostCreate to apply XDoclet best
210: // practice. If not done, there will be an error in JBoss if
211: // the Value Object has relations.
212: this .setBnAuthRoleValue(pAuthRole);
213: }
214:
215: public void ejbPostCreate(BnAuthRoleData pAuthRole) {
216: }
217:
218: public void setEntityContext(EntityContext lContext) {
219: mContext = lContext;
220: }
221:
222: public void unsetEntityContext() {
223: mContext = null;
224: }
225:
226: public void ejbActivate() {
227: }
228:
229: public void ejbPassivate() {
230: }
231:
232: public void ejbLoad() {
233: }
234:
235: public void ejbStore() {
236: }
237:
238: public void ejbRemove() throws RemoveException {
239: }
240: }
|