1 7 8 package org.enhydra.snapper.business; 9 10 import org.enhydra.snapper.spec.*; 12 import org.enhydra.snapper.data.*; 13 14 import com.lutris.appserver.server.sql.DBTransaction; 15 import com.lutris.appserver.server.sql.ObjectId; 16 import com.lutris.dods.builder.generator.query.DataObjectException; 17 18 19 public class PathTypeImpl implements PathType { 20 protected PathTypeDO pathTypeDO = null; 21 22 public PathTypeImpl(){} 23 24 public PathTypeImpl(DBTransaction dbt){ 25 try { 26 this.pathTypeDO = PathTypeDO.createVirgin(dbt); 27 } 28 catch(Exception ex) { 29 System.out.print(ex.toString()); 30 } 31 32 } 33 34 protected PathTypeImpl(PathTypeDO path, DBTransaction dbt) throws Exception { 35 this.pathTypeDO = PathTypeDO.createExisting(path.get_Handle(),dbt); 36 } 37 38 public void createNew(DBTransaction dbt) { 39 try { 40 this.pathTypeDO = PathTypeDO.createVirgin(dbt); 41 } 42 catch(Exception ex) { 43 System.out.print(ex.toString()); 44 } 45 } 46 47 public String getName() 48 throws Exception { 49 try { 50 return pathTypeDO.getTYPENAME(); 51 } catch(DataObjectException ex) { 52 throw new Exception ("Error getting site's name", ex); 53 } 54 55 } 56 57 public String getID() 58 throws Exception { 59 try { 60 return pathTypeDO.get_Handle(); 61 } catch(Exception ex) { 62 throw new Exception ("Error getting site's ID", ex); 63 } 64 65 } 66 67 public void setName(String str) throws Exception { 68 try { 69 pathTypeDO.setTYPENAME(str); 70 } catch(Exception ex) { 71 throw new Exception ("Error setting name", ex); 72 } 73 } 74 75 public void save() throws Exception { 76 try { 77 this.pathTypeDO.save(); 78 } 79 catch (Exception ex) { 80 throw new Exception ("Read-only table: DML operations not allowed", ex); 81 } 82 } 83 84 public void delete() throws Exception { 85 try { 86 this.pathTypeDO.delete(); 87 } 88 catch (Exception ex) { 89 throw new Exception ("Read-only table: DML operations not allowed", ex); 90 } 91 } 92 93 public PathType findPathTypeByID(String id, DBTransaction dbt) throws Exception 94 { 95 PathTypeImpl pathType = null; 96 try { 97 PathTypeQuery query = new PathTypeQuery(dbt); 98 query.setQueryOId(new ObjectId(id)); 100 query.requireUniqueInstance(); 102 PathTypeDO pathTypeDO = query.getNextDO(); 103 pathType = new PathTypeImpl(pathTypeDO, dbt); 104 return pathType; 105 }catch(Exception ex) { 106 throw new Exception ("Exception in findPathTypeByID()", ex); 107 } 108 } 109 110 public PathType[] getList(DBTransaction dbt) throws Exception { 111 PathTypeImpl[] pathArray = null; 112 try { 113 PathTypeQuery query = new PathTypeQuery(dbt); 114 query.addOrderByTYPENAME(); 118 PathTypeDO[] DOarray = query.getDOArray(); 119 pathArray = new PathTypeImpl[ DOarray.length ]; 120 for ( int i = 0; i < DOarray.length; i++ ) 121 pathArray[i] = new PathTypeImpl(DOarray[i], dbt); 122 }catch(Exception ex) { 123 throw new Exception ("Exception in getList()", ex); 124 } 125 126 return pathArray; 127 } 128 129 130 131 } 132 | Popular Tags |