1 19 20 package org.apache.cayenne.remote; 21 22 import org.apache.cayenne.map.DataMap; 23 import org.apache.cayenne.map.DbEntity; 24 import org.apache.cayenne.map.EntityResolver; 25 import org.apache.cayenne.map.ObjEntity; 26 import org.apache.cayenne.map.Procedure; 27 import org.apache.cayenne.query.PrefetchTreeNode; 28 import org.apache.cayenne.query.Query; 29 import org.apache.cayenne.query.QueryMetadata; 30 import org.apache.cayenne.query.QueryRouter; 31 import org.apache.cayenne.query.SQLAction; 32 import org.apache.cayenne.query.SQLActionVisitor; 33 import org.apache.cayenne.query.SQLResultSetMapping; 34 import org.apache.cayenne.reflect.ClassDescriptor; 35 36 44 class IncrementalQuery implements Query { 45 46 private Query query; 47 private String cacheKey; 48 49 IncrementalQuery(Query query, String cacheKey) { 50 this.query = query; 51 this.cacheKey = cacheKey; 52 } 53 54 public QueryMetadata getMetaData(EntityResolver resolver) { 55 final QueryMetadata metadata = query.getMetaData(resolver); 56 57 62 return new QueryMetadata() { 63 64 public String getCacheKey() { 65 return cacheKey; 66 } 67 68 public SQLResultSetMapping getResultSetMapping() { 69 return metadata.getResultSetMapping(); 70 } 71 72 public String [] getCacheGroups() { 73 return metadata.getCacheGroups(); 74 } 75 76 public String getCachePolicy() { 77 return metadata.getCachePolicy(); 78 } 79 80 public DataMap getDataMap() { 81 return metadata.getDataMap(); 82 } 83 84 public DbEntity getDbEntity() { 85 return metadata.getDbEntity(); 86 } 87 88 public int getFetchLimit() { 89 return metadata.getFetchLimit(); 90 } 91 92 public int getFetchStartIndex() { 93 return metadata.getFetchStartIndex(); 94 } 95 96 public ObjEntity getObjEntity() { 97 return metadata.getObjEntity(); 98 } 99 100 public ClassDescriptor getClassDescriptor() { 101 return metadata.getClassDescriptor(); 102 } 103 104 public int getPageSize() { 105 return metadata.getPageSize(); 106 } 107 108 public PrefetchTreeNode getPrefetchTree() { 109 return metadata.getPrefetchTree(); 110 } 111 112 public Procedure getProcedure() { 113 return metadata.getProcedure(); 114 } 115 116 public boolean isFetchingDataRows() { 117 return metadata.isFetchingDataRows(); 118 } 119 120 public boolean isRefreshingObjects() { 121 return metadata.isRefreshingObjects(); 122 } 123 124 public boolean isResolvingInherited() { 125 return metadata.isResolvingInherited(); 126 } 127 }; 128 } 129 130 public void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery) { 131 query.route(router, resolver, substitutedQuery); 132 } 133 134 public SQLAction createSQLAction(SQLActionVisitor visitor) { 135 return query.createSQLAction(visitor); 136 } 137 138 public String getName() { 139 return query.getName(); 140 } 141 } 142 | Popular Tags |