KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > relation > tier > TiephyBean


1 package org.objectweb.jonas.jtests.beans.relation.tier;
2
3 import javax.ejb.EJBException JavaDoc;
4
5 public abstract class TiephyBean
6
7 implements javax.ejb.EntityBean JavaDoc {
8
9     protected javax.ejb.EntityContext JavaDoc entityCtx = null;
10
11     protected TiephyValue TiephyValue = null;
12
13     /**
14      * Returns the numinttie
15      * @return the numinttie
16      */

17     public abstract java.lang.Integer JavaDoc getNuminttie();
18
19     /**
20      * Sets the numinttie
21      * @param numinttie the new numinttie value
22      */

23     public abstract void setNuminttie(java.lang.Integer JavaDoc numinttie);
24
25     /**
26      * Returns the nomusatie
27      * @return the nomusatie
28      */

29     public abstract java.lang.String JavaDoc getNomusatie();
30
31     /**
32      * Sets the nomusatie
33      * @param nomusatie the new nomusatie value
34      */

35     public abstract void setNomusatie(java.lang.String JavaDoc nomusatie);
36
37     /**
38      * This is a bi-directional one-to-one relationship CMR method
39      * @return the TierLocal.
40      */

41     public abstract TierLocal getTier();
42
43     /**
44      * get method relation one
45      */

46     public TierValue getTierValue() {
47         // return the value !
48
return getTier().getTierValue();
49     }
50
51     /**
52      * get method relation one
53      * @ejb.interface-method view-type="local"
54      */

55     public void setTierValue(TierValue value) {
56         getTier().update(value);
57     }
58
59     /**
60      * Sets the related TierLocal
61      * @param tier the related TierLocal
62      */

63     public abstract void setTier(TierLocal tier);
64
65     /**
66      * Return the value object version of this entity.
67      */

68     public TiephyValue getTiephyValue() {
69         try {
70             TiephyValue = new TiephyValue();
71             TiephyValue = setColumns(TiephyValue);
72             return TiephyValue;
73         } catch (EJBException JavaDoc e) {
74             // TODO Auto-generated catch block
75
e.printStackTrace();
76         } catch (IllegalStateException JavaDoc e) {
77             // TODO Auto-generated catch block
78
e.printStackTrace();
79         }
80         return null;
81
82     }
83
84     /**
85      * Update the value object version of this entity.
86      * @ejb.interface-method view-type="local"
87      */

88     public void update(TiephyValue value) {
89         if (value.nomusatieHasBeenSet()) setNomusatie(value.getNomusatie());
90     }
91
92     /**
93      * Creates an instance based on a value object When the client invokes a
94      * create method, the EJB container invokes the ejbCreate method. Typically,
95      * an ejbCreate method in an entity bean performs the following tasks:
96      * <UL>
97      * <LI>Inserts the entity state into the database.</LI>
98      * <LI>Initializes the instance variables.</LI>
99      * <LI>Returns the primary key.</LI>
100      * </UL>
101      * @param value the value object used to initialise the new instance
102      * @return the primary key of the new instance
103      */

104     public java.lang.Integer JavaDoc ejbCreate(TiephyValue value, TierLocal tier)
105             throws javax.ejb.CreateException JavaDoc {
106         // Use Middlegen's Sequence Block PK generator. Only works for numeric
107
// fields
108
try {
109             SequenceSessionLocal sequenceGenerator = SequenceSessionUtil.getLocalHome().create();
110             setNuminttie(new java.lang.Integer JavaDoc(Integer.toString(sequenceGenerator
111                     .getNextSequenceNumber("CNEDI.TIEPHY.NUMINTTIE"))));
112         } catch (javax.naming.NamingException JavaDoc e) {
113             throw new javax.ejb.CreateException JavaDoc(e.getMessage());
114         }
115         // Use XDoclet's GUID generator. Only works for String fields
116
// This requires <utilobject includeGUID="true"/> in ejbdoclet.
117

118         setNomusatie(value.getNomusatie());
119         // EJB 2.0 spec says return null for CMP ejbCreate methods.
120
return null;
121     }
122
123     /**
124      * The container invokes this method immediately after it calls ejbCreate.
125      * @param value the value object used to initialise the new instance
126      */

127     public void ejbPostCreate(TiephyValue value, TierLocal tier)
128             throws javax.ejb.CreateException JavaDoc {
129         // Set CMR fields
130
setTier(tier);
131     }
132
133     // No
134
// D:\IBM\Eclipse3.0\eclipse\workspace\TestBugs\middlegen/src/middlegen/cmp20-tiephy-class-code.txt
135
// found.
136

137     public void setEntityContext(javax.ejb.EntityContext JavaDoc entityCtx) {
138         this.entityCtx = entityCtx;
139     }
140
141     public void unsetEntityContext() {
142         this.entityCtx = null;
143     }
144
145     private TiephyValue setColumns(TiephyValue value) {
146         value.setNuminttie(getNuminttie());
147         value.setNomusatie(getNomusatie());
148         return value;
149     }
150 }
Popular Tags