Mir goes GPL
[mir.git] / source / mir / storage / StorageObject.java
1 /*
2  * Copyright (C) 2001, 2002  The Mir-coders group
3  *
4  * This file is part of Mir.
5  *
6  * Mir is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * Mir 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
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Mir; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  * In addition, as a special exception, The Mir-coders gives permission to link
21  * the code of this program with the com.oreilly.servlet library, any library
22  * licensed under the Apache Software License, The Sun (tm) Java Advanced
23  * Imaging library (JAI), The Sun JIMI library (or with modified versions of
24  * the above that use the same license as the above), and distribute linked
25  * combinations including the two.  You must obey the GNU General Public
26  * License in all respects for all of the code used other than the above
27  * mentioned libraries.  If you modify this file, you may extend this exception
28  * to your version of the file, but you are not obligated to do so.  If you do
29  * not wish to do so, delete this exception statement from your version.
30  */
31 /*
32  * Implementiert Interface für die Speicherschicht.
33  * Bislang gibt es in der Bibliothek nur die Möglichkeit
34  * in einer Datenbank zu speichern.
35  */
36
37 package mir.storage;
38
39 import java.lang.*;
40 import java.util.*;
41 import java.sql.*;
42 import freemarker.template.*;
43 import mir.entity.*;
44
45
46 /**
47  * Implementiert Interface für die Speicherschicht.
48  * Bislang gibt es in der Bibliothek nur die Möglichkeit
49  * in einer Datenbank zu speichern.
50  * @author RK
51  * @version     29.6.1999
52  */
53 public interface StorageObject {
54
55         /**
56          * Dokumentation siehe Database.java
57          * @param id
58          * @return Entity
59          * @exception StorageObjectException
60          */
61         abstract public Entity selectById (String id) throws StorageObjectException;
62
63
64
65         /**
66          * Dokumentation siehe Database.java
67          * @param aField
68          * @param aValue
69          * @return EntityList
70          * @exception StorageObjectException
71          */
72         abstract public EntityList selectByFieldValue (String aField, String aValue) throws StorageObjectException;
73
74
75
76         /**
77          * Dokumentation siehe Database.java
78          * @param whereClause
79          * @return EntityList
80          * @exception StorageObjectException
81          */
82         abstract public EntityList selectByWhereClause (String whereClause) throws StorageObjectException;
83
84
85
86         /**
87          * Dokumentation siehe Database.java
88          * @param whereClause
89          * @param offset
90          * @return EntityList
91          * @exception StorageObjectException
92          */
93         abstract public EntityList selectByWhereClause (String whereClause, int offset) throws StorageObjectException;
94
95
96
97         /**
98          * Dokumentation siehe Database.java
99          * @param whereClause
100          * @param orderBy
101          * @param offset
102          * @return EntityList
103          * @exception StorageObjectException
104          */
105         abstract public EntityList selectByWhereClause (String whereClause, String orderBy,
106                         int offset) throws StorageObjectException;
107
108
109
110         /**
111          * Dokumentation siehe Database.java
112          * @param whereClause
113          * @param orderBy
114          * @param offset
115          * @param limit
116          * @return EntityList
117          * @exception StorageObjectException
118          */
119         abstract public EntityList selectByWhereClause (String whereClause, String orderBy,
120                         int offset, int limit) throws StorageObjectException;
121
122
123
124         /**
125          * Dokumentation siehe Database.java
126          * @param id
127          * @return boolen
128          * @exception StorageObjectException
129          */
130         abstract public boolean delete (String id) throws StorageObjectException;
131
132
133
134         /**
135          * Dokumentation siehe Database.java
136          * @return ArrayList
137          * @exception StorageObjectException
138          */
139         abstract public ArrayList getFields () throws StorageObjectException;
140
141
142
143         /**
144          * Dokumentation siehe Database.java
145          * @return int[]
146          * @exception StorageObjectException
147          */
148         abstract public int[] getTypes () throws StorageObjectException;
149
150
151
152         /**
153          * Dokumentation siehe Database.java
154          * @return ArrayList
155          * @exception StorageObjectException
156          */
157         abstract public ArrayList getLabels () throws StorageObjectException;
158
159
160
161         /**
162          * Dokumentation siehe Database.java
163          * @param a
164          * @exception StorageObjectException
165          */
166         abstract public void update (Entity a) throws StorageObjectException;
167
168
169
170         /**
171          * Dokumentation siehe Database.java
172          * @param a
173          * @return String id
174          * @exception StorageObjectException
175          */
176         abstract public String insert (Entity a) throws StorageObjectException;
177
178
179
180         /**
181          * Dokumentation siehe Database.java
182          * @return Class Klasse der Entity
183          */
184                 abstract public Class getEntityClass();
185
186
187
188         /**
189          * put your documentation comment here
190          * @return
191          */
192                 abstract public String getIdName();
193
194
195
196         /**
197          * Dokumentation siehe Database.java
198          * @return String
199          */
200                 abstract public String getTableName();
201
202
203
204         /**
205          * Dokumentation siehe Database.java
206          * @return SimpleHash
207          */
208                 abstract public SimpleHash getHashData();
209
210
211
212         /**
213          * Dokumentation siehe Database.java
214          * @return Connection
215          * @exception StorageObjectException
216          */
217         abstract public Connection getPooledCon () throws StorageObjectException;
218
219
220
221         /**
222          * Dokumentation siehe Database.java
223          * @param a
224          * @param sql
225          * @return ResultSet
226          * @exception StorageObjectException, SQLException
227          */
228         abstract public ResultSet executeSql (Statement a, String sql) throws StorageObjectException,
229                         SQLException;
230
231
232
233         /**
234          * Dokumentation siehe Database.java
235          * @param con
236          * @param stmt
237          */
238                 abstract public void freeConnection(Connection con,  Statement stmt)
239             throws StorageObjectException;
240
241
242
243         /**
244          * Dokumentation siehe Database.java
245          * @return
246          */
247         abstract public SimpleList getPopupData () throws StorageObjectException;
248
249         abstract public int executeUpdate(Statement a, String sql) throws StorageObjectException, SQLException ;
250         abstract public int executeUpdate(String sql) throws StorageObjectException, SQLException ;
251         abstract public int getSize(String where) throws SQLException,StorageObjectException;
252
253 }
254
255
256