001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: PersonneEC.java 4406 2004-03-19 11:57:20Z benoitf $
023: * --------------------------------------------------------------------------
024: */
025:
026: // PersonneEC.java
027: package org.objectweb.jonas.jtests.beans.annuaire;
028:
029: import javax.ejb.EntityBean;
030:
031: import org.objectweb.util.monolog.api.BasicLevel;
032:
033: /**
034: * This is an entity bean with "container managed persistence version 1.x".
035: * This class extends the similar entity bean with "CMP version 2.x",
036: * and implements methods specifics to this bean.
037: * @author Philippe Durieux, Helene Joanin (jonas team)
038: */
039: public class PersonneEC extends PersonneEC2 implements EntityBean {
040:
041: boolean dirty = false;
042: boolean isModifiedCalled = false;
043: boolean ejbStoreCalled = false;
044:
045: // ------------------------------------------------------------------
046: // State of the bean.
047: // They must be public for Container Managed Persistance.
048: // ------------------------------------------------------------------
049: public String nom;
050: public String numero;
051: public int timerIdent;
052: public int timerCount;
053:
054: // ------------------------------------------------------------------
055: // Accessors and setters implementation
056: // ------------------------------------------------------------------
057:
058: /**
059: * getNumero / Tx Attribute = Required
060: */
061: public String getNumero() {
062: logger.log(BasicLevel.DEBUG, "");
063: return numero;
064: }
065:
066: /**
067: * setNumero / Tx Attribute = Required
068: */
069: public void setNumero(String s) {
070: logger.log(BasicLevel.DEBUG, "");
071: numero = s;
072: dirty = true;
073: }
074:
075: /**
076: * setNumero / Tx Attribute = Supports
077: */
078: public void setNumeroNTX(String s) {
079: logger.log(BasicLevel.DEBUG, "");
080: super .setNumeroNTX(s);
081: dirty = true;
082: }
083:
084: /**
085: * setNom - Attention: on modifie la PK!!!
086: */
087: public void setNom(String s) {
088: logger.log(BasicLevel.DEBUG, "");
089: nom = s;
090: dirty = true;
091: }
092:
093: /**
094: * getNom
095: */
096: public String getNom() {
097: logger.log(BasicLevel.DEBUG, "");
098: return nom;
099: }
100:
101: public int getTimerIdent() {
102: logger.log(BasicLevel.DEBUG, "");
103: return timerIdent;
104: }
105:
106: public void setTimerIdent(int id) {
107: logger.log(BasicLevel.DEBUG, "");
108: dirty = true;
109: timerIdent = id;
110: }
111:
112: public int getTimerCount() {
113: logger.log(BasicLevel.DEBUG, "");
114: return timerCount;
115: }
116:
117: public void setTimerCount(int cnt) {
118: logger.log(BasicLevel.DEBUG, "");
119: dirty = true;
120: timerCount = cnt;
121: }
122:
123: // ------------------------------------------------------------------
124: // isModified method
125: // ------------------------------------------------------------------
126: public boolean isModified() {
127: isModifiedCalled = true;
128: return dirty;
129: }
130:
131: // ------------------------------------------------------------------
132: // EntityBean implementation
133: // ------------------------------------------------------------------
134:
135: public void ejbLoad() {
136: logger.log(BasicLevel.DEBUG, "");
137: super .ejbLoad();
138: dirty = false;
139: }
140:
141: public void ejbStore() {
142: logger.log(BasicLevel.DEBUG, "");
143: ejbStoreCalled = true;
144: super .ejbStore();
145: dirty = false;
146: }
147:
148: // ------------------------------------------------------------------
149: // Personne implementation
150: // ------------------------------------------------------------------
151:
152: public boolean isDirty() {
153: logger.log(BasicLevel.DEBUG, "PersonneEC " + nom + " isDirty ="
154: + dirty + " " + numero);
155: return dirty;
156: }
157:
158: public void reset() {
159: logger.log(BasicLevel.DEBUG, "PersonneEC " + nom + " reset "
160: + numero);
161: isModifiedCalled = false;
162: ejbStoreCalled = false;
163: }
164:
165: public boolean isModifiedCalled() {
166: logger.log(BasicLevel.DEBUG, "PersonneEC " + nom
167: + " isModifiedCalled =" + isModifiedCalled + " "
168: + numero);
169: return isModifiedCalled;
170: }
171:
172: public boolean ejbStoreCalled() {
173: logger.log(BasicLevel.DEBUG, "PersonneEC " + nom
174: + " ejbStoreCalled =" + ejbStoreCalled + " " + numero);
175: return ejbStoreCalled;
176: }
177:
178: }
|