1 28 29 package com.caucho.ejb.ql; 30 31 import com.caucho.config.ConfigException; 32 import com.caucho.ejb.cfg.EjbEntityBean; 33 import com.caucho.util.CharBuffer; 34 35 38 class ThisExpr extends PathExpr { 39 private String _tableName; 41 42 48 ThisExpr(Query query, EjbEntityBean bean) 49 throws ConfigException 50 { 51 super(bean); 52 53 _query = query; 54 55 } 57 58 61 String getName() 62 { 63 return "this"; 64 } 65 66 String getKeyTable() 67 { 68 return getName(); 69 } 70 71 String []getKeyFields() 72 { 73 78 throw new UnsupportedOperationException (); 79 } 80 81 String getTable() 82 { 83 return "this"; 84 } 85 86 89 EjbEntityBean getBean() 90 { 91 return _bean; 92 } 93 94 97 void setBean(EjbEntityBean bean) 98 { 99 _bean = bean; 100 } 101 102 105 String getTableName() 106 { 107 if (_tableName != null) 108 return _tableName; 109 else if (_bean != null) 110 return _bean.getSQLTable(); 111 else 112 return null; 113 } 114 115 118 void setTableName(String tableName) 119 { 120 _tableName = tableName; 121 } 122 123 126 EjbEntityBean getItemBean() 127 { 128 return _bean; 129 } 130 131 int getComponentCount() 132 { 133 throw new UnsupportedOperationException (); 135 } 136 137 142 void generateSelect(CharBuffer cb) 143 { 144 if (_bean == null) 145 throw new IllegalStateException ("no bean for " + getName()); 146 147 166 } 167 168 173 String getSelectTable(CharBuffer cb) 174 throws ConfigException 175 { 176 184 return getName(); 185 } 186 187 192 void generateWhere(CharBuffer cb) 193 { 194 if (_bean == null) 195 throw new IllegalStateException ("no bean for " + getName()); 196 197 212 throw new UnsupportedOperationException (); 213 } 214 215 void generateComponent(CharBuffer cb, int index) 216 { 217 if (_bean == null) 218 throw new IllegalStateException ("no bean for " + getName()); 219 220 227 throw new UnsupportedOperationException (); 228 } 229 230 233 public boolean equals(Object bObj) 234 { 235 return bObj instanceof ThisExpr; 236 } 237 238 241 public int hashCode() 242 { 243 return "this".hashCode(); 244 } 245 246 249 public String toString() 250 { 251 return "this"; 252 } 253 } 254 | Popular Tags |