1 19 package org.apache.cayenne.remote; 20 21 import java.util.List ; 22 import java.util.Map ; 23 24 import org.apache.cayenne.access.IncrementalFaultList; 25 import org.apache.cayenne.exp.Expression; 26 import org.apache.cayenne.map.DataMap; 27 import org.apache.cayenne.map.DbEntity; 28 import org.apache.cayenne.map.EntityResolver; 29 import org.apache.cayenne.map.ObjEntity; 30 import org.apache.cayenne.map.Procedure; 31 import org.apache.cayenne.query.Ordering; 32 import org.apache.cayenne.query.PrefetchTreeNode; 33 import org.apache.cayenne.query.Query; 34 import org.apache.cayenne.query.QueryMetadata; 35 import org.apache.cayenne.query.QueryRouter; 36 import org.apache.cayenne.query.SQLAction; 37 import org.apache.cayenne.query.SQLActionVisitor; 38 import org.apache.cayenne.query.SQLResultSetMapping; 39 import org.apache.cayenne.query.SelectQuery; 40 import org.apache.cayenne.reflect.ClassDescriptor; 41 import org.apache.cayenne.util.XMLEncoder; 42 43 53 class IncrementalSelectQuery extends SelectQuery { 54 55 private SelectQuery query; 56 private String cacheKey; 57 58 IncrementalSelectQuery(SelectQuery delegate, String cacheKey) { 59 this.query = delegate; 60 this.cacheKey = cacheKey; 61 } 62 63 public QueryMetadata getMetaData(EntityResolver resolver) { 64 final QueryMetadata metadata = query.getMetaData(resolver); 65 66 71 return new QueryMetadata() { 72 73 public String getCacheKey() { 74 return cacheKey; 75 } 76 77 public SQLResultSetMapping getResultSetMapping() { 78 return metadata.getResultSetMapping(); 79 } 80 81 public String [] getCacheGroups() { 82 return metadata.getCacheGroups(); 83 } 84 85 public String getCachePolicy() { 86 return metadata.getCachePolicy(); 87 } 88 89 public DataMap getDataMap() { 90 return metadata.getDataMap(); 91 } 92 93 public DbEntity getDbEntity() { 94 return metadata.getDbEntity(); 95 } 96 97 public int getFetchLimit() { 98 return metadata.getFetchLimit(); 99 } 100 101 public int getFetchStartIndex() { 102 return metadata.getFetchStartIndex(); 103 } 104 105 public ObjEntity getObjEntity() { 106 return metadata.getObjEntity(); 107 } 108 109 public ClassDescriptor getClassDescriptor() { 110 return metadata.getClassDescriptor(); 111 } 112 113 public int getPageSize() { 114 return metadata.getPageSize(); 115 } 116 117 public PrefetchTreeNode getPrefetchTree() { 118 return metadata.getPrefetchTree(); 119 } 120 121 public Procedure getProcedure() { 122 return metadata.getProcedure(); 123 } 124 125 public boolean isFetchingDataRows() { 126 return metadata.isFetchingDataRows(); 127 } 128 129 public boolean isRefreshingObjects() { 130 return metadata.isRefreshingObjects(); 131 } 132 133 public boolean isResolvingInherited() { 134 return metadata.isResolvingInherited(); 135 } 136 }; 137 } 138 139 public void addCustomDbAttribute(String attributePath) { 140 query.addCustomDbAttribute(attributePath); 141 } 142 143 public void addCustomDbAttributes(List attrPaths) { 144 query.addCustomDbAttributes(attrPaths); 145 } 146 147 public void addOrdering(Ordering ordering) { 148 query.addOrdering(ordering); 149 } 150 151 public void addOrdering(String sortPathSpec, boolean isAscending, boolean ignoreCase) { 152 query.addOrdering(sortPathSpec, isAscending, ignoreCase); 153 } 154 155 public void addOrdering(String sortPathSpec, boolean isAscending) { 156 query.addOrdering(sortPathSpec, isAscending); 157 } 158 159 public void addOrderings(List orderings) { 160 query.addOrderings(orderings); 161 } 162 163 public PrefetchTreeNode addPrefetch(String prefetchPath) { 164 return query.addPrefetch(prefetchPath); 165 } 166 167 public void andParentQualifier(Expression e) { 168 query.andParentQualifier(e); 169 } 170 171 public void andQualifier(Expression e) { 172 query.andQualifier(e); 173 } 174 175 public void clearOrderings() { 176 query.clearOrderings(); 177 } 178 179 public void clearPrefetches() { 180 query.clearPrefetches(); 181 } 182 183 public Query createQuery(Map parameters) { 184 return query.createQuery(parameters); 185 } 186 187 public SQLAction createSQLAction(SQLActionVisitor visitor) { 188 return query.createSQLAction(visitor); 189 } 190 191 public void encodeAsXML(XMLEncoder encoder) { 192 query.encodeAsXML(encoder); 193 } 194 195 public boolean equals(Object obj) { 196 return query.equals(obj); 197 } 198 199 public String [] getCacheGroups() { 200 return query.getCacheGroups(); 201 } 202 203 public String getCachePolicy() { 204 return query.getCachePolicy(); 205 } 206 207 public List getCustomDbAttributes() { 208 return query.getCustomDbAttributes(); 209 } 210 211 public int getFetchLimit() { 212 return query.getFetchLimit(); 213 } 214 215 public String getName() { 216 return query.getName(); 217 } 218 219 public List getOrderings() { 220 return query.getOrderings(); 221 } 222 223 public int getPageSize() { 224 return query.getPageSize(); 225 } 226 227 public String getParentObjEntityName() { 228 return query.getParentObjEntityName(); 229 } 230 231 public Expression getParentQualifier() { 232 return query.getParentQualifier(); 233 } 234 235 public PrefetchTreeNode getPrefetchTree() { 236 return query.getPrefetchTree(); 237 } 238 239 public Expression getQualifier() { 240 return query.getQualifier(); 241 } 242 243 public Object getRoot() { 244 return query.getRoot(); 245 } 246 247 public int hashCode() { 248 return query.hashCode(); 249 } 250 251 public void initWithProperties(Map properties) { 252 query.initWithProperties(properties); 253 } 254 255 public boolean isDistinct() { 256 return query.isDistinct(); 257 } 258 259 public boolean isFetchingCustomAttributes() { 260 return query.isFetchingCustomAttributes(); 261 } 262 263 public boolean isFetchingDataRows() { 264 return query.isFetchingDataRows(); 265 } 266 267 public boolean isQualifiedOnParent() { 268 return query.isQualifiedOnParent(); 269 } 270 271 public boolean isRefreshingObjects() { 272 return query.isRefreshingObjects(); 273 } 274 275 public boolean isResolvingInherited() { 276 return query.isResolvingInherited(); 277 } 278 279 public void orParentQualifier(Expression e) { 280 query.orParentQualifier(e); 281 } 282 283 public void orQualifier(Expression e) { 284 query.orQualifier(e); 285 } 286 287 public SelectQuery queryWithParameters(Map parameters, boolean pruneMissing) { 288 return query.queryWithParameters(parameters, pruneMissing); 289 } 290 291 public SelectQuery queryWithParameters(Map parameters) { 292 return query.queryWithParameters(parameters); 293 } 294 295 public void removeOrdering(Ordering ordering) { 296 query.removeOrdering(ordering); 297 } 298 299 public void removePrefetch(String prefetchPath) { 300 query.removePrefetch(prefetchPath); 301 } 302 303 public void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery) { 304 query.route(router, resolver, substitutedQuery); 305 } 306 307 public void setCacheGroups(String [] cachGroups) { 308 query.setCacheGroups(cachGroups); 309 } 310 311 public void setCachePolicy(String policy) { 312 query.setCachePolicy(policy); 313 } 314 315 public void setDistinct(boolean distinct) { 316 query.setDistinct(distinct); 317 } 318 319 public void setFetchingDataRows(boolean flag) { 320 query.setFetchingDataRows(flag); 321 } 322 323 public void setFetchLimit(int fetchLimit) { 324 query.setFetchLimit(fetchLimit); 325 } 326 327 public void setName(String name) { 328 query.setName(name); 329 } 330 331 public void setPageSize(int pageSize) { 332 query.setPageSize(pageSize); 333 } 334 335 public void setParentObjEntityName(String parentObjEntityName) { 336 query.setParentObjEntityName(parentObjEntityName); 337 } 338 339 public void setParentQualifier(Expression parentQualifier) { 340 query.setParentQualifier(parentQualifier); 341 } 342 343 public void setPrefetchTree(PrefetchTreeNode prefetchTree) { 344 query.setPrefetchTree(prefetchTree); 345 } 346 347 public void setQualifier(Expression qualifier) { 348 query.setQualifier(qualifier); 349 } 350 351 public void setRefreshingObjects(boolean flag) { 352 query.setRefreshingObjects(flag); 353 } 354 355 public void setResolvingInherited(boolean b) { 356 query.setResolvingInherited(b); 357 } 358 359 public void setRoot(Object value) { 360 query.setRoot(value); 361 } 362 363 public String toString() { 364 return query.toString(); 365 } 366 } 367 | Popular Tags |