KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > snapper > business > IndexedImpl


1 /*
2  * snapper
3  *
4  * Enhydra super-servlet business object
5  *
6  */

7
8 package org.enhydra.snapper.business;
9
10 // Enhydra SuperServlet specification imports
11

12 import java.sql.Timestamp JavaDoc;
13
14 import org.enhydra.snapper.Log;
15 import org.enhydra.snapper.SnapperAdmin;
16 import org.enhydra.snapper.spec.*;
17 import org.enhydra.snapper.data.*;
18
19 import com.lutris.appserver.server.sql.DBTransaction;
20 import com.lutris.appserver.server.sql.ObjectId;
21 import com.lutris.dods.builder.generator.query.DataObjectException;
22
23
24
25
26
27
28 // Standard imports
29
//import java.text.DateFormat;
30

31 public class IndexedImpl implements Indexed {
32     protected IndexedDO indexedDO = null;
33     
34     public IndexedImpl(){}
35     
36     public String JavaDoc getID()
37     throws Exception JavaDoc {
38         try {
39             return indexedDO.get_Handle();
40         } catch(Exception JavaDoc ex) {
41             throw new Exception JavaDoc("Error getting ID: ", ex);
42         }
43     
44     }
45     
46     public int getDoc() throws Exception JavaDoc {
47         try {
48             return indexedDO.getDOC();
49         } catch (Exception JavaDoc ex) {
50             throw new Exception JavaDoc("Error getting doc nr: ", ex);
51         }
52
53     }
54     
55      public void setDoc(String JavaDoc str) throws Exception JavaDoc {
56             try {
57                 int size = Integer.parseInt(str);
58                 indexedDO.setDOC(size);
59             } catch (Exception JavaDoc ex) {
60             }
61         }
62     
63     
64     public IndexedImpl(DBTransaction dbt){
65          try {
66             this.indexedDO = IndexedDO.createVirgin(dbt);
67          }
68          catch(Exception JavaDoc ex) {
69             Log.log(ex.toString());
70         }
71          
72     }
73     
74     public void createNew(DBTransaction dbt) {
75         try {
76             this.indexedDO = IndexedDO.createVirgin(dbt);
77          }
78          catch(Exception JavaDoc ex) {
79             Log.log(ex.toString());
80             
81         }
82     }
83     
84     protected IndexedImpl(IndexedDO indexed, DBTransaction dbt) throws Exception JavaDoc {
85         this.indexedDO = IndexedDO.createExisting(indexed.get_Handle(),dbt);
86     }
87     
88     public String JavaDoc getName()
89         throws Exception JavaDoc {
90             try {
91                 return indexedDO.getSITENAME();
92             } catch(DataObjectException ex) {
93                 Log.logException(ex);
94                 throw new Exception JavaDoc("Error getting indexed name", ex);
95             }
96         
97     }
98     
99     
100     
101     public void setName(String JavaDoc str) throws Exception JavaDoc {
102     try {
103         indexedDO.setSITENAME(str);
104     } catch(Exception JavaDoc ex) {
105         Log.logException(ex);
106         throw new Exception JavaDoc("Error setting name", ex);
107     }
108     }
109     
110
111     
112     
113             
114     public void save() throws Exception JavaDoc {
115                 try {
116                     this.indexedDO.save();
117                 }
118                 catch (Exception JavaDoc ex) {
119                     Log.logException(ex);
120                     throw new Exception JavaDoc("Read-only table: DML operations not allowed");
121                 }
122             }
123     
124     public void delete() throws Exception JavaDoc {
125         try {
126             this.indexedDO.delete();
127         }
128         catch (Exception JavaDoc ex) {
129             Log.logException(ex);
130             throw new Exception JavaDoc("Read-only table: DML operations not allowed");
131         }
132     }
133
134     
135     
136     
137     public Timestamp JavaDoc getTime() throws Exception JavaDoc{
138         try {
139             return indexedDO.getTIME();
140            } catch(Exception JavaDoc ex) {
141             Log.logException(ex);
142                throw new Exception JavaDoc("Error getting timestamp");
143            }
144     }
145     
146     
147     public void setTime(Timestamp JavaDoc str) throws Exception JavaDoc{
148         try {
149             indexedDO.setTIME(str);
150         } catch(Exception JavaDoc ex) {
151             Log.logException(ex);
152             throw new Exception JavaDoc("Error setting time", ex);
153         }
154     }
155     
156     public Indexed[] getList(DBTransaction dbt){
157         Indexed[] iArray = null;
158         try {
159             IndexedQuery query = new IndexedQuery(dbt);
160             IndexedDO[] DOarray = query.getDOArray();
161             iArray = new IndexedImpl[ DOarray.length ];
162             for ( int i = 0; i < DOarray.length; i++ )
163                 iArray[i] = new IndexedImpl(DOarray[i], dbt);
164         }catch(Exception JavaDoc ex) {
165             System.out.println(ex.toString());
166         }
167         
168         return iArray;
169     }
170     
171     public Timestamp JavaDoc getLASTSTART() throws Exception JavaDoc{
172         try {
173             return indexedDO.getLASTSTART();
174            } catch(Exception JavaDoc ex) {
175             Log.logException(ex);
176                throw new Exception JavaDoc("Error getting laststart");
177            }
178     }
179     public void setLASTSTART(Timestamp JavaDoc str) throws Exception JavaDoc{
180         try {
181             indexedDO.setLASTSTART(str);
182         } catch(Exception JavaDoc ex) {
183             Log.logException(ex);
184             throw new Exception JavaDoc("Error setting laststart", ex);
185         }
186     }
187     
188     public String JavaDoc getLASTTYPE() throws Exception JavaDoc{
189         try {
190             return indexedDO.getLASTTYPE();
191            } catch(Exception JavaDoc ex) {
192             Log.logException(ex);
193                throw new Exception JavaDoc("Error getting lasttype");
194            }
195     }
196     
197     public void setLASTTYPE(String JavaDoc str) throws Exception JavaDoc {
198         try {
199             indexedDO.setLASTTYPE(str);
200         } catch(Exception JavaDoc ex) {
201             Log.logException(ex);
202             throw new Exception JavaDoc("Error setting lasttype", ex);
203         }
204         }
205             
206     
207     
208 }
209
Popular Tags