1 7 8 package org.enhydra.snapper.business; 9 10 12 import org.enhydra.snapper.Log; 13 import org.enhydra.snapper.spec.*; 14 import org.enhydra.snapper.data.*; 15 16 import com.lutris.appserver.server.sql.DBTransaction; 17 import com.lutris.appserver.server.sql.ObjectId; 18 import com.lutris.dods.builder.generator.query.DataObjectException; 19 20 21 22 23 24 25 28 public class NotIndexedImpl implements NotIndexed { 29 protected NotIndexedDO notIndexedDO = null; 30 public DBTransaction dbt = null; 31 32 public NotIndexedImpl(){} 33 34 35 public NotIndexedImpl(DBTransaction dbt){ 36 try { 37 this.notIndexedDO = NotIndexedDO.createVirgin(dbt); 38 } 39 catch(Exception ex) { 40 Log.log(ex.toString()); 41 } 42 43 } 44 45 public void createNew(DBTransaction dbt) { 46 try { 47 this.notIndexedDO = NotIndexedDO.createVirgin(dbt); 48 this.dbt = dbt; 49 } 50 catch(Exception ex) { 51 Log.log(ex.toString()); 52 53 } 54 } 55 56 protected NotIndexedImpl(NotIndexedDO indexed, DBTransaction dbt) throws Exception { 57 this.notIndexedDO = NotIndexedDO.createExisting(indexed.get_Handle(),dbt); 58 } 59 60 public String getIndexed() 61 throws Exception { 62 try { 63 return String.valueOf(notIndexedDO.getINDEXED_FK()); 64 } catch(DataObjectException ex) { 65 Log.logException(ex); 66 throw new Exception ("Error getting indexed fk", ex); 67 } 68 69 } 70 71 72 73 public void setIndexed(String str) throws Exception { 74 try { 75 notIndexedDO.oid_setINDEXED_FK(str); 76 } catch(Exception ex) { 77 Log.logException(ex); 78 throw new Exception ("Error setting indexed fk", ex); 79 } 80 } 81 82 83 84 85 86 public void save() throws Exception { 87 try { 88 this.notIndexedDO.save(); 89 } 90 catch (Exception ex) { 91 Log.logException(ex); 92 throw new Exception ("Read-only table: DML operations not allowed"); 93 } 94 } 95 96 public void delete() throws Exception { 97 try { 98 this.notIndexedDO.delete(); 99 } 100 catch (Exception ex) { 101 Log.logException(ex); 102 throw new Exception ("Read-only table: DML operations not allowed"); 103 } 104 } 105 106 107 108 109 public String getLink() throws Exception { 110 try { 111 return notIndexedDO.getFILENAME(); 112 } catch(Exception ex) { 113 Log.logException(ex); 114 throw new Exception ("Error getting timestamp"); 115 } 116 } 117 118 119 public void setLink(String str) throws Exception { 120 try { 121 notIndexedDO.setFILENAME(str); 122 } catch(Exception ex) { 123 Log.logException(ex); 124 throw new Exception ("Error setting link", ex); 125 } 126 } 127 128 public NotIndexed findPathByID(String id, DBTransaction dbt) throws Exception 129 { 130 NotIndexedImpl ni = null; 131 try { 132 NotIndexedQuery query = new NotIndexedQuery(dbt); 133 query.setQueryOId(new ObjectId(id)); 135 query.requireUniqueInstance(); 137 NotIndexedDO objectDO = query.getNextDO(); 138 ni = new NotIndexedImpl(objectDO, dbt); 139 return ni; 140 }catch(Exception ex) { 141 throw new Exception ("Exception in findPathByID()", ex); 142 } 143 144 } 145 146 public NotIndexed[] getList(DBTransaction dbt){ 147 NotIndexed[] niArray = null; 148 try { 149 NotIndexedQuery query = new NotIndexedQuery(dbt); 150 NotIndexedDO[] DOarray = query.getDOArray(); 151 niArray = new NotIndexedImpl[ DOarray.length ]; 152 for ( int i = 0; i < DOarray.length; i++ ) 153 niArray[i] = new NotIndexedImpl(DOarray[i], dbt); 154 }catch(Exception ex) { 155 System.out.println(ex.toString()); 156 } 157 158 return niArray; 159 } 160 161 public NotIndexed[] getListForID(DBTransaction dbt, String str){ 162 NotIndexed[] niArray = null; 163 try { 164 IndexedDO indexedDO = IndexedDO.createExisting(str, dbt); 165 NotIndexedQuery query = new NotIndexedQuery(dbt); 166 query.setQueryINDEXED_FK(indexedDO); 167 NotIndexedDO[] notIndexedDOArray = query.getDOArray(); 168 niArray = new NotIndexedImpl[ notIndexedDOArray.length ]; 169 for ( int i = 0; i < notIndexedDOArray.length; i++ ) 170 niArray[i] = new NotIndexedImpl(notIndexedDOArray[i], dbt); 171 }catch(Exception ex) { 172 System.out.println(ex.toString()); 173 } 174 175 return niArray; 176 } 177 178 } 179 | Popular Tags |