KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > dbtest > bean > AllTypesBean


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.dbtest.bean;
23
24 import java.rmi.*;
25 import javax.ejb.*;
26 import java.util.Collection JavaDoc;
27 import java.util.ArrayList JavaDoc;
28
29 import javax.naming.Context JavaDoc;
30 import javax.naming.InitialContext JavaDoc;
31 import java.sql.Date JavaDoc;
32 import java.sql.Time JavaDoc;
33 import java.sql.Timestamp JavaDoc;
34 import org.jboss.test.dbtest.interfaces.MyObject;
35
36
37 public class AllTypesBean implements EntityBean {
38     public boolean aBoolean;
39     public byte aByte;
40     public short aShort;
41     public int anInt;
42     public long aLong;
43     public float aFloat;
44     public double aDouble;
45 // public char aChar;
46
public String JavaDoc aString;
47     public Date JavaDoc aDate;
48     public Time JavaDoc aTime;
49     public Timestamp JavaDoc aTimestamp;
50
51     public MyObject anObject;
52
53     public Collection JavaDoc aList;
54
55     private EntityContext entityContext;
56
57
58     public String JavaDoc ejbCreate(String JavaDoc pk) throws RemoteException, CreateException {
59         return ejbCreate(true, (byte)1, (short)2, (int)3, (long)4, (float)5.6,
60             (double)7.8, /*'9',*/ pk, new Date JavaDoc(System.currentTimeMillis()),
61             new Time JavaDoc(System.currentTimeMillis()),
62             new Timestamp JavaDoc(System.currentTimeMillis()), new MyObject());
63     }
64
65     public void ejbPostCreate(String JavaDoc pk)
66         throws RemoteException, CreateException {}
67
68
69     public String JavaDoc ejbCreate(boolean aBoolean, byte aByte, short aShort, int anInt,
70         long aLong, float aFloat, double aDouble, /*char aChar,*/ String JavaDoc aString,
71         Date JavaDoc aDate, Time JavaDoc aTime, Timestamp JavaDoc aTimestamp, MyObject anObject )
72
73         throws RemoteException, CreateException {
74
75         this.aBoolean = aBoolean;
76         this.aByte = aByte;
77         this.aShort = aShort;
78         this.anInt = anInt;
79         this.aLong = aLong;
80         this.aFloat = aFloat;
81         this.aDouble = aDouble;
82         //this.aChar = aChar;
83
this.aString = aString;
84         this.aDate = aDate;
85         this.aTime = aTime;
86         this.aTimestamp = aTimestamp;
87         this.anObject = anObject;
88
89         aList = new ArrayList JavaDoc();
90
91         return null;
92     }
93
94
95     public void ejbPostCreate(boolean aBoolean, byte aByte, short aShort, int anInt,
96         long aLong, float aFloat, double aDouble, /*char aChar,*/ String JavaDoc aString,
97         Date JavaDoc aDate, Time JavaDoc aTime, Timestamp JavaDoc aTimestamp, MyObject anObject )
98
99         throws RemoteException, CreateException {}
100
101     public void ejbActivate() throws RemoteException {}
102
103     public void ejbLoad() throws RemoteException {}
104
105     public void ejbPassivate() throws RemoteException {}
106
107     public void ejbRemove() throws RemoteException, RemoveException {}
108
109     public void ejbStore() throws RemoteException {}
110
111
112     public void setEntityContext(EntityContext context) throws RemoteException {
113         entityContext = context;
114     }
115
116     public void unsetEntityContext() throws RemoteException {
117         entityContext = null;
118     }
119
120
121     public void updateAllValues(boolean aBoolean, byte aByte, short aShort, int anInt,
122         long aLong, float aFloat, double aDouble, /*char aChar,*/ String JavaDoc aString,
123         Date JavaDoc aDate, Time JavaDoc aTime, Timestamp JavaDoc aTimestamp, MyObject anObject ) {
124
125         this.aBoolean = aBoolean;
126         this.aByte = aByte;
127         this.aShort = aShort;
128         this.anInt = anInt;
129         this.aLong = aLong;
130         this.aFloat = aFloat;
131         this.aDouble = aDouble;
132         //this.aChar = aChar;
133
this.aString = aString;
134         this.aDate = aDate;
135         this.aTime = aTime;
136         this.aTimestamp = aTimestamp;
137         this.anObject = anObject;
138
139     }
140
141     public void addObjectToList(Object JavaDoc anObject) throws RemoteException {
142         aList.add(anObject);
143     }
144
145     public void removeObjectFromList(Object JavaDoc anObject) throws RemoteException {
146         aList.remove(anObject);
147     }
148
149     public Collection JavaDoc getObjectList() throws RemoteException { return aList; }
150
151     public boolean getBoolean() throws RemoteException { return aBoolean; }
152     public byte getByte() throws RemoteException { return aByte; }
153     public short getShort() throws RemoteException { return aShort; }
154     public int getInt() throws RemoteException { return anInt; }
155     public long getLong() throws RemoteException { return aLong; }
156     public float getFloat() throws RemoteException { return aFloat; }
157     public double getDouble() throws RemoteException { return aDouble; }
158     //public char getChar() throws RemoteException { return aChar; }
159
public String JavaDoc getString() throws RemoteException { return aString; }
160     public Date JavaDoc getDate() throws RemoteException { return aDate; }
161     public Time JavaDoc getTime() throws RemoteException { return aTime; }
162     public Timestamp JavaDoc getTimestamp() throws RemoteException { return aTimestamp; }
163
164     public MyObject getObject() throws RemoteException { return anObject; }
165
166     public void setByte(byte b) {aByte = b;}
167     public void setShort(short s) {aShort = s;}
168     public void setInt(int i) {anInt = i;}
169     public void setLong(long l) {aLong = l;}
170     public void setFloat(float f) {aFloat = f;}
171     public void setDouble(double d) {aDouble = d;}
172 }
173
Popular Tags