001: package org.objectweb.jonas.jtests.beans.relation.tier;
002:
003: import javax.ejb.EJBException;
004:
005: public abstract class TiephyBean
006:
007: implements javax.ejb.EntityBean {
008:
009: protected javax.ejb.EntityContext entityCtx = null;
010:
011: protected TiephyValue TiephyValue = 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 nomusatie
027: * @return the nomusatie
028: */
029: public abstract java.lang.String getNomusatie();
030:
031: /**
032: * Sets the nomusatie
033: * @param nomusatie the new nomusatie value
034: */
035: public abstract void setNomusatie(java.lang.String nomusatie);
036:
037: /**
038: * This is a bi-directional one-to-one relationship CMR method
039: * @return the TierLocal.
040: */
041: public abstract TierLocal getTier();
042:
043: /**
044: * get method relation one
045: */
046: public TierValue getTierValue() {
047: // return the value !
048: return getTier().getTierValue();
049: }
050:
051: /**
052: * get method relation one
053: * @ejb.interface-method view-type="local"
054: */
055: public void setTierValue(TierValue value) {
056: getTier().update(value);
057: }
058:
059: /**
060: * Sets the related TierLocal
061: * @param tier the related TierLocal
062: */
063: public abstract void setTier(TierLocal tier);
064:
065: /**
066: * Return the value object version of this entity.
067: */
068: public TiephyValue getTiephyValue() {
069: try {
070: TiephyValue = new TiephyValue();
071: TiephyValue = setColumns(TiephyValue);
072: return TiephyValue;
073: } catch (EJBException e) {
074: // TODO Auto-generated catch block
075: e.printStackTrace();
076: } catch (IllegalStateException e) {
077: // TODO Auto-generated catch block
078: e.printStackTrace();
079: }
080: return null;
081:
082: }
083:
084: /**
085: * Update the value object version of this entity.
086: * @ejb.interface-method view-type="local"
087: */
088: public void update(TiephyValue value) {
089: if (value.nomusatieHasBeenSet())
090: setNomusatie(value.getNomusatie());
091: }
092:
093: /**
094: * Creates an instance based on a value object When the client invokes a
095: * create method, the EJB container invokes the ejbCreate method. Typically,
096: * an ejbCreate method in an entity bean performs the following tasks:
097: * <UL>
098: * <LI>Inserts the entity state into the database.</LI>
099: * <LI>Initializes the instance variables.</LI>
100: * <LI>Returns the primary key.</LI>
101: * </UL>
102: * @param value the value object used to initialise the new instance
103: * @return the primary key of the new instance
104: */
105: public java.lang.Integer ejbCreate(TiephyValue value, TierLocal tier)
106: throws javax.ejb.CreateException {
107: // Use Middlegen's Sequence Block PK generator. Only works for numeric
108: // fields
109: try {
110: SequenceSessionLocal sequenceGenerator = SequenceSessionUtil
111: .getLocalHome().create();
112: setNuminttie(new java.lang.Integer(
113: Integer
114: .toString(sequenceGenerator
115: .getNextSequenceNumber("CNEDI.TIEPHY.NUMINTTIE"))));
116: } catch (javax.naming.NamingException e) {
117: throw new javax.ejb.CreateException(e.getMessage());
118: }
119: // Use XDoclet's GUID generator. Only works for String fields
120: // This requires <utilobject includeGUID="true"/> in ejbdoclet.
121:
122: setNomusatie(value.getNomusatie());
123: // EJB 2.0 spec says return null for CMP ejbCreate methods.
124: return null;
125: }
126:
127: /**
128: * The container invokes this method immediately after it calls ejbCreate.
129: * @param value the value object used to initialise the new instance
130: */
131: public void ejbPostCreate(TiephyValue value, TierLocal tier)
132: throws javax.ejb.CreateException {
133: // Set CMR fields
134: setTier(tier);
135: }
136:
137: // No
138: // D:\IBM\Eclipse3.0\eclipse\workspace\TestBugs\middlegen/src/middlegen/cmp20-tiephy-class-code.txt
139: // found.
140:
141: public void setEntityContext(javax.ejb.EntityContext entityCtx) {
142: this .entityCtx = entityCtx;
143: }
144:
145: public void unsetEntityContext() {
146: this .entityCtx = null;
147: }
148:
149: private TiephyValue setColumns(TiephyValue value) {
150: value.setNuminttie(getNuminttie());
151: value.setNomusatie(getNomusatie());
152: return value;
153: }
154: }
|