KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > annuaire > PersonneEC


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: PersonneEC.java,v 1.7 2004/03/19 11:57:15 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 // PersonneEC.java
27

28 package org.objectweb.jonas.jtests.beans.annuaire;
29
30 import javax.ejb.EntityBean JavaDoc;
31
32 import org.objectweb.util.monolog.api.BasicLevel;
33
34 /**
35  * This is an entity bean with "container managed persistence version 1.x".
36  * This class extends the similar entity bean with "CMP version 2.x",
37  * and implements methods specifics to this bean.
38  * @author Philippe Durieux, Helene Joanin (jonas team)
39  */

40 public class PersonneEC extends PersonneEC2 implements EntityBean JavaDoc {
41
42     boolean dirty = false;
43     boolean isModifiedCalled = false;
44     boolean ejbStoreCalled = false;
45
46     // ------------------------------------------------------------------
47
// State of the bean.
48
// They must be public for Container Managed Persistance.
49
// ------------------------------------------------------------------
50
public String JavaDoc nom;
51     public String JavaDoc numero;
52     public int timerIdent;
53     public int timerCount;
54
55     // ------------------------------------------------------------------
56
// Accessors and setters implementation
57
// ------------------------------------------------------------------
58

59     /**
60      * getNumero / Tx Attribute = Required
61      */

62     public String JavaDoc getNumero() {
63         logger.log(BasicLevel.DEBUG, "");
64         return numero;
65     }
66
67     /**
68      * setNumero / Tx Attribute = Required
69      */

70     public void setNumero(String JavaDoc s) {
71         logger.log(BasicLevel.DEBUG, "");
72         numero = s;
73         dirty = true;
74     }
75
76     /**
77      * setNumero / Tx Attribute = Supports
78      */

79     public void setNumeroNTX(String JavaDoc s) {
80         logger.log(BasicLevel.DEBUG, "");
81         super.setNumeroNTX(s);
82         dirty = true;
83     }
84
85     /**
86      * setNom - Attention: on modifie la PK!!!
87      */

88     public void setNom(String JavaDoc s) {
89         logger.log(BasicLevel.DEBUG, "");
90         nom = s;
91         dirty = true;
92     }
93
94     /**
95      * getNom
96      */

97     public String JavaDoc getNom() {
98         logger.log(BasicLevel.DEBUG, "");
99         return nom;
100     }
101
102     public int getTimerIdent() {
103         logger.log(BasicLevel.DEBUG, "");
104         return timerIdent;
105     }
106
107     public void setTimerIdent(int id) {
108         logger.log(BasicLevel.DEBUG, "");
109         dirty = true;
110         timerIdent = id;
111     }
112
113     public int getTimerCount() {
114         logger.log(BasicLevel.DEBUG, "");
115         return timerCount;
116     }
117
118     public void setTimerCount(int cnt) {
119         logger.log(BasicLevel.DEBUG, "");
120         dirty = true;
121         timerCount = cnt;
122     }
123
124
125     // ------------------------------------------------------------------
126
// isModified method
127
// ------------------------------------------------------------------
128
public boolean isModified() {
129         isModifiedCalled = true;
130         return dirty;
131     }
132
133     // ------------------------------------------------------------------
134
// EntityBean implementation
135
// ------------------------------------------------------------------
136

137     public void ejbLoad() {
138         logger.log(BasicLevel.DEBUG, "");
139         super.ejbLoad();
140         dirty = false;
141     }
142
143     public void ejbStore() {
144         logger.log(BasicLevel.DEBUG, "");
145         ejbStoreCalled = true;
146         super.ejbStore();
147         dirty = false;
148     }
149     
150     // ------------------------------------------------------------------
151
// Personne implementation
152
// ------------------------------------------------------------------
153

154     public boolean isDirty() {
155         logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" isDirty ="+dirty+" "+numero);
156         return dirty;
157     }
158
159     public void reset() {
160         logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" reset "+numero);
161         isModifiedCalled = false;
162         ejbStoreCalled = false;
163     }
164
165     public boolean isModifiedCalled() {
166         logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" isModifiedCalled ="+isModifiedCalled+" "+numero);
167         return isModifiedCalled;
168     }
169
170     public boolean ejbStoreCalled() {
171         logger.log(BasicLevel.DEBUG, "PersonneEC "+nom+" ejbStoreCalled ="+ejbStoreCalled+" "+numero);
172         return ejbStoreCalled;
173     }
174     
175 }
176
Popular Tags