cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r649247 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query: BaseQueryMetadata.java ProcedureQuery.java SQLTemplate.java SelectQuery.java
Date Thu, 17 Apr 2008 19:45:23 GMT
Author: aadamchik
Date: Thu Apr 17 12:45:05 2008
New Revision: 649247

URL: http://svn.apache.org/viewvc?rev=649247&view=rev
Log:
CAY-1035 Replace QueryMetadata String cache policies with an enum
(more deprecation/new API additions)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplate.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java?rev=649247&r1=649246&r2=649247&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/BaseQueryMetadata.java
Thu Apr 17 12:45:05 2008
@@ -216,6 +216,13 @@
     public QueryCacheStrategy getCacheStrategy() {
         return cacheStrategy;
     }
+    
+    /**
+     * @since 3.0
+     */
+    void setCacheStrategy(QueryCacheStrategy cacheStrategy) {
+        this.cacheStrategy = cacheStrategy;
+    }
 
     public void encodeAsXML(XMLEncoder encoder) {
         if (refreshingObjects != QueryMetadata.REFRESHING_OBJECTS_DEFAULT) {
@@ -345,10 +352,16 @@
         this.prefetchTree = prefetchTree;
     }
 
+    /**
+     * @deprecated since 3.0 {@link #getCacheStrategy()} replaces this method.
+     */
     public String getCachePolicy() {
         return cachePolicy;
     }
 
+    /**
+     * @deprecated since 3.0 {@link #setCacheStrategy(QueryCacheStrategy)} replaces this
method.
+     */
     void setCachePolicy(String policy) {
         this.cachePolicy = policy;
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java?rev=649247&r1=649246&r2=649247&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQuery.java
Thu Apr 17 12:45:05 2008
@@ -286,12 +286,33 @@
         return query;
     }
 
+    /**
+     * @deprecated since 3.0 {@link #getCacheStrategy()} replaces this method.
+     */
     public String getCachePolicy() {
         return metaData.getCachePolicy();
     }
 
+    /**
+     * @deprecated since 3.0 {@link #setCacheStrategy(QueryCacheStrategy)} replaces this
+     *             method.
+     */
     public void setCachePolicy(String policy) {
-        this.metaData.setCachePolicy(policy);
+        metaData.setCachePolicy(policy);
+    }
+
+    /**
+     * @since 3.0
+     */
+    public QueryCacheStrategy getCacheStrategy() {
+        return metaData.getCacheStrategy();
+    }
+
+    /**
+     * @since 3.0
+     */
+    public void setCacheStrategy(QueryCacheStrategy strategy) {
+        metaData.setCacheStrategy(strategy);
     }
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplate.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplate.java?rev=649247&r1=649246&r2=649247&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplate.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplate.java
Thu Apr 17 12:45:05 2008
@@ -99,7 +99,7 @@
     protected Map<String, ?>[] parameters;
     protected String columnNamesCapitalization;
 
-    SQLTemplateMetadata selectInfo = new SQLTemplateMetadata();
+    SQLTemplateMetadata metaData = new SQLTemplateMetadata();
 
     /**
      * Creates an empty SQLTemplate. Note this constructor does not specify the "root" of
@@ -156,8 +156,8 @@
      */
     @Override
     public QueryMetadata getMetaData(EntityResolver resolver) {
-        selectInfo.resolve(root, resolver, this);
-        return selectInfo;
+        metaData.resolve(root, resolver, this);
+        return metaData;
     }
 
     /**
@@ -220,7 +220,7 @@
 
         encoder.indent(1);
 
-        selectInfo.encodeAsXML(encoder);
+        metaData.encodeAsXML(encoder);
 
         if (getColumnNamesCapitalization() != null) {
             encoder.printProperty(
@@ -267,7 +267,7 @@
      */
     public void initWithProperties(Map<String, ?> properties) {
         // must init defaults even if properties are empty
-        selectInfo.initWithProperties(properties);
+        metaData.initWithProperties(properties);
 
         if (properties == null) {
             properties = Collections.EMPTY_MAP;
@@ -322,7 +322,7 @@
             query.templates = new HashMap<String, String>(templates);
         }
 
-        query.selectInfo.copyFromInfo(this.selectInfo);
+        query.metaData.copyFromInfo(this.metaData);
         query.setParameters(parameters);
 
         // The following algorithm is for building the new query name based
@@ -357,66 +357,87 @@
         return queryWithParameters(parameters);
     }
 
+    /**
+     * @deprecated since 3.0 {@link #getCacheStrategy()} replaces this method.
+     */
     public String getCachePolicy() {
-        return selectInfo.getCachePolicy();
+        return metaData.getCachePolicy();
     }
 
+    /**
+     * @deprecated since 3.0 {@link #setCacheStrategy(QueryCacheStrategy)} replaces this
+     *             method.
+     */
     public void setCachePolicy(String policy) {
-        this.selectInfo.setCachePolicy(policy);
+        metaData.setCachePolicy(policy);
+    }
+
+    /**
+     * @since 3.0
+     */
+    public QueryCacheStrategy getCacheStrategy() {
+        return metaData.getCacheStrategy();
+    }
+
+    /**
+     * @since 3.0
+     */
+    public void setCacheStrategy(QueryCacheStrategy strategy) {
+        metaData.setCacheStrategy(strategy);
     }
 
     /**
      * @since 3.0
      */
     public String[] getCacheGroups() {
-        return selectInfo.getCacheGroups();
+        return metaData.getCacheGroups();
     }
 
     /**
      * @since 3.0
      */
     public void setCacheGroups(String[] cachGroups) {
-        this.selectInfo.setCacheGroups(cachGroups);
+        this.metaData.setCacheGroups(cachGroups);
     }
 
     public int getFetchLimit() {
-        return selectInfo.getFetchLimit();
+        return metaData.getFetchLimit();
     }
 
     public void setFetchLimit(int fetchLimit) {
-        this.selectInfo.setFetchLimit(fetchLimit);
+        this.metaData.setFetchLimit(fetchLimit);
     }
 
     public int getPageSize() {
-        return selectInfo.getPageSize();
+        return metaData.getPageSize();
     }
 
     public void setPageSize(int pageSize) {
-        selectInfo.setPageSize(pageSize);
+        metaData.setPageSize(pageSize);
     }
 
     public void setFetchingDataRows(boolean flag) {
-        selectInfo.setFetchingDataRows(flag);
+        metaData.setFetchingDataRows(flag);
     }
 
     public boolean isFetchingDataRows() {
-        return selectInfo.isFetchingDataRows();
+        return metaData.isFetchingDataRows();
     }
 
     public boolean isRefreshingObjects() {
-        return selectInfo.isRefreshingObjects();
+        return metaData.isRefreshingObjects();
     }
 
     public void setRefreshingObjects(boolean flag) {
-        selectInfo.setRefreshingObjects(flag);
+        metaData.setRefreshingObjects(flag);
     }
 
     public boolean isResolvingInherited() {
-        return selectInfo.isResolvingInherited();
+        return metaData.isResolvingInherited();
     }
 
     public void setResolvingInherited(boolean b) {
-        selectInfo.setResolvingInherited(b);
+        metaData.setResolvingInherited(b);
     }
 
     /**
@@ -527,7 +548,7 @@
      * @since 1.2
      */
     public PrefetchTreeNode getPrefetchTree() {
-        return selectInfo.getPrefetchTree();
+        return metaData.getPrefetchTree();
     }
 
     /**
@@ -537,7 +558,7 @@
      */
     public PrefetchTreeNode addPrefetch(String prefetchPath) {
         // by default use JOINT_PREFETCH_SEMANTICS
-        return selectInfo.addPrefetch(
+        return metaData.addPrefetch(
                 prefetchPath,
                 PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
     }
@@ -546,7 +567,7 @@
      * @since 1.2
      */
     public void removePrefetch(String prefetch) {
-        selectInfo.removePrefetch(prefetch);
+        metaData.removePrefetch(prefetch);
     }
 
     /**
@@ -555,7 +576,7 @@
      * @since 1.2
      */
     public void addPrefetches(Collection<String> prefetches) {
-        selectInfo.addPrefetches(prefetches, PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
+        metaData.addPrefetches(prefetches, PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
     }
 
     /**
@@ -564,7 +585,7 @@
      * @since 1.2
      */
     public void clearPrefetches() {
-        selectInfo.clearPrefetches();
+        metaData.clearPrefetches();
     }
 
     /**
@@ -607,6 +628,6 @@
      * @since 3.0
      */
     public void setResultSetMapping(SQLResultSetMapping resultSetMapping) {
-        selectInfo.setResultSetMapping(resultSetMapping);
+        metaData.setResultSetMapping(resultSetMapping);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java?rev=649247&r1=649246&r2=649247&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQuery.java
Thu Apr 17 12:45:05 2008
@@ -52,7 +52,7 @@
     protected List<Ordering> orderings;
     protected boolean distinct;
 
-    SelectQueryMetadata selectInfo = new SelectQueryMetadata();
+    SelectQueryMetadata metaData = new SelectQueryMetadata();
 
     /** Creates an empty SelectQuery. */
     public SelectQuery() {
@@ -144,16 +144,16 @@
      */
     @Override
     public QueryMetadata getMetaData(EntityResolver resolver) {
-        selectInfo.resolve(root, resolver, this);
+        metaData.resolve(root, resolver, this);
 
         // must force DataRows if custom attributes are fetched
         if (isFetchingCustomAttributes()) {
-            QueryMetadataWrapper wrapper = new QueryMetadataWrapper(selectInfo);
+            QueryMetadataWrapper wrapper = new QueryMetadataWrapper(metaData);
             wrapper.override(QueryMetadata.FETCHING_DATA_ROWS_PROPERTY, Boolean.TRUE);
             return wrapper;
         }
         else {
-            return selectInfo;
+            return metaData;
         }
     }
 
@@ -207,7 +207,7 @@
                 ? "true".equalsIgnoreCase(distinct.toString())
                 : DISTINCT_DEFAULT;
 
-        selectInfo.initWithProperties(properties);
+        metaData.initWithProperties(properties);
     }
 
     /**
@@ -261,7 +261,7 @@
             encoder.printProperty(DISTINCT_PROPERTY, distinct);
         }
 
-        selectInfo.encodeAsXML(encoder);
+        metaData.encodeAsXML(encoder);
 
         // encode qualifier
         if (qualifier != null) {
@@ -301,7 +301,7 @@
         SelectQuery query = new SelectQuery();
         query.setDistinct(distinct);
 
-        query.selectInfo.copyFromInfo(this.selectInfo);
+        query.metaData.copyFromInfo(this.metaData);
         query.setRoot(root);
 
         // The following algorithm is for building the new query name based
@@ -458,14 +458,14 @@
      * @since 1.2
      */
     public PrefetchTreeNode getPrefetchTree() {
-        return selectInfo.getPrefetchTree();
+        return metaData.getPrefetchTree();
     }
 
     /**
      * @since 1.2
      */
     public void setPrefetchTree(PrefetchTreeNode prefetchTree) {
-        selectInfo.setPrefetchTree(prefetchTree);
+        metaData.setPrefetchTree(prefetchTree);
     }
 
     /**
@@ -474,14 +474,14 @@
      * @since 1.2 signature changed to return created PrefetchTreeNode.
      */
     public PrefetchTreeNode addPrefetch(String prefetchPath) {
-        return selectInfo.addPrefetch(prefetchPath, PrefetchTreeNode.UNDEFINED_SEMANTICS);
+        return metaData.addPrefetch(prefetchPath, PrefetchTreeNode.UNDEFINED_SEMANTICS);
     }
 
     /**
      * Clears all stored prefetch paths.
      */
     public void clearPrefetches() {
-        selectInfo.clearPrefetches();
+        metaData.clearPrefetches();
     }
 
     /**
@@ -490,7 +490,7 @@
      * @since 1.1
      */
     public void removePrefetch(String prefetchPath) {
-        selectInfo.removePrefetch(prefetchPath);
+        metaData.removePrefetch(prefetchPath);
     }
 
     /**
@@ -499,7 +499,7 @@
      * QueryEngine executing this query.
      */
     public boolean isFetchingDataRows() {
-        return this.isFetchingCustomAttributes() || selectInfo.isFetchingDataRows();
+        return this.isFetchingCustomAttributes() || metaData.isFetchingDataRows();
     }
 
     /**
@@ -511,7 +511,7 @@
      * </p>
      */
     public void setFetchingDataRows(boolean flag) {
-        selectInfo.setFetchingDataRows(flag);
+        metaData.setFetchingDataRows(flag);
     }
 
     /**
@@ -520,56 +520,73 @@
      * @since 1.1
      */
     public boolean isRefreshingObjects() {
-        return selectInfo.isRefreshingObjects();
+        return metaData.isRefreshingObjects();
     }
 
     /**
      * @since 1.1
      */
     public void setRefreshingObjects(boolean flag) {
-        selectInfo.setRefreshingObjects(flag);
+        metaData.setRefreshingObjects(flag);
     }
 
     /**
      * @since 1.1
+     * @deprecated since 3.0 {@link #getCacheStrategy()} replaces this method.
      */
     public String getCachePolicy() {
-        return selectInfo.getCachePolicy();
+        return metaData.getCachePolicy();
     }
 
     /**
      * @since 1.1
+     * @deprecated since 3.0 {@link #setCacheStrategy(QueryCacheStrategy)} replaces this
+     *             method.
      */
     public void setCachePolicy(String policy) {
-        this.selectInfo.setCachePolicy(policy);
+        metaData.setCachePolicy(policy);
+    }
+
+    /**
+     * @since 3.0
+     */
+    public QueryCacheStrategy getCacheStrategy() {
+        return metaData.getCacheStrategy();
+    }
+
+    /**
+     * @since 3.0
+     */
+    public void setCacheStrategy(QueryCacheStrategy strategy) {
+        metaData.setCacheStrategy(strategy);
     }
 
     /**
      * @since 3.0
      */
     public String[] getCacheGroups() {
-        return selectInfo.getCacheGroups();
+        return metaData.getCacheGroups();
     }
 
     /**
      * @since 3.0
      */
     public void setCacheGroups(String... cacheGroups) {
-        this.selectInfo.setCacheGroups(cacheGroups);
+        this.metaData.setCacheGroups(cacheGroups);
     }
 
     /**
      * Returns the fetchLimit.
      */
     public int getFetchLimit() {
-        return selectInfo.getFetchLimit();
+        return metaData.getFetchLimit();
     }
 
     /**
      * Sets the fetchLimit.
      */
     public void setFetchLimit(int fetchLimit) {
-        this.selectInfo.setFetchLimit(fetchLimit);
+        this.metaData.setFetchLimit(fetchLimit);
     }
 
     /**
@@ -578,7 +595,7 @@
      * in the memory.
      */
     public int getPageSize() {
-        return selectInfo.getPageSize();
+        return metaData.getPageSize();
     }
 
     /**
@@ -587,7 +604,7 @@
      * @param pageSize The pageSize to set
      */
     public void setPageSize(int pageSize) {
-        selectInfo.setPageSize(pageSize);
+        metaData.setPageSize(pageSize);
     }
 
     /**
@@ -597,7 +614,7 @@
      * @since 1.1
      */
     public boolean isResolvingInherited() {
-        return selectInfo.isResolvingInherited();
+        return metaData.isResolvingInherited();
     }
 
     /**
@@ -607,7 +624,7 @@
      * @since 1.1
      */
     public void setResolvingInherited(boolean b) {
-        selectInfo.setResolvingInherited(b);
+        metaData.setResolvingInherited(b);
     }
 
     /**



Mime
View raw message