organizing imports
[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 package mir.storage;
37
38 import java.sql.Connection;
39 import java.sql.ResultSet;
40 import java.sql.SQLException;
41 import java.sql.Statement;
42 import java.util.List;
43
44 import mir.entity.Entity;
45 import mir.entity.EntityList;
46 import freemarker.template.SimpleHash;
47 import freemarker.template.SimpleList;
48
49
50 /**
51  * Implementiert Interface f?r die Speicherschicht.
52  * Bislang gibt es in der Bibliothek nur die M?glichkeit
53  * in einer Datenbank zu speichern.
54  * @author RK
55  * @version        29.6.1999
56  */
57 public interface StorageObject {
58   /**
59    * Dokumentation siehe Database.java
60    * @param id
61    * @return Entity
62    * @exception StorageObjectException
63    */
64   abstract public Entity selectById(String id) throws StorageObjectExc;
65
66   /**
67    * Dokumentation siehe Database.java
68    * @param aField
69    * @param aValue
70    * @return EntityList
71    * @exception StorageObjectException
72    */
73   abstract public EntityList selectByFieldValue(String aField, String aValue)
74     throws StorageObjectFailure;
75
76   /**
77    * Dokumentation siehe Database.java
78    * @param whereClause
79    * @return EntityList
80    * @exception StorageObjectException
81    */
82   abstract public EntityList selectByWhereClause(String whereClause)
83     throws StorageObjectFailure;
84
85   /**
86    * Dokumentation siehe Database.java
87    * @param whereClause
88    * @param offset
89    * @return EntityList
90    * @exception StorageObjectException
91    */
92   abstract public EntityList selectByWhereClause(String whereClause, int offset)
93     throws StorageObjectFailure;
94
95   /**
96    * Dokumentation siehe Database.java
97    * @param whereClause
98    * @param orderBy
99    * @param offset
100    * @return EntityList
101    * @exception StorageObjectException
102    */
103   abstract public EntityList selectByWhereClause(String whereClause,
104     String orderBy, int offset) throws StorageObjectFailure;
105
106   /**
107    * Dokumentation siehe Database.java
108    * @param whereClause
109    * @param orderBy
110    * @param offset
111    * @param limit
112    * @return EntityList
113    * @exception StorageObjectException
114    */
115   abstract public EntityList selectByWhereClause(String whereClause,
116     String orderBy, int offset, int limit) throws StorageObjectFailure;
117
118   /**
119    * Dokumentation siehe Database.java
120    * @param id
121    * @return boolen
122    * @exception StorageObjectException
123    */
124   abstract public boolean delete(String id) throws StorageObjectFailure;
125
126   /**
127    * Dokumentation siehe Database.java
128    * @return ArrayList
129    * @exception StorageObjectException
130    */
131   abstract public List getFields() throws StorageObjectFailure;
132
133   /**
134    * Dokumentation siehe Database.java
135    * @return int[]
136    * @exception StorageObjectException
137    */
138   abstract public int[] getTypes() throws StorageObjectFailure;
139
140   /**
141    * Dokumentation siehe Database.java
142    * @return ArrayList
143    * @exception StorageObjectException
144    */
145   abstract public List getLabels() throws StorageObjectFailure;
146
147   /**
148    * Dokumentation siehe Database.java
149    * @param a
150    * @exception StorageObjectException
151    */
152   abstract public void update(Entity a) throws StorageObjectFailure;
153
154   /**
155    * Dokumentation siehe Database.java
156    * @param a
157    * @return String id
158    * @exception StorageObjectException
159    */
160   abstract public String insert(Entity a) throws StorageObjectFailure;
161
162   /**
163    * Dokumentation siehe Database.java
164    * @return Class Klasse der Entity
165    */
166   abstract public Class getEntityClass();
167
168   /**
169    * put your documentation comment here
170    * @return
171    */
172   abstract public String getIdName();
173
174   /**
175    * Dokumentation siehe Database.java
176    * @return String
177    */
178   abstract public String getTableName();
179
180   /**
181    * Dokumentation siehe Database.java
182    * @return SimpleHash
183    */
184   abstract public SimpleHash getHashData();
185
186   /**
187    * Dokumentation siehe Database.java
188    * @return Connection
189    * @exception StorageObjectException
190    */
191   abstract public Connection getPooledCon() throws StorageObjectFailure;
192
193   /**
194    * Dokumentation siehe Database.java
195    * @param a
196    * @param sql
197    * @return ResultSet
198    * @exception StorageObjectException, SQLException
199    */
200   abstract public ResultSet executeSql(Statement a, String sql)
201     throws StorageObjectFailure, SQLException;
202
203   /**
204    * Dokumentation siehe Database.java
205    * @param con
206    * @param stmt
207    */
208   abstract public void freeConnection(Connection con, Statement stmt)
209     throws StorageObjectFailure;
210
211   /**
212    * Dokumentation siehe Database.java
213    * @return
214    */
215   abstract public SimpleList getPopupData() throws StorageObjectFailure;
216
217   abstract public int executeUpdate(Statement a, String sql)
218     throws StorageObjectFailure, SQLException;
219
220   abstract public int executeUpdate(String sql)
221     throws StorageObjectFailure, SQLException;
222
223   abstract public int getSize(String where)
224     throws SQLException, StorageObjectFailure;
225 }