1 package de.webman.acl.db; 2 3 import java.sql.ResultSet ; 4 import java.sql.SQLException ; 5 import com.teamkonzept.db.TKDBTableData; 6 import com.teamkonzept.db.TKQuery; 7 8 20 public class ObjectCollectionDBData 21 extends TKDBTableData 22 { 23 24 26 29 protected String restrictorName = null; 30 31 34 protected Object restrictorValue = null; 35 36 39 protected String selectorName = null; 40 41 44 protected Integer selectorValue = null; 45 46 47 49 57 public ObjectCollectionDBData (String restrictorName, 58 Object restrictorValue, 59 String selectorName, 60 Integer selectorValue) 61 { 62 this.restrictorName = restrictorName; 63 this.restrictorValue = restrictorValue; 64 this.selectorName = selectorName; 65 this.selectorValue = selectorValue; 66 } 67 68 69 71 77 public void insertIntoQuery (TKQuery query) 78 throws SQLException 79 { 80 if (this.restrictorName != null) 81 { 82 query.setQueryParams(this.restrictorName, this.restrictorValue); 83 } 84 85 if (this.selectorName != null) 86 { 87 query.setQueryParams(this.selectorName, this.selectorValue); 88 } 89 } 90 91 98 public TKDBTableData newFromResultSet (ResultSet result) 99 throws SQLException 100 { 101 return new ObjectCollectionDBData(null, 102 null, 103 null, 104 new Integer (result.getInt(this.selectorName))); 105 } 106 107 113 public TKDBTableData newFromValue (Integer value) 114 { 115 return new ObjectCollectionDBData(this.restrictorName, 116 this.restrictorValue, 117 this.selectorName, 118 value); 119 } 120 121 126 public Integer getValue () 127 { 128 return this.selectorValue; 129 } 130 131 } 132 | Popular Tags |