olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject olingo-odata4 git commit: [OLINGO-553] Allow system query options for functions returning entity collections
Date Wed, 11 Mar 2015 13:42:21 GMT
Repository: olingo-odata4
Updated Branches:
  refs/heads/master 3eeffe6d2 -> 8edba8f8c


[OLINGO-553] Allow system query options for functions returning entity collections

Signed-off-by: Michael Bolz <michael.bolz@sap.com>


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/8edba8f8
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/8edba8f8
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/8edba8f8

Branch: refs/heads/master
Commit: 8edba8f8c9e360649d3932988b65f84e9a8e314e
Parents: 3eeffe6
Author: Klaus Straubinger <klaus.straubinger@sap.com>
Authored: Wed Mar 11 14:23:53 2015 +0100
Committer: Michael Bolz <michael.bolz@sap.com>
Committed: Wed Mar 11 14:42:04 2015 +0100

----------------------------------------------------------------------
 .../server/core/uri/validator/UriValidator.java |  9 +++---
 .../core/uri/validator/UriValidatorTest.java    | 29 ++++++++++++++------
 2 files changed, 25 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8edba8f8/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
index 81d1e4e..6ea1f3f 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
@@ -438,11 +438,10 @@ public class UriValidator {
     EdmReturnType rt = urf.getFunction().getReturnType();
     switch (rt.getType().getKind()) {
     case ENTITY:
-      if (((EdmEntityType) rt.getType()).hasStream()) {
-        idx = RowIndexForUriType.mediaStream;
-      } else {
-        idx = rt.isCollection() ? RowIndexForUriType.entitySet : RowIndexForUriType.entity;
-      }
+      idx = rt.isCollection() ?
+          RowIndexForUriType.entitySet :
+          ((EdmEntityType) rt.getType()).hasStream() ?
+              RowIndexForUriType.mediaStream : RowIndexForUriType.entity;
       break;
     case PRIMITIVE:
       idx = rt.isCollection() ? RowIndexForUriType.propertyPrimitiveCollection : RowIndexForUriType.propertyPrimitive;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8edba8f8/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
index 6386570..4be5da5 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
@@ -61,6 +61,8 @@ public class UriValidatorTest {
   private static final String URI_SINGLETON = "/SI";
   private static final String URI_NAV_ENTITY = "/ESKeyNav(1)/NavPropertyETKeyNavOne";
   private static final String URI_NAV_ENTITY_SET = "/ESKeyNav(1)/NavPropertyETKeyNavMany";
+  private static final String URI_FI_ENTITY_SET = "FICRTCollESMedia()";
+  private static final String URI_FI_ENTITY = "FICRTETTwoKeyNavParam(ParameterInt16=1)";
 
   private static final String QO_FILTER = "$filter='1' eq '1'";
   private static final String QO_FORMAT = "$format=bla/bla";
@@ -143,13 +145,18 @@ public class UriValidatorTest {
       /* { URI_NAV_ENTITY_SET, QO_SEARCH }, */{ URI_NAV_ENTITY_SET, QO_SELECT }, { URI_NAV_ENTITY_SET,
QO_SKIP },
       { URI_NAV_ENTITY_SET, QO_SKIPTOKEN }, { URI_NAV_ENTITY_SET, QO_LEVELS }, { URI_NAV_ENTITY_SET,
QO_TOP },
 
-      { "FINRTInt16()" },
-      { "FICRTETKeyNav()" },
-      { "FICRTETTwoKeyNavParam(ParameterInt16=1)" },
-      { "FICRTCollString()" },
-      { "FICRTCTTwoPrim()" },
-      { "FICRTCollCTTwoPrim()" },
-      { "FICRTESMedia()" },
+      { URI_FI_ENTITY_SET, QO_FILTER }, { URI_FI_ENTITY_SET, QO_FORMAT }, { URI_FI_ENTITY_SET,
QO_EXPAND },
+      { URI_FI_ENTITY_SET, QO_COUNT }, { URI_FI_ENTITY_SET, QO_ORDERBY }, /* { URI_FI_ENTITY_SET,
QO_SEARCH }, */
+      { URI_FI_ENTITY_SET, QO_SELECT }, { URI_FI_ENTITY_SET, QO_SKIP }, { URI_FI_ENTITY_SET,
QO_SKIPTOKEN },
+      { URI_FI_ENTITY_SET, QO_LEVELS }, { URI_FI_ENTITY_SET, QO_TOP },
+
+      { URI_FI_ENTITY, QO_FORMAT }, { URI_FI_ENTITY, QO_EXPAND }, { URI_FI_ENTITY, QO_SELECT
},
+      { URI_FI_ENTITY, QO_LEVELS },
+
+      { "FINRTInt16()", QO_FORMAT },
+      { "FICRTCollString()", QO_FORMAT },
+      { "FICRTCTTwoPrim()", QO_FORMAT },
+      { "FICRTCollCTTwoPrim()", QO_FORMAT },
 
       { "ESTwoKeyNav/olingo.odata.test1.BAESTwoKeyNavRTESTwoKeyNav" },
       { "ESAllPrim/olingo.odata.test1.BAESAllPrimRTETAllPrim" },
@@ -252,7 +259,13 @@ public class UriValidatorTest {
       { URI_NAV_ENTITY, QO_ORDERBY }, /* { URI_NAV_ENTITY, QO_SEARCH }, */{ URI_NAV_ENTITY,
QO_SKIP },
       { URI_NAV_ENTITY, QO_SKIPTOKEN }, { URI_SINGLETON, QO_TOP },
 
-      { URI_NAV_ENTITY_SET, QO_ID }
+      { URI_NAV_ENTITY_SET, QO_ID },
+
+      { URI_FI_ENTITY_SET, QO_ID },
+
+      { URI_FI_ENTITY, QO_FILTER }, { URI_FI_ENTITY, QO_ID }, { URI_FI_ENTITY, QO_COUNT },
+      { URI_FI_ENTITY, QO_ORDERBY }, /* { URI_FI_ENTITY, QO_SEARCH }, */ { URI_FI_ENTITY,
QO_SKIP },
+      { URI_FI_ENTITY, QO_SKIPTOKEN }, { URI_FI_ENTITY, QO_TOP }
   };
 
   private static final Edm edm = new EdmProviderImpl(new EdmTechProvider());


Mime
View raw message