001: package org.objectweb.jonas.jtests.beans.relation.tier;
002:
003: import javax.ejb.EJBException;
004:
005: public abstract class TierBean
006:
007: implements javax.ejb.EntityBean {
008:
009: protected javax.ejb.EntityContext entityCtx = null;
010:
011: protected TierValue TierValue = null;
012:
013: /**
014: * Returns the numinttie
015: * @return the numinttie
016: */
017: public abstract java.lang.Integer getNuminttie();
018:
019: /**
020: * Sets the numinttie
021: * @param numinttie the new numinttie value
022: */
023: public abstract void setNuminttie(java.lang.Integer numinttie);
024:
025: /**
026: * Returns the emailtie
027: * @return the emailtie
028: */
029: public abstract java.lang.String getEmailtie();
030:
031: /**
032: * Sets the emailtie
033: * @param emailtie the new emailtie value
034: */
035: public abstract void setEmailtie(java.lang.String emailtie);
036:
037: /**
038: * This is a bi-directional one-to-one relationship CMR method
039: * @return the related TiephyLocal.
040: */
041: public abstract TiephyLocal getTiephy();
042:
043: /**
044: * get method relation one
045: */
046: public TiephyValue getTiephyValue() {
047: // return the value !
048: return getTiephy().getTiephyValue();
049: }
050:
051: /**
052: * get method relation one
053: */
054: public void setTiephyValue(TiephyValue value) {
055: getTiephy().update(value);
056: }
057:
058: /**
059: * Sets the related test.entity.tiephy.TiephyLocal
060: */
061: public abstract void setTiephy(TiephyLocal tiephy);
062:
063: /**
064: * This is a bi-directional one-to-one relationship CMR method
065: * @return the related TiemorLocal.
066: */
067: public abstract TiemorLocal getTiemor();
068:
069: /**
070: * get method relation one
071: */
072: public TiemorValue getTiemorValue() {
073: // return the value !
074: return getTiemor().getTiemorValue();
075: }
076:
077: /**
078: * get method relation one
079: */
080: public void setTiemorValue(TiemorValue value) {
081: getTiemor().update(value);
082: }
083:
084: /**
085: * Sets the related test.entity.tiemor.TiemorLocal
086: * @param tiemor the related TiemorLocal
087: */
088: public abstract void setTiemor(TiemorLocal tiemor);
089:
090: /**
091: * Return the value object version of this entity.
092: */
093: public TierValue getTierValue() {
094: try {
095: TierValue = new TierValue();
096: TierValue = setColumns(TierValue);
097: return TierValue;
098: } catch (EJBException e) {
099: // TODO Auto-generated catch block
100: e.printStackTrace();
101: } catch (IllegalStateException e) {
102: // TODO Auto-generated catch block
103: e.printStackTrace();
104: }
105: return null;
106:
107: }
108:
109: /**
110: * Update the value object version of this entity.
111: * @ejb.interface-method view-type="local"
112: */
113: public void update(TierValue value) {
114: if (value.emailtieHasBeenSet())
115: setEmailtie(value.getEmailtie());
116: }
117:
118: /**
119: * Creates an instance based on a value object When the client invokes a
120: * create method, the EJB container invokes the ejbCreate method. Typically,
121: * an ejbCreate method in an entity bean performs the following tasks:
122: * <UL>
123: * <LI>Inserts the entity state into the database.</LI>
124: * <LI>Initializes the instance variables.</LI>
125: * <LI>Returns the primary key.</LI>
126: * </UL>
127: * @param value the value object used to initialise the new instance
128: * @return the primary key of the new instance
129: * @ejb.create-method view-type="local"
130: */
131: public java.lang.Integer ejbCreate(TierValue value)
132: throws javax.ejb.CreateException {
133: // Use Middlegen's Sequence Block PK generator. Only works for numeric
134: // fields
135: try {
136: SequenceSessionLocal sequenceGenerator = SequenceSessionUtil
137: .getLocalHome().create();
138: setNuminttie(new java.lang.Integer(
139: Integer
140: .toString(sequenceGenerator
141: .getNextSequenceNumber("CNEDI.TIERS.NUMINTTIE"))));
142: } catch (javax.naming.NamingException e) {
143: throw new javax.ejb.CreateException(e.getMessage());
144: }
145: // Use XDoclet's GUID generator. Only works for String fields
146: // This requires <utilobject includeGUID="true"/> in ejbdoclet.
147:
148: setEmailtie(value.getEmailtie());
149: // EJB 2.0 spec says return null for CMP ejbCreate methods.
150: return null;
151: }
152:
153: /**
154: * The container invokes this method immediately after it calls ejbCreate.
155: * @param value the value object used to initialise the new instance
156: */
157: public void ejbPostCreate(TierValue value)
158: throws javax.ejb.CreateException {
159: }
160:
161: public void setEntityContext(javax.ejb.EntityContext entityCtx) {
162: this .entityCtx = entityCtx;
163: }
164:
165: public void unsetEntityContext() {
166: this .entityCtx = null;
167: }
168:
169: private TierValue setColumns(TierValue value) {
170: value.setNuminttie(getNuminttie());
171: value.setEmailtie(getEmailtie());
172: return value;
173: }
174: }
|