1 56 package org.objectstyle.cayenne.map; 57 58 import java.util.Iterator ; 59 import java.util.Map ; 60 61 import org.objectstyle.cayenne.query.Query; 62 import org.objectstyle.cayenne.query.SQLTemplate; 63 64 70 class SQLTemplateBuilder extends QueryBuilder { 71 72 75 public Query getQuery() { 76 77 SQLTemplate template = new SQLTemplate(selecting); 78 Object root = getRoot(); 79 80 if (root != null) { 81 template.setRoot(root); 82 } 83 84 template.setName(name); 85 template.initWithProperties(properties); 86 87 template.setDefaultTemplate(sql); 89 if (adapterSql != null) { 90 Iterator it = adapterSql.entrySet().iterator(); 91 while (it.hasNext()) { 92 Map.Entry entry = (Map.Entry ) it.next(); 93 Object key = entry.getKey(); 94 Object value = entry.getValue(); 95 if (key != null && value != null) { 96 template.setTemplate(key.toString(), value.toString()); 97 } 98 } 99 } 100 101 return template; 102 } 103 } | Popular Tags |