olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [25/33] olingo-odata2 git commit: [OLINGO-497] Fixed orderby ordering
Date Wed, 10 Dec 2014 19:31:14 GMT
[OLINGO-497] Fixed orderby ordering


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/1d150017
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/1d150017
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/1d150017

Branch: refs/heads/Olingo-129_PocJpaDataStore
Commit: 1d150017eae04d0445a58ec671d9c613401a2c60
Parents: 413bde2
Author: Michael Bolz <michael.bolz@sap.com>
Authored: Wed Nov 26 06:02:09 2014 +0100
Committer: Michael Bolz <michael.bolz@sap.com>
Committed: Wed Nov 26 06:09:57 2014 +0100

----------------------------------------------------------------------
 .../jpa/processor/api/jpql/JPQLSelectContextView.java     | 10 ++++++----
 .../odata2/jpa/processor/core/ODataExpressionParser.java  |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/1d150017/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/jpql/JPQLSelectContextView.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/jpql/JPQLSelectContextView.java
b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/jpql/JPQLSelectContextView.java
index 88878b6..072dc3d 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/jpql/JPQLSelectContextView.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/jpql/JPQLSelectContextView.java
@@ -18,7 +18,7 @@
  ******************************************************************************/
 package org.apache.olingo.odata2.jpa.processor.api.jpql;
 
-import java.util.HashMap;
+import java.util.Map;
 
 /**
  * The interface provide a view on JPQL select context.The interface provides
@@ -40,16 +40,18 @@ public interface JPQLSelectContextView extends JPQLContextView {
   public String getSelectExpression();
 
   /**
-   * The method returns a Hash Map of JPQL ORDERBY clause. The ORDERBY clause
+   * The method returns an ordered map of JPQL ORDERBY clause. The ORDERBY clause
    * is built from $orderby OData system query option. The hash map contains
    * <ol>
    * <li>Key - JPA Entity Property name to be ordered</li>
    * <li>Value - Sort Order in JPQL (desc,asc)</li>
    * </ol>
+   * in the order based on the expression specified
+   * (accessible with <code>Map.entrySet(..)</code>).
    * 
-   * @return a hash map of (JPA Property Name,Sort Order)
+   * @return an ordered map of (JPA Property Name,Sort Order)
    */
-  public HashMap<String, String> getOrderByCollection();
+  public Map<String, String> getOrderByCollection();
 
   /**
    * The method returns a JPQL WHERE condition as string. The WHERE condition

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/1d150017/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParser.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParser.java
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParser.java
index 5510fde..83079cc 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParser.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParser.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 
 import org.apache.olingo.odata2.api.edm.EdmException;
@@ -377,7 +378,7 @@ public class ODataExpressionParser {
 
   public static HashMap<String, String> parseKeyPropertiesToJPAOrderByExpression(
       final List<EdmProperty> edmPropertylist, final String tableAlias) throws ODataJPARuntimeException
{
-    HashMap<String, String> orderByMap = new HashMap<String, String>();
+    LinkedHashMap<String, String> orderByMap = new LinkedHashMap<String, String>();
     String propertyName = null;
     for (EdmProperty edmProperty : edmPropertylist) {
       try {


Mime
View raw message