1 28 29 package com.caucho.amber.field; 30 31 import com.caucho.amber.expr.AmberExpr; 32 import com.caucho.amber.expr.PathExpr; 33 import com.caucho.amber.query.QueryParser; 34 import com.caucho.amber.table.Column; 35 import com.caucho.amber.table.Table; 36 import com.caucho.amber.type.RelatedType; 37 import com.caucho.config.ConfigException; 38 import com.caucho.java.JavaWriter; 39 import com.caucho.log.Log; 40 import com.caucho.util.L10N; 41 42 import java.io.IOException ; 43 import java.util.ArrayList ; 44 import java.util.HashSet ; 45 import java.util.logging.Logger ; 46 47 50 public class EmbeddedIdField extends EntityEmbeddedField implements IdField { 51 private static final L10N L = new L10N(EmbeddedIdField.class); 52 protected static final Logger log = Log.open(EmbeddedIdField.class); 53 54 boolean _isKeyField; 55 56 public EmbeddedIdField(RelatedType tableType) 57 { 58 super(tableType); 59 setEmbeddedId(true); 60 } 61 62 public EmbeddedIdField(RelatedType tableType, 63 String name) 64 throws ConfigException 65 { 66 super(tableType, name); 67 setEmbeddedId(true); 68 } 69 70 73 public ArrayList <Column> getColumns() 74 { 75 return null; 76 } 77 78 81 public void setKeyField(boolean isKeyField) 82 { 83 _isKeyField = isKeyField; 84 } 85 86 89 public int getComponentCount() 90 { 91 return 1; 92 } 93 94 97 public String getForeignTypeName() 98 { 99 return null; 100 } 101 102 105 public String getGenerator() 106 { 107 return null; 108 } 109 110 113 public String generateSetKeyProperty(String key, String value) 114 throws IOException 115 { 116 return null; 117 } 118 119 122 public String generateGetKeyProperty(String key) 123 throws IOException 124 { 125 return null; 126 } 127 128 133 public String generateGetProxyProperty(String value) 134 { 135 return null; 136 } 137 138 141 public void generatePrologue(JavaWriter out, HashSet <Object > completedSet) 142 throws IOException 143 { 144 super.generatePrologue(out, completedSet); 145 146 if (isAbstract()) { 147 out.println(); 148 149 out.println(); 150 out.println("public " + getJavaTypeName() + " " + getGetterName() + "()"); 151 out.println("{"); 152 out.println(" return " + getFieldName() + ";"); 153 out.println("}"); 154 155 out.println(); 156 out.println("public void " + getSetterName() + "(" + getJavaTypeName() + " v)"); 157 out.println("{"); 158 out.println(" " + getFieldName() + " = v;"); 159 out.println("}"); 160 } 161 } 162 163 166 public void generateSetGeneratedKeys(JavaWriter out, String pstmt) 167 throws IOException 168 { 169 } 170 171 174 public String generateMatchArgWhere(String id) 175 { 176 return generateWhere(id); 177 } 178 179 182 public String generateRawWhere(String id) 183 { 184 return id + "." + getName() + "=?"; 185 } 186 187 190 public int generateLoad(JavaWriter out, String rs, 191 String indexVar, int index) 192 throws IOException 193 { 194 return index; 195 } 196 197 200 public int generateLoadForeign(JavaWriter out, String rs, 201 String indexVar, int index) 202 throws IOException 203 { 204 return 0; 205 } 206 207 210 public void generateLoadFromObject(JavaWriter out, String obj) 211 throws IOException 212 { 213 out.println(generateSuperSetter(generateGet(obj)) + ";"); 214 } 215 216 219 public String generateLoadSelect(Table table, String id) 220 { 221 return null; 222 } 223 224 227 public String generateSetNull(String obj) 228 throws IOException 229 { 230 return null; 231 } 232 233 236 public String generateIsNull(String value) 237 { 238 return null; 239 } 240 241 244 public int generateLoadForeign(JavaWriter out, String rs, 245 String indexVar, int index, 246 String name) 247 throws IOException 248 { 249 return 0; 251 } 252 253 256 public void generateSet(JavaWriter out, String pstmt, 257 String index, String value) 258 throws IOException 259 { 260 super.generateSet(out, pstmt, index, value); 261 } 262 263 266 public void generateMatch(JavaWriter out, String key) 267 throws IOException 268 { 269 } 270 271 274 public String generateEquals(String left, String right) 275 { 276 return null; 277 } 278 279 282 public void generateSetInsert(JavaWriter out, String pstmt, String index) 283 throws IOException 284 { 285 generateSet(out, pstmt, index); 286 } 287 288 291 public void generateCheckCreateKey(JavaWriter out) 292 throws IOException 293 { 294 } 295 296 299 public AmberExpr createExpr(QueryParser parser, PathExpr parent) 300 { 301 return null; 302 } 303 304 307 public String toObject(String value) 308 { 309 return null; 310 } 311 312 315 public String toValue(String value) 316 { 317 return null; 318 } 319 } 320 | Popular Tags |