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