openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r890857 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/datacache/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ openjpa-persistence/src/main/java/o...
Date Tue, 15 Dec 2009 16:15:22 GMT
Author: ppoddar
Date: Tue Dec 15 16:15:21 2009
New Revision: 890857

URL: http://svn.apache.org/viewvc?rev=890857&view=rev
Log:
OPENJPA-1050: Restore existing method signature but deprecate them.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryKey.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DelegatingQuery.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryContext.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaQueryImpl.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java?rev=890857&r1=890856&r2=890857&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java
Tue Dec 15 16:15:21 2009
@@ -468,7 +468,11 @@
             return _ex.hasGrouping(unwrap(q));
         }
 
-        public OrderedMap<Object, Class<?>> getParameterTypes(StoreQuery q) {
+        public OrderedMap<Object, Class<?>> getOrderedParameterTypes(StoreQuery
q) {
+            return _ex.getOrderedParameterTypes(unwrap(q));
+        }
+        
+        public LinkedMap getParameterTypes(StoreQuery q) {
             return _ex.getParameterTypes(unwrap(q));
         }
         

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryKey.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryKey.java?rev=890857&r1=890856&r2=890857&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryKey.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryKey.java
Tue Dec 15 16:15:21 2009
@@ -266,7 +266,7 @@
         // Create a map for the given parameters, and convert the
         // parameter list into a map, using the query's parameter
         // declaration to determine ordering etc.
-        Map types = q.getParameterTypes();
+        Map types = q.getOrderedParameterTypes();
         Map map = new HashMap((int) (types.size() * 1.33 + 1));
         int idx = 0;
         for (Iterator iter = types.keySet().iterator(); iter.hasNext(); idx++)

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java?rev=890857&r1=890856&r2=890857&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java
Tue Dec 15 16:15:21 2009
@@ -24,8 +24,10 @@
 import org.apache.openjpa.kernel.exps.AggregateListener;
 import org.apache.openjpa.kernel.exps.FilterListener;
 import org.apache.openjpa.kernel.exps.QueryExpressions;
+import org.apache.openjpa.kernel.exps.Value;
 import org.apache.openjpa.lib.util.OrderedMap;
 import org.apache.openjpa.meta.ClassMetaData;
+import org.apache.openjpa.meta.FieldMetaData;
 import org.apache.openjpa.util.InternalException;
 import org.apache.openjpa.util.UnsupportedException;
 
@@ -35,6 +37,7 @@
  * @author Abe White
  * @since 0.4.0
  */
+@SuppressWarnings("serial")
 public abstract class AbstractStoreQuery
     implements StoreQuery {
 
@@ -166,7 +169,7 @@
             return EMPTY_STRINGS;
         }
 
-        public Class[] getProjectionTypes(StoreQuery q) {
+        public Class<?>[] getProjectionTypes(StoreQuery q) {
             return EMPTY_CLASSES;
         }
 
@@ -186,15 +189,21 @@
             return false;
         }
 
-        public OrderedMap<Object,Class<?>> getParameterTypes(StoreQuery q) {
-            return EMPTY_PARAMS;
+        public OrderedMap<Object,Class<?>> getOrderedParameterTypes(StoreQuery
q) {
+            return EMPTY_ORDERED_PARAMS;
+        }
+        
+        public LinkedMap getParameterTypes(StoreQuery q) {
+            LinkedMap result = new LinkedMap();
+            result.putAll(getOrderedParameterTypes(q));
+            return result;
         }
 
-        public Class getResultClass(StoreQuery q) {
+        public Class<?> getResultClass(StoreQuery q) {
             return null;
         }
 
-        public Map getUpdates(StoreQuery q) {
+        public Map<FieldMetaData,Value> getUpdates(StoreQuery q) {
             return null;
         }
     }

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DelegatingQuery.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DelegatingQuery.java?rev=890857&r1=890856&r2=890857&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DelegatingQuery.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DelegatingQuery.java
Tue Dec 15 16:15:21 2009
@@ -21,6 +21,7 @@
 import java.util.Collection;
 import java.util.Map;
 
+import org.apache.commons.collections.map.LinkedMap;
 import org.apache.openjpa.kernel.exps.AggregateListener;
 import org.apache.openjpa.kernel.exps.FilterListener;
 import org.apache.openjpa.lib.util.OrderedMap;
@@ -382,7 +383,15 @@
         }
     }
 
-    public OrderedMap<Object,Class<?>> getParameterTypes() {
+    public OrderedMap<Object,Class<?>> getOrderedParameterTypes() {
+        try {
+            return _query.getOrderedParameterTypes();
+        } catch (RuntimeException re) {
+            throw translate(re);
+        }
+    }
+
+    public LinkedMap getParameterTypes() {
         try {
             return _query.getParameterTypes();
         } catch (RuntimeException re) {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java?rev=890857&r1=890856&r2=890857&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java
Tue Dec 15 16:15:21 2009
@@ -387,7 +387,7 @@
             return assertQueryExpression().grouping.length > 0;
         }
 
-        public final OrderedMap<Object,Class<?>> getParameterTypes(StoreQuery
q) {
+        public final OrderedMap<Object,Class<?>> getOrderedParameterTypes(StoreQuery
q) {
             return assertQueryExpression().parameterTypes;
         }
 
@@ -398,7 +398,7 @@
             if (userParams == null || userParams.isEmpty())
                 return StoreQuery.EMPTY_OBJECTS;
 
-            OrderedMap<?,Class<?>> paramTypes = getParameterTypes(q);
+            OrderedMap<?,Class<?>> paramTypes = getOrderedParameterTypes(q);
             Object[] arr = new Object[userParams.size()];
             int base = positionalParameterBase(userParams.keySet());
             for (Object key : paramTypes.keySet()) {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java?rev=890857&r1=890856&r2=890857&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java
Tue Dec 15 16:15:21 2009
@@ -103,7 +103,7 @@
                 return _params;
             String params = ctx.getParameterDeclaration();
             if (params == null)
-                return EMPTY_PARAMS;
+                return EMPTY_ORDERED_PARAMS;
 
             List decs = Filters.parseDeclaration(params, ',', "parameters");
             if (_params == null)
@@ -150,7 +150,7 @@
             if (params.length == 0)
                 paramMap = Collections.EMPTY_MAP;
             else {
-                Map paramTypes = q.getContext().getParameterTypes();
+                Map paramTypes = q.getContext().getOrderedParameterTypes();
                 paramMap = new HashMap((int) (params.length * 1.33 + 1));
                 int idx = 0;
                 for (Iterator itr = paramTypes.keySet().iterator();
@@ -260,7 +260,7 @@
             _meth = meth;
         }
 
-        public OrderedMap<Object, Class<?>> getParameterTypes(StoreQuery q) {
+        public OrderedMap<Object, Class<?>> getOrderedParameterTypes(StoreQuery
q) {
             return ((MethodStoreQuery) q).bindParameterTypes();
 		}
         
@@ -268,7 +268,7 @@
             if (userParams == null || userParams.isEmpty())
                 return StoreQuery.EMPTY_OBJECTS;
 
-            OrderedMap<Object, Class<?>> paramTypes = getParameterTypes(q);
+            OrderedMap<Object, Class<?>> paramTypes = getOrderedParameterTypes(q);
             Object[] arr = new Object[userParams.size()];
             int base = positionalParameterBase(userParams.keySet());
             for (Object key : paramTypes.keySet()) {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryContext.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryContext.java?rev=890857&r1=890856&r2=890857&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryContext.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryContext.java
Tue Dec 15 16:15:21 2009
@@ -21,6 +21,7 @@
 import java.util.Collection;
 import java.util.Map;
 
+import org.apache.commons.collections.map.LinkedMap;
 import org.apache.openjpa.kernel.exps.AggregateListener;
 import org.apache.openjpa.kernel.exps.Constant;
 import org.apache.openjpa.kernel.exps.FilterListener;
@@ -183,7 +184,15 @@
      * map will iterate in the order that the parameters were declared or,
      * if they're implicit, used.
      */
-    public OrderedMap<Object,Class<?>> getParameterTypes();
+    public OrderedMap<Object,Class<?>> getOrderedParameterTypes();
+    
+    /**
+     * Return a map of parameter name to type for this query. The returned
+     * map will iterate in the order that the parameters were declared or,
+     * if they're implicit, used.
+     */
+    @Deprecated
+    public LinkedMap getParameterTypes();
 
     /**
      * If this query is a bulk update, return a map of the

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java?rev=890857&r1=890856&r2=890857&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java
Tue Dec 15 16:15:21 2009
@@ -67,7 +67,7 @@
     public boolean[] ascending = StoreQuery.EMPTY_BOOLEANS;
     public String[] orderingClauses = StoreQuery.EMPTY_STRINGS;
     public String[] orderingAliases = StoreQuery.EMPTY_STRINGS;
-    public OrderedMap<Object,Class<?>> parameterTypes = StoreQuery.EMPTY_PARAMS;
+    public OrderedMap<Object,Class<?>> parameterTypes = StoreQuery.EMPTY_ORDERED_PARAMS;
     public int operation = QueryOperations.OP_SELECT;
     public ClassMetaData[] accessPath = StoreQuery.EMPTY_METAS;
     public String[] fetchPaths = StoreQuery.EMPTY_STRINGS;

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java?rev=890857&r1=890856&r2=890857&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
Tue Dec 15 16:15:21 2009
@@ -969,7 +969,7 @@
     public Map<Object, Parameter<?>> getDeclaredParameters() {
         if (_declaredParams == null) {
             _declaredParams = new HashMap<Object, Parameter<?>>();
-            OrderedMap<Object,Class<?>> paramTypes = _query.getParameterTypes();
+            OrderedMap<Object,Class<?>> paramTypes = _query.getOrderedParameterTypes();
             for (Object key : paramTypes.keySet()) {
                 Parameter<?> param = null;
                 Class<?> expectedValueType = paramTypes.get(key);

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaQueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaQueryImpl.java?rev=890857&r1=890856&r2=890857&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaQueryImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaQueryImpl.java
Tue Dec 15 16:15:21 2009
@@ -404,7 +404,7 @@
      */
     public OrderedMap<Object, Class<?>> getParameterTypes() {
         collectParameters(new CriteriaExpressionVisitor.ParameterVisitor(this));
-        return _params == null ? StoreQuery.EMPTY_PARAMS : _params;
+        return _params == null ? StoreQuery.EMPTY_ORDERED_PARAMS : _params;
     }
     
     /**



Mime
View raw message