You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ko...@apache.org on 2014/01/29 13:45:33 UTC
[1/6] [OLINGO-63] Uri Parser: Add test cases for key predicates,
select, expand and code cleanup
Updated Branches:
refs/heads/master 757eb54c0 -> 1ef03f92f
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestByAbapResourcePath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestByAbapResourcePath.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestByAbapResourcePath.java
index 35016b4..34bef45 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestByAbapResourcePath.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestByAbapResourcePath.java
@@ -20,8 +20,10 @@ package org.apache.olingo.odata4.producer.core.uri.antlr;
// sync 20.1.2014
import java.util.Arrays;
+import java.util.Stack;
import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
@@ -43,7 +45,6 @@ public class TestByAbapResourcePath {
testUri = new UriValidator().setEdm(edm);
testRes = new UriResourceValidator().setEdm(edm);
testFilter = new FilterValidator().setEdm(edm);
-
}
@Test
@@ -1940,7 +1941,6 @@ public class TestByAbapResourcePath {
.isSimple("CollPropertyString")
.isType(EdmTechProvider.nameString, true);
testUri.run("SINav/CollPropertyString/$count")
-
.isKind(UriInfoKind.resource).goPath()
.first()
.isSingleton("SINav")
@@ -1951,137 +1951,766 @@ public class TestByAbapResourcePath {
.isCount();
}
- // TODO make rest
@Test
public void runExpand() {
- testUri.run("ESKeyNav(1)?$expand=*");
- testUri.run("ESKeyNav(1)?$expand=*/$ref");
- testUri.run("ESKeyNav(1)?$expand=*/$ref,NavPropertyETKeyNavMany");
- testUri.run("ESKeyNav(1)?$expand=*($levels=3)");
- testUri.run("ESKeyNav(1)?$expand=*($levels=max)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$ref");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($filter=PropertyInt16 eq 1)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($orderby=PropertyInt16)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($top=2)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($count=true)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1;$top=3)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1%3b$top=3)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$count");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$count");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$count($filter=PropertyInt16 gt 1)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($filter=PropertyInt16 eq 1)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($orderby=PropertyInt16)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($top=2)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($count=true)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($select=PropertyString)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($expand=NavPropertyETTwoKeyNavOne)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($expand=NavPropertyETKeyNavMany)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne($levels=5)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($select=PropertyString)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne($levels=max)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1;$top=2)");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1%3b$top=2)");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')?$expand=NavPropertyETKeyNavMany");
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')?$expand=com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETKeyNavMany");
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$expand=com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETTwoKeyNavMany");
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$expand=com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETTwoBaseTwoKeyNav");
- testUri.run("ESTwoKeyNav?$expand=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexNav/NavPropertyETTwoKeyNavOne");
- testUri
- .run("ESTwoKeyNav?$expand=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexNav"
- + "/com.sap.odata.test1.CTTwoBasePrimCompNav/NavPropertyETTwoKeyNavOne");
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref,NavPropertyETTwoKeyNavMany($skip=2;$top=1)");
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$expand=com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETTwoBaseTwoKeyNav($select=PropertyString)");
- testUri
- .run("ESKeyNav?$expand=NavPropertyETKeyNavOne($expand=NavPropertyETKeyNavMany("
- + "$expand=NavPropertyETKeyNavOne))");
- testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyInt16)");
- testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyComplex/PropertyInt16)");
+
+ testUri.run("ESKeyNav(1)?$expand=*")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .isSegStar(0);
+
+ testUri.run("ESKeyNav(1)?$expand=*/$ref")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .isSegStar(0)
+ .isSegRef(1);
+
+ testUri.run("ESKeyNav(1)?$expand=*/$ref,NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .isSegStar(0).isSegRef(1)
+ .n()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ testUri.run("ESKeyNav(1)?$expand=*($levels=3)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .isSegStar(0)
+ .isLevels("3");
+
+ testUri.run("ESKeyNav(1)?$expand=*($levels=max)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .isSegStar(0)
+ .isLevels("max");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef();
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$ref")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavOne")
+ .isType(EdmTechProvider.nameETKeyNav, false)
+ .n().isRef();
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($filter=PropertyInt16 eq 1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator().isFilterSerialized("<PropertyInt16 eq 1>");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($orderby=PropertyInt16)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator();// .isFilterSerialized(""); TODO check order BY
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator()
+ .isSkipText("1");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($top=2)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator()
+ .isTopText("1");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($count=true)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator()
+ .isCountText("1");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1;$top=3)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator()
+ .isSkipText("1")
+ .isTopText("3");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1%3b$top=3)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator()
+ .isSkipText("1")
+ .isTopText("3");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$count")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isCount();
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$count")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavOne")
+ .isType(EdmTechProvider.nameETKeyNav, false)
+ .n().isCount();
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$count($filter=PropertyInt16 gt 1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isCount()
+ .goUpExpandValidator()
+ .isFilterSerialized("<PropertyInt16 gt 1>");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($filter=PropertyInt16 eq 1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isFilterSerialized("<PropertyInt16 eq 1>");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($orderby=PropertyInt16)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator();// TODO check orderby
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isSkipText("1");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($top=2)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isTopText("1");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($count=true)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isCountText("1");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($select=PropertyString)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isSelectText("PropertyString");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($expand=NavPropertyETTwoKeyNavOne)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .goExpand()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETTwoKeyNavOne");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($expand=NavPropertyETKeyNavMany)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .goExpand()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne($levels=5)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavOne")
+ .isType(EdmTechProvider.nameETKeyNav, false)
+ .goUpExpandValidator()
+ .isLevelsText("5");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($select=PropertyString)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isSelectText("PropertyString");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne($levels=max)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavOne")
+ .isType(EdmTechProvider.nameETKeyNav, false)
+ .goUpExpandValidator()
+ .isLevelsText("max");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1;$top=2)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isSkipText("1")
+ .isTopText("2");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1%3b$top=2)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isSkipText("max")
+ .isTopText("2");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')?$expand=NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'Hugo'")
+ .goExpand()
+ .first()
+ .goPath().first()
+ .isIt().n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, true);
+
+ testUri.run("ESTwoKeyNav?"
+ + "$expand=com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath().first()
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')?"
+ + "$expand=com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath().first()
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'Hugo'")
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?"
+ + "$expand=com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETTwoKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath().first()
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$expand=com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath().first()
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav?$expand=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexNav/NavPropertyETTwoKeyNavOne")
+ .isKind(UriInfoKind.resource).goPath().first()
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplexNav")
+ .isType(EdmTechProvider.nameCTBasePrimCompNav)
+ .n()
+ .isNav("NavPropertyETTwoKeyNavOne");
+
+ testUri.run("ESTwoKeyNav?$expand=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexNav"
+ + "/com.sap.odata.test1.CTTwoBasePrimCompNav/NavPropertyETTwoKeyNavOne")
+ .isKind(UriInfoKind.resource).goPath().first()
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplexNav")
+ .isType(EdmTechProvider.nameCTBasePrimCompNav)
+ .n()
+ .isNav("NavPropertyETTwoKeyNavOne");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref,NavPropertyETTwoKeyNavMany($skip=2;$top=1)")
+ .isKind(UriInfoKind.resource).goPath().first()
+ .goExpand().first()
+ .goPath()
+ .first().isUriPathInfoKind(UriResourceKind.it)
+ .n().isNav("NavPropertyETKeyNavMany")
+ .n().isRef()
+ .goUpExpandValidator()
+ .n()
+ .goPath()
+ .first().isUriPathInfoKind(UriResourceKind.it)
+ .n().isNav("NavPropertyETTwoKeyNavMany")
+ .goUpExpandValidator()
+ .isSkipText("2")
+ .isTopText("1");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$expand=com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETTwoBaseTwoKeyNav($select=PropertyString)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n().isNav("NavPropertyETTwoKeyNavMany")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav)
+ .goUpExpandValidator(); // TODO check select
+
+ testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($expand=NavPropertyETKeyNavMany("
+ + "$expand=NavPropertyETKeyNavOne))")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .n().isNav("NavPropertyETKeyNavOne")
+ .goUpExpandValidator()
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .n().isNav("NavPropertyETKeyNavMany")
+ .goUpExpandValidator()
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .n().isNav("NavPropertyETKeyNavOne");
+
+ testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyInt16)")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .n().isNav("NavPropertyETKeyNavOne")
+ .goUpExpandValidator();
+ // .isSelectText("PropertyInt16") //TODO check select
+
+ testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyComplex/PropertyInt16)")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .goExpand().first()
+ .goPath().first()
+ .isUriPathInfoKind(UriResourceKind.it)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .n().isNav("NavPropertyETKeyNavOne")
+ .goUpExpandValidator();
+ // .isSelectText("PropertyInt16")//TODO check select
+ }
+
+ private void isSkipText(String string) {
+ // TODO Auto-generated method stub
+
}
@Test
public void runTop() {
// top
- testUri.run("ESKeyNav?$top=1");
- testUri.run("ESKeyNav?$top=0");
- testUri.run("ESKeyNav?$top=-3");
+ testUri.run("ESKeyNav?$top=1")
+ .isKind(UriInfoKind.resource).goPath()
+ .isEntitySet("ESKeyNav")
+ .isTopText("1");
+
+ testUri.run("ESKeyNav?$top=0")
+ .isKind(UriInfoKind.resource).goPath()
+ .isEntitySet("ESKeyNav")
+ .isTopText("0");
+
+ testUri.run("ESKeyNav?$top=-3")
+ .isKind(UriInfoKind.resource).goPath()
+ .isEntitySet("ESKeyNav")
+ .isTopText("-3");
}
@Test
public void runFormat() {
// format
- testUri.run("ESKeyNav(1)?$format=atom");
- testUri.run("ESKeyNav(1)?$format=json");
- testUri.run("ESKeyNav(1)?$format=xml");
- testUri.run("ESKeyNav(1)?$format=IANA_content_type/must_contain_a_slash");
- testUri.run("ESKeyNav(1)?$format=Test_all_valid_signsSpecified_for_format_signs%26-._~$@%27/Aa123%26-._~$@%27");
+ testUri.run("ESKeyNav(1)?$format=atom")
+ .isKind(UriInfoKind.resource).goPath()
+ .isFormatText("atom");
+ testUri.run("ESKeyNav(1)?$format=json")
+ .isKind(UriInfoKind.resource).goPath()
+ .isFormatText("json");
+ testUri.run("ESKeyNav(1)?$format=xml")
+ .isKind(UriInfoKind.resource).goPath()
+ .isFormatText("xml");
+ testUri.run("ESKeyNav(1)?$format=IANA_content_type/must_contain_a_slash")
+ .isKind(UriInfoKind.resource).goPath()
+ .isFormatText("IANA_content_type/must_contain_a_slash");
+ testUri.run("ESKeyNav(1)?$format=Test_all_valid_signsSpecified_for_format_signs%26-._~$@%27/Aa123%26-._~$@%27")
+ .isKind(UriInfoKind.resource).goPath()
+ .isFormatText("Test_all_valid_signsSpecified_for_format_signs%26-._~$@%27/Aa123%26-._~$@%27");
}
@Test
public void runCount() {
// count
- testUri.run("ESAllPrim?$count=true");
- testUri.run("ESAllPrim?$count=false");
+ testUri.run("ESAllPrim?$count=true")
+ .isKind(UriInfoKind.resource).goPath()
+ .isInlineCountText("true");
+ testUri.run("ESAllPrim?$count=false")
+ .isKind(UriInfoKind.resource).goPath()
+ .isInlineCountText("false");
// testUri.run("ESAllPrim?$count=foo");
}
@Test
- public void rest() {
+ public void skip() {
// skip
- testUri.run("ESAllPrim?$skip=3");
- testUri.run("ESAllPrim?$skip=0");
- testUri.run("ESAllPrim?$skip=-3");
- testUri.run("ESAllPrim?$skiptoken=foo");
+ testUri.run("ESAllPrim?$skip=3")
+ .isKind(UriInfoKind.resource).goPath()
+ .isSkipText("3");
+ testUri.run("ESAllPrim?$skip=0")
+ .isKind(UriInfoKind.resource).goPath()
+ .isSkipText("0");
+ testUri.run("ESAllPrim?$skip=-3")
+ .isKind(UriInfoKind.resource).goPath()
+ .isSkipText("-3");
+ }
+
+ @Test
+ public void skiptoken() {
+
+ testUri.run("ESAllPrim?$skiptoken=foo")
+ .isKind(UriInfoKind.resource).goPath()
+ .isSkipTokenText("foo");
+ }
+
+ @Test
+ public void misc() {
+
testUri.run("");
- testUri.run("$all");
- testUri.run("$metadata");
- testUri.run("$batch");
- testUri.run("$crossjoin(ESKeyNav)");
- testUri.run("ESKeyNav");
- testUri.run("ESKeyNav(1)");
- testUri.run("SINav");
- testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')");
- testUri.run("FICRTETKeyNav()");
- testUri.run("FICRTCollCTTwoPrim()");
- testUri.run("FICRTCTAllPrimTwoParam(ParameterInt16=1,ParameterString='2')");
- testUri.run("FICRTCollStringTwoParam(ParameterInt16=1,ParameterString='2')");
- testUri.run("FICRTStringTwoParam(ParameterInt16=1)");
- testUri.run("FICRTStringTwoParam(ParameterInt16=1,ParameterString='2')");
- testUri.run("AIRTETParam");
- testUri.run("AIRTPrimParam");
- testUri.run("ESKeyNav/$count");
- testUri.run("ESKeyNav/$ref");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()");
- testUri.run("ESAllPrim/com.sap.odata.test1.BAESAllPrimRTETAllPrim");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav");
- testUri.run("ESTwoKeyNav/$count");
- testUri.run("ESTwoKeyNav/$ref");
- testUri.run("ESKeyNav(1)");
- testUri.run("ESKeyNav(1)/$ref");
- testUri.run("ESMedia(1)/$value");
- testUri.run("ESAllPrim/com.sap.odata.test1.BAESAllPrimRTETAllPrim");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()");
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav");
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/$ref");
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/$value");
+ testUri.run("$all")
+ .isKind(UriInfoKind.all);
+
+ testUri.run("$metadata")
+ .isKind(UriInfoKind.metadata);
+
+ testUri.run("$batch")
+ .isKind(UriInfoKind.batch);
+
+ testUri.run("$crossjoin(ESKeyNav)")
+ .isKind(UriInfoKind.crossjoin)
+ .isCrossJoinEntityList(Arrays.asList("ESKeyNav"));
+
+ testUri.run("ESKeyNav")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESKeyNav");
+ testUri.run("ESKeyNav(1)")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1");
+
+ testUri.run("SINav")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isSingleton("SINav");
+
+ testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
+ .isKind(UriInfoKind.resource)
+ .goPath()
+ .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
+ .isType(EdmTechProvider.nameETMixPrimCollComp)
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'2'");
+
+ testUri.run("FICRTETKeyNav()")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTETKeyNav")
+ .isType(EdmTechProvider.nameETKeyNav);
+
+ testUri.run("FICRTCollCTTwoPrim()")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCollCTTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim);
+
+ testUri.run("FICRTCTAllPrimTwoParam(ParameterInt16=1,ParameterString='2')")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCTAllPrimTwoParam")
+ .isType(EdmTechProvider.nameCTAllPrim)
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'2'");
+
+ testUri.run("FICRTCollStringTwoParam(ParameterInt16=1,ParameterString='2')")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCollStringTwoParam")
+ .isType(EdmTechProvider.nameString)
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'2'");
+
+ testUri.run("FICRTStringTwoParam(ParameterInt16=1)")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTStringTwoParam")
+ .isFunction("UFCRTStringTwoParam")
+ .isType(EdmTechProvider.nameString)
+ .isParameter(0, "ParameterInt16", "1");
+
+ testUri.run("FICRTStringTwoParam(ParameterInt16=1,ParameterString='2')")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTStringTwoParam")
+ .isFunction("UFCRTStringTwoParam")
+ .isType(EdmTechProvider.nameString)
+ .isParameter(0, "ParameterInt16", "1");
+
+ testUri.run("AIRTETParam")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isActionImport("AIRTETParam");
+
+ testUri.run("AIRTPrimParam")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isActionImport("AIRTPrimParam");
+
+ testUri.run("ESKeyNav/$count")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESKeyNav")
+ .n().isCount();
+
+ testUri.run("ESKeyNav/$ref")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESKeyNav")
+ .n().isRef();
+
+ testUri.run("ESKeyNav/$count")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESKeyNav")
+ .n().isCount();
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESTwoKeyNav")
+ .n().isFunction("BFCESTwoKeyNavRTESTwoKeyNav");
+
+ testUri.run("ESAllPrim/com.sap.odata.test1.BAESAllPrimRTETAllPrim")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESAllPrim")
+ .n().isAction("BAESAllPrimRTETAllPrim");
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESTwoKeyNav")
+ .n().isFunction("BFCESTwoKeyNavRTESTwoKeyNav");
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESTwoKeyNav")
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav/$count")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isCount();
+
+ testUri.run("ESTwoKeyNav/$ref")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isRef();
+
+ testUri.run("ESKeyNav(1)")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1");
+
+ testUri.run("ESKeyNav(1)/$ref")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isRef();
+
+ testUri.run("ESMedia(1)/$value")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESMedia")
+ .n()
+ .isValue();
+
+ testUri.run("ESAllPrim/com.sap.odata.test1.BAESAllPrimRTETAllPrim")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESAllPrim")
+ .n().isAction("BAESAllPrimRTETAllPrim");
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESTwoKeyNav")
+ .n().isFunction("BFCESTwoKeyNavRTESTwoKeyNav");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/$ref")
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n().isRef();
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/$value")
+ .goPath().first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n().isValue();
+
}
@Test
public void testSpecial() {
- testFilter.runOnETKeyNav("any()");
+ // testFilter.runOnETKeyNav("any()");
}
@@ -2327,7 +2956,7 @@ public class TestByAbapResourcePath {
testFilter.runOnETKeyNav("cast(NavPropertyETKeyNavOne,com.sap.odata.test1.ETKeyPrimNav)");
// testFilter.runOnETKeyNav("Xcast(NavPropertyETKeyPrimNavOne,com.sap.odata.test1.ETKeyNav)");
- testFilter.runOnETKeyNav("any()");
+ // testFilter.runOnETKeyNav("any()");
testFilter.runOnETKeyNav("any(d:d/PropertyInt16 eq 1)");
testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyString eq 'SomeString')");
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
index a0e895f..44917c6 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
@@ -27,7 +27,7 @@ import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
import org.apache.olingo.odata4.producer.core.testutil.FilterValidator;
[6/6] git commit: [OLINGO-63] Uri Parser: Add test cases for key
predicates, select, expand and code cleanup
Posted by ko...@apache.org.
[OLINGO-63] Uri Parser: Add test cases for key predicates, select,expand and code cleanup
Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/commit/1ef03f92
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/1ef03f92
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/1ef03f92
Branch: refs/heads/master
Commit: 1ef03f92f491c5b17b085349a046f335e6a5124f
Parents: 757eb54
Author: Sven Kobler <sv...@sap.com>
Authored: Fri Jan 24 14:05:20 2014 +0100
Committer: Sven Kobler <sv...@sap.com>
Committed: Wed Jan 29 13:44:24 2014 +0100
----------------------------------------------------------------------
.../exception/ODataApplicationException.java | 36 +
.../olingo/odata4/producer/api/uri/UriInfo.java | 2 +-
.../odata4/producer/api/uri/UriInfoAll.java | 2 +-
.../odata4/producer/api/uri/UriInfoBatch.java | 2 +-
.../producer/api/uri/UriInfoEntityId.java | 2 +-
.../producer/api/uri/UriInfoMetadata.java | 2 +
.../producer/api/uri/UriInfoResource.java | 4 +-
.../odata4/producer/api/uri/UriParameter.java | 11 +-
.../producer/api/uri/UriResourceAction.java | 2 +-
.../odata4/producer/api/uri/UriResourceAll.java | 3 +
.../odata4/producer/api/uri/UriResourceAny.java | 3 +
.../api/uri/UriResourceComplexProperty.java | 1 +
.../producer/api/uri/UriResourceCount.java | 3 +-
.../producer/api/uri/UriResourceEntitySet.java | 1 -
.../producer/api/uri/UriResourceFunction.java | 3 +-
.../odata4/producer/api/uri/UriResourceIt.java | 10 +-
.../producer/api/uri/UriResourceKind.java | 5 +-
.../producer/api/uri/UriResourceLambdaRef.java | 33 +
.../producer/api/uri/UriResourceNavigation.java | 7 +-
.../producer/api/uri/UriResourcePart.java | 6 +-
.../producer/api/uri/UriResourcePartTyped.java | 2 +
.../producer/api/uri/UriResourceProperty.java | 2 +
.../odata4/producer/api/uri/UriResourceRef.java | 3 +-
.../api/uri/UriResourceSimpleProperty.java | 3 +-
.../producer/api/uri/UriResourceSingleton.java | 6 +-
.../producer/api/uri/UriResourceValue.java | 3 +-
.../api/uri/queryoption/AliasQueryOption.java | 3 +-
.../uri/queryoption/ExceptionVisitExpand.java | 5 +-
.../api/uri/queryoption/ExpandItem.java | 14 +-
.../api/uri/queryoption/ExpandOption.java | 2 +
.../api/uri/queryoption/ExpandVisitor.java | 36 -
.../api/uri/queryoption/FilterOption.java | 1 +
.../api/uri/queryoption/FormatOption.java | 3 +-
.../producer/api/uri/queryoption/IdOption.java | 2 +
.../api/uri/queryoption/InlineCountOption.java | 4 +-
.../api/uri/queryoption/LevelExpandOption.java | 2 +-
.../api/uri/queryoption/OrderByItem.java | 2 +-
.../api/uri/queryoption/OrderByOption.java | 4 +-
.../api/uri/queryoption/QueryOption.java | 1 +
.../api/uri/queryoption/SearchOption.java | 3 +-
.../api/uri/queryoption/SelectItem.java | 5 +-
.../api/uri/queryoption/SelectOption.java | 4 +-
.../api/uri/queryoption/SkipOption.java | 4 +-
.../api/uri/queryoption/SkipTokenOption.java | 26 -
.../api/uri/queryoption/SkiptokenOption.java | 26 +
.../api/uri/queryoption/SortOrderEnum.java | 20 -
.../uri/queryoption/SupportedQueryOptions.java | 45 +
.../api/uri/queryoption/SystemQueryOption.java | 2 +-
.../uri/queryoption/SystemQueryOptionEnum.java | 45 -
.../producer/api/uri/queryoption/TopOption.java | 4 +-
.../api/uri/queryoption/VisitableExpand.java | 48 -
.../expression/BinaryExpression.java | 2 +-
.../expression/ExceptionVisitExpression.java | 25 +
.../uri/queryoption/expression/Expression.java | 2 +-
.../expression/ExpressionVisitor.java | 52 +
.../uri/queryoption/expression/LambdaRef.java | 4 +-
.../api/uri/queryoption/expression/Literal.java | 4 +-
.../api/uri/queryoption/expression/Member.java | 6 +-
.../uri/queryoption/expression/MethodCall.java | 4 +-
.../expression/SupportedBinaryOperators.java | 17 +-
.../expression/SupportedMethodCalls.java | 26 +-
.../expression/SupportedUnaryOperators.java | 4 +-
.../uri/queryoption/expression/TypeLiteral.java | 6 +-
.../queryoption/expression/UnaryOperator.java | 6 +-
.../expression/VisitableExression.java | 47 +
.../uri/queryoption/search/SearchBinary.java | 1 +
.../api/uri/queryoption/search/SearchTerm.java | 2 +
.../api/uri/queryoption/search/SearchUnary.java | 2 +
.../search/SupportedSearchBinaryOperators.java | 12 +-
.../search/SupportedSearchUnaryOperators.java | 2 +-
.../odata4/producer/core/uri/antlr/UriParser.g4 | 8 +-
.../producer/core/uri/ErrorCollector.java | 78 +-
.../producer/core/uri/ExpandSegmentCount.java | 25 -
.../producer/core/uri/ExpandSegmentIt.java | 25 -
.../producer/core/uri/ExpandSegmentRef.java | 25 -
.../odata4/producer/core/uri/ParserAdapter.java | 5 +-
.../odata4/producer/core/uri/UriInfoImpl.java | 73 +-
.../producer/core/uri/UriParameterImpl.java | 8 +-
.../producer/core/uri/UriParseTreeVisitor.java | 1299 +++++++++---------
.../producer/core/uri/UriParserException.java | 8 +-
.../core/uri/UriParserSemanticException.java | 10 +-
.../core/uri/UriParserSyntaxException.java | 6 +-
.../core/uri/UriResourceActionImpl.java | 22 +-
.../producer/core/uri/UriResourceAllImpl.java | 15 +-
.../producer/core/uri/UriResourceAnyImpl.java | 15 +-
.../uri/UriResourceComplexPropertyImpl.java | 9 +-
.../producer/core/uri/UriResourceCountImpl.java | 5 +
.../core/uri/UriResourceEntitySetImpl.java | 20 +-
.../core/uri/UriResourceFunctionImpl.java | 29 +-
.../core/uri/UriResourceImplKeyPred.java | 9 +-
.../producer/core/uri/UriResourceImplTyped.java | 10 +-
.../producer/core/uri/UriResourceItImpl.java | 23 +-
.../core/uri/UriResourceLambdaRefImpl.java | 67 +
.../uri/UriResourceNavigationPropertyImpl.java | 23 +-
.../producer/core/uri/UriResourcePartImpl.java | 4 +-
.../core/uri/UriResourcePropertyImpl.java | 10 +-
.../producer/core/uri/UriResourceRefImpl.java | 8 +-
.../producer/core/uri/UriResourceRootImpl.java | 7 +-
.../core/uri/UriResourceSimplePropertyImpl.java | 18 +-
.../core/uri/UriResourceSingletonImpl.java | 26 +-
.../producer/core/uri/UriResourceValueImpl.java | 9 +-
.../core/uri/antlr/ParserException.java | 44 -
.../uri/queryoption/AliasQueryOptionImpl.java | 8 +-
.../uri/queryoption/CustomQueryOptionImpl.java | 1 -
.../core/uri/queryoption/ExpandItemImpl.java | 140 +-
.../core/uri/queryoption/ExpandOptionImpl.java | 20 +-
.../core/uri/queryoption/ExpandSegment.java | 55 -
.../core/uri/queryoption/FilterOptionImpl.java | 11 +-
.../core/uri/queryoption/FormatOptionImpl.java | 10 +-
.../core/uri/queryoption/IdOptionImpl.java | 16 +-
.../core/uri/queryoption/InlineCountImpl.java | 48 -
.../uri/queryoption/InlineCountOptionImpl.java | 46 +
.../uri/queryoption/LevelExpandOptionImpl.java | 58 +
.../core/uri/queryoption/LevelOption.java | 23 -
.../core/uri/queryoption/LevelOptionImpl.java | 54 -
.../core/uri/queryoption/OrderByImpl.java | 22 +-
.../core/uri/queryoption/OrderByOptionImpl.java | 11 +-
.../core/uri/queryoption/QueryOptionImpl.java | 8 +-
.../core/uri/queryoption/SearchOptionImpl.java | 7 +-
.../uri/queryoption/SelectItemOptionImpl.java | 170 +--
.../core/uri/queryoption/SelectOptionImpl.java | 8 +-
.../core/uri/queryoption/SelectSegmentImpl.java | 78 ++
.../core/uri/queryoption/SkipOptionImpl.java | 20 +-
.../uri/queryoption/SkipTokenOptionImpl.java | 52 -
.../uri/queryoption/SkiptokenOptionImpl.java | 44 +
.../uri/queryoption/SystemQueryOptionImpl.java | 17 +-
.../core/uri/queryoption/TopOptionImpl.java | 14 +-
.../uri/queryoption/expression/AliasImpl.java | 8 +-
.../uri/queryoption/expression/BinaryImpl.java | 17 +-
.../expression/ExceptionVisitExpression.java | 28 -
.../queryoption/expression/ExpressionImpl.java | 8 +-
.../expression/ExpressionVisitor.java | 40 -
.../queryoption/expression/LambdaRefImpl.java | 17 +-
.../uri/queryoption/expression/LiteralImpl.java | 8 +-
.../uri/queryoption/expression/MemberImpl.java | 23 +-
.../queryoption/expression/MethodCallImpl.java | 22 +-
.../queryoption/expression/TypeLiteralImpl.java | 14 +-
.../expression/UnaryOperatorImpl.java | 10 +-
.../expression/VisitableExression.java | 54 -
.../producer/core/testutil/EdmTechProvider.java | 18 +-
.../producer/core/testutil/ExpandToText.java | 68 -
.../producer/core/testutil/ExpandValidator.java | 180 +++
.../core/testutil/FilterTreeToText.java | 89 +-
.../producer/core/testutil/FilterValidator.java | 6 +-
.../core/testutil/UriResourceValidator.java | 77 +-
.../producer/core/testutil/UriValidator.java | 2 +-
.../core/uri/antlr/TestByAbapResourcePath.java | 841 ++++++++++--
.../core/uri/antlr/TestUriParserImpl.java | 2 +-
148 files changed, 2847 insertions(+), 2261 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/exception/ODataApplicationException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/exception/ODataApplicationException.java b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/exception/ODataApplicationException.java
new file mode 100644
index 0000000..fed8861
--- /dev/null
+++ b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/exception/ODataApplicationException.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.commons.api.exception;
+
+public class ODataApplicationException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public ODataApplicationException(final String msg) {
+ super(msg);
+ }
+
+ public ODataApplicationException(final String msg, final Throwable e) {
+ super(msg, e);
+ }
+
+ public ODataApplicationException(final Throwable e) {
+ super(e);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java
index 5a01c97..96e5172 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java
@@ -22,7 +22,7 @@ package org.apache.olingo.odata4.producer.api.uri;
public interface UriInfo extends
UriInfoService, UriInfoAll, UriInfoBatch, UriInfoCrossjoin,
UriInfoEntityId, UriInfoMetadata, UriInfoResource {
-
+
public UriInfoService asUriInfoService();
public UriInfoAll asUriInfoAll();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoAll.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoAll.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoAll.java
index aab9524..b2e236a 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoAll.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoAll.java
@@ -19,6 +19,6 @@
package org.apache.olingo.odata4.producer.api.uri;
-public interface UriInfoAll {
+public interface UriInfoAll {
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java
index accdffe..13b6673 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java
@@ -19,6 +19,6 @@
package org.apache.olingo.odata4.producer.api.uri;
-public interface UriInfoBatch {
+public interface UriInfoBatch {
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoEntityId.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoEntityId.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoEntityId.java
index 2afacb3..7a8a317 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoEntityId.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoEntityId.java
@@ -32,7 +32,7 @@ import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectOption;
* Indicates a URL access to an single Entity
*/
public interface UriInfoEntityId {
-
+
public List<CustomQueryOption> getCustomQueryOptions();
public EdmEntityType getEntityTypeCast();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoMetadata.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoMetadata.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoMetadata.java
index cf73412..ad46a2a 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoMetadata.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoMetadata.java
@@ -22,7 +22,9 @@ package org.apache.olingo.odata4.producer.api.uri;
import org.apache.olingo.odata4.producer.api.uri.queryoption.FormatOption;
public interface UriInfoMetadata {
+
public String getContext();
public FormatOption getFormatOption();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoResource.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoResource.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoResource.java
index 9be2b1c..aa9c0a8 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoResource.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoResource.java
@@ -30,7 +30,7 @@ import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SearchOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipTokenOption;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SkiptokenOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.TopOption;
public interface UriInfoResource {
@@ -55,7 +55,7 @@ public interface UriInfoResource {
SkipOption getSkipOption();
- SkipTokenOption getSkipTokenOption();
+ SkiptokenOption getSkipTokenOption();
TopOption getTopOption();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriParameter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriParameter.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriParameter.java
index c4deb50..7a47585 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriParameter.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriParameter.java
@@ -22,9 +22,12 @@ import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expressi
public interface UriParameter {
- public String getAlias();
- public String getText();
- public Expression getExression();
- public String getName();
+ public String getAlias();
+
+ public String getText();
+
+ public Expression getExression();
+
+ public String getName();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAction.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAction.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAction.java
index 321d143..b96d13e 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAction.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAction.java
@@ -26,7 +26,7 @@ public interface UriResourceAction extends UriResourcePartTyped {
EdmAction getAction();
/**
- * Convenience method which return the {@link EdmActionImport} which was used in
+ * Convenience method which returns the {@link EdmActionImport} which was used in
* the resource path to define the {@link EdmAction}.
* @return
*/
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAll.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAll.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAll.java
index 95c0e00..660a0a5 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAll.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAll.java
@@ -21,6 +21,9 @@ package org.apache.olingo.odata4.producer.api.uri;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
public interface UriResourceAll extends UriResourcePartTyped {
+
public String getLamdaVariable();
+
public Expression getExpression();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAny.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAny.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAny.java
index 2405cbf..25e9ce9 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAny.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAny.java
@@ -21,6 +21,9 @@ package org.apache.olingo.odata4.producer.api.uri;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
public interface UriResourceAny extends UriResourcePartTyped {
+
public String getLamdaVariable();
+
public Expression getExpression();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceComplexProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceComplexProperty.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceComplexProperty.java
index ce7d614..ffca624 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceComplexProperty.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceComplexProperty.java
@@ -21,6 +21,7 @@ package org.apache.olingo.odata4.producer.api.uri;
import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
public interface UriResourceComplexProperty extends UriResourceProperty {
+
EdmComplexType getComplexType();
EdmComplexType getComplexTypeFilter();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceCount.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceCount.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceCount.java
index d4be146..e120d27 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceCount.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceCount.java
@@ -18,7 +18,6 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri;
-
public interface UriResourceCount extends UriResourcePart {
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceEntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceEntitySet.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceEntitySet.java
index 349e45e..1b24170 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceEntitySet.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceEntitySet.java
@@ -26,7 +26,6 @@ import org.apache.olingo.odata4.commons.api.edm.EdmType;
public interface UriResourceEntitySet extends UriResourcePartTyped {
-
EdmEntitySet getEntitySet();
EdmEntityType getEntityType();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceFunction.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceFunction.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceFunction.java
index 45d2b31..8e4c6de 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceFunction.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceFunction.java
@@ -26,11 +26,10 @@ import org.apache.olingo.odata4.commons.api.edm.EdmType;
public interface UriResourceFunction extends UriResourcePartTyped {
-
EdmFunction getFunction();
/**
- * Convenience method which return the {@link EdmFunctionImport} which was used in
+ * Convenience method which returns the {@link EdmFunctionImport} which was used in
* the resource path to define the {@link EdmFunction}.
* @return
*/
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceIt.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceIt.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceIt.java
index cd86f1d..7812b71 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceIt.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceIt.java
@@ -22,11 +22,15 @@ import org.apache.olingo.odata4.commons.api.edm.EdmType;
/**
* Class indicating the $it reference. $it may be used within filter to
- * refer to the last EDM object reference in the resource path.
+ * refer to the last EDM object reference in the resource path. Since $it is
+ * optional in some cases ( e.g. first member expressions) the {@link #isExplicitIt()}
+ * method can be used to check if $it was explicitly noted in the URI
*/
public interface UriResourceIt extends UriResourcePartTyped {
-
+
EdmType getTypeFilterOnCollection();
+
EdmType getTypeFilterOnEntry();
- boolean isExplicitIt();
+
+ boolean isExplicitIt();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceKind.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceKind.java
index 3acf57e..aac5c41 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceKind.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceKind.java
@@ -20,7 +20,6 @@
package org.apache.olingo.odata4.producer.api.uri;
public enum UriResourceKind {
- action, entitySet, function, it, singleton, navigationProperty,
- simpleProperty, complexProperty, value, count, ref, root, lamdaAll, lamdaAny
-
+ action, complexProperty, count, entitySet, function, it, lambdaAll, lambdaAny,
+ lambdaVariable, navigationProperty, ref, root, simpleProperty, singleton, value,
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaRef.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaRef.java
new file mode 100644
index 0000000..dddf34c
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaRef.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.api.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+
+/**
+ * Class indicating the $it reference. $it may be used within filter to
+ * refer to the last EDM object reference in the resource path. Since $it is
+ * optional in some cases ( e.g. first member expressions) the {@link #isExplicitIt()}
+ * method can be used to check if $it was explicitly noted in the URI
+ */
+public interface UriResourceLambdaRef extends UriResourcePartTyped {
+
+ public String getVariableText();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceNavigation.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceNavigation.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceNavigation.java
index de80fd9..9fd3c86 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceNavigation.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceNavigation.java
@@ -24,10 +24,13 @@ import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
public interface UriResourceNavigation extends UriResourcePartTyped {
-
+
List<UriParameter> getKeyPredicates();
+
EdmNavigationProperty getNavigationProperty();
-
+
EdmType getTypeFilterOnCollection();
+
EdmType getTypeFilterOnEntry();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePart.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePart.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePart.java
index 0a3312a..20b1010 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePart.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePart.java
@@ -18,7 +18,11 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri;
-
public interface UriResourcePart {
+
UriResourceKind getKind();
+
+ @Override
+ String toString();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePartTyped.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePartTyped.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePartTyped.java
index a44093d..54771e9 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePartTyped.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePartTyped.java
@@ -22,7 +22,9 @@ package org.apache.olingo.odata4.producer.api.uri;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
public interface UriResourcePartTyped extends UriResourcePart {
+
EdmType getType();
boolean isCollection();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceProperty.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceProperty.java
index 04cbbf1..5ff0fca 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceProperty.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceProperty.java
@@ -21,5 +21,7 @@ package org.apache.olingo.odata4.producer.api.uri;
import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
public interface UriResourceProperty extends UriResourcePartTyped {
+
EdmProperty getProperty();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRef.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRef.java
index bb80032..8104a36 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRef.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRef.java
@@ -18,7 +18,6 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri;
-
public interface UriResourceRef extends UriResourcePart {
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSimpleProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSimpleProperty.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSimpleProperty.java
index 8730e05..bfb3868 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSimpleProperty.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSimpleProperty.java
@@ -18,7 +18,6 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri;
+public interface UriResourceSimpleProperty extends UriResourceProperty {
-public interface UriResourceSimpleProperty extends UriResourceProperty{
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java
index 2e0232b..2f888db 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java
@@ -18,15 +18,15 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri;
-import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
public interface UriResourceSingleton extends UriResourcePartTyped {
-
EdmSingleton getSingleton();
+
EdmEntityType getEntityType();
+
EdmEntityType getEntityTypeFilter();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceValue.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceValue.java
index d5c8734..ea1a15a 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceValue.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceValue.java
@@ -18,7 +18,6 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri;
-
public interface UriResourceValue extends UriResourcePart {
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/AliasQueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/AliasQueryOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/AliasQueryOption.java
index d9fc828..1b98aba 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/AliasQueryOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/AliasQueryOption.java
@@ -21,6 +21,7 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
public interface AliasQueryOption extends QueryOption {
- public Expression getAliasValue();
+ public Expression getAliasValue();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExceptionVisitExpand.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExceptionVisitExpand.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExceptionVisitExpand.java
index 433f5f0..4e9f332 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExceptionVisitExpand.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExceptionVisitExpand.java
@@ -20,9 +20,6 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption;
public class ExceptionVisitExpand extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 822365726050299076L;
+ private static final long serialVersionUID = 1L;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandItem.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandItem.java
index 55d6b80..b22464f 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandItem.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandItem.java
@@ -18,14 +18,9 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri.queryoption;
-import java.util.List;
-
-import org.apache.olingo.odata4.producer.api.uri.UriResourceProperty;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
public interface ExpandItem {
- boolean isStar();
-
- List<UriResourceProperty> getPropertyChainList();
LevelExpandOption getLevel();
@@ -44,4 +39,11 @@ public interface ExpandItem {
SelectOption getSelect();
ExpandOption getExpand();
+
+ UriInfoResource getPath();
+
+ boolean isStar();
+
+ boolean isRef();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandOption.java
index 5ccefd8..ccfb394 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandOption.java
@@ -21,5 +21,7 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption;
import java.util.List;
public interface ExpandOption extends SystemQueryOption {
+
List<ExpandItem> getExpandItems();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandVisitor.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandVisitor.java
deleted file mode 100644
index fdd72d7..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandVisitor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.api.uri.queryoption;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmElement;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-
-public interface ExpandVisitor<T> {
-
- T visitExpandSegment(EdmElement property, EdmType initialType, EdmType finalType);
-
- T visitExpandItem(List<T> expandSegments, boolean isStar, boolean isRef, EdmType finalType);
-
- T visitExpand(List<T> expandItems);
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FilterOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FilterOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FilterOption.java
index b632742..98b260b 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FilterOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FilterOption.java
@@ -21,5 +21,6 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
public interface FilterOption extends SystemQueryOption {
+
Expression getExpression();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FormatOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FormatOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FormatOption.java
index e6d24b9..2d490ee 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FormatOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FormatOption.java
@@ -19,6 +19,7 @@
package org.apache.olingo.odata4.producer.api.uri.queryoption;
public interface FormatOption extends SystemQueryOption {
- // TODO select best representation for format
+
+ // TODO Select best representation for format
Object getFormat();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/IdOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/IdOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/IdOption.java
index f9fa254..4024ea8 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/IdOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/IdOption.java
@@ -19,5 +19,7 @@
package org.apache.olingo.odata4.producer.api.uri.queryoption;
public interface IdOption extends SystemQueryOption {
+
String getIdValue();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/InlineCountOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/InlineCountOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/InlineCountOption.java
index 032a086..cf08cfc 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/InlineCountOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/InlineCountOption.java
@@ -19,5 +19,7 @@
package org.apache.olingo.odata4.producer.api.uri.queryoption;
public interface InlineCountOption extends SystemQueryOption {
- boolean getInlineCountValue();
+
+ boolean getvalue();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/LevelExpandOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/LevelExpandOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/LevelExpandOption.java
index 450fd77..ae56925 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/LevelExpandOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/LevelExpandOption.java
@@ -22,6 +22,6 @@ public interface LevelExpandOption {
boolean isMax();
- String getLevel();
+ int getLevel();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByItem.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByItem.java
index 7b18473..d5aae45 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByItem.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByItem.java
@@ -28,7 +28,7 @@ public interface OrderByItem {
* @return if false (default) the sort order is ascending, if true the sort order is descending
*/
boolean isDescending();
-
+
Expression getExpression();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByOption.java
index 717fac4..609306f 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByOption.java
@@ -21,7 +21,7 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption;
import java.util.List;
public interface OrderByOption extends SystemQueryOption {
-
+
List<OrderByItem> getOrders();
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/QueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/QueryOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/QueryOption.java
index 01d8f66..e1e70d4 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/QueryOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/QueryOption.java
@@ -23,4 +23,5 @@ public interface QueryOption {
public String getName();
public String getText();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SearchOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SearchOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SearchOption.java
index 903b8c6..a3b2e5b 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SearchOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SearchOption.java
@@ -21,6 +21,7 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.search.SearchExpression;
public interface SearchOption extends SystemQueryOption {
-
+
SearchExpression getSearchExpression();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java
index 20407da..1a03d31 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java
@@ -35,9 +35,6 @@ public interface SelectItem {
EdmEntityType getEntityTypeCast();
- EdmAction getAction();
-
- EdmFunction getFunction();
-
List<UriResourceProperty> getPropertyChainList();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectOption.java
index 11b5edf..7b301fa 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectOption.java
@@ -21,7 +21,7 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption;
import java.util.List;
public interface SelectOption extends SystemQueryOption {
-
+
List<SelectItem> getSelectItems();
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipOption.java
index f9fc91c..e9a64e3 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipOption.java
@@ -20,6 +20,6 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption;
public interface SkipOption extends SystemQueryOption {
- String getSkipValue();
-
+ String getValue();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipTokenOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipTokenOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipTokenOption.java
deleted file mode 100644
index 995fcbc..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipTokenOption.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.api.uri.queryoption;
-
-public interface SkipTokenOption extends SystemQueryOption{
-
- String getSkipTokenValue();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkiptokenOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkiptokenOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkiptokenOption.java
new file mode 100644
index 0000000..8d8259f
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkiptokenOption.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.api.uri.queryoption;
+
+public interface SkiptokenOption extends SystemQueryOption {
+
+ String getValue();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SortOrderEnum.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SortOrderEnum.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SortOrderEnum.java
deleted file mode 100644
index a38fc8c..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SortOrderEnum.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.api.uri.queryoption;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SupportedQueryOptions.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SupportedQueryOptions.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SupportedQueryOptions.java
new file mode 100644
index 0000000..6954818
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SupportedQueryOptions.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.api.uri.queryoption;
+
+public enum SupportedQueryOptions {
+ FILTER("$filter"),
+ FORMAT("$format"),
+ EXPAND("$expand"),
+ ID("$id"),
+ INLINECOUNT("$inlinecount"),
+ ORDERBY("$orderby"),
+ SEARCH("$search"),
+ SELECT("$select"),
+ SKIP("$skip"),
+ SKIPTOKEN("$skiptoken"),
+ TOP("$top"),
+ LEVEL("$level");
+
+ String syntax;
+
+ private SupportedQueryOptions(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOption.java
index a6b3677..8abafbd 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOption.java
@@ -20,6 +20,6 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption;
public interface SystemQueryOption extends QueryOption {
- SystemQueryOptionEnum getKind();
+ SupportedQueryOptions getKind();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOptionEnum.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOptionEnum.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOptionEnum.java
deleted file mode 100644
index 5ab11dd..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOptionEnum.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.api.uri.queryoption;
-
-public enum SystemQueryOptionEnum {
- FILTER("$filter"),
- FORMAT("$format"),
- EXPAND("$expand"),
- ID("$id"),
- INLINECOUNT("$inlinecount"),
- ORDERBY("$orderby"),
- SEARCH("$search"),
- SELECT("$select"),
- SKIP("$skip"),
- SKIPTOKEN("$skiptoken"),
- TOP("$top"),
- LEVEL("$level");
-
- String syntax;
-
- private SystemQueryOptionEnum(final String syntax) {
- this.syntax = syntax;
- }
-
- @Override
- public String toString() {
- return syntax;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/TopOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/TopOption.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/TopOption.java
index a972929..31d67f1 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/TopOption.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/TopOption.java
@@ -18,6 +18,8 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri.queryoption;
-public interface TopOption extends SystemQueryOption{
+public interface TopOption extends SystemQueryOption {
+
String getTopValue();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/VisitableExpand.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/VisitableExpand.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/VisitableExpand.java
deleted file mode 100644
index ebfa4a4..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/VisitableExpand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.api.uri.queryoption;
-
-
-/* TODO update documentation*/
-public interface VisitableExpand {
-
- /**
- * Method {@link #accept(ExpressionVisitor)} is called when traversing the expression tree. This method is invoked on
- * each
- * expression used as node in an expression tree. The implementations should
- * behave as follows:
- * <li>Call accept on all sub nodes and store the returned Objects
- * <li>Call the appropriate method on the {@link ExpressionVisitor} instance and provide the stored objects to that
- * instance
- * <li>Return the object which should be passed to the processing algorithm of the parent expression node
- * <br>
- * <br>
- * @param visitor
- * Object ( implementing {@link ExpressionVisitor}) whose methods are called during traversing a expression node of
- * the expression tree.
- * @return
- * Object which should be passed to the processing algorithm of the parent expression node
- * @throws ExceptionVisitExpression
- * Exception occurred the OData library while traversing the tree
- * @throws ODataApplicationException
- * Exception thrown by the application who implemented the visitor
- */
- <T> T accept(ExpandVisitor<T> visitor) throws ExceptionVisitExpand;
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/BinaryExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/BinaryExpression.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/BinaryExpression.java
index 4d417b0..bd4d159 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/BinaryExpression.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/BinaryExpression.java
@@ -18,7 +18,7 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
-public interface BinaryExpression {
+public interface BinaryExpression extends Expression {
public SupportedBinaryOperators getOperator();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExceptionVisitExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExceptionVisitExpression.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExceptionVisitExpression.java
new file mode 100644
index 0000000..f722ec0
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExceptionVisitExpression.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
+
+public class ExceptionVisitExpression extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Expression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Expression.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Expression.java
index cbea81d..5a1b8b1 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Expression.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Expression.java
@@ -18,6 +18,6 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
-public interface Expression {
+public interface Expression extends VisitableExression {
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExpressionVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExpressionVisitor.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExpressionVisitor.java
new file mode 100644
index 0000000..ce74805
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExpressionVisitor.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
+
+public interface ExpressionVisitor<T> {
+
+ T visitBinaryOperator(SupportedBinaryOperators operator, T left, T right)
+ throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitUnaryOperator(SupportedUnaryOperators operator, T operand)
+ throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitMethodCall(SupportedMethodCalls methodCall, List<T> parameters)
+ throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitLambdaExpression(String variableText, Expression expression)
+ throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitLiteral(String literal) throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitMember(UriInfoResource member) throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitAlias(String referenceName) throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitTypeLiteral(EdmType type) throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitLambdaReference(String variableText) throws ExceptionVisitExpression, ODataApplicationException;
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/LambdaRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/LambdaRef.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/LambdaRef.java
index 8a9a966..67a18b6 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/LambdaRef.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/LambdaRef.java
@@ -18,8 +18,8 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
-public interface LambdaRef {
+public interface LambdaRef extends Expression {
- public String getVariableText();
+ public String getVariableName();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Literal.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Literal.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Literal.java
index 75dc753..1d9a76c 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Literal.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Literal.java
@@ -18,8 +18,8 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
-public interface Literal {
+public interface Literal extends Expression {
- public String getText();
+ public String getText();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Member.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Member.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Member.java
index be26858..2af920e 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Member.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Member.java
@@ -20,10 +20,8 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-public interface Member {
+public interface Member extends Expression {
- public boolean isIT();
-
- public UriInfoResource getPath();
+ public UriInfoResource getPath();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/MethodCall.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/MethodCall.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/MethodCall.java
index be82a21..31dfe9b 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/MethodCall.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/MethodCall.java
@@ -20,12 +20,10 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
import java.util.List;
-public interface MethodCall {
+public interface MethodCall extends Expression {
public SupportedMethodCalls getMethod();
public List<Expression> getParameters();
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java
index ce85956..c686362 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java
@@ -19,17 +19,17 @@
package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
public enum SupportedBinaryOperators {
- //multiplicative
+ // multiplicative
MUL("mul"), DIV("div"), MOD("mod"),
- //additive
+ // additive
ADD("add"), SUB("sub"),
- //comparism
+ // comparism
GT("gt"), GE("ge"), LT("lt"), LE("le"),
- //isof
+ // isof
ISOF("isof"),
- //equality
+ // equality
EQ("eq"), NE("ne"),
- //and/or
+ // and/or
AND("and"), OR("or");
private String syntax;
@@ -38,7 +38,7 @@ public enum SupportedBinaryOperators {
this.syntax = syntax;
}
- public static SupportedBinaryOperators get(String operator) {
+ public static SupportedBinaryOperators get(final String operator) {
for (SupportedBinaryOperators op : SupportedBinaryOperators.values()) {
if (op.toString().equals(operator)) {
return op;
@@ -46,11 +46,10 @@ public enum SupportedBinaryOperators {
}
return null;
}
-
+
@Override
public String toString() {
return syntax;
}
-
}
[3/6] [OLINGO-63] Uri Parser: Add test cases for key predicates,
select, expand and code cleanup
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java
index 530b24f..687bb42 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java
@@ -24,16 +24,14 @@ public class UriParserSemanticException extends UriParserException {
/**
*
*/
- private static final long serialVersionUID = -1813203179082217112L;
-
- public UriParserSemanticException(String message, Throwable cause) {
+ private static final long serialVersionUID = 1L;
+
+ public UriParserSemanticException(final String message, final Throwable cause) {
super(message, cause);
}
- public UriParserSemanticException(String message) {
+ public UriParserSemanticException(final String message) {
super(message, null);
}
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java
index d3f9dcf..16ab8f0 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java
@@ -23,13 +23,13 @@ public class UriParserSyntaxException extends UriParserException {
/**
*
*/
- private static final long serialVersionUID = -975557346686301719L;
+ private static final long serialVersionUID = 1L;
- public UriParserSyntaxException(String message, Throwable cause) {
+ public UriParserSyntaxException(final String message, final Throwable cause) {
super(message, cause);
}
- public UriParserSyntaxException(String message) {
+ public UriParserSyntaxException(final String message) {
super(message, null);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java
index d714969..5b418ef 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java
@@ -38,7 +38,7 @@ public class UriResourceActionImpl extends UriResourceImplTyped implements UriRe
return action;
}
- public UriResourceActionImpl setAction(EdmAction action) {
+ public UriResourceActionImpl setAction(final EdmAction action) {
this.action = action;
return this;
}
@@ -48,20 +48,15 @@ public class UriResourceActionImpl extends UriResourceImplTyped implements UriRe
return actionImport;
}
- public UriResourceActionImpl setActionImport(EdmActionImport actionImport) {
+ public UriResourceActionImpl setActionImport(final EdmActionImport actionImport) {
this.actionImport = actionImport;
- this.setAction(actionImport.getAction());
+ setAction(actionImport.getAction());
return this;
}
@Override
- public String toString() {
- return action.getName() + super.toString();
- }
-
- @Override
public boolean isCollection() {
- if ( action != null) {
+ if (action != null) {
return action.getReturnType().isCollection();
}
return false;
@@ -72,4 +67,13 @@ public class UriResourceActionImpl extends UriResourceImplTyped implements UriRe
return action.getReturnType().getType();
}
+ @Override
+ public String toString() {
+ if (actionImport != null) {
+ return actionImport.getName();
+ } else if (action != null) {
+ return action.getName();
+ }
+ return "";
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAllImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAllImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAllImpl.java
index 6bc480d..0bd66f7 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAllImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAllImpl.java
@@ -32,7 +32,7 @@ public class UriResourceAllImpl extends UriResourceImplTyped implements UriResou
private ExpressionImpl expression;
public UriResourceAllImpl() {
- super(UriResourceKind.lamdaAll);
+ super(UriResourceKind.lambdaAll);
}
@Override
@@ -49,8 +49,8 @@ public class UriResourceAllImpl extends UriResourceImplTyped implements UriResou
public String getLamdaVariable() {
return lamdaVariable;
}
-
- public UriResourceAllImpl setLamdaVariable(String lamdaVariable) {
+
+ public UriResourceAllImpl setLamdaVariable(final String lamdaVariable) {
this.lamdaVariable = lamdaVariable;
return this;
};
@@ -59,9 +59,14 @@ public class UriResourceAllImpl extends UriResourceImplTyped implements UriResou
public Expression getExpression() {
return expression;
}
-
- public UriResourceAllImpl setExpression(ExpressionImpl expression) {
+
+ public UriResourceAllImpl setExpression(final ExpressionImpl expression) {
this.expression = expression;
return this;
};
+
+ @Override
+ public String toString() {
+ return "all";
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAnyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAnyImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAnyImpl.java
index eb1ce68..ba4f4f8 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAnyImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAnyImpl.java
@@ -32,7 +32,7 @@ public class UriResourceAnyImpl extends UriResourceImplTyped implements UriResou
private ExpressionImpl expression;
public UriResourceAnyImpl() {
- super(UriResourceKind.lamdaAny);
+ super(UriResourceKind.lambdaAny);
}
@Override
@@ -49,8 +49,8 @@ public class UriResourceAnyImpl extends UriResourceImplTyped implements UriResou
public String getLamdaVariable() {
return lamdaVariable;
}
-
- public UriResourceAnyImpl setLamdaVariable(String lamdaVariable) {
+
+ public UriResourceAnyImpl setLamdaVariable(final String lamdaVariable) {
this.lamdaVariable = lamdaVariable;
return this;
};
@@ -59,9 +59,14 @@ public class UriResourceAnyImpl extends UriResourceImplTyped implements UriResou
public Expression getExpression() {
return expression;
}
-
- public UriResourceAnyImpl setExpression(ExpressionImpl expression) {
+
+ public UriResourceAnyImpl setExpression(final ExpressionImpl expression) {
this.expression = expression;
return this;
+ }
+
+ @Override
+ public String toString() {
+ return "any";
};
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java
index 9ce1afa..0ef7ce3 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java
@@ -37,14 +37,14 @@ public class UriResourceComplexPropertyImpl extends UriResourceImplTyped impleme
return property;
}
- public UriResourceComplexPropertyImpl setProperty(EdmProperty property) {
+ public UriResourceComplexPropertyImpl setProperty(final EdmProperty property) {
this.property = property;
return this;
}
@Override
public EdmComplexType getComplexType() {
- return (EdmComplexType) this.getType();
+ return (EdmComplexType) getType();
}
@Override
@@ -62,4 +62,9 @@ public class UriResourceComplexPropertyImpl extends UriResourceImplTyped impleme
return property.isCollection();
}
+ @Override
+ public String toString() {
+ return property.getName();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java
index f276d76..23164ab 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java
@@ -27,4 +27,9 @@ public class UriResourceCountImpl extends UriResourcePartImpl implements UriReso
super(UriResourceKind.count);
}
+ @Override
+ public String toString() {
+ return "$count";
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java
index e997063..523901e 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java
@@ -37,28 +37,19 @@ public class UriResourceEntitySetImpl extends UriResourceImplKeyPred implements
return edmEntitySet;
}
- public UriResourceEntitySetImpl setEntitSet(EdmEntitySet edmES) {
- this.edmEntitySet = edmES;
+ public UriResourceEntitySetImpl setEntitSet(final EdmEntitySet edmES) {
+ edmEntitySet = edmES;
return this;
}
@Override
- public String toString() {
- return edmEntitySet.getName() + super.toString();
- }
-
- @Override
public EdmEntityType getEntityType() {
return edmEntitySet.getEntityType();
}
@Override
public EdmType getType() {
- /*if (singleTypeFilter != null) {
- return singleTypeFilter;
- } else if (collectionTypeFilter != null) {
- return collectionTypeFilter;
- }*/
+
return edmEntitySet.getEntityType();
}
@@ -71,4 +62,9 @@ public class UriResourceEntitySetImpl extends UriResourceImplKeyPred implements
return false;
}
+ @Override
+ public String toString() {
+ return edmEntitySet.getName();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java
index 0042f9c..9769a2c 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java
@@ -50,7 +50,7 @@ public class UriResourceFunctionImpl extends UriResourceImplKeyPred implements U
return retList;
}
- public UriResourceFunctionImpl setParameters(List<UriParameterImpl> parameters) {
+ public UriResourceFunctionImpl setParameters(final List<UriParameterImpl> parameters) {
this.parameters = parameters;
return this;
}
@@ -60,7 +60,7 @@ public class UriResourceFunctionImpl extends UriResourceImplKeyPred implements U
return function;
}
- public UriResourceFunctionImpl setFunction(EdmFunction function) {
+ public UriResourceFunctionImpl setFunction(final EdmFunction function) {
this.function = function;
return this;
}
@@ -70,8 +70,9 @@ public class UriResourceFunctionImpl extends UriResourceImplKeyPred implements U
return functionImport;
}
- public UriResourceFunctionImpl setFunctionImport(EdmFunctionImport edmFI, List<UriParameterImpl> parameters) {
- this.functionImport = edmFI;
+ public UriResourceFunctionImpl setFunctionImport(final EdmFunctionImport edmFI,
+ final List<UriParameterImpl> parameters) {
+ functionImport = edmFI;
this.parameters = parameters;
List<String> names = new ArrayList<String>();
@@ -85,26 +86,28 @@ public class UriResourceFunctionImpl extends UriResourceImplKeyPred implements U
}
@Override
- public String toString() {
- return function.getName() + super.toString();
- }
-
- @Override
public EdmType getType() {
return function.getReturnType().getType();
-
+
}
@Override
public boolean isCollection() {
- if (keyPredicates != null ) {
+ if (keyPredicates != null) {
return false;
}
return function.getReturnType().isCollection();
}
-
+ @Override
+ public String toString() {
+ if (functionImport != null) {
+ return functionImport.getName();
+ } else if (function != null) {
+ return function.getName();
+ }
+ return "";
+ }
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java
index ab6d748..6af51d9 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java
@@ -31,7 +31,7 @@ public abstract class UriResourceImplKeyPred extends UriResourceImplTyped {
protected List<UriParameterImpl> keyPredicates = null;
protected EdmType singleTypeFilter = null;
- public UriResourceImplKeyPred(UriResourceKind kind) {
+ public UriResourceImplKeyPred(final UriResourceKind kind) {
super(kind);
}
@@ -58,18 +58,17 @@ public abstract class UriResourceImplKeyPred extends UriResourceImplTyped {
return retList;
}
- public UriResourceImplKeyPred setKeyPredicates(List<UriParameterImpl> list) {
+ public UriResourceImplKeyPred setKeyPredicates(final List<UriParameterImpl> list) {
keyPredicates = list;
return this;
}
- public void setSingleTypeFilter(EdmType singleTypeFilter) {
+ public void setSingleTypeFilter(final EdmType singleTypeFilter) {
this.singleTypeFilter = singleTypeFilter;
}
- public void setCollectionTypeFilter(EdmType collectionTypeFilter) {
+ public void setCollectionTypeFilter(final EdmType collectionTypeFilter) {
this.collectionTypeFilter = collectionTypeFilter;
}
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java
index 0b5aca4..4a1e3ef 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java
@@ -26,16 +26,16 @@ import org.apache.olingo.odata4.producer.api.uri.UriResourcePartTyped;
public abstract class UriResourceImplTyped extends UriResourcePartImpl implements UriResourcePartTyped {
protected EdmType typeFilter = null;
-
- public UriResourceImplTyped(UriResourceKind kind) {
+
+ public UriResourceImplTyped(final UriResourceKind kind) {
super(kind);
}
- public EdmType getTypeFilter() {//TODO rename to TypeFilter
+ public EdmType getTypeFilter() {
return typeFilter;
}
-
- public UriResourceImplTyped setTypeFilter(EdmStructuralType typeFilter) {
+
+ public UriResourceImplTyped setTypeFilter(final EdmStructuralType typeFilter) {
this.typeFilter = typeFilter;
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java
index 3297660..c4de8cc 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java
@@ -31,21 +31,11 @@ public class UriResourceItImpl extends UriResourceImplKeyPred implements UriReso
private EdmType type;
private boolean isCollection;
-
public UriResourceItImpl() {
super(UriResourceKind.it);
}
- @Override
- public String toString() {
-
- if (explicitIT) {
- return "$it" + super.toString();
- }
- return super.toString();
- }
-
- public UriResourceItImpl setIsExplicitIT(boolean explicitIT) {
+ public UriResourceItImpl setIsExplicitIT(final boolean explicitIT) {
this.explicitIT = explicitIT;
return this;
}
@@ -62,22 +52,25 @@ public class UriResourceItImpl extends UriResourceImplKeyPred implements UriReso
@Override
public boolean isCollection() {
- if (keyPredicates != null ) {
+ if (keyPredicates != null) {
return false;
}
return isCollection;
}
- public UriResourceItImpl setType(EdmType type) {
+ public UriResourceItImpl setType(final EdmType type) {
this.type = type;
return this;
}
- public UriResourceItImpl setCollection(boolean isCollection) {
+ public UriResourceItImpl setCollection(final boolean isCollection) {
this.isCollection = isCollection;
return this;
}
-
+ @Override
+ public String toString() {
+ return "$it";
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaRefImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaRefImpl.java
new file mode 100644
index 0000000..4b0d4f3
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaRefImpl.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceIt;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceLambdaRef;
+
+public class UriResourceLambdaRefImpl extends UriResourceImplTyped implements UriResourceLambdaRef {
+
+ private EdmType type;
+ private boolean isCollection;
+ private String variableText;
+
+ public UriResourceLambdaRefImpl() {
+ super(UriResourceKind.lambdaVariable);
+ }
+
+ @Override
+ public String getVariableText() {
+ return variableText;
+ }
+
+ public UriResourceLambdaRefImpl setVariableText(String variableText) {
+ this.variableText = variableText;
+ return this;
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ public UriResourceLambdaRefImpl setType(EdmType type) {
+ this.type = type;
+ return this;
+
+ }
+
+ @Override
+ public boolean isCollection() {
+ return isCollection;
+ }
+
+ public UriResourceLambdaRefImpl isCollection(boolean isCollection) {
+ this.isCollection = isCollection;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java
index 9da82c2..c55a679 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java
@@ -32,41 +32,32 @@ public class UriResourceNavigationPropertyImpl extends UriResourceImplKeyPred im
}
@Override
- public String toString() {
- return navigationProperty.getName() + super.toString();
- }
-
- @Override
public EdmNavigationProperty getNavigationProperty() {
return navigationProperty;
}
- public UriResourceNavigationPropertyImpl addNavigationProperty(EdmNavigationProperty property) {
- this.navigationProperty = property;
+ public UriResourceNavigationPropertyImpl setNavigationProperty(final EdmNavigationProperty property) {
+ navigationProperty = property;
return this;
}
@Override
public EdmType getType() {
- /*if (singleTypeFilter != null) {
- return singleTypeFilter;
- } else if (collectionTypeFilter != null) {
- return collectionTypeFilter;
- }*/
return navigationProperty.getType();
}
@Override
public boolean isCollection() {
- if (keyPredicates != null ) {
+ if (keyPredicates != null) {
return false;
}
return navigationProperty.isCollection();
-
-
}
-
+ @Override
+ public String toString() {
+ return navigationProperty.getName();
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePartImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePartImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePartImpl.java
index 0a2e66f..deaba06 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePartImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePartImpl.java
@@ -24,10 +24,10 @@ import org.apache.olingo.odata4.producer.api.uri.UriResourcePart;
/**
* Covers Functionimports and BoundFunction in URI
*/
-public class UriResourcePartImpl implements UriResourcePart {
+public abstract class UriResourcePartImpl implements UriResourcePart {
protected UriResourceKind kind;
- public UriResourcePartImpl(UriResourceKind kind) {
+ public UriResourcePartImpl(final UriResourceKind kind) {
this.kind = kind;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePropertyImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePropertyImpl.java
index 8ba9037..11bb0ef 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePropertyImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePropertyImpl.java
@@ -26,7 +26,7 @@ import org.apache.olingo.odata4.producer.api.uri.UriResourceSimpleProperty;
public class UriResourcePropertyImpl extends UriResourceImplTyped implements UriResourceSimpleProperty {
protected EdmProperty property;
- public UriResourcePropertyImpl(UriResourceKind kind) {
+ public UriResourcePropertyImpl(final UriResourceKind kind) {
super(kind);
}
@@ -35,7 +35,7 @@ public class UriResourcePropertyImpl extends UriResourceImplTyped implements Uri
return property;
}
- public UriResourcePropertyImpl setProperty(EdmProperty property) {
+ public UriResourcePropertyImpl setProperty(final EdmProperty property) {
this.property = property;
return this;
}
@@ -48,7 +48,11 @@ public class UriResourcePropertyImpl extends UriResourceImplTyped implements Uri
@Override
public boolean isCollection() {
return property.isCollection();
-
+ }
+
+ @Override
+ public String toString() {
+ return property.getName();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRefImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRefImpl.java
index 690034e..0ff23e3 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRefImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRefImpl.java
@@ -18,9 +18,9 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri;
-
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
import org.apache.olingo.odata4.producer.api.uri.UriResourceRef;
+
public class UriResourceRefImpl extends UriResourcePartImpl implements UriResourceRef {
public UriResourceRefImpl() {
@@ -28,7 +28,9 @@ public class UriResourceRefImpl extends UriResourcePartImpl implements UriResour
}
-
-
+ @Override
+ public String toString() {
+ return "$ref";
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRootImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRootImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRootImpl.java
index bf2c3fb..f6c3d79 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRootImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRootImpl.java
@@ -21,12 +21,15 @@ package org.apache.olingo.odata4.producer.core.uri;
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
import org.apache.olingo.odata4.producer.api.uri.UriResourceRoot;
-public class UriResourceRootImpl extends UriResourcePartImpl implements UriResourceRoot {
+public class UriResourceRootImpl extends UriResourcePartImpl implements UriResourceRoot {
public UriResourceRootImpl() {
super(UriResourceKind.root);
}
-
+ @Override
+ public String toString() {
+ return "$root";
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSimplePropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSimplePropertyImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSimplePropertyImpl.java
index e16a73c..4a66afc 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSimplePropertyImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSimplePropertyImpl.java
@@ -18,7 +18,6 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri;
-
import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
@@ -27,20 +26,18 @@ import org.apache.olingo.odata4.producer.api.uri.UriResourceSimpleProperty;
public class UriResourceSimplePropertyImpl extends UriResourceImplTyped implements UriResourceSimpleProperty {
EdmProperty property;
-
+
public UriResourceSimplePropertyImpl() {
super(UriResourceKind.simpleProperty);
}
-
-
@Override
public EdmProperty getProperty() {
return property;
}
-
- public UriResourceSimplePropertyImpl setProperty( EdmProperty property) {
- this.property = property;
+
+ public UriResourceSimplePropertyImpl setProperty(final EdmProperty property) {
+ this.property = property;
return this;
}
@@ -53,7 +50,10 @@ public class UriResourceSimplePropertyImpl extends UriResourceImplTyped implemen
public boolean isCollection() {
return property.isCollection();
}
-
-
+
+ @Override
+ public String toString() {
+ return property.getName();
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java
index bee3fb0..5bec6fb 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java
@@ -31,34 +31,28 @@ public class UriResourceSingletonImpl extends UriResourceImplTyped implements Ur
public UriResourceSingletonImpl() {
super(UriResourceKind.singleton);
}
-
@Override
public EdmSingleton getSingleton() {
return singleton;
}
-
- public UriResourceSingletonImpl setSingleton(EdmSingleton singleton) {
+
+ public UriResourceSingletonImpl setSingleton(final EdmSingleton singleton) {
this.singleton = singleton;
return this;
}
-
+
@Override
public EdmEntityType getEntityTypeFilter() {
return (EdmEntityType) typeFilter;
}
@Override
- public String toString() {
- return singleton.getName() + super.toString();
- }
-
- @Override
public EdmType getType() {
return singleton.getEntityType();
}
-
+
@Override
public EdmEntityType getEntityType() {
return singleton.getEntityType();
@@ -69,13 +63,9 @@ public class UriResourceSingletonImpl extends UriResourceImplTyped implements Ur
return false;
}
-
-
-
-
-
-
-
-
+ @Override
+ public String toString() {
+ return singleton.toString();
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceValueImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceValueImpl.java
index ceae82a..1dd82b6 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceValueImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceValueImpl.java
@@ -18,10 +18,9 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri;
-
-
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
import org.apache.olingo.odata4.producer.api.uri.UriResourceValue;
+
public class UriResourceValueImpl extends UriResourcePartImpl implements UriResourceValue {
public UriResourceValueImpl() {
@@ -29,7 +28,9 @@ public class UriResourceValueImpl extends UriResourcePartImpl implements UriReso
}
-
-
+ @Override
+ public String toString() {
+ return "$value";
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/antlr/ParserException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/antlr/ParserException.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/antlr/ParserException.java
deleted file mode 100644
index aeca706..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/antlr/ParserException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri.antlr;
-
-public class ParserException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public ParserException() {
- super();
- }
-
- public ParserException(final String msg) {
- super(msg);
- }
-
- public ParserException(final String msg, final Throwable e) {
- super(msg, e);
- }
-
- public ParserException(final Throwable e) {
- super(e);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java
index 2e0a9e1..d5ed1ec 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java
@@ -22,7 +22,7 @@ import org.apache.olingo.odata4.producer.api.uri.queryoption.AliasQueryOption;
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
public class AliasQueryOptionImpl extends QueryOptionImpl implements AliasQueryOption {
- // TODO change value of alias to a interface which need to be defined
+
private ExpressionImpl aliasValue;
@Override
@@ -30,13 +30,9 @@ public class AliasQueryOptionImpl extends QueryOptionImpl implements AliasQueryO
return aliasValue;
}
-
-
- public AliasQueryOptionImpl setAliasValue(ExpressionImpl aliasValue) {
+ public AliasQueryOptionImpl setAliasValue(final ExpressionImpl aliasValue) {
this.aliasValue = aliasValue;
return this;
}
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/CustomQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/CustomQueryOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/CustomQueryOptionImpl.java
index 2096d6f..b3822a9 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/CustomQueryOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/CustomQueryOptionImpl.java
@@ -21,6 +21,5 @@ package org.apache.olingo.odata4.producer.core.uri.queryoption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
public class CustomQueryOptionImpl extends QueryOptionImpl implements CustomQueryOption {
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandItemImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandItemImpl.java
index 22b34d7..896f062 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandItemImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandItemImpl.java
@@ -23,11 +23,10 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceProperty;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExceptionVisitExpand;
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandItem;
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandVisitor;
import org.apache.olingo.odata4.producer.api.uri.queryoption.FilterOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.InlineCountOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.LevelExpandOption;
@@ -35,18 +34,11 @@ import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SearchOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
import org.apache.olingo.odata4.producer.api.uri.queryoption.TopOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.VisitableExpand;
-public class ExpandItemImpl implements ExpandItem, VisitableExpand {
- private Edm edm;
- private ExpandSegment lastExpandSegment = null;
-
- private List<ExpandSegment> segments = new ArrayList<ExpandSegment>();
-
- private boolean isStar;
+public class ExpandItemImpl implements ExpandItem {
private LevelExpandOption levelExpandOption;
private FilterOption filterOption;
private SearchOption searchOption;
@@ -57,49 +49,44 @@ public class ExpandItemImpl implements ExpandItem, VisitableExpand {
private SelectOption selectOption;
private ExpandOption expandOption;
- public ExpandItemImpl setEdm(Edm edm) {
- this.edm = edm;
- return this;
- }
+ private UriInfoResource resourcePath;
-
- public ExpandItemImpl setStar(boolean isStar) {
- this.isStar = isStar;
- return this;
- }
+ private boolean isStar;
-
+ private boolean isRef;
- public ExpandSegment getLastSegement() {
- return lastExpandSegment;
+ public ExpandItemImpl setEdm(final Edm edm) {
+ return this;
}
-
-
- public ExpandItemImpl setExpandQueryOption(QueryOptionImpl item) {
+
+ public ExpandItemImpl setExpandQueryOption(final QueryOptionImpl item) {
if (item instanceof SystemQueryOptionImpl) {
- SystemQueryOptionImpl sysItem = (SystemQueryOptionImpl) item;
-
- if (sysItem.getKind() == SystemQueryOptionEnum.EXPAND) {
- expandOption = (ExpandOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.FILTER) {
- filterOption = (FilterOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.INLINECOUNT) {
- inlineCountOption = (InlineCountImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.ORDERBY) {
- orderByOption = (OrderByImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.SEARCH) {
- searchOption = (SearchOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.SELECT) {
- selectOption = (SelectOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.SKIP) {
- skipOption = (SkipOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.TOP) {
- topOption = (TopOptionImpl) sysItem;
- }
+ SystemQueryOptionImpl sysItem = (SystemQueryOptionImpl) item;
+
+ if (sysItem.getKind() == SupportedQueryOptions.EXPAND) {
+ expandOption = (ExpandOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.FILTER) {
+ filterOption = (FilterOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.INLINECOUNT) {
+ inlineCountOption = (InlineCountOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.ORDERBY) {
+ orderByOption = (OrderByImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.SEARCH) {
+ searchOption = (SearchOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.SELECT) {
+ selectOption = (SelectOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.SKIP) {
+ skipOption = (SkipOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.TOP) {
+ topOption = (TopOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.LEVEL) {
+ levelExpandOption = (LevelExpandOption) sysItem;
}
+ }
return this;
}
- public ExpandItemImpl setExpandQueryOptions(List<QueryOptionImpl> list) {
+
+ public ExpandItemImpl setExpandQueryOptions(final List<QueryOptionImpl> list) {
for (QueryOptionImpl item : list) {
setExpandQueryOption(item);
@@ -107,40 +94,8 @@ public class ExpandItemImpl implements ExpandItem, VisitableExpand {
return this;
}
- public ExpandItemImpl addSegment(ExpandSegment segment) {
- lastExpandSegment = segment;
- segments.add(segment);
- return this;
- }
-
-
- @Override
- public <T> T accept(ExpandVisitor<T> visitor) throws ExceptionVisitExpand {
-
- List<T> parameters = new ArrayList<T>();
- for (ExpandSegment segment : segments) {
- parameters.add(segment.accept(visitor));
- }
-
- // TODO implement visitor pattern for options
-
- return null; //visitor.visitExpandItem(parameters, isStar, isRef, finalType);
- }
-
- @Override
- public boolean isStar() {
- return isStar;
- }
-
-
-
- @Override
- public List<UriResourceProperty> getPropertyChainList() {
-
- return null;
- }
@Override
public LevelExpandOption getLevel() {
@@ -188,6 +143,35 @@ public class ExpandItemImpl implements ExpandItem, VisitableExpand {
return expandOption;
}
+ public ExpandItemImpl setResourcePath(final UriInfoResource resourcePath) {
+ this.resourcePath = resourcePath;
+ return this;
+ }
+
+ @Override
+ public UriInfoResource getPath() {
+
+ return resourcePath;
+ }
+
+ @Override
+ public boolean isStar() {
+ return isStar;
+ }
+
+ public ExpandItemImpl setIsStar(final boolean isStar) {
+ this.isStar = isStar;
+ return this;
+ }
+
+ @Override
+ public boolean isRef() {
+ return isRef;
+ }
+ public ExpandItemImpl setIsRef(final boolean isRef) {
+ this.isRef = isRef;
+ return this;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandOptionImpl.java
index 08161a3..ad330fc 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandOptionImpl.java
@@ -24,22 +24,21 @@ import java.util.List;
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExceptionVisitExpand;
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandItem;
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.VisitableExpand;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-public class ExpandOptionImpl extends SystemQueryOptionImpl implements ExpandOption, VisitableExpand {
+public class ExpandOptionImpl extends SystemQueryOptionImpl implements ExpandOption {
List<ExpandItemImpl> expandItems = new ArrayList<ExpandItemImpl>();
public ExpandOptionImpl() {
- setKind(SystemQueryOptionEnum.EXPAND);
+ setKind(SupportedQueryOptions.EXPAND);
}
- public void addExpandItem(ExpandItemImpl expandItem) {
+ public void addExpandItem(final ExpandItemImpl expandItem) {
expandItems.add(expandItem);
}
+ @Override
public List<ExpandItem> getExpandItems() {
List<ExpandItem> retList = new ArrayList<ExpandItem>();
for (ExpandItemImpl item : expandItems) {
@@ -48,14 +47,5 @@ public class ExpandOptionImpl extends SystemQueryOptionImpl implements ExpandOpt
return retList;
}
- @Override
- public <T> T accept(ExpandVisitor<T> visitor) throws ExceptionVisitExpand {
- List<T> parameters = new ArrayList<T>();
- for (ExpandItemImpl expandItem : expandItems) {
- parameters.add(expandItem.accept(visitor));
- }
-
- return visitor.visitExpand(parameters);
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandSegment.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandSegment.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandSegment.java
deleted file mode 100644
index 173cbce..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandSegment.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri.queryoption;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmElement;
-import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExceptionVisitExpand;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.VisitableExpand;
-/*TODO fix this*/
-public class ExpandSegment implements VisitableExpand {
- private EdmType typeFilter;
- private EdmElement property;
-
- public ExpandSegment setProperty(EdmElement property) {
- this.property = property;
- return this;
- }
-
- public EdmType getType() {
- return property.getType();
- }
-
- public EdmType getTypeFilter() {
- return this.typeFilter;
- }
-
-
- public void setFilter(EdmStructuralType type) {
- this.typeFilter = type;
- }
-
- @Override
- public <T> T accept(ExpandVisitor<T> visitor) throws ExceptionVisitExpand {
- return null;//visitor.visitExpandSegment(property, initialType, finalType);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FilterOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FilterOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FilterOptionImpl.java
index bb1d6ec..f24f17f 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FilterOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FilterOptionImpl.java
@@ -18,9 +18,8 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.queryoption;
-
import org.apache.olingo.odata4.producer.api.uri.queryoption.FilterOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
public class FilterOptionImpl extends SystemQueryOptionImpl implements FilterOption {
@@ -28,10 +27,10 @@ public class FilterOptionImpl extends SystemQueryOptionImpl implements FilterOpt
private ExpressionImpl expression;
public FilterOptionImpl() {
- setKind(SystemQueryOptionEnum.FILTER);
+ setKind(SupportedQueryOptions.FILTER);
}
-
- public FilterOptionImpl setExpression(ExpressionImpl expression) {
+
+ public FilterOptionImpl setExpression(final ExpressionImpl expression) {
this.expression = expression;
return this;
}
@@ -41,6 +40,4 @@ public class FilterOptionImpl extends SystemQueryOptionImpl implements FilterOpt
return expression;
}
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FormatOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FormatOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FormatOptionImpl.java
index ab8e280..0104c4e 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FormatOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FormatOptionImpl.java
@@ -19,25 +19,23 @@
package org.apache.olingo.odata4.producer.core.uri.queryoption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.FormatOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
-
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
public class FormatOptionImpl extends SystemQueryOptionImpl implements FormatOption {
private String value;
public FormatOptionImpl() {
- setKind(SystemQueryOptionEnum.FORMAT);
+ setKind(SupportedQueryOptions.FORMAT);
}
- public FormatOptionImpl setValue(String value) {
+ public FormatOptionImpl setValue(final String value) {
this.value = value;
return this;
}
-
+
@Override
public String getFormat() {
return value;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/IdOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/IdOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/IdOptionImpl.java
index 6d5722e..4dfb708 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/IdOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/IdOptionImpl.java
@@ -18,28 +18,20 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.queryoption;
-
import org.apache.olingo.odata4.producer.api.uri.queryoption.IdOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
public class IdOptionImpl extends SystemQueryOptionImpl implements IdOption {
private String value;
-
public IdOptionImpl() {
- setKind(SystemQueryOptionEnum.ID);
+ setKind(SupportedQueryOptions.ID);
}
-
- public IdOptionImpl setValue(String value) {
+
+ public IdOptionImpl setValue(final String value) {
this.value = value;
return this;
}
-
- //TODO remove
- public String getValue() {
- return value;
- }
-
@Override
public String getIdValue() {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountImpl.java
deleted file mode 100644
index 3610d60..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.InlineCountOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
-
-
-public class InlineCountImpl extends SystemQueryOptionImpl implements InlineCountOption {
-
- private String count;
-
- public InlineCountImpl() {
- setKind(SystemQueryOptionEnum.INLINECOUNT);
- }
-
- public String getCount() {
- return count;
- }
-
- public InlineCountImpl setCount(String count) {
- this.count = count;
- return this;
- }
-
- @Override
- public boolean getInlineCountValue() {
- // TODO Auto-generated method stub
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountOptionImpl.java
new file mode 100644
index 0000000..f70635c
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountOptionImpl.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri.queryoption;
+
+import org.apache.olingo.odata4.producer.api.uri.queryoption.InlineCountOption;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
+
+public class InlineCountOptionImpl extends SystemQueryOptionImpl implements InlineCountOption {
+
+ private boolean count;
+
+ public InlineCountOptionImpl() {
+ setKind(SupportedQueryOptions.INLINECOUNT);
+ }
+
+
+ @Override
+ public boolean getvalue() {
+ return count;
+ }
+
+
+ public InlineCountOptionImpl setValue(boolean count) {
+ this.count = count;
+ return this;
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelExpandOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelExpandOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelExpandOptionImpl.java
new file mode 100644
index 0000000..b50b1dc
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelExpandOptionImpl.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri.queryoption;
+
+import org.apache.olingo.odata4.producer.api.uri.queryoption.LevelExpandOption;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
+
+public class LevelExpandOptionImpl extends SystemQueryOptionImpl implements LevelExpandOption {
+ private boolean isMax;
+ private int value;
+
+ public LevelExpandOptionImpl() {
+ setKind(SupportedQueryOptions.LEVEL);
+ }
+
+ public LevelExpandOptionImpl setValue(final int value) {
+ this.value = value;
+ return this;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+ @Override
+ public boolean isMax() {
+ return isMax;
+ }
+
+ public LevelExpandOptionImpl setMax() {
+ isMax = true;
+ return this;
+
+ }
+
+ @Override
+ public int getLevel() {
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelOption.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelOption.java
deleted file mode 100644
index 34bdaaf..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelOption.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri.queryoption;
-
-public interface LevelOption {
- boolean isMax();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelOptionImpl.java
deleted file mode 100644
index ab0d34f..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelOptionImpl.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
-
-public class LevelOptionImpl extends SystemQueryOptionImpl implements LevelOption{
- private boolean isMax;
- private String value;
-
- public LevelOptionImpl() {
- setKind(SystemQueryOptionEnum.LEVEL);
- }
-
- public LevelOptionImpl setValue(String value) {
- this.value = value;
- return this;
- }
-
- public String getValue() {
- return value;
- }
-
-
- @Override
- public boolean isMax() {
- return isMax;
- }
-
- public LevelOptionImpl setMax() {
- isMax = true;
- return this;
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByImpl.java
index a9b2014..43f1d95 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByImpl.java
@@ -18,34 +18,34 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.queryoption;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByItem;
import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
+
+public class OrderByImpl extends SystemQueryOptionImpl implements OrderByOption {
-public class OrderByImpl extends SystemQueryOptionImpl implements OrderByOption{
-
private List<OrderByOptionImpl> orders;
public OrderByImpl() {
- setKind(SystemQueryOptionEnum.ORDERBY);
+ setKind(SupportedQueryOptions.ORDERBY);
}
-
- public List<OrderByItem> getOrders() {
+
+ @Override
+ public List<OrderByItem> getOrders() {
List<OrderByItem> retList = new ArrayList<OrderByItem>();
- for ( OrderByOptionImpl item: orders) {
+ for (OrderByOptionImpl item : orders) {
retList.add(item);
}
return Collections.unmodifiableList(retList);
}
-
- public OrderByImpl addOrder(OrderByOptionImpl order) {
+
+ public OrderByImpl addOrder(final OrderByOptionImpl order) {
orders.add(order);
return this;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByOptionImpl.java
index 2da85cb..db0eded 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByOptionImpl.java
@@ -31,21 +31,20 @@ public class OrderByOptionImpl extends SystemQueryOptionImpl implements OrderByI
public boolean isDescending() {
return descending;
}
-
- public OrderByItem setSortOrder( boolean descending) {
+
+ public OrderByItem setSortOrder(final boolean descending) {
this.descending = descending;
return this;
}
-
+ @Override
public ExpressionImpl getExpression() {
return expression;
}
-
- public OrderByItem setExpression(ExpressionImpl expression) {
+
+ public OrderByItem setExpression(final ExpressionImpl expression) {
this.expression = expression;
return this;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionImpl.java
index b6c2bb2..e5a7a6d 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionImpl.java
@@ -20,7 +20,7 @@ package org.apache.olingo.odata4.producer.core.uri.queryoption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.QueryOption;
-public class QueryOptionImpl implements QueryOption {
+public abstract class QueryOptionImpl implements QueryOption {
private String name;
private String text;
@@ -29,7 +29,7 @@ public class QueryOptionImpl implements QueryOption {
return name;
}
- public QueryOptionImpl setName(String name) {
+ public QueryOptionImpl setName(final String name) {
this.name = name;
return this;
}
@@ -39,8 +39,8 @@ public class QueryOptionImpl implements QueryOption {
return text;
}
- public QueryOptionImpl setText(String value) {
- this.text = value;
+ public QueryOptionImpl setText(final String value) {
+ text = value;
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SearchOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SearchOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SearchOptionImpl.java
index c271907..0bf1a1a 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SearchOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SearchOptionImpl.java
@@ -20,14 +20,14 @@
package org.apache.olingo.odata4.producer.core.uri.queryoption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SearchOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
import org.apache.olingo.odata4.producer.api.uri.queryoption.search.SearchExpression;
-/*TODO implement*/
+/* TODO implement */
public class SearchOptionImpl extends SystemQueryOptionImpl implements SearchOption {
public SearchOptionImpl() {
- setKind(SystemQueryOptionEnum.SEARCH);
+ setKind(SupportedQueryOptions.SEARCH);
}
@Override
@@ -36,5 +36,4 @@ public class SearchOptionImpl extends SystemQueryOptionImpl implements SearchOpt
return null;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemOptionImpl.java
index 51992a1..28a2e93 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemOptionImpl.java
@@ -25,7 +25,6 @@ import java.util.List;
import org.apache.olingo.odata4.commons.api.edm.Edm;
import org.apache.olingo.odata4.commons.api.edm.EdmAction;
import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
-import org.apache.olingo.odata4.commons.api.edm.EdmElement;
import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
@@ -34,154 +33,36 @@ import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
import org.apache.olingo.odata4.producer.api.uri.UriResourceProperty;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
-public class SelectItemOptionImpl implements SelectItem{
+public class SelectItemOptionImpl implements SelectItem {
- private Edm edm;
- private EdmType finalType;
- private SelectSegment lastSegment = null;
+ private SelectSegmentImpl lastSegment = null;
// only one of these must me filled
- private List<SelectSegment> segments = new ArrayList<SelectSegment>();
- private EdmAction action;
- private EdmFunction function;
- private boolean isStar;
- private FullQualifiedName addOperationsInSchema;
-
- public class SelectSegment {
- private EdmElement property; // ia EdmProperty or EdmNavigationProperty
- private EdmType initialType;
- private EdmType typeCast;
- private EdmType finalType;
-
-
- public SelectSegment setProperty(EdmElement property) {
- this.property = property;
- this.initialType = property.getType();
- this.finalType = initialType;
- return this;
- }
-
- public EdmType getType() {
- return finalType;
- }
-
- public EdmType getTypeCast() {
- return typeCast;
- }
-
- public EdmElement getProperty() {
- return property;
- }
-
- public void addCast(EdmStructuralType type) {
- this.typeCast = type;
- this.finalType = type;
-
- }
- }
+ private List<SelectSegmentImpl> segments = new ArrayList<SelectSegmentImpl>();
public EdmType getType() {
- return finalType;
- }
-
- public SelectItemOptionImpl setEdm(Edm edm) {
- this.edm = edm;
- return this;
- }
-
- /**
- * Sets the start type used for the type validation. For example this may be the type of the
- * last resource path segment.
- * @param startType
- * @return
- */
- public SelectItemOptionImpl setStartType(EdmType startType) {
- this.finalType = startType;
- return this;
- }
-
- public SelectItemOptionImpl addProperty(String propertyName) {
-
- if (!(finalType instanceof EdmStructuralType)) {
- // TODO error
- return this;
- }
-
- EdmStructuralType structType = (EdmStructuralType) finalType;
- EdmElement property = (EdmElement) structType.getProperty(propertyName);
- if (property == null) {
- // TODO error
- return this;
- }
-
- // create new segment
- this.lastSegment = new SelectSegment().setProperty(property);
- this.segments.add(this.lastSegment);
-
- this.finalType = lastSegment.getType();
- return this;
- }
-
- public void addStar() {
- // TODO add checks
- isStar = true;
- }
-
- public void addAllOperationsInSchema(FullQualifiedName addOperationsInSchema) {
- // TODO add checks
- this.addOperationsInSchema =addOperationsInSchema;
- }
-
- public SelectItemOptionImpl addQualifiedThing(FullQualifiedName fullName) {
- // TODO add checks
- if (finalType instanceof EdmEntityType) {
- EdmEntityType et = edm.getEntityType(fullName);
- if (((EdmStructuralType) finalType).compatibleTo(et)) {
- this.lastSegment.addCast(et);
- this.finalType = this.lastSegment.getType();
- return this;
- }
- }
-
- if (finalType instanceof EdmComplexType) {
- EdmComplexType ct = edm.getComplexType(fullName);
- if (ct != null) {
- if (((EdmStructuralType) finalType).compatibleTo(ct)) {
- this.lastSegment.addCast(ct);
- this.finalType = this.lastSegment.getType();
- return this;
- }
+ if (lastSegment != null) {
+ EdmType type = lastSegment.getTypeCast();
+ if (type != null) {
+ return type;
}
+ return lastSegment.getType();
}
+ return null;
+ }
- FullQualifiedName finalTypeName = new FullQualifiedName(finalType.getNamespace(), finalType.getName());
- // check for action
- EdmAction action = edm.getAction(fullName, finalTypeName, null);
- // TODO verify that null ignores if it is a collection
+ public void addSegment(SelectSegmentImpl newSegment) {
+ segments.add(newSegment);
+ lastSegment = newSegment;
- if (action != null) {
- if (lastSegment != null) {
- // TODO throw error action not usable behind property cast
- }
- this.action = action;
- }
+ }
- // check for function
- EdmFunction function = edm.getFunction(fullName, finalTypeName, null, null);
- // TODO verify that null ignores if it is a collection
- // TODO verify that the second for parameters null ignores the parameters
+ public void addStar() {}
- if (function != null) {
- if (lastSegment != null) {
- // TODO throw error action not usable behind property cast
- }
- this.function = function;
- }
+ public void addAllOperationsInSchema(final FullQualifiedName addOperationsInSchema) {}
- return null;
- }
@Override
public boolean isStar() {
@@ -207,19 +88,22 @@ public class SelectItemOptionImpl implements SelectItem{
return null;
}
+
@Override
- public EdmAction getAction() {
- return action;
+ public List<UriResourceProperty> getPropertyChainList() {
+ // TODO Auto-generated method stub
+ return null;
}
- @Override
- public EdmFunction getFunction() {
- return function;
+
+ public SelectSegmentImpl getLastSegment() {
+ return lastSegment;
}
- @Override
- public List<UriResourceProperty> getPropertyChainList() {
+
+ public void setEntityTypeCast(EdmEntityType et) {
// TODO Auto-generated method stub
- return null;
+
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectOptionImpl.java
index bfa5fda..7365c6b 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectOptionImpl.java
@@ -23,17 +23,17 @@ import java.util.List;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
public class SelectOptionImpl extends SystemQueryOptionImpl implements SelectOption {
private List<SelectItemOptionImpl> selectItems;
public SelectOptionImpl() {
- setKind(SystemQueryOptionEnum.SELECT);
+ setKind(SupportedQueryOptions.SELECT);
}
- public SelectOptionImpl setSelectItems(List<SelectItemOptionImpl> selectItems) {
+ public SelectOptionImpl setSelectItems(final List<SelectItemOptionImpl> selectItems) {
this.selectItems = selectItems;
return this;
}
@@ -41,7 +41,7 @@ public class SelectOptionImpl extends SystemQueryOptionImpl implements SelectOpt
@Override
public List<SelectItem> getSelectItems() {
List<SelectItem> retList = new ArrayList<SelectItem>();
- for ( SelectItemOptionImpl item : selectItems) {
+ for (SelectItemOptionImpl item : selectItems) {
retList.add(item);
}
return retList;
[4/6] [OLINGO-63] Uri Parser: Add test cases for key predicates,
select, expand and code cleanup
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
index 2ae5675..4e07ae4 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
@@ -46,115 +46,17 @@ import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
import org.apache.olingo.odata4.producer.api.uri.UriResourcePart;
import org.apache.olingo.odata4.producer.api.uri.UriResourcePartTyped;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserBaseVisitor;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AliasAndValueContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AllExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAddContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAllContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAndContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAnyContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltBatchContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltComparismContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltEntityCastContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltEntityContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltEqualityContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltLiteralContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMetadataContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMultContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltOrContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltResourcePathContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AnyExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CastExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CeilingMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ConcatMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ConstSegmentContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ContainsMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CrossjoinContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CustomQueryOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.DayMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.DistanceMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EndsWithMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionCastContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionsCastContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionsContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandCountOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandItemContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandPathContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandPathExtensionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandPathSegmentContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandRefOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FilterContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FloorMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FormatContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FractionalsecondsMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.GeoLengthMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.HourMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IdContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IndexOfMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.InlinecountContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IntersectsMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IsofExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.LengthMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MaxDateTimeMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MemberExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MinDateTimeMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MinuteMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MonthMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NameValueOptListContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NameValuePairContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NamespaceContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NowMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataIdentifierContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OrderByContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.PathSegmentContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.PathSegmentsContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.QueryOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.QueryOptionsContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ResourcePathContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.RootExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.RoundMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SecondMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SelectContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SelectItemContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SelectSegmentContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.StartsWithMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SubstringMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TimeMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ToLowerMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ToUpperMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TotalOffsetMinutesMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TotalsecondsMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TrimMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.UnaryContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.YearMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.AliasQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandItemImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandSegment;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FormatOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.LevelOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.QueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectItemOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SystemQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.BinaryImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.LambdaRefImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.LiteralImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.MemberImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.MethodCallImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.TypeLiteralImpl;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SkipContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SkiptokenContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TopContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.*;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.*;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.*;
/**
* UriVisitor
@@ -173,21 +75,20 @@ import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.TypeLit
* - Parsing the context of $metadata
*/
public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
-
private Edm edm;
- private EdmEntityContainer edmEntityContainer;
- // --- context ---
- private SelectItemOptionImpl contextSelectItem;
- private UriInfoImpl contextUriInfo;
+ private EdmEntityContainer edmEntityContainer;
/**
- * Set within method {@link #visitExpandPath(ExpandPathContext ctx)} to allow nodes
- * deeper in the parse tree appending path segments to the currently processed {@link ExpandItemImpl}.
- * <li>The context is required because the following path segments depend on the successor.</li>
- * <li>A stack is used because the $expand system query option can be nested.</li>
+ * Hold all currently allowed lambda variables
+ * As lambda functions can be nested there may be more than one allowed lambda variables while parsing a
+ * $filter or $orderby expression.
*/
- private Stack<ExpandItemImpl> contextExpandItemPath = new Stack<ExpandItemImpl>();
+ private class LambdaVariables {
+ public boolean isCollection;
+ public String name;
+ public EdmType type;
+ }
/**
* Set to allow nodes deeper in the parse tree appending path segments to the currently
@@ -196,91 +97,165 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
* <li>A stack is used because some system query options which are applied to the last type can
* be nested ($expand, $filter)</li>
*/
- private Stack<EdmType> contextType = new Stack<EdmType>();
- private Stack<String> lambdaVariables = new Stack<String>();
- private LambdaRefImpl contextDetectedLambda;
+ private class LastTypeColl {
+ private boolean isCollection;
+ private EdmType type;
+
+ LastTypeColl(EdmType type, boolean isCollection) {
+ this.type = type;
+ this.isCollection = isCollection;
+ }
+ }
+
+ // --- context ---
+
+ private Stack<LambdaVariables> allowedLambdaVariables = new Stack<LambdaVariables>();
+
+ /**
+ * Set within method {@link #visitExpandItem(ExpandPathContext ctx)} and {@link #visitExpandPathExtension(final
+ * ExpandPathExtensionContext ctx)} to allow nodes
+ * deeper in the expand tree at {@link #visitExpandPathExtension(ExpandPathExtensionContext ctx)} appending path
+ * segments to the currently processed {@link ExpandItemImpl}.
+ */
+ private ExpandItemImpl contextExpandItemPath;
+
+ /**
+ * Set within method {@link #visitSelectItem(SelectItemContext ctx)} to allow nodes
+ * deeper in the expand tree at {@link #visitSelectSegment(SelectSegmentContext ctx)} appending path segments to the
+ * currently processed {@link SelectItemOptionImpl}.
+ */
+ private SelectItemOptionImpl contextSelectItem;
+
+ private Stack<LastTypeColl> contextTypes = new Stack<LastTypeColl>();
+
+ /**
+ * Stores the currently processed UriInfo objects. There is one URI Info object for the resource path
+ * and one for each new first member access within $filter and $orderBy options.
+ */
+ private UriInfoImpl contextUriInfo;
+
+ // --- class ---
- public UriParseTreeVisitor(Edm edm) {
+ public UriParseTreeVisitor(final Edm edm) {
this.edm = edm;
- this.edmEntityContainer = edm.getEntityContainer(null);
+ edmEntityContainer = edm.getEntityContainer(null);
}
- public UriResourceImplTyped readFirstPathInfoSegment(PathSegmentContext ctx) {
- UriInfoImpl uriInfoResource = this.contextUriInfo;
+ private FullQualifiedName getFullName(final NamespaceContext vNS, final String odi) {
+ if (vNS != null) {
+ String namespace = vNS.getText();
+ namespace = namespace.substring(0, namespace.length() - 1);
+
+ return new FullQualifiedName(namespace, odi);
+ }
+ return null;
+
+ }
+
+ /* here */
+ private LambdaVariables getLambdaVar(String odi) {
+ for (LambdaVariables item : this.allowedLambdaVariables) {
+ if (item.name.equals(odi)) {
+ return item;
+ }
+ }
+ return null;
+ }
+ private EdmType getLastType(final UriResourceImplTyped lastResourceSegment) {
+ if (lastResourceSegment instanceof UriResourceImplKeyPred) {
+ UriResourceImplKeyPred lastKeyPred = (UriResourceImplKeyPred) lastResourceSegment;
+ if (lastKeyPred.getTypeFilterOnEntry() != null) {
+ return lastKeyPred.getTypeFilterOnEntry();
+ } else if (lastKeyPred.getTypeFilterOnCollection() != null) {
+ return lastKeyPred.getTypeFilterOnCollection();
+ }
+ }
+ EdmType type = lastResourceSegment.getTypeFilter();
+ if (type != null) {
+ return type;
+ }
+
+ return lastResourceSegment.getType();
+ }
+
+ public UriResourceImplTyped readFirstPathInfoSegment(final PathSegmentContext ctx) {
String odi = ctx.vODI.getText();
// check EntitySet
- EdmEntitySet edmES = edmEntityContainer.getEntitySet(odi);
- if (edmES != null) {
- UriResourceEntitySetImpl uriPathInfo = new UriResourceEntitySetImpl();
- uriPathInfo.setEntitSet(edmES);
- uriInfoResource.addPathInfo(uriPathInfo);
+ EdmEntitySet edmEntitySet = edmEntityContainer.getEntitySet(odi);
+ if (edmEntitySet != null) {
+ UriResourceEntitySetImpl uriResource = new UriResourceEntitySetImpl();
+ uriResource.setEntitSet(edmEntitySet);
+ contextUriInfo.addPathInfo(uriResource);
return null;
}
// check Singleton
- EdmSingleton edmSI = edmEntityContainer.getSingleton(odi);
- if (edmSI != null) {
- UriResourceSingletonImpl uriPathInfo = new UriResourceSingletonImpl();
- uriPathInfo.setSingleton(edmSI);
- uriInfoResource.addPathInfo(uriPathInfo);
+ EdmSingleton edmSingleton = edmEntityContainer.getSingleton(odi);
+ if (edmSingleton != null) {
+ UriResourceSingletonImpl uriResource = new UriResourceSingletonImpl();
+ uriResource.setSingleton(edmSingleton);
+ contextUriInfo.addPathInfo(uriResource);
return null;
}
// check ActionImport
- EdmActionImport edmAI = edmEntityContainer.getActionImport(odi);
- if (edmAI != null) {
- UriResourceActionImpl uriPathInfo = new UriResourceActionImpl();
- uriPathInfo.setActionImport(edmAI);
-
- uriInfoResource.addPathInfo(uriPathInfo);
+ EdmActionImport edmActionImport = edmEntityContainer.getActionImport(odi);
+ if (edmActionImport != null) {
+ UriResourceActionImpl uriResource = new UriResourceActionImpl();
+ uriResource.setActionImport(edmActionImport);
+ contextUriInfo.addPathInfo(uriResource);
return null;
}
// check FunctionImport
- EdmFunctionImport edmFI = edmEntityContainer.getFunctionImport(odi);
- if (edmFI != null) {
+ EdmFunctionImport edmFunctionImport = edmEntityContainer.getFunctionImport(odi);
+ if (edmFunctionImport != null) {
// read the URI parameters
List<UriParameterImpl> parameters = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
ctx.vlNVO.remove(0); // parameters are consumed
- UriResourceFunctionImpl uriPathInfo = new UriResourceFunctionImpl();
- uriPathInfo.setFunctionImport(edmFI, parameters);
- uriInfoResource.addPathInfo(uriPathInfo);
+ UriResourceFunctionImpl uriResource = new UriResourceFunctionImpl();
+ uriResource.setFunctionImport(edmFunctionImport, parameters);
+ contextUriInfo.addPathInfo(uriResource);
return null;
}
- throw wrap(new UriParserSemanticException("Unkown path segment found: " + odi));
+ throw wrap(new UriParserSemanticException("Unkown path segment: " + odi));
}
- public UriResourceImplTyped readNextPathInfoSegment(PathSegmentContext ctx) {
+ public UriResourceImplTyped readNextPathInfoSegment(final PathSegmentContext ctx) {
String odi = ctx.vODI.getText();
- if (!(this.contextUriInfo.getLastUriPathInfo() instanceof UriResourceImplTyped)) {
+ UriResourcePart lastResource = contextUriInfo.getLastResourcePart();
+ if (!(lastResource instanceof UriResourceImplTyped)) {
throw wrap(new UriParserSemanticException("Previous path segment not typed"));
}
- UriResourceImplTyped lastSegment = (UriResourceImplTyped) this.contextUriInfo.getLastUriPathInfo();
- // TODO add check for type filters
+ UriResourceImplTyped lastTyped = (UriResourceImplTyped) lastResource;
- if (ctx.vNS == null) {
+ if (ctx.vNS == null) { // without namespace
- //first check for lamda variable because a newly add property should not shaddow a long used lamdavarable
-
- if (this.lambdaVariables.contains(odi)) {
- contextDetectedLambda = new LambdaRefImpl().setVariableText(odi);
+ // first check for lambda variable because a newly add property should not shadow a long used lambda variable
+ LambdaVariables lVar = getLambdaVar(odi);
+ if (lVar != null) {
+ UriResourceLambdaRefImpl lambdaResource = new UriResourceLambdaRefImpl();
+ lambdaResource.setVariableText(lVar.name);
+ lambdaResource.setType(lVar.type);
+ lambdaResource.isCollection(lVar.isCollection);
+ contextUriInfo.addPathInfo(lambdaResource);
return null;
}
-
- //
- EdmType targetType = getLastType(lastSegment);
+
+ EdmType targetType = getLastType(lastTyped);
if (!(targetType instanceof EdmStructuralType)) {
- throw wrap(new UriParserSemanticException("Property " + odi + " not found"));
+ throw wrap(new UriParserSemanticException("Previous path segment not a structural type"));
}
EdmStructuralType structType = (EdmStructuralType) targetType;
+
EdmElement property = structType.getProperty(odi);
if (property == null) {
throw wrap(new UriParserSemanticException("Unkown property: " + odi));
@@ -288,100 +263,109 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (property instanceof EdmProperty) {
if (((EdmProperty) property).isPrimitive() == true) {
- UriResourceSimplePropertyImpl uriPropertyImpl = new UriResourceSimplePropertyImpl();
- uriPropertyImpl.setProperty((EdmProperty) property);
- this.contextUriInfo.addPathInfo(uriPropertyImpl);
+ // create simple property
+ UriResourceSimplePropertyImpl simpleResource = new UriResourceSimplePropertyImpl();
+ simpleResource.setProperty((EdmProperty) property);
+ contextUriInfo.addPathInfo(simpleResource);
return null;
} else {
- UriResourceComplexPropertyImpl uriPropertyImpl = new UriResourceComplexPropertyImpl();
- uriPropertyImpl.setProperty((EdmProperty) property);
- this.contextUriInfo.addPathInfo(uriPropertyImpl);
+ // create complex property
+ UriResourceComplexPropertyImpl complexResource = new UriResourceComplexPropertyImpl();
+ complexResource.setProperty((EdmProperty) property);
+ contextUriInfo.addPathInfo(complexResource);
return null;
}
} else if (property instanceof EdmNavigationProperty) {
- UriResourceNavigationPropertyImpl uriPathInfoNavigation = new UriResourceNavigationPropertyImpl();
- uriPathInfoNavigation.addNavigationProperty((EdmNavigationProperty) property);
- contextUriInfo.addPathInfo(uriPathInfoNavigation);
+ // create navigation property
+ UriResourceNavigationPropertyImpl navigationResource = new UriResourceNavigationPropertyImpl();
+ navigationResource.setNavigationProperty((EdmNavigationProperty) property);
+ contextUriInfo.addPathInfo(navigationResource);
return null;
} else {
throw wrap(new UriParserSemanticException("Unkown property type"));
}
- } else {
- FullQualifiedName fullName = getFullName(ctx.vNS, odi);
- EdmType lastType = getLastType(lastSegment);
+ } else { // with namespace
+
+ FullQualifiedName fullFilterName = getFullName(ctx.vNS, odi);
+
+ EdmType lastType = getLastType(lastTyped);
if (lastType instanceof EdmEntityType) {
- EdmEntityType et = edm.getEntityType(fullName);
- if (et != null) {
- // is simple entity type cast
- if (!(et.compatibleTo(lastType))) {
- throw wrap(new UriParserSemanticException("Types not kompatible"));
+ EdmEntityType filterEntityType = edm.getEntityType(fullFilterName);
+ if (filterEntityType != null) {
+
+ // is entity type cast
+ if (!(filterEntityType.compatibleTo(lastType))) {
+ throw wrap(new UriParserSemanticException(
+ "Entity typefilter not compatible to previous path segment: " + fullFilterName.toString()));
}
- // check if last segement may contain key properties
- if (lastSegment instanceof UriResourceImplKeyPred) {
- UriResourceImplKeyPred lastKeyPred = (UriResourceImplKeyPred) lastSegment;
+ // check if last segment may contain key properties
+ if (lastTyped instanceof UriResourceImplKeyPred) {
+ UriResourceImplKeyPred lastKeyPred = (UriResourceImplKeyPred) lastTyped;
if (lastKeyPred.isCollection() == false) {
if (lastKeyPred.getTypeFilterOnEntry() != null) {
- throw wrap(new UriParserSemanticException("Single typeFilter are not chainable"));
+ throw wrap(new UriParserSemanticException("Single type filters are not chainable"));
}
- lastKeyPred.setSingleTypeFilter(et);
+ lastKeyPred.setSingleTypeFilter(filterEntityType);
return null;
} else {
if (lastKeyPred.getTypeFilterOnCollection() != null) {
- throw wrap(new UriParserSemanticException("Collection typeFilters are not chainable"));
+ throw wrap(new UriParserSemanticException("Collection type filters are not chainable"));
}
- lastKeyPred.setCollectionTypeFilter(et);
+ lastKeyPred.setCollectionTypeFilter(filterEntityType);
return null;
}
-
} else {
- // is
- if (lastSegment.getTypeFilter() != null) {
- throw wrap(new UriParserSemanticException("Chaining typefilters not allowed"));
+ if (lastTyped.getTypeFilter() != null) {
+ throw wrap(new UriParserSemanticException("type filters are not chainable"));
}
- lastSegment.setTypeFilter(et);
+ lastTyped.setTypeFilter(filterEntityType);
return null;
}
-
}
+
} else if (lastType instanceof EdmComplexType) {
- EdmComplexType ct = edm.getComplexType(fullName);
- if (ct != null) {
- if (!(ct.compatibleTo(lastType))) {
- throw wrap(new UriParserSemanticException("Types not kompatible"));
+ EdmComplexType filterComplexType = edm.getComplexType(fullFilterName);
+
+ if (filterComplexType != null) {
+
+ // is complex type cast
+ if (!(filterComplexType.compatibleTo(lastType))) {
+ throw wrap(new UriParserSemanticException(
+ "Complex typefilter not compatible to previous path segment: " + fullFilterName.toString()));
}
// is simple complex type cast
- if (lastSegment instanceof UriResourceImplKeyPred) {
- UriResourceImplKeyPred lastKeyPred = (UriResourceImplKeyPred) lastSegment;
+ if (lastTyped instanceof UriResourceImplKeyPred) {
+ // e.g. in case of function returning complex data or a list of complex data
+ UriResourceImplKeyPred lastKeyPred = (UriResourceImplKeyPred) lastTyped;
if (lastKeyPred.isCollection() == false) {
if (lastKeyPred.getTypeFilterOnEntry() != null) {
throw wrap(new UriParserSemanticException("Single TypeFilter are not chainable"));
}
- lastKeyPred.setSingleTypeFilter(ct);
+ lastKeyPred.setSingleTypeFilter(filterComplexType);
return null;
} else {
if (lastKeyPred.getTypeFilterOnCollection() != null) {
throw wrap(new UriParserSemanticException("Collection TypeFilter are not chainable"));
}
- lastKeyPred.setCollectionTypeFilter(ct);
+ lastKeyPred.setCollectionTypeFilter(filterComplexType);
return null;
}
} else {
-
- if (lastSegment.getTypeFilter() != null) {
+ if (lastTyped.getTypeFilter() != null) {
throw wrap(new UriParserSemanticException("Chaining Typefilters not allowed"));
}
- lastSegment.setTypeFilter(ct);
+ lastTyped.setTypeFilter(filterComplexType);
return null;
}
}
@@ -390,15 +374,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
FullQualifiedName fullBindingTypeName = new FullQualifiedName(lastType.getNamespace(), lastType.getName());
// check for action
- EdmAction action = edm.getAction(fullName, fullBindingTypeName, lastSegment.isCollection());
+ EdmAction action = edm.getAction(fullFilterName, fullBindingTypeName, lastTyped.isCollection());
if (action != null) {
UriResourceActionImpl pathInfoAction = new UriResourceActionImpl();
pathInfoAction.setAction(action);
- this.contextUriInfo.addPathInfo(pathInfoAction);
+ contextUriInfo.addPathInfo(pathInfoAction);
return null;
}
- // path segemend is not a complex type and not a entity type
// do a check for bound functions (which requires the parameter list)
if (ctx.vlNVO.size() == 0) {
@@ -407,81 +390,75 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
List<UriParameterImpl> parameters = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
- // handle bound function
-
// get names of function parameters
List<String> names = new ArrayList<String>();
for (UriParameterImpl item : parameters) {
names.add(item.getName());
}
- EdmFunction function =
- edm.getFunction(fullName, fullBindingTypeName, lastSegment.isCollection(), names);
+ EdmFunction function = edm.getFunction(fullFilterName, fullBindingTypeName, lastTyped.isCollection(), names);
if (function != null) {
UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl();
pathInfoFunction.setFunction(function);
pathInfoFunction.setParameters(parameters);
- this.contextUriInfo.addPathInfo(pathInfoFunction);
- ctx.vlNVO.remove(0);// as the parameters are consumed
+ contextUriInfo.addPathInfo(pathInfoFunction);
+ ctx.vlNVO.remove(0);// parameters are consumed
return null;
}
- // check for special case
- if (lastSegment instanceof UriResourceItImpl) {
- if (((UriResourceItImpl) lastSegment).isExplicitIt() == false) {
+ // check for unbound function in the $filter case ( where the previous resource segment is a $it)
+ if (lastTyped instanceof UriResourceItImpl) {
+ if (((UriResourceItImpl) lastTyped).isExplicitIt() == false) {
// check for unbound function
- EdmFunction functionUnbound =
- edm.getFunction(fullName, null, lastSegment.isCollection(), names);
+ EdmFunction functionUnbound = edm.getFunction(fullFilterName, null, lastTyped.isCollection(), names);
if (functionUnbound != null) {
- this.contextUriInfo.clearPathInfo(); // replace the $it
+ contextUriInfo.clearPathInfo(); // replace the $it
+
// TODO maybe add $root pathinfo first
UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl();
pathInfoFunction.setFunction(functionUnbound);
pathInfoFunction.setParameters(parameters);
- this.contextUriInfo.addPathInfo(pathInfoFunction);
- ctx.vlNVO.remove(0);// as the parameters are consumed
+ contextUriInfo.addPathInfo(pathInfoFunction);
+ ctx.vlNVO.remove(0);// parameters are consumed
return null;
}
}
}
- throw wrap(new UriParserSemanticException("Unknown resource path segment:" + fullName.toString()));
+ throw wrap(new UriParserSemanticException("Unknown resource path segment:" + fullFilterName.toString()));
}
-
- }
-
- private EdmType getLastType(UriResourceImplTyped lastSegment) {
- if (lastSegment instanceof UriResourceImplKeyPred) {
- UriResourceImplKeyPred lastKeyPred = (UriResourceImplKeyPred) lastSegment;
- if (lastKeyPred.getTypeFilterOnEntry() != null) {
- return lastKeyPred.getTypeFilterOnEntry();
- } else if (lastKeyPred.getTypeFilterOnCollection() != null) {
- return lastKeyPred.getTypeFilterOnCollection();
- }
- }
- EdmType type = lastSegment.getTypeFilter();
- if (type != null) {
- return type;
- }
-
- return lastSegment.getType();
}
@Override
- public Object visitAliasAndValue(AliasAndValueContext ctx) {
-
+ public Object visitAliasAndValue(final AliasAndValueContext ctx) {
AliasQueryOptionImpl alias = new AliasQueryOptionImpl();
-
alias.setName(ctx.vODI.getText());
alias.setText(ctx.vV.getText());
alias.setAliasValue((ExpressionImpl) ctx.vV.accept(this));
-
return alias;
}
@Override
- public ExpressionImpl visitAltAdd(AltAddContext ctx) {
+ public Object visitAllExpr(final AllExprContext ctx) {
+ UriResourceAllImpl all = new UriResourceAllImpl();
+
+ LastTypeColl lastTypeInfo = this.contextTypes.peek();
+
+ LambdaVariables var = new LambdaVariables();
+ var.name = ctx.vLV.getText();
+ var.type = lastTypeInfo.type;
+ var.isCollection = lastTypeInfo.isCollection;
+
+ all.setLamdaVariable(ctx.vLV.getText());
+ allowedLambdaVariables.push(var);
+ all.setExpression((ExpressionImpl) ctx.vLE.accept(this));
+ allowedLambdaVariables.pop();
+ return all;
+ }
+
+ @Override
+ public ExpressionImpl visitAltAdd(final AltAddContext ctx) {
BinaryImpl binary = new BinaryImpl();
int tokenIndex = ctx.vO.getType();
@@ -498,7 +475,23 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public ExpressionImpl visitAltAnd(AltAndContext ctx) {
+ public Object visitAltAll(final AltAllContext ctx) {
+ UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
+
+ UriResourceItImpl pathInfoIT = new UriResourceItImpl();
+ LastTypeColl lastTypeInfo = this.contextTypes.peek();
+ pathInfoIT.setType(lastTypeInfo.type);
+ pathInfoIT.setCollection(lastTypeInfo.isCollection);
+
+ uriInfoImplpath.addPathInfo(pathInfoIT);
+ uriInfoImplpath.addPathInfo((UriResourcePartImpl) super.visitAltAll(ctx));
+
+ return new MemberImpl()
+ .setPath(uriInfoImplpath);
+ }
+
+ @Override
+ public ExpressionImpl visitAltAnd(final AltAndContext ctx) {
BinaryImpl binary = new BinaryImpl();
binary.setOperator(SupportedBinaryOperators.AND);
@@ -508,13 +501,28 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitAltBatch(AltBatchContext ctx) {
- this.contextUriInfo = new UriInfoImpl(edm).setKind(UriInfoKind.batch);
+ public Object visitAltAny(final AltAnyContext ctx) {
+ UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
+
+ UriResourceItImpl pathInfoIT = new UriResourceItImpl();
+ pathInfoIT.setType(contextTypes.peek().type);
+ pathInfoIT.setCollection(contextTypes.peek().isCollection);
+
+ uriInfoImplpath.addPathInfo(pathInfoIT);
+ uriInfoImplpath.addPathInfo((UriResourcePartImpl) super.visitAltAny(ctx));
+
+ return new MemberImpl()
+ .setPath(uriInfoImplpath);
+ }
+
+ @Override
+ public Object visitAltBatch(final AltBatchContext ctx) {
+ contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.batch);
return null;
}
@Override
- public ExpressionImpl visitAltComparism(AltComparismContext ctx) {
+ public ExpressionImpl visitAltComparism(final AltComparismContext ctx) {
BinaryImpl binary = new BinaryImpl();
int tokenIndex = ctx.vO.getType();
@@ -537,19 +545,19 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitAltEntity(AltEntityContext ctx) {
- UriInfoImpl uriInfo = new UriInfoImpl(edm).setKind(UriInfoKind.entityId);
+ public Object visitAltEntity(final AltEntityContext ctx) {
+ UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.entityId);
List<QueryOptionImpl> list = (List<QueryOptionImpl>) ctx.vEO.accept(this);
uriInfo.setQueryOptions(list);
- this.contextUriInfo = uriInfo;
+ contextUriInfo = uriInfo;
return null;
}
@Override
- public Object visitAltEntityCast(AltEntityCastContext ctx) {
- UriInfoImpl uriInfo = new UriInfoImpl(edm).setKind(UriInfoKind.entityId);
+ public Object visitAltEntityCast(final AltEntityCastContext ctx) {
+ UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.entityId);
String odi = ctx.vODI.getText();
FullQualifiedName fullName = getFullName(ctx.vNS, odi);
@@ -559,9 +567,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
throw wrap(new UriParserSemanticException("Expected EntityTypeName"));
}
uriInfo.setEntityTypeCast(type);
-
+
contextUriInfo = uriInfo;
- contextType.push(uriInfo.getEntityTypeCast());
+ contextTypes.push(new LastTypeColl(uriInfo.getEntityTypeCast(), true));
List<QueryOptionImpl> list = (List<QueryOptionImpl>) ctx.vEO.accept(this);
uriInfo.setQueryOptions(list);
@@ -569,12 +577,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
return null;
}
- private ParseCancellationException wrap(UriParserException uriParserException) {
- return new ParseCancellationException(uriParserException);
- }
-
@Override
- public ExpressionImpl visitAltEquality(AltEqualityContext ctx) {
+ public ExpressionImpl visitAltEquality(final AltEqualityContext ctx) {
BinaryImpl binary = new BinaryImpl();
int tokenIndex = ctx.vO.getType();
@@ -591,13 +595,13 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitAltLiteral(AltLiteralContext ctx) {
+ public Object visitAltLiteral(final AltLiteralContext ctx) {
return new LiteralImpl().setText(ctx.getText());
}
@Override
- public Object visitAltMetadata(AltMetadataContext ctx) {
- UriInfoImpl uriInfo = new UriInfoImpl(edm).setKind(UriInfoKind.metadata);
+ public Object visitAltMetadata(final AltMetadataContext ctx) {
+ UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.metadata);
if (ctx.vF != null) {
FormatOptionImpl format = (FormatOptionImpl) ctx.vF.accept(this);
@@ -608,12 +612,12 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
throw wrap(new UriParserException("Fragment for $metadata not supported"));
}
- this.contextUriInfo = uriInfo;
+ contextUriInfo = uriInfo;
return null;
}
@Override
- public ExpressionImpl visitAltMult(AltMultContext ctx) {
+ public ExpressionImpl visitAltMult(final AltMultContext ctx) {
BinaryImpl binary = new BinaryImpl();
int tokenIndex = ctx.vO.getType();
@@ -632,7 +636,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public ExpressionImpl visitAltOr(AltOrContext ctx) {
+ public ExpressionImpl visitAltOr(final AltOrContext ctx) {
BinaryImpl binary = new BinaryImpl();
binary.setOperator(SupportedBinaryOperators.OR);
@@ -643,14 +647,15 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitAltResourcePath(AltResourcePathContext ctx) {
+ public Object visitAltResourcePath(final AltResourcePathContext ctx) {
ctx.vRP.accept(this);
if (ctx.vQO != null) {
- UriResourcePart lastSegment = contextUriInfo.getLastUriPathInfo();
+ UriResourcePart lastSegment = contextUriInfo.getLastResourcePart();
if (lastSegment instanceof UriResourceImplTyped) {
- contextType.push(getLastType((UriResourceImplTyped) lastSegment));
+ UriResourceImplTyped typed = (UriResourceImplTyped) lastSegment;
+ contextTypes.push(new LastTypeColl(getLastType(typed), typed.isCollection()));
}
contextUriInfo.setQueryOptions((List<QueryOptionImpl>) ctx.vQO.accept(this));
}
@@ -658,9 +663,29 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public ExpressionImpl visitCastExpr(CastExprContext ctx) {
+ public Object visitAnyExpr(final AnyExprContext ctx) {
+ UriResourceAnyImpl any = new UriResourceAnyImpl();
+ if (ctx.vLV != null) {
+ LastTypeColl lastTypeInfo = this.contextTypes.peek();
+
+ LambdaVariables var = new LambdaVariables();
+ var.name = ctx.vLV.getText();
+ var.type = lastTypeInfo.type;
+ var.isCollection = lastTypeInfo.isCollection;
+
+ any.setLamdaVariable(ctx.vLV.getText());
+ allowedLambdaVariables.push(var);
+ any.setExpression((ExpressionImpl) ctx.vLE.accept(this));
+ allowedLambdaVariables.pop();
+ }
+ return any;
+ }
+
+ @Override
+ public ExpressionImpl visitCastExpr(final CastExprContext ctx) {
MethodCallImpl method = new MethodCallImpl();
if (ctx.vE1 != null) {
+ // is optional parameter
ExpressionImpl onExpression = (ExpressionImpl) ctx.vE1.accept(this);
method.addParameter(onExpression);
}
@@ -674,14 +699,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public ExpressionImpl visitCeilingMethodCallExpr(CeilingMethodCallExprContext ctx) {
+ public ExpressionImpl visitCeilingMethodCallExpr(final CeilingMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.CEILING)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitConcatMethodCallExpr(ConcatMethodCallExprContext ctx) {
+ public ExpressionImpl visitConcatMethodCallExpr(final ConcatMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.CONCAT)
.addParameter((ExpressionImpl) ctx.vE1.accept(this))
@@ -689,7 +714,54 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public ExpressionImpl visitContainsMethodCallExpr(ContainsMethodCallExprContext ctx) {
+ public Object visitConstSegment(final ConstSegmentContext ctx) {
+ UriInfoImpl uriInfoResource = contextUriInfo;
+ UriResourcePart pathInfo = uriInfoResource.getLastResourcePart();
+
+ if (ctx.vV != null) {
+ if (pathInfo instanceof UriResourcePartTyped) {
+ if (!((UriResourcePartTyped) pathInfo).isCollection()) {
+ contextUriInfo.addPathInfo(new UriResourceValueImpl());
+ } else {
+ throw wrap(new UriParserSemanticException("$value only allowed on typed path segments"));
+ }
+ return null;
+ } else {
+ throw wrap(new UriParserSemanticException("$value only allowed on typed path segments"));
+ }
+
+ } else if (ctx.vC != null) {
+ if (pathInfo instanceof UriResourceImplTyped) {
+ if (((UriResourceImplTyped) pathInfo).isCollection()) {
+ contextUriInfo.addPathInfo(new UriResourceCountImpl());
+ } else {
+ throw wrap(new UriParserSemanticException("$count only allowed on collection properties"));
+ }
+ } else {
+ throw wrap(new UriParserSemanticException("$count only allowed on typed properties"));
+ }
+ } else if (ctx.vR != null) {
+ if (pathInfo instanceof UriResourceImplTyped) {
+ EdmType type = ((UriResourceImplTyped) pathInfo).getType();
+ if (type instanceof EdmEntityType) {
+ contextUriInfo.addPathInfo(new UriResourceRefImpl());
+ } else {
+ throw wrap(new UriParserSemanticException("$ref only allowd on endity types"));
+ }
+ } else {
+ throw wrap(new UriParserSemanticException("$ref only allowed on typed properties"));
+ }
+
+ } else if (ctx.vAll != null) {
+ contextUriInfo.addPathInfo((UriResourceAllImpl) ctx.vAll.accept(this));
+ } else if (ctx.vAny != null) {
+ contextUriInfo.addPathInfo((UriResourceAnyImpl) ctx.vAny.accept(this));
+ }
+ return null;
+ }
+
+ @Override
+ public ExpressionImpl visitContainsMethodCallExpr(final ContainsMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.CONTAINS)
.addParameter((ExpressionImpl) ctx.vE1.accept(this))
@@ -697,19 +769,19 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitCrossjoin(CrossjoinContext ctx) {
- UriInfoImpl crossJoin = new UriInfoImpl(edm).setKind(UriInfoKind.crossjoin);
+ public Object visitCrossjoin(final CrossjoinContext ctx) {
+ UriInfoImpl crossJoin = new UriInfoImpl().setKind(UriInfoKind.crossjoin);
for (OdataIdentifierContext obj : ctx.vlODI) {
crossJoin.addEntitySetName(obj.getText());
}
- this.contextUriInfo = crossJoin;
+ contextUriInfo = crossJoin;
return null;
}
@Override
- public Object visitCustomQueryOption(CustomQueryOptionContext ctx) {
+ public Object visitCustomQueryOption(final CustomQueryOptionContext ctx) {
CustomQueryOptionImpl queryOption = new CustomQueryOptionImpl();
queryOption.setName(ctx.getChild(0).getText());
@@ -722,14 +794,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public ExpressionImpl visitDayMethodCallExpr(DayMethodCallExprContext ctx) {
+ public ExpressionImpl visitDayMethodCallExpr(final DayMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.DAY)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitDistanceMethodCallExpr(DistanceMethodCallExprContext ctx) {
+ public ExpressionImpl visitDistanceMethodCallExpr(final DistanceMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.DISTANCE)
.addParameter((ExpressionImpl) ctx.vE1.accept(this))
@@ -737,14 +809,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitEndsWithMethodCallExpr(EndsWithMethodCallExprContext ctx) {
+ public Object visitEndsWithMethodCallExpr(final EndsWithMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.ENDSWITH)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public Object visitEntityOptions(EntityOptionsContext ctx) {
+ public Object visitEntityOptions(final EntityOptionsContext ctx) {
List<QueryOptionImpl> queryOptionList = new ArrayList<QueryOptionImpl>();
for (EntityOptionContext entityOption : ctx.vlEOb) {
@@ -760,7 +832,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitEntityOptionsCast(EntityOptionsCastContext ctx) {
+ public Object visitEntityOptionsCast(final EntityOptionsCastContext ctx) {
List<QueryOptionImpl> queryOptionList = new ArrayList<QueryOptionImpl>();
for (EntityOptionCastContext entityOption : ctx.vlEOb) {
queryOptionList.add((QueryOptionImpl) entityOption.accept(this));
@@ -775,7 +847,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitExpand(ExpandContext ctx) {
+ public Object visitExpand(final ExpandContext ctx) {
ExpandOptionImpl expand = new ExpandOptionImpl();
for (ExpandItemContext eI : ctx.vlEI) {
expand.addExpandItem((ExpandItemImpl) eI.accept(this));
@@ -785,33 +857,32 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitExpandItem(ExpandItemContext ctx) {
+ public Object visitExpandItem(final ExpandItemContext ctx) {
ExpandItemImpl expandItem = null;
if (ctx.vS != null) {
- expandItem = new ExpandItemImpl().setStar(true);
+ expandItem = new ExpandItemImpl().setIsStar(true);
if (ctx.vR != null) {
- //expandItem.setRef(true);
- //TODO do creat reference segement
+ expandItem.setIsRef(true);
} else if (ctx.vM != null) {
- expandItem.setExpandQueryOption(new LevelOptionImpl().setMax());
+ expandItem.setExpandQueryOption(new LevelExpandOptionImpl().setMax().setText(ctx.vM.getText()));
} else if (ctx.vL != null) {
- expandItem.setExpandQueryOption(new LevelOptionImpl().setValue(ctx.vL.getText()));
+ expandItem.setExpandQueryOption(new LevelExpandOptionImpl().setText(ctx.vL.getText()));
}
} else if (ctx.vEP != null) {
expandItem = (ExpandItemImpl) ctx.vEP.accept(this);
- } else {
- // error
- }
- if (ctx.vEPE != null) {
- contextExpandItemPath.push(expandItem);
- List<SystemQueryOptionImpl> list = (List<SystemQueryOptionImpl>) ctx.vEPE.accept(this);
- for (SystemQueryOptionImpl option : list) {
- expandItem.setExpandQueryOption(option);
+ if (ctx.vEPE != null) {
+ ExpandItemImpl contextExpandItemPathBU = contextExpandItemPath;
+ contextExpandItemPath = expandItem;
+
+ List<SystemQueryOptionImpl> list = (List<SystemQueryOptionImpl>) ctx.vEPE.accept(this);
+ for (SystemQueryOptionImpl option : list) {
+ expandItem.setExpandQueryOption(option);
+ }
+ contextExpandItemPath = contextExpandItemPathBU;
}
- contextExpandItemPath.pop();
}
return expandItem;
@@ -819,134 +890,71 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitExpandPath(ExpandPathContext ctx) {
+ public Object visitExpandPath(final ExpandPathContext ctx) {
ExpandItemImpl expandItem = new ExpandItemImpl();
- contextExpandItemPath.push(expandItem);
-
- super.visitExpandPath(ctx);
-
- contextExpandItemPath.pop();
-
- return expandItem;
- }
-
- @Override
- public Object visitExpandPathSegment(ExpandPathSegmentContext ctx) {
- ExpandItemImpl expandItemPrev = contextExpandItemPath.peek();
-
- String odi = ctx.vODI.getText();
- if (ctx.vNS == null) {
- EdmType targetType = null;
- if (expandItemPrev.getLastSegement() == null) {
- // used the global type
- UriResourceImplTyped lastSegment = (UriResourceImplTyped) this.contextUriInfo.getLastUriPathInfo();
- targetType = this.getLastType(lastSegment);
- } else {
- ExpandSegment segment = expandItemPrev.getLastSegement();
- if (segment.getTypeFilter() != null) {
- targetType = segment.getTypeFilter();
- } else {
- targetType = segment.getType();
- }
- }
-
- if (!(targetType instanceof EdmStructuralType)) {
- throw wrap(new UriParserSemanticException("Prev Expandsegment has no properties"));
- }
-
- EdmStructuralType structType = (EdmStructuralType) targetType;
- EdmElement property = (EdmElement) structType.getProperty(odi);
- if (property != null) {
- ExpandSegment seg = new ExpandSegment();
- seg.setProperty(property);
- expandItemPrev.addSegment(seg);
- return null;
- }
-
- throw wrap(new UriParserSemanticException("Prev Expandsegment has no property:" + odi));
+ UriResourceItImpl pathInfoIT = new UriResourceItImpl();
- } else {
- EdmType targetType = null;
- if (expandItemPrev.getLastSegement() == null) {
- UriResourceImplTyped lastSegment = (UriResourceImplTyped) this.contextUriInfo.getLastUriPathInfo();
- targetType = this.getLastType(lastSegment);
+ UriResourceImplTyped tmp = (UriResourceImplTyped) contextUriInfo.getLastResourcePart();
+ pathInfoIT.setCollection(tmp.isCollection()).setType(getLastType(tmp));
- ExpandSegment seg = new ExpandSegmentIt();
- expandItemPrev.addSegment(seg);
+ // save context
+ ExpandItemImpl contextExpandItemPathBU = contextExpandItemPath;
+ UriInfoImpl uriInfoResourceBU = contextUriInfo;
- } else {
- ExpandSegment segment = expandItemPrev.getLastSegement();
- if (segment.getTypeFilter() != null) {
- throw wrap(new UriParserSemanticException("Prev Expandsegment has already a type filter"));
- } else {
- targetType = segment.getType();
- }
- }
+ // set tmp context
+ contextExpandItemPath = expandItem;
+ contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
+ contextUriInfo.addPathInfo(pathInfoIT);
- FullQualifiedName fullName = getFullName(ctx.vNS, odi);
+ super.visitExpandPath(ctx);
+ expandItem.setResourcePath(contextUriInfo);
- if (targetType instanceof EdmEntityType) {
- EdmEntityType et = edm.getEntityType(fullName);
- if (et == null) {
- throw wrap(new UriParserSemanticException("entity type not found"));
- }
- if (et.compatibleTo(targetType)) {
- expandItemPrev.getLastSegement().setFilter(et);
- return null;
- }
- }
+ // reset context
+ contextUriInfo = uriInfoResourceBU;
+ contextExpandItemPath = contextExpandItemPathBU;
- if (targetType instanceof EdmComplexType) {
- EdmComplexType ct = edm.getComplexType(fullName);
- if (ct == null) {
- throw wrap(new UriParserSemanticException("Complex type not found"));
- }
- if (ct.compatibleTo(targetType)) {
- expandItemPrev.getLastSegement().setFilter(ct);
- return null;
- }
- }
- }
- return null;
+ return expandItem;
}
@Override
- public Object visitExpandPathExtension(ExpandPathExtensionContext ctx) {
- ExpandItemImpl expandItemPrev = contextExpandItemPath.peek();
-
- if (contextType == null) {
- contextType = new Stack<EdmType>();
- }
-
+ public Object visitExpandPathExtension(final ExpandPathExtensionContext ctx) {
List<SystemQueryOptionImpl> list = new ArrayList<SystemQueryOptionImpl>();
EdmType targetType = null;
- if (expandItemPrev.getLastSegement() == null) {
- // used the global type
- UriResourceImplTyped lastSegment = (UriResourceImplTyped) this.contextUriInfo.getLastUriPathInfo();
- targetType = this.getLastType(lastSegment);
+ boolean isColl = false;
+ if (contextExpandItemPath == null) {
+ // use the type of the last resource path segement
+ UriResourceImplTyped lastSegment = (UriResourceImplTyped) contextUriInfo.getLastResourcePart();
+ targetType = getLastType(lastSegment);
+ isColl = lastSegment.isCollection();
} else {
- ExpandSegment segment = expandItemPrev.getLastSegement();
- if (segment.getTypeFilter() != null) {
- targetType = segment.getTypeFilter();
+ if (contextExpandItemPath.getPath() == null) {
+ // use the type of the last resource path segement
+ UriResourceImplTyped lastSegment = (UriResourceImplTyped) contextUriInfo.getLastResourcePart();
+ targetType = getLastType(lastSegment);
+ isColl = lastSegment.isCollection();
} else {
- targetType = segment.getType();
+ // use the type of the last ''expand'' path segement
+ UriInfoImpl info = (UriInfoImpl) contextExpandItemPath.getPath();
+ targetType = getLastType((UriResourceImplTyped) info.getLastResourcePart());
+ isColl = ((UriResourceImplTyped) info.getLastResourcePart()).isCollection();
}
}
- contextType.push(targetType);
+ contextTypes.push(new LastTypeColl(targetType, isColl));
if (ctx.vC != null) {
- ExpandSegment seg = new ExpandSegmentCount();
- expandItemPrev.addSegment(seg);
+ UriInfoImpl resourcePath = (UriInfoImpl) contextExpandItemPath.getPath();
+ resourcePath.addPathInfo(new UriResourceCountImpl());
+
for (ExpandCountOptionContext s : ctx.vlEOC) {
list.add((SystemQueryOptionImpl) s.accept(this));
}
-
} else if (ctx.vR != null) {
- ExpandSegment seg = new ExpandSegmentRef();
- expandItemPrev.addSegment(seg);
+ UriInfoImpl resourcePath = (UriInfoImpl) contextExpandItemPath.getPath();
+ resourcePath.addPathInfo(new UriResourceRefImpl());
+
for (ExpandRefOptionContext s : ctx.vlEOR) {
list.add((SystemQueryOptionImpl) s.accept(this));
}
@@ -956,37 +964,27 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
}
- contextType.pop();
+ contextTypes.pop();
return list;
}
@Override
- public Object visitFilter(FilterContext ctx) {
+ public Object visitFilter(final FilterContext ctx) {
- FilterOptionImpl filter = new FilterOptionImpl()
- .setExpression((ExpressionImpl) ctx.children.get(2).accept(this));
+ FilterOptionImpl filter = new FilterOptionImpl().setExpression((ExpressionImpl) ctx.children.get(2).accept(this));
return filter;
}
@Override
- public Object visitOrderBy(OrderByContext ctx) {
-
- OrderByOptionImpl orderBy = new OrderByOptionImpl();
- // TODO collect orders
- // .setExpression((Expression) ctx.children.get(2).accept(this));
- return orderBy;
- }
-
- @Override
- public ExpressionImpl visitFloorMethodCallExpr(FloorMethodCallExprContext ctx) {
+ public ExpressionImpl visitFloorMethodCallExpr(final FloorMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.FLOOR)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public Object visitFormat(FormatContext ctx) {
+ public Object visitFormat(final FormatContext ctx) {
FormatOptionImpl format = new FormatOptionImpl();
TerminalNodeImpl c2 = (TerminalNodeImpl) ctx.children.get(2);
@@ -1003,62 +1001,50 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
format.setValue(c2.getText() + "/" + ctx.children.get(4).getText());
}
}
+ String text = ctx.children.get(2).getText();
+ if ( ctx.getChildCount()> 4) {
+ text += ctx.children.get(3).getText();
+ text += ctx.children.get(4).getText();
+ }
+
+ format.setText(text);
+
return format;
}
@Override
- public ExpressionImpl visitFractionalsecondsMethodCallExpr(FractionalsecondsMethodCallExprContext ctx) {
+ public ExpressionImpl visitFractionalsecondsMethodCallExpr(final FractionalsecondsMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.FRACTIONALSECOND)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitGeoLengthMethodCallExpr(GeoLengthMethodCallExprContext ctx) {
+ public ExpressionImpl visitGeoLengthMethodCallExpr(final GeoLengthMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.GEOLENGTH)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitHourMethodCallExpr(HourMethodCallExprContext ctx) {
+ public ExpressionImpl visitHourMethodCallExpr(final HourMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.HOUR)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public Object visitId(IdContext ctx) {
+ public Object visitId(final IdContext ctx) {
IdOptionImpl id = new IdOptionImpl();
- /*
- * UriInfoImplResource uriInfoImplpath = new UriInfoImplResource(edm);
- *
- * // store the context uriInfoPath
- * UriInfoImplResource backupUriInfoPath = this.contextUriInfoPath;
- *
- * // set temporary uriInfoPath to collect the path information of the memberExpression
- * this.contextUriInfoPath = uriInfoImplpath;
- *
- * ctx.children.get(2).accept(this);
- *
- * this.contextUriInfoPath = backupUriInfoPath;
- *
- * // add the typeFilter which was part of the resource path behind the $entity segment
- * UriPathInfoImpl lastPathInfo = uriInfoImplpath.getLastUriPathInfo();
- * EdmStructuralType typeFilter = ((UriInfoImplEntity) this.contextUriInfo).getTypeFilter();
- * if (typeFilter != null) {
- * lastPathInfo.addTypeFilter(typeFilter);
- * }
- */
-
- String text = ctx.children.get(2).getText();
-
+
+ String text = ctx.children.get(2).getText();
+
return id.setValue(text).setText(text);
}
@Override
- public ExpressionImpl visitIndexOfMethodCallExpr(IndexOfMethodCallExprContext ctx) {
+ public ExpressionImpl visitIndexOfMethodCallExpr(final IndexOfMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.INDEXOF)
.addParameter((ExpressionImpl) ctx.vE1.accept(this))
@@ -1066,7 +1052,16 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public ExpressionImpl visitIntersectsMethodCallExpr(IntersectsMethodCallExprContext ctx) {
+ public Object visitInlinecount(final InlinecountContext ctx) {
+ InlineCountOptionImpl inlineCount = new InlineCountOptionImpl();
+
+ String text = ctx.children.get(2).getText();
+
+ return inlineCount.setValue(text.equals("true") ? true : false).setText(text);
+ }
+
+ @Override
+ public ExpressionImpl visitIntersectsMethodCallExpr(final IntersectsMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.GEOLENGTH)
.addParameter((ExpressionImpl) ctx.vE1.accept(this))
@@ -1074,7 +1069,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public ExpressionImpl visitIsofExpr(IsofExprContext ctx) {
+ public ExpressionImpl visitIsofExpr(final IsofExprContext ctx) {
MethodCallImpl method = new MethodCallImpl();
if (ctx.vE1 != null) {
ExpressionImpl onExpression = (ExpressionImpl) ctx.vE1.accept(this);
@@ -1090,107 +1085,28 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public ExpressionImpl visitLengthMethodCallExpr(LengthMethodCallExprContext ctx) {
+ public ExpressionImpl visitLengthMethodCallExpr(final LengthMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.LENGTH)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitMaxDateTimeMethodCallExpr(MaxDateTimeMethodCallExprContext ctx) {
+ public ExpressionImpl visitMaxDateTimeMethodCallExpr(final MaxDateTimeMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.MINDATETIME);
}
@Override
- public Object visitRootExpr(RootExprContext ctx) {
- UriInfoImpl uriInfoImplpath = new UriInfoImpl(edm).setKind(UriInfoKind.resource);
-
- UriResourceRootImpl pathInfoRoot = new UriResourceRootImpl();
-
- uriInfoImplpath.addPathInfo(pathInfoRoot);
-
- if (ctx.vPs != null) {
- // store the context uriInfoPath
- UriInfoImpl backupUriInfoPath = this.contextUriInfo;
-
- // set temporary uriInfoPath to collect the path information of the memberExpression
- this.contextUriInfo = uriInfoImplpath;
+ public Object visitMemberExpr(final MemberExprContext ctx) {
- ctx.vPs.accept(this);
-
- this.contextUriInfo = backupUriInfoPath;
- }
- return new MemberImpl()
- .setPath(uriInfoImplpath);
-
- }
-
- @Override
- public Object visitInlinecount(InlinecountContext ctx) {
- // TODO implement
- return super.visitInlinecount(ctx);
- }
-
- @Override
- public Object visitAltAny(AltAnyContext ctx) {
- UriInfoImpl uriInfoImplpath = new UriInfoImpl(edm).setKind(UriInfoKind.resource);
+ UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
UriResourceItImpl pathInfoIT = new UriResourceItImpl();
- pathInfoIT.setType(contextType.peek());
-
- uriInfoImplpath.addPathInfo(pathInfoIT);
- uriInfoImplpath.addPathInfo((UriResourcePartImpl) super.visitAltAny(ctx));
+ LastTypeColl lastTypeInfo = this.contextTypes.peek();
+ pathInfoIT.setType(lastTypeInfo.type);
+ pathInfoIT.setCollection(lastTypeInfo.isCollection);
- return new MemberImpl()
- .setPath(uriInfoImplpath);
- }
-
- @Override
- public Object visitAnyExpr(AnyExprContext ctx) {
- UriResourceAnyImpl any = new UriResourceAnyImpl();
- if (ctx.vLV != null) {
- any.setLamdaVariable(ctx.vLV.getText());
- lambdaVariables.push(any.getLamdaVariable());
- any.setExpression((ExpressionImpl) ctx.vLE.accept(this));
- lambdaVariables.pop();
- }
- return any;
- }
-
- @Override
- public Object visitAltAll(AltAllContext ctx) {
- UriInfoImpl uriInfoImplpath = new UriInfoImpl(edm).setKind(UriInfoKind.resource);
-
- UriResourceItImpl pathInfoIT = new UriResourceItImpl();
- pathInfoIT.setType(contextType.peek());
-
- uriInfoImplpath.addPathInfo(pathInfoIT);
- uriInfoImplpath.addPathInfo((UriResourcePartImpl) super.visitAltAll(ctx));
-
- return new MemberImpl()
- .setPath(uriInfoImplpath);
- }
-
- @Override
- public Object visitAllExpr(AllExprContext ctx) {
- UriResourceAllImpl all = new UriResourceAllImpl();
- all.setLamdaVariable(ctx.vLV.getText());
- lambdaVariables.push(all.getLamdaVariable());
- all.setExpression((ExpressionImpl) ctx.vLE.accept(this));
- lambdaVariables.pop();
- return all;
- }
-
- @Override
- public Object visitMemberExpr(MemberExprContext ctx) {
-
- UriInfoImpl uriInfoImplpath = new UriInfoImpl(edm).setKind(UriInfoKind.resource);
-
- UriResourceItImpl pathInfoIT = new UriResourceItImpl();
- // the start type for members is the final type of the resource path
- // check wath happens for expand
- pathInfoIT.setType(contextType.peek());
if (ctx.vIt != null || ctx.vIts != null) {
pathInfoIT.setIsExplicitIT(true); // a $it prohibits unbound functions as member expression
}
@@ -1198,22 +1114,17 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
uriInfoImplpath.addPathInfo(pathInfoIT);
if (ctx.vPs != null) {
- // store the context uriInfoPath
- UriInfoImpl backupUriInfoPath = this.contextUriInfo;
+ // save the context
+ UriInfoImpl backupUriInfoPath = contextUriInfo;
+
+ // set temporary uriInfoPath
+ contextUriInfo = uriInfoImplpath;
- // set temporary uriInfoPath to collect the path information of the memberExpression
- this.contextUriInfo = uriInfoImplpath;
- contextDetectedLambda = null;
ctx.vPs.accept(this);
- this.contextUriInfo = backupUriInfoPath;
- if (contextDetectedLambda!= null) {
- LambdaRefImpl tmp = contextDetectedLambda;
- contextDetectedLambda = null;
- return tmp;
- }
-
- }
+ // reset context
+ contextUriInfo = backupUriInfoPath;
+ }
if (ctx.vALL != null) {
uriInfoImplpath.addPathInfo((UriResourcePartImpl) ctx.vALL.accept(this));
@@ -1221,79 +1132,64 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (ctx.vANY != null) {
uriInfoImplpath.addPathInfo((UriResourcePartImpl) ctx.vANY.accept(this));
}
-
return new MemberImpl()
.setPath(uriInfoImplpath);
}
@Override
- public ExpressionImpl visitMinDateTimeMethodCallExpr(MinDateTimeMethodCallExprContext ctx) {
+ public ExpressionImpl visitMinDateTimeMethodCallExpr(final MinDateTimeMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.MINDATETIME);
}
@Override
- public ExpressionImpl visitMinuteMethodCallExpr(MinuteMethodCallExprContext ctx) {
+ public ExpressionImpl visitMinuteMethodCallExpr(final MinuteMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.MINUTE)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitMonthMethodCallExpr(MonthMethodCallExprContext ctx) {
+ public ExpressionImpl visitMonthMethodCallExpr(final MonthMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.MONTH)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public Object visitNameValueOptList(NameValueOptListContext ctx) {
+ public Object visitNameValueOptList(final NameValueOptListContext ctx) {
// is key predicate
if (ctx.vVO != null) {
- String text = ctx.vVO.vV.getText();
+ String valueText = ctx.vVO.vV.getText();
ExpressionImpl expression = (ExpressionImpl) ctx.vVO.vV.accept(this);
- if (!(contextUriInfo.getLastUriPathInfo() instanceof UriResourceImplTyped)) {
- throw wrap(new UriParserSyntaxException("Invalid Paramterslist"));
+ if (!(contextUriInfo.getLastResourcePart() instanceof UriResourceImplTyped)) {
+ throw wrap(new UriParserSyntaxException("Paramterslist on untyped resource path segement not allowed"));
}
- EdmEntityType entityType = (EdmEntityType) ((UriResourceImplTyped) contextUriInfo.getLastUriPathInfo()).getType();
+ EdmEntityType entityType =
+ (EdmEntityType) ((UriResourceImplTyped) contextUriInfo.getLastResourcePart()).getType();
List<String> keyPredicates = entityType.getKeyPredicateNames();
if (keyPredicates.size() == 1) {
String keyName = keyPredicates.get(0);
List<UriParameterImpl> list = new ArrayList<UriParameterImpl>();
- list.add(new UriParameterImpl().setName(keyName).setText(text).setExpression(expression));
+ list.add(new UriParameterImpl().setName(keyName).setText(valueText).setExpression(expression));
return list;
}
- // if there is only a single key in the URI but there are more than one keys defined in the EDM, then reduce
- // the keylist with the keys defined as referential constained.
-
- if (contextUriInfo.getLastUriPathInfo() instanceof UriResourceNavigationPropertyImpl) {
- UriResourceNavigationPropertyImpl nav = (UriResourceNavigationPropertyImpl) contextUriInfo.getLastUriPathInfo();
- EdmNavigationProperty navProp = (EdmNavigationProperty) nav.getNavigationProperty();
- /*
- * if ( navProp.getPartner() != null) {
- * //copy keylist into tmpKeyList
- *
- * EdmEntityType entityType = nav.getType()// TODO check typecast,
- * EdmNavigationProperty navProp2 = entityType.getProperty(navProp.getPartner());
- * for ( EdmRefConstrain constrain : navProp2 ) {
- * //remove constrain.referenceproperty from tmpKeyList
- * }
- *
- * if( tmpKeyList.size==1)
- * String keyName = keyPredicates.get(0);
- * List<UriParameterImpl> list = new ArrayList<UriParameterImpl>();
- * list.add(new UriParameterImpl().setName(keyName).setValue(value));
- * return list;
- * }
- * }
- */
- }
+ // If there is only a single key in the URI but there are more than one keys defined in the EDM, then reduce
+ // The keylist with the keys defined as referential constrained.
+ // TODO add support vor using refential constrains
+ /*
+ * if (contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl) {
+ * UriResourceNavigationPropertyImpl nav =
+ * (UriResourceNavigationPropertyImpl) contextUriInfo.getLastResourcePart();
+ * nav.getNavigationProperty();
+ * }
+ */
throw wrap(new UriParserSyntaxException(
"for using a value only keyPredicate there must be exact ONE defined keyProperty"));
@@ -1311,7 +1207,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public UriParameterImpl visitNameValuePair(NameValuePairContext ctx) {
+ public UriParameterImpl visitNameValuePair(final NameValuePairContext ctx) {
UriParameterImpl uriParameter = new UriParameterImpl();
uriParameter.setName(ctx.vODI.getText());
@@ -1326,32 +1222,38 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public ExpressionImpl visitNowMethodCallExpr(NowMethodCallExprContext ctx) {
+ public ExpressionImpl visitNowMethodCallExpr(final NowMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.NOW);
}
@Override
- public Object visitOdataRelativeUriEOF(OdataRelativeUriEOFContext ctx) {
- // setup context
- this.contextUriInfo = null;
- // visit children
+ public Object visitOdataRelativeUriEOF(final OdataRelativeUriEOFContext ctx) {
+ contextUriInfo = null;
super.visitOdataRelativeUriEOF(ctx);
+ return contextUriInfo;
+ }
- return this.contextUriInfo;
+ @Override
+ public Object visitOrderBy(final OrderByContext ctx) {
+
+ OrderByOptionImpl orderBy = new OrderByOptionImpl();
+ // TODO collect orders
+ // .setExpression((Expression) ctx.children.get(2).accept(this));
+ return orderBy;
}
@Override
- public Object visitPathSegment(PathSegmentContext ctx) {
+ public Object visitPathSegment(final PathSegmentContext ctx) {
- if (contextUriInfo.getLastUriPathInfo() == null ||
- contextUriInfo.getLastUriPathInfo() instanceof UriResourceRootImpl) {
+ if (contextUriInfo.getLastResourcePart() == null ||
+ contextUriInfo.getLastResourcePart() instanceof UriResourceRootImpl) {
readFirstPathInfoSegment(ctx);
} else {
readNextPathInfoSegment(ctx);
}
- UriResourcePartImpl pathInfoSegment = (UriResourcePartImpl) this.contextUriInfo.getLastUriPathInfo();
+ UriResourcePartImpl pathInfoSegment = (UriResourcePartImpl) contextUriInfo.getLastResourcePart();
if (ctx.vlNVO.size() > 0) {
// check for keyPredicates
@@ -1369,7 +1271,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitPathSegments(PathSegmentsContext ctx) {
+ public Object visitPathSegments(final PathSegmentsContext ctx) {
// path segment
for (PathSegmentContext it : ctx.vlPS) {
it.accept(this);
@@ -1383,57 +1285,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitConstSegment(ConstSegmentContext ctx) {
- UriInfoImpl uriInfoResource = this.contextUriInfo;
- UriResourcePart pathInfo = uriInfoResource.getLastUriPathInfo();
+ public Object visitQueryOptions(final QueryOptionsContext ctx) {
- if (ctx.vV != null) {
- if (pathInfo instanceof UriResourcePartTyped) {
- if (!((UriResourcePartTyped) pathInfo).isCollection()) {
- this.contextUriInfo.addPathInfo(new UriResourceValueImpl());
- } else {
- throw wrap(new UriParserSemanticException("$value only allowed on typed path segments"));
- }
- return null;
- } else {
- throw wrap(new UriParserSemanticException("$value only allowed on typed path segments"));
- }
-
- } else if (ctx.vC != null) {
- if (pathInfo instanceof UriResourceImplTyped) {
- if (((UriResourceImplTyped) pathInfo).isCollection()) {
- this.contextUriInfo.addPathInfo(new UriResourceCountImpl());
- } else {
- throw wrap(new UriParserSemanticException("$count only allowed on collection properties"));
- }
- } else {
- throw wrap(new UriParserSemanticException("$count only allowed on typed properties"));
- }
- } else if (ctx.vR != null) {
- if (pathInfo instanceof UriResourceImplTyped) {
- EdmType type = ((UriResourceImplTyped) pathInfo).getType();
- if (type instanceof EdmEntityType) {
- this.contextUriInfo.addPathInfo(new UriResourceRefImpl());
- } else {
- throw wrap(new UriParserSemanticException("$ref only allowd on endity types"));
- }
- } else {
- throw wrap(new UriParserSemanticException("$ref only allowed on typed properties"));
- }
-
- }
- return null;
- }
-
- @Override
- public Object visitQueryOptions(QueryOptionsContext ctx) {
- if (contextType == null) {
- contextType = new Stack<EdmType>();
-
- }
- // contextType.push(this.contextUriInfo.getLastUriPathInfo().getType());
-
- // QueryOptionsList qpList = new QueryOptionsList();
List<QueryOptionImpl> qpList = new ArrayList<QueryOptionImpl>();
for (QueryOptionContext entityOption : ctx.vlQO) {
qpList.add((QueryOptionImpl) entityOption.accept(this));
@@ -1443,35 +1296,59 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitResourcePath(ResourcePathContext ctx) {
+ public Object visitResourcePath(final ResourcePathContext ctx) {
if (ctx.vAll != null) {
- this.contextUriInfo = new UriInfoImpl(edm).setKind(UriInfoKind.all);
+ contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.all);
} else if (ctx.vCJ != null) {
ctx.vCJ.accept(this);
} else if (ctx.vlPS != null) {
- UriInfoImpl uriInfoPath = new UriInfoImpl(edm).setKind(UriInfoKind.resource);
- this.contextUriInfo = uriInfoPath;
+ UriInfoImpl uriInfoPath = new UriInfoImpl().setKind(UriInfoKind.resource);
+ contextUriInfo = uriInfoPath;
super.visitResourcePath(ctx); // visit all children of ctx
}
- return this.contextUriInfo;
+ return contextUriInfo;
+ }
+
+ @Override
+ public Object visitRootExpr(final RootExprContext ctx) {
+ UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
+
+ UriResourceRootImpl pathInfoRoot = new UriResourceRootImpl();
+
+ uriInfoImplpath.addPathInfo(pathInfoRoot);
+
+ if (ctx.vPs != null) {
+ // store the context uriInfoPath
+ UriInfoImpl backupUriInfoPath = contextUriInfo;
+
+ // set temporary uriInfoPath to collect the path information of the memberExpression
+ contextUriInfo = uriInfoImplpath;
+
+ ctx.vPs.accept(this);
+
+ contextUriInfo = backupUriInfoPath;
+ }
+ return new MemberImpl()
+ .setPath(uriInfoImplpath);
+
}
@Override
- public ExpressionImpl visitRoundMethodCallExpr(RoundMethodCallExprContext ctx) {
+ public ExpressionImpl visitRoundMethodCallExpr(final RoundMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.ROUND)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitSecondMethodCallExpr(SecondMethodCallExprContext ctx) {
+ public ExpressionImpl visitSecondMethodCallExpr(final SecondMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.SECOND)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public Object visitSelect(SelectContext ctx) {
+ public Object visitSelect(final SelectContext ctx) {
List<SelectItemOptionImpl> selectItems = new ArrayList<SelectItemOptionImpl>();
for (SelectItemContext si : ctx.vlSI) {
@@ -1482,10 +1359,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitSelectItem(SelectItemContext ctx) {
+ public Object visitSelectItem(final SelectItemContext ctx) {
SelectItemOptionImpl selectItem = new SelectItemOptionImpl();
- selectItem.setEdm(edm);
- selectItem.setStartType(contextType.peek());
contextSelectItem = selectItem;
for (SelectSegmentContext si : ctx.vlSS) {
@@ -1497,7 +1372,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitSelectSegment(SelectSegmentContext ctx) {
+ public Object visitSelectSegment(final SelectSegmentContext ctx) {
if (ctx.vS != null) {
if (ctx.vNS != null) {
@@ -1514,28 +1389,109 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
String odi = ctx.vODI.getText();
if (ctx.vNS == null) {
- contextSelectItem.addProperty(odi);
+ EdmType prevType = contextSelectItem.getType();
+ if (prevType == null) {
+ prevType = this.contextTypes.peek().type;
+ }
+
+ if (!(prevType instanceof EdmStructuralType)) {
+ throw wrap(new UriParserSemanticException("Previous select item is not a structural type"));
+ }
+
+ EdmStructuralType structType = (EdmStructuralType) prevType;
+ EdmElement property = (EdmElement) structType.getProperty(odi);
+ if (property == null) {
+ throw wrap(new UriParserSemanticException("Previous select item has not property: " + odi));
+
+ }
+
+ // create new segment
+ SelectSegmentImpl newSegment = new SelectSegmentImpl().setProperty(property);
+ contextSelectItem.addSegment(newSegment);
+
+ return this;
} else {
String namespace = ctx.vNS.getText();
namespace = namespace.substring(0, namespace.length() - 1);
FullQualifiedName fullName = new FullQualifiedName(namespace, odi);
- contextSelectItem.addQualifiedThing(fullName);
+ // contextSelectItem.addQualifiedThing(fullName);
+
+ EdmType prevType = contextSelectItem.getType();
+ if (prevType != null) { // context types required at least one property
+ if (prevType instanceof EdmComplexType) {
+ EdmComplexType ct = edm.getComplexType(fullName);
+ if (ct != null) {
+ if (((EdmStructuralType) prevType).compatibleTo(ct)) {
+ SelectSegmentImpl lastSegment = contextSelectItem.getLastSegment();
+ lastSegment.setTypeCast(ct);
+ return this;
+ }
+ }
+ }
+ } else {
+ prevType = this.contextTypes.peek().type;
+ if (prevType instanceof EdmEntityType) {
+ EdmEntityType et = edm.getEntityType(fullName);
+ if (((EdmStructuralType) prevType).compatibleTo(et)) {
+ contextSelectItem.setEntityTypeCast(et);
+ return this;
+ }
+ }
+ }
+
+ FullQualifiedName finalTypeName = new FullQualifiedName(prevType.getNamespace(), prevType.getName());
+
+ // check for action
+ EdmAction action = edm.getAction(fullName, finalTypeName, null);
+ // TODO verify that null ignores if it is a collection
+
+ if (action != null) {
+ contextSelectItem.addSegment(new SelectSegmentImpl().setAction(action));
+ }
+
+ // check for function
+ EdmFunction function = edm.getFunction(fullName, finalTypeName, null, null);
+ // TODO verify that null ignores if it is a collection
+
+ if (function != null) {
+ contextSelectItem.addSegment(new SelectSegmentImpl().setFunction(function));
+ }
+
}
return null;
}
+
+ @Override
+ public Object visitSkip(SkipContext ctx) {
+ SkipOptionImpl skiptoken = new SkipOptionImpl();
+
+ String text = ctx.children.get(2).getText();
+
+ return skiptoken.setValue(text).setText(text);
+ }
+
@Override
- public ExpressionImpl visitStartsWithMethodCallExpr(StartsWithMethodCallExprContext ctx) {
+ public Object visitSkiptoken(SkiptokenContext ctx) {
+ SkiptokenOptionImpl skiptoken = new SkiptokenOptionImpl();
+
+ String text = ctx.children.get(2).getText();
+
+ return skiptoken.setValue(text).setText(text);
+ }
+
+ @Override
+ public ExpressionImpl visitStartsWithMethodCallExpr(final StartsWithMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.STARTSWITH)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitSubstringMethodCallExpr(SubstringMethodCallExprContext ctx) {
+ public ExpressionImpl visitSubstringMethodCallExpr(final SubstringMethodCallExprContext ctx) {
MethodCallImpl ret = new MethodCallImpl();
ret.setMethod(SupportedMethodCalls.SUBSTRING);
ret.addParameter((ExpressionImpl) ctx.vE1.accept(this));
@@ -1550,69 +1506,72 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public ExpressionImpl visitTimeMethodCallExpr(TimeMethodCallExprContext ctx) {
+ public ExpressionImpl visitTimeMethodCallExpr(final TimeMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.TIME)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
+
+ @Override
+ public Object visitTop(TopContext ctx) {
+ TopOptionImpl top = new TopOptionImpl();
+
+ String text = ctx.children.get(2).getText();
+
+ return top.setValue(text).setText(text);
+ }
+
@Override
- public ExpressionImpl visitToLowerMethodCallExpr(ToLowerMethodCallExprContext ctx) {
+ public ExpressionImpl visitToLowerMethodCallExpr(final ToLowerMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.TOLOWER)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitTotalOffsetMinutesMethodCallExpr(TotalOffsetMinutesMethodCallExprContext ctx) {
+ public ExpressionImpl visitTotalOffsetMinutesMethodCallExpr(final TotalOffsetMinutesMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.TOTALOFFSETMINUTES)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitTotalsecondsMethodCallExpr(TotalsecondsMethodCallExprContext ctx) {
+ public ExpressionImpl visitTotalsecondsMethodCallExpr(final TotalsecondsMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.TOTALSECONDS)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitToUpperMethodCallExpr(ToUpperMethodCallExprContext ctx) {
+ public ExpressionImpl visitToUpperMethodCallExpr(final ToUpperMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.TOUPPER)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public ExpressionImpl visitTrimMethodCallExpr(TrimMethodCallExprContext ctx) {
+ public ExpressionImpl visitTrimMethodCallExpr(final TrimMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.TRIM)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
- public Object visitUnary(UnaryContext ctx) {
+ public Object visitUnary(final UnaryContext ctx) {
// TODO implement
return super.visitUnary(ctx);
}
@Override
- public ExpressionImpl visitYearMethodCallExpr(YearMethodCallExprContext ctx) {
+ public ExpressionImpl visitYearMethodCallExpr(final YearMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(SupportedMethodCalls.YEAR)
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
- private FullQualifiedName getFullName(NamespaceContext vNS, String odi) {
- if (vNS != null) {
- String namespace = vNS.getText();
- namespace = namespace.substring(0, namespace.length() - 1);
-
- return new FullQualifiedName(namespace, odi);
- }
- return null;
-
+ private ParseCancellationException wrap(final UriParserException uriParserException) {
+ return new ParseCancellationException(uriParserException);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java
index f4780c3..e766d68 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java
@@ -23,16 +23,14 @@ public class UriParserException extends Exception {
/**
*
*/
- private static final long serialVersionUID = -1813203179082217112L;
+ private static final long serialVersionUID = 1L;
- public UriParserException(String message, Throwable cause) {
+ public UriParserException(final String message, final Throwable cause) {
super(message, cause);
}
- public UriParserException(String message) {
+ public UriParserException(final String message) {
super(message, null);
}
-
-
}
[2/6] [OLINGO-63] Uri Parser: Add test cases for key predicates,
select, expand and code cleanup
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectSegmentImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectSegmentImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectSegmentImpl.java
new file mode 100644
index 0000000..7fbad91
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectSegmentImpl.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri.queryoption;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmAction;
+import org.apache.olingo.odata4.commons.api.edm.EdmElement;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
+import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+
+public class SelectSegmentImpl {
+
+ private EdmElement property;
+ private EdmAction action;
+ private EdmFunction function;
+
+ private EdmType typeCast;
+
+ public EdmElement getProperty() {
+ return property;
+ }
+
+ public SelectSegmentImpl setProperty(final EdmElement property) {
+ this.property = property;
+
+ return this;
+ }
+
+ public EdmType getType() {
+ return property.getType();
+ }
+
+ public EdmType getTypeCast() {
+ return typeCast;
+ }
+
+ public SelectSegmentImpl setTypeCast(final EdmStructuralType type) {
+ typeCast = type;
+ return this;
+ }
+
+
+
+ public EdmAction getAction() {
+ return action;
+ }
+
+ public SelectSegmentImpl setAction(EdmAction action) {
+ this.action = action;
+ return this;
+ }
+
+ public EdmFunction getFunction() {
+ return function;
+ }
+
+ public SelectSegmentImpl setFunction(EdmFunction function) {
+ this.function = function;
+ return this;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipOptionImpl.java
index 80cf37f..7a43666 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipOptionImpl.java
@@ -20,30 +20,26 @@
package org.apache.olingo.odata4.producer.core.uri.queryoption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-/*TODO implement*/
+/* TODO implement */
public class SkipOptionImpl extends SystemQueryOptionImpl implements SkipOption {
- private boolean isMax;
private String value;
public SkipOptionImpl() {
- setKind(SystemQueryOptionEnum.SEARCH);
+ setKind(SupportedQueryOptions.SKIP);
}
-
+
+ @Override
public String getValue() {
return value;
}
- public SkipOptionImpl setValue(String value) {
+
+ public SkipOptionImpl setValue(final String value) {
this.value = value;
return this;
}
- @Override
- public String getSkipValue() {
- // TODO Auto-generated method stub
- return null;
- }
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipTokenOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipTokenOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipTokenOptionImpl.java
deleted file mode 100644
index 78f222d..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipTokenOptionImpl.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri.queryoption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipTokenOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
-
-/*TODO implement*/
-public class SkipTokenOptionImpl extends SystemQueryOptionImpl implements SkipTokenOption{
- private boolean isMax;
- private String token;
-
- public SkipTokenOptionImpl() {
- setKind(SystemQueryOptionEnum.SEARCH);
- }
-
- public String getToken() {
- return token;
- }
-
- public SkipTokenOptionImpl
- setToken( String token) {
- this.token = token;
- return this;
- }
-
- @Override
- public String getSkipTokenValue() {
- // TODO Auto-generated method stub
- return null;
- }
-
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkiptokenOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkiptokenOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkiptokenOptionImpl.java
new file mode 100644
index 0000000..67ce8a7
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkiptokenOptionImpl.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri.queryoption;
+
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SkiptokenOption;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
+
+/* TODO implement */
+public class SkiptokenOptionImpl extends SystemQueryOptionImpl implements SkiptokenOption {
+ private String skipTokenValue;
+
+ public SkiptokenOptionImpl() {
+ setKind(SupportedQueryOptions.SKIPTOKEN);
+ }
+
+
+ @Override
+ public String getValue() {
+ return skipTokenValue;
+ }
+
+ public SkiptokenOptionImpl setValue(String skipTokenValue) {
+ this.skipTokenValue = skipTokenValue;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOptionImpl.java
index c855d80..388b712 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOptionImpl.java
@@ -19,31 +19,24 @@
package org.apache.olingo.odata4.producer.core.uri.queryoption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
+public class SystemQueryOptionImpl extends QueryOptionImpl implements SystemQueryOption {
-public class SystemQueryOptionImpl extends QueryOptionImpl implements SystemQueryOption{
+ private SupportedQueryOptions kind;
- private SystemQueryOptionEnum kind;
-
@Override
- public SystemQueryOptionEnum getKind() {
+ public SupportedQueryOptions getKind() {
return kind;
}
-
- void setKind(SystemQueryOptionEnum kind) {
+ void setKind(final SupportedQueryOptions kind) {
this.kind = kind;
}
-
-
@Override
public String getName() {
return kind.toString();
}
-
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/TopOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/TopOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/TopOptionImpl.java
index dff7cec..9d6f7d6 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/TopOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/TopOptionImpl.java
@@ -19,24 +19,22 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
import org.apache.olingo.odata4.producer.api.uri.queryoption.TopOption;
-/*TODO implement*/
+/* TODO implement */
public class TopOptionImpl extends SystemQueryOptionImpl implements TopOption {
- private boolean isMax;
private String value;
public TopOptionImpl() {
- setKind(SystemQueryOptionEnum.TOP);
+ setKind(SupportedQueryOptions.TOP);
}
public String getValue() {
return value;
}
-
- public TopOptionImpl setValue(String value) {
+
+ public TopOptionImpl setValue(final String value) {
this.value = value;
return this;
}
@@ -46,5 +44,5 @@ public class TopOptionImpl extends SystemQueryOptionImpl implements TopOption {
// TODO Auto-generated method stub
return null;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java
index 7b42317..30f7a08 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java
@@ -18,16 +18,20 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
+
public class AliasImpl extends ExpressionImpl {
private String referenceName;
- public void setReference(String referenceName) {
+ public void setReference(final String referenceName) {
this.referenceName = referenceName;
}
@Override
- public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
return visitor.visitAlias(referenceName);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/BinaryImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/BinaryImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/BinaryImpl.java
index bf22f39..480abcb 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/BinaryImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/BinaryImpl.java
@@ -18,11 +18,14 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.BinaryExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
-public class BinaryImpl extends ExpressionImpl implements BinaryExpression, VisitableExression {
+public class BinaryImpl extends ExpressionImpl implements BinaryExpression {
private SupportedBinaryOperators operator;
private ExpressionImpl left;
@@ -33,7 +36,7 @@ public class BinaryImpl extends ExpressionImpl implements BinaryExpression, Visi
return operator;
}
- public BinaryExpression setOperator(SupportedBinaryOperators operator) {
+ public BinaryExpression setOperator(final SupportedBinaryOperators operator) {
this.operator = operator;
return this;
}
@@ -43,8 +46,8 @@ public class BinaryImpl extends ExpressionImpl implements BinaryExpression, Visi
return left;
}
- public void setLeftOperand(ExpressionImpl operand) {
- this.left = operand;
+ public void setLeftOperand(final ExpressionImpl operand) {
+ left = operand;
}
@Override
@@ -52,13 +55,13 @@ public class BinaryImpl extends ExpressionImpl implements BinaryExpression, Visi
return right;
}
- public void setRightOperand(ExpressionImpl operand) {
- this.right = operand;
+ public void setRightOperand(final ExpressionImpl operand) {
+ right = operand;
}
@Override
- public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
T left = this.left.accept(visitor);
T right = this.right.accept(visitor);
return visitor.visitBinaryOperator(operator, left, right);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExceptionVisitExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExceptionVisitExpression.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExceptionVisitExpression.java
deleted file mode 100644
index c0ff338..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExceptionVisitExpression.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
-
-public class ExceptionVisitExpression extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 822365726050299076L;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionImpl.java
index 0bdb71f..0854630 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionImpl.java
@@ -20,12 +20,6 @@ package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-public class ExpressionImpl implements Expression, VisitableExression {
-
- @Override
- public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
- // TODO Auto-generated method stub
- return null;
- }
+public abstract class ExpressionImpl implements Expression {
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionVisitor.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionVisitor.java
deleted file mode 100644
index 6283865..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionVisitor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedUnaryOperators;
-
-public interface ExpressionVisitor<T> {
-
- T visitBinaryOperator(SupportedBinaryOperators operator, T left, T right) throws ExceptionVisitExpression;
-
- T visitUnaryOperator(SupportedUnaryOperators operator, T operand) throws ExceptionVisitExpression;
-
- T visitMethodCall(SupportedMethodCalls methodCall, List<T> parameters) throws ExceptionVisitExpression;
-
- T visitLiteral(String literal) throws ExceptionVisitExpression;
-
- T visitMember(MemberImpl member) throws ExceptionVisitExpression;
-
- T visitAlias(String referenceName) throws ExceptionVisitExpression;
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java
index 665af59..dc9063f 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java
@@ -18,27 +18,30 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.LambdaRef;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
public class LambdaRefImpl extends ExpressionImpl implements LambdaRef, VisitableExression {
private String variableText;
@Override
- public String getVariableText() {
+ public String getVariableName() {
return variableText;
}
- public LambdaRefImpl setVariableText(String text) {
- this.variableText = text;
+ public LambdaRefImpl setVariableText(final String text) {
+ variableText = text;
return this;
}
@Override
- public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
- return null;
- }
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
-
+ return visitor.visitLambdaReference(variableText);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LiteralImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LiteralImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LiteralImpl.java
index eade6b7..0057bf0 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LiteralImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LiteralImpl.java
@@ -18,7 +18,11 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Literal;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
public class LiteralImpl extends ExpressionImpl implements Literal, VisitableExression {
@@ -29,13 +33,13 @@ public class LiteralImpl extends ExpressionImpl implements Literal, VisitableExr
return text;
}
- public LiteralImpl setText(String text) {
+ public LiteralImpl setText(final String text) {
this.text = text;
return this;
}
@Override
- public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
return visitor.visitLiteral(text);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java
index 56ff31d..641ed7e 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java
@@ -18,37 +18,30 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Member;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
public class MemberImpl extends ExpressionImpl implements Member, VisitableExression {
- private boolean isIT; // means $it as defined in the ABNF
private UriInfoResource path;
@Override
- public boolean isIT() {
- return isIT;
- }
-
- public Member setIT(boolean isIT) {
- this.isIT = isIT;
- return this;
- }
-
- @Override
public UriInfoResource getPath() {
return path;
}
- public Member setPath(UriInfoResource pathSegments) {
- this.path = pathSegments;
+ public Member setPath(final UriInfoResource pathSegments) {
+ path = pathSegments;
return this;
}
@Override
- public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
- return visitor.visitMember(this);
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ return visitor.visitMember(path);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MethodCallImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MethodCallImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MethodCallImpl.java
index f8c666d..a9d4022 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MethodCallImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MethodCallImpl.java
@@ -21,43 +21,47 @@ package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
import java.util.ArrayList;
import java.util.List;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.MethodCall;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
-public class MethodCallImpl extends ExpressionImpl implements MethodCall, VisitableExression{
+public class MethodCallImpl extends ExpressionImpl implements MethodCall, VisitableExression {
private SupportedMethodCalls method;
private List<ExpressionImpl> parameters = new ArrayList<ExpressionImpl>();
-
+
@Override
public SupportedMethodCalls getMethod() {
return method;
}
- public MethodCallImpl setMethod(SupportedMethodCalls methodCalls) {
- this.method = methodCalls;
+ public MethodCallImpl setMethod(final SupportedMethodCalls methodCalls) {
+ method = methodCalls;
return this;
}
-
+
@Override
public List<Expression> getParameters() {
List<Expression> list = new ArrayList<Expression>();
- for ( ExpressionImpl item : parameters) {
+ for (ExpressionImpl item : parameters) {
list.add(item);
}
return list;
}
- public MethodCallImpl addParameter(ExpressionImpl readCommonExpression) {
+ public MethodCallImpl addParameter(final ExpressionImpl readCommonExpression) {
parameters.add(readCommonExpression);
return this;
}
@Override
- public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
List<T> userParameters = new ArrayList<T>();
- for (ExpressionImpl parameter : parameters ) {
+ for (ExpressionImpl parameter : parameters) {
userParameters.add(parameter.accept(visitor));
}
return visitor.visitMethodCall(method, userParameters);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/TypeLiteralImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/TypeLiteralImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/TypeLiteralImpl.java
index e74ff76..e0a43ce 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/TypeLiteralImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/TypeLiteralImpl.java
@@ -19,7 +19,11 @@
package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.TypeLiteral;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
public class TypeLiteralImpl extends ExpressionImpl implements TypeLiteral, VisitableExression {
@@ -29,17 +33,15 @@ public class TypeLiteralImpl extends ExpressionImpl implements TypeLiteral, Visi
public EdmType getType() {
return type;
}
-
- public TypeLiteralImpl setType(EdmType type) {
+
+ public TypeLiteralImpl setType(final EdmType type) {
this.type = type;
return this;
}
@Override
- public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
- return null;
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ return visitor.visitTypeLiteral(type);
}
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryOperatorImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryOperatorImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryOperatorImpl.java
index 98da4ba..8ec6ecb 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryOperatorImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryOperatorImpl.java
@@ -18,9 +18,13 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedUnaryOperators;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.UnaryOperator;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
public class UnaryOperatorImpl extends ExpressionImpl implements UnaryOperator, VisitableExression {
@@ -32,7 +36,7 @@ public class UnaryOperatorImpl extends ExpressionImpl implements UnaryOperator,
return operator;
}
- public void setOperator(SupportedUnaryOperators operator) {
+ public void setOperator(final SupportedUnaryOperators operator) {
this.operator = operator;
}
@@ -41,12 +45,12 @@ public class UnaryOperatorImpl extends ExpressionImpl implements UnaryOperator,
return expression;
}
- public void setOperand(ExpressionImpl expression) {
+ public void setOperand(final ExpressionImpl expression) {
this.expression = expression;
}
@Override
- public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
T operand = expression.accept(visitor);
return visitor.visitUnaryOperator(operator, operand);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/VisitableExression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/VisitableExression.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/VisitableExression.java
deleted file mode 100644
index e4a2235..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/VisitableExression.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
-
-
-
-
-
-
-
-
-/* TODO update documentation*/
-public interface VisitableExression {
-
- /**
- * Method {@link #accept(ExpressionVisitor)} is called when traversing the expression tree. This method is invoked on
- * each
- * expression used as node in an expression tree. The implementations should
- * behave as follows:
- * <li>Call accept on all sub nodes and store the returned Objects
- * <li>Call the appropriate method on the {@link ExpressionVisitor} instance and provide the stored objects to that
- * instance
- * <li>Return the object which should be passed to the processing algorithm of the parent expression node
- * <br>
- * <br>
- * @param visitor
- * Object ( implementing {@link ExpressionVisitor}) whose methods are called during traversing a expression node of
- * the expression tree.
- * @return
- * Object which should be passed to the processing algorithm of the parent expression node
- * @throws ExceptionVisitExpression
- * Exception occurred the OData library while traversing the tree
- * @throws ODataApplicationException
- * Exception thrown by the application who implemented the visitor
- */
- <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression;
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
index 38adef0..1bcd351 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
@@ -674,7 +674,7 @@ public class EdmTechProvider extends EdmProvider {
propertyDecimal, propertySingle, propertyDouble,
propertyDuration, propertyGuid, propertyInt16,
propertyInt32, propertyInt64, propertySByte,
- propertyTimeOfDay/* ,TODO propertyStream */));
+ propertyTimeOfDay/* TODO add steam property */));
} else if (complexTypeName.equals(nameCTCollAllPrim)) {
return new ComplexType()
@@ -688,7 +688,7 @@ public class EdmTechProvider extends EdmProvider {
collPropertyDecimal, collPropertyBinary,
collPropertyDate, collPropertyDateTimeOffset,
collPropertyDuration, collPropertyGuid,
- collPropertyTimeOfDay /* ,TODO collectionPropertyStream */));
+ collPropertyTimeOfDay /* TODO add collectionPropertyStream */));
} else if (complexTypeName.equals(nameCTTwoPrim)) {
return new ComplexType()
@@ -1089,7 +1089,7 @@ public class EdmTechProvider extends EdmProvider {
propertySingle, propertyDouble,
propertyDecimal, propertyBinary, propertyDate,
propertyDateTimeOffset,
- propertyDuration, propertyGuid, propertyTimeOfDay /* TODO add stream */,
+ propertyDuration, propertyGuid, propertyTimeOfDay /* TODO add stream property */,
collPropertyString, collPropertyBoolean,
collPropertyByte, collPropertySByte,
collPropertyInt16,
@@ -1097,7 +1097,7 @@ public class EdmTechProvider extends EdmProvider {
collPropertySingle, collPropertyDouble,
collPropertyDecimal, collPropertyBinary, collPropertyDate,
collPropertyDateTimeOffset,
- collPropertyDuration, collPropertyGuid, collPropertyTimeOfDay /* TODO add stream, */));
+ collPropertyDuration, collPropertyGuid, collPropertyTimeOfDay /* TODO add stream property */));
} else if (entityTypeName.equals(nameETKeyNav)) {
return new EntityType()
@@ -1374,6 +1374,15 @@ public class EdmTechProvider extends EdmProvider {
.setName("UFCRTStringTwoParam")
.setParameters(Arrays.asList(
new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameString)),
+ new Function()
+ .setName("UFCRTStringTwoParam")
+ .setParameters(Arrays.asList(
+ new Parameter()
.setName("ParameterString")
.setType(nameString),
new Parameter()
@@ -1382,6 +1391,7 @@ public class EdmTechProvider extends EdmProvider {
.setComposable(true)
.setReturnType(
new ReturnType().setType(nameString))
+
);
} else if (functionName.equals(nameUFCRTESTwoKeyNavParam)) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandToText.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandToText.java
deleted file mode 100644
index d9926ce..0000000
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandToText.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.testutil;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmElement;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExceptionVisitExpand;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandVisitor;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
-
-
-public class ExpandToText implements ExpandVisitor<String> {
-
- public static String Serialize(ExpandOptionImpl expand) throws ExceptionVisitExpand {
- return expand.accept(new ExpandToText());
- }
-
- @Override
- public String visitExpandSegment(EdmElement property, EdmType initialType, EdmType finalType) {
-
- return "<" + property.getName() + "(" + finalType.getNamespace() + "/" + finalType.getName() + ">";
- }
-
- @Override
- public String visitExpandItem(List<String> expandSegments, boolean isStar, boolean isRef, EdmType finalType) {
- String tmp = "";
- for (String expandItem : expandSegments) {
- if (tmp.length() != 0) {
- tmp += ",";
- }
- tmp += expandItem;
- }
- return "<(" + tmp + ")>";
- }
-
- @Override
- public String visitExpand(List<String> expandItems) {
- String tmp = "";
-
- for (String expandItem : expandItems) {
- if (tmp.length() != 0) {
- tmp += ",";
- }
- tmp += expandItem;
- }
- return "<(" + tmp + ")>";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java
new file mode 100644
index 0000000..324fd6f
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.testutil;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.producer.api.uri.UriResourcePart;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceRef;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandItem;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceNavigationPropertyImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.LevelExpandOptionImpl;
+
+public class ExpandValidator implements Validator{
+ private Edm edm;
+ private Validator invokedByValidator;
+ private int expandItemIndex;
+ private ExpandOptionImpl expandOption;
+ private ExpandItem expandItem;
+
+ // --- Setup ---
+
+ public ExpandValidator setUpValidator(Validator parentValidator) {
+ this.invokedByValidator = parentValidator;
+ return this;
+ }
+
+
+ public ExpandValidator setExpand(ExpandOptionImpl expand) {
+ this.expandOption = expand;
+ first();
+ return this;
+ }
+
+ public ExpandValidator setEdm(final Edm edm) {
+ this.edm = edm;
+ return this;
+ }
+
+ // --- Navigation ---
+
+ public UriResourceValidator goPath() {
+ UriInfoImpl uriInfo = (UriInfoImpl) expandItem.getPath();
+
+
+ if (uriInfo.getKind() != UriInfoKind.resource) {
+ fail("goPath can only be used on resourcePaths");
+ }
+
+ return new UriResourceValidator()
+ .setUpValidator(this)
+ .setEdm(edm)
+ .setUriInfoImplPath(uriInfo);
+
+ }
+
+ public ExpandValidator goExpand() {
+ ExpandValidator val = new ExpandValidator();
+ val.setExpand( (ExpandOptionImpl)expandItem.getExpand());
+ val.setUpValidator(this);
+ return val;
+ }
+
+ public ExpandValidator goUpExpandValidator() {
+ return (ExpandValidator) invokedByValidator;
+ }
+
+ public UriResourceValidator goUpUriResValidator() {
+ return (UriResourceValidator) invokedByValidator;
+ }
+
+ public ExpandValidator first() {
+ expandItemIndex = 0;
+ expandItem = expandOption.getExpandItems().get(expandItemIndex);
+ return this;
+ }
+
+ public ExpandValidator n() {
+ expandItemIndex++;
+
+ try {
+ expandItem = expandOption.getExpandItems().get(expandItemIndex);
+ } catch (IndexOutOfBoundsException ex) {
+ fail("not enought segemnts");
+ }
+ return this;
+
+ }
+
+ public ExpandValidator isSegStar(int index) {
+ assertEquals(true, expandItem.isStar());
+ return this;
+ }
+
+ public ExpandValidator isSegRef(int index) {
+ assertEquals(true, expandItem.isRef());
+ return this;
+ }
+
+
+
+
+ public ExpandValidator isLevels(String text) {
+ LevelExpandOptionImpl obj = (LevelExpandOptionImpl) expandItem.getLevel();
+ assertEquals(text, obj.getText());
+ return this;
+ }
+
+ public ExpandValidator isSkipText(String string) {
+ // TODO Auto-generated method stub
+ return this;
+ }
+
+ public ExpandValidator isTopText(String string) {
+ // TODO Auto-generated method stub
+ return this;
+ }
+
+ public ExpandValidator isCountText(String string) {
+ // TODO Auto-generated method stub
+ return this;
+ }
+
+ public ExpandValidator isSegCount(int i) {
+ // TODO Auto-generated method stub
+ return this;
+ }
+
+ public ExpandValidator isSelectText(String string) {
+ // TODO Auto-generated method stub
+ return this;
+ }
+
+ public ExpandValidator isLevelsText(String string) {
+
+ return this;
+ }
+
+ public ExpandValidator isFilterSerialized(String serialized) {
+ FilterOptionImpl filter = (FilterOptionImpl) expandItem.getFilter();
+
+ try {
+ String tmp = FilterTreeToText.Serialize(filter);
+ assertEquals(serialized, tmp);
+ } catch (ExceptionVisitExpression e) {
+ fail(e.getMessage());
+ } catch (ODataApplicationException e) {
+ fail(e.getMessage());
+ }
+
+ return this;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterTreeToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterTreeToText.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterTreeToText.java
index d3f933c..1d8749e 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterTreeToText.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterTreeToText.java
@@ -18,22 +18,43 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.testutil;
+import static org.junit.Assert.fail;
+
import java.util.List;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.producer.api.uri.UriResourcePart;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceIt;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceCount;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceAction;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceAll;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceAny;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceEntitySet;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceFunction;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceNavigation;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceProperty;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceSingleton;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceRef;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceRoot;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceValue;
+
+import org.apache.olingo.odata4.producer.api.uri.queryoption.FilterOption;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedUnaryOperators;
-import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.MemberImpl;
-
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceActionImpl;
public class FilterTreeToText implements ExpressionVisitor<String> {
-
- public static String Serialize(FilterOptionImpl filter) throws ExceptionVisitExpression {
- return filter.getExpression().accept(new FilterTreeToText());
+
+ public static String Serialize(FilterOption filter) throws ExceptionVisitExpression, ODataApplicationException {
+ Expression expression = filter.getExpression();
+ return expression.accept(new FilterTreeToText());
}
@Override
@@ -68,15 +89,34 @@ public class FilterTreeToText implements ExpressionVisitor<String> {
}
@Override
- public String visitMember(MemberImpl member) throws ExceptionVisitExpression {
+ public String visitMember(UriInfoResource resource) throws ExceptionVisitExpression, ODataApplicationException {
String ret = "";
- if (member.isIT()) {
- ret += "$it";
- }
- UriInfoImpl path = (UriInfoImpl) member.getPath();
- if (path != null) {
- ret += path.toString();
+ UriInfoResource path = resource;
+
+ for (UriResourcePart item : path.getUriResourceParts()) {
+ String tmp = "";
+ if (item instanceof UriResourceIt) {
+ if (((UriResourceIt) item).isExplicitIt()) {
+ tmp = "$it";
+ }
+ } else if ( item instanceof UriResourceAll) {
+ UriResourceAll all = (UriResourceAll) item;
+ tmp = visitLambdaExpression(all.getLamdaVariable(), all.getExpression());
+ } else if ( item instanceof UriResourceAny) {
+ UriResourceAny any = (UriResourceAny) item;
+ tmp = visitLambdaExpression(any.getLamdaVariable(), any.getExpression());
+ } else {
+ tmp = item.toString();
+ }
+
+
+
+ if (ret.length() != 0) {
+ ret += "/";
+ }
+ ret += tmp;
+
}
return ret;
}
@@ -86,4 +126,21 @@ public class FilterTreeToText implements ExpressionVisitor<String> {
return "<" + referenceName + ">";
}
+ @Override
+ public String visitLambdaExpression(String variableText, Expression expression)
+ throws ExceptionVisitExpression, ODataApplicationException {
+ return "<" + variableText + ";" + expression.accept(this) + ">";
+ }
+
+ @Override
+ public String visitTypeLiteral(EdmType type) {
+ return type.toString();
+ }
+
+ @Override
+ public String visitLambdaReference(String variableText) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
index e3673e6..47d1e00 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
@@ -22,13 +22,14 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.producer.core.uri.ParserAdapter;
import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
import org.apache.olingo.odata4.producer.core.uri.UriParserException;
import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExceptionVisitExpression;
public class FilterValidator implements Validator {
private Edm edm;
@@ -167,6 +168,9 @@ public class FilterValidator implements Validator {
} catch (ExceptionVisitExpression e) {
fail("Exception occured while converting the filterTree into text" + "\n"
+ " Exception: " + e.getMessage());
+ } catch (ODataApplicationException e) {
+ fail("Exception occured while converting the filterTree into text" + "\n"
+ + " Exception: " + e.getMessage());
}
return this;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
index ee25df4..411e433 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
@@ -28,12 +28,14 @@ import org.apache.olingo.odata4.commons.api.edm.Edm;
import org.apache.olingo.odata4.commons.api.edm.EdmElement;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
import org.apache.olingo.odata4.producer.api.uri.UriInfo;
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
import org.apache.olingo.odata4.producer.api.uri.UriParameter;
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.producer.core.uri.ParserAdapter;
import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
import org.apache.olingo.odata4.producer.core.uri.UriParserException;
@@ -50,7 +52,7 @@ import org.apache.olingo.odata4.producer.core.uri.UriResourcePropertyImpl;
import org.apache.olingo.odata4.producer.core.uri.UriResourceSimplePropertyImpl;
import org.apache.olingo.odata4.producer.core.uri.UriResourceSingletonImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
public class UriResourceValidator implements Validator {
@@ -63,7 +65,7 @@ public class UriResourceValidator implements Validator {
// --- Setup ---
- public UriResourceValidator setUriValidator(UriValidator uriValidator) {
+ public UriResourceValidator setUpValidator(Validator uriValidator) {
invokedBy = uriValidator;
return this;
}
@@ -106,23 +108,24 @@ public class UriResourceValidator implements Validator {
return (UriValidator) invokedBy;
}
- public UriResourceValidator at(int index) {
- uriResourceIndex = index;
- try {
- uriPathInfo = (UriResourcePartImpl) uriInfo.getUriResourceParts().get(index);
- } catch (IndexOutOfBoundsException ex) {
- fail("not enought segemnts");
+ public ExpandValidator goUpExpandValidator() {
+ return (ExpandValidator) invokedBy;
+ }
+
+ public ExpandValidator goExpand() {
+
+ ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
+ if (expand == null) {
+ fail("goExpand can only be used if there is an expand option");
}
- return this;
+
+ return new ExpandValidator().setUpValidator(this).setExpand(expand);
}
public UriResourceValidator first() {
uriResourceIndex = 0;
- try {
- uriPathInfo = (UriResourcePartImpl) uriInfo.getUriResourceParts().get(0);
- } catch (IndexOutOfBoundsException ex) {
- fail("not enought segemnts");
- }
+ uriPathInfo = (UriResourcePartImpl) uriInfo.getUriResourceParts().get(0);
+
return this;
}
@@ -150,6 +153,16 @@ public class UriResourceValidator implements Validator {
return this;
}
+ public UriResourceValidator at(int index) {
+ uriResourceIndex = index;
+ try {
+ uriPathInfo = (UriResourcePartImpl) uriInfo.getUriResourceParts().get(index);
+ } catch (IndexOutOfBoundsException ex) {
+ fail("not enought segemnts");
+ }
+ return this;
+ }
+
// --- Validation ---
public UriResourceValidator isTypeFilter(FullQualifiedName expectedType) {
@@ -275,6 +288,8 @@ public class UriResourceValidator implements Validator {
assertEquals(expectedFilterTreeAsString, filterTreeAsString);
} catch (ExceptionVisitExpression e) {
fail("isFilterString: Exception " + e.getMessage() + " occured");
+ } catch (ODataApplicationException e) {
+ fail("isFilterString: Exception " + e.getMessage() + " occured");
}
return this;
@@ -293,7 +308,7 @@ public class UriResourceValidator implements Validator {
return this;
}
-
+
public UriResourceValidator isParameter(int index, String name, String text) {
if (!(uriPathInfo instanceof UriResourceFunctionImpl)) {
// TODO add and "or" for FunctionImports
@@ -360,7 +375,7 @@ public class UriResourceValidator implements Validator {
assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunction().getName());
return this;
}
-
+
public UriResourceValidator isFunctionImport(String name) {
assertEquals(UriResourceKind.function, uriPathInfo.getKind());
assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunctionImport().getName());
@@ -415,8 +430,36 @@ public class UriResourceValidator implements Validator {
public UriResourceValidator isNav(String name) {
assertEquals(UriResourceKind.navigationProperty, uriPathInfo.getKind());
assertEquals(name, ((UriResourceNavigationPropertyImpl) uriPathInfo).getNavigationProperty().getName());
- // assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
return this;
}
+ public UriResourceValidator isIt() {
+ assertEquals(UriResourceKind.it, uriPathInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isTopText(String topText) {
+ assertEquals(topText,uriInfo.getTopOption().getText());
+ return this;
+ }
+
+ public UriResourceValidator isFormatText(String formatText) {
+ assertEquals(formatText,uriInfo.getFormatOption().getText());
+ return this;
+ }
+
+ public UriResourceValidator isInlineCountText(String inlineCountText) {
+ assertEquals(inlineCountText,uriInfo.getInlineCountOption().getText());
+ return this;
+ }
+
+ public UriResourceValidator isSkipText(String skipText) {
+ assertEquals(skipText,uriInfo.getSkipOption().getText());
+ return this;
+ }
+
+ public UriResourceValidator isSkipTokenText(String skipTokenText) {
+ assertEquals(skipTokenText,uriInfo.getSkipTokenOption().getText());
+ return this;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
index 8054085..c308ac6 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
@@ -67,7 +67,7 @@ public class UriValidator implements Validator {
}
return new UriResourceValidator()
- .setUriValidator(this)
+ .setUpValidator(this)
.setEdm(edm)
.setUriInfoImplPath(uriInfo);
}
[5/6] [OLINGO-63] Uri Parser: Add test cases for key predicates,
select, expand and code cleanup
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java
index db9f3f9..55056de 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java
@@ -19,18 +19,18 @@
package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
public enum SupportedMethodCalls {
- CONTAINS("contains"),STARTSWITH("startswith"),ENDSWITH("endswith"),LENGTH("length"),
- INDEXOF("indexof"),SUBSTRING("substring"),TOLOWER("tolower"),TOUPPER("toupper"),TRIM("trim"),
+ CONTAINS("contains"), STARTSWITH("startswith"), ENDSWITH("endswith"), LENGTH("length"),
+ INDEXOF("indexof"), SUBSTRING("substring"), TOLOWER("tolower"), TOUPPER("toupper"), TRIM("trim"),
CONCAT("concat"),
-
- YEAR("year"),MONTH("month"),DAY("day"),HOUR("hour"),MINUTE("minute"),SECOND("second"),
- FRACTIONALSECOND("fractionalsecond"),TOTALSECONDS("totalseconds"),DATE("date"),TIME("time"),
- TOTALOFFSETMINUTES("totaloffsetminutes"),MINDATETIME("mindatetime"),MAXDATETIME("maxdatetime"),NOW("now"),
-
- ROUND("round"),FLOOR("floor"),
-
-
- CEILING("ceiling"),DISTANCE("distance"),GEOLENGTH("geolength"),INTERSECTS("intersects"), CAST("cast"), ISOF("isof");
+
+ YEAR("year"), MONTH("month"), DAY("day"), HOUR("hour"), MINUTE("minute"), SECOND("second"),
+ FRACTIONALSECOND("fractionalsecond"), TOTALSECONDS("totalseconds"), DATE("date"), TIME("time"),
+ TOTALOFFSETMINUTES("totaloffsetminutes"), MINDATETIME("mindatetime"), MAXDATETIME("maxdatetime"), NOW("now"),
+
+ ROUND("round"), FLOOR("floor"),
+
+ CEILING("ceiling"), DISTANCE("distance"), GEOLENGTH("geolength"), INTERSECTS("intersects"), CAST("cast"),
+ ISOF("isof");
private String syntax;
@@ -43,9 +43,9 @@ public enum SupportedMethodCalls {
return syntax;
}
- public static SupportedMethodCalls get(String operator) {
+ public static SupportedMethodCalls get(final String operator) {
for (SupportedMethodCalls op : SupportedMethodCalls.values()) {
- if (op.toString().equals(operator+'(')) {
+ if (op.toString().equals(operator + '(')) {
return op;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedUnaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedUnaryOperators.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedUnaryOperators.java
index ed6abaa..cd4a932 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedUnaryOperators.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedUnaryOperators.java
@@ -32,7 +32,7 @@ public enum SupportedUnaryOperators {
return syntax;
}
- public static SupportedUnaryOperators get(String operator) {
+ public static SupportedUnaryOperators get(final String operator) {
for (SupportedUnaryOperators op : SupportedUnaryOperators.values()) {
if (op.toString().equals(operator)) {
return op;
@@ -40,5 +40,5 @@ public enum SupportedUnaryOperators {
}
return null;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/TypeLiteral.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/TypeLiteral.java
index 96cc228..4aa6bcf 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/TypeLiteral.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/TypeLiteral.java
@@ -20,10 +20,8 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
-public interface TypeLiteral {
-
- public EdmType getType();
-
+public interface TypeLiteral extends Expression {
+ public EdmType getType();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/UnaryOperator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/UnaryOperator.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/UnaryOperator.java
index 6e85d6b..62d935c 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/UnaryOperator.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/UnaryOperator.java
@@ -18,10 +18,10 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
-public interface UnaryOperator {
+public interface UnaryOperator extends Expression {
- public abstract Expression getOperand();
+ public Expression getOperand();
- public abstract SupportedUnaryOperators getOperator();
+ public SupportedUnaryOperators getOperator();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/VisitableExression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/VisitableExression.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/VisitableExression.java
new file mode 100644
index 0000000..ab31dd7
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/VisitableExression.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+
+public interface VisitableExression {
+
+ /**
+ * Method {@link #accept(ExpressionVisitor)} is called when traversing the expression tree. This method is invoked on
+ * each expression used as node in an expression tree. The implementations should
+ * behave as follows:
+ * <li>Call accept on all sub nodes and store the returned Objects which are of the generic type T
+ * <li>Call the appropriate method on the {@link ExpressionVisitor} instance and provide the stored return objects
+ * to that instance
+ * <li>Return the object which should be passed to the processing algorithm of the parent expression node
+ * <br>
+ * <br>
+ * @param visitor
+ * Object (implementing {@link ExpressionVisitor}) whose methods are called during traversing a
+ * expression node of the expression tree.
+ * @return
+ * Object of type T which should be passed to the processing algorithm of the parent expression node
+ * @throws ExceptionVisitExpression
+ * Exception occurred the OData library while traversing the tree
+ * @throws ODataApplicationException
+ * Exception thrown by the application who implemented the visitor
+ */
+ <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException;
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchBinary.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchBinary.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchBinary.java
index b3fe8ce..c6b123b 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchBinary.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchBinary.java
@@ -25,4 +25,5 @@ public interface SearchBinary extends SearchExpression {
SearchExpression getLeftOperand();
SearchExpression getRightOperand();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchTerm.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchTerm.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchTerm.java
index 07a35cd..7979917 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchTerm.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchTerm.java
@@ -19,5 +19,7 @@
package org.apache.olingo.odata4.producer.api.uri.queryoption.search;
public interface SearchTerm extends SearchExpression {
+
String getSearchTerm();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchUnary.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchUnary.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchUnary.java
index 5d02544..422641a 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchUnary.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchUnary.java
@@ -19,5 +19,7 @@
package org.apache.olingo.odata4.producer.api.uri.queryoption.search;
public interface SearchUnary {
+
SearchExpression getOperand();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchBinaryOperators.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
index d0810db..76702b5 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
@@ -27,8 +27,13 @@ public enum SupportedSearchBinaryOperators {
private SupportedSearchBinaryOperators(final String syntax) {
this.syntax = syntax;
}
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
- public static SupportedSearchBinaryOperators get(String operator) {
+ public static SupportedSearchBinaryOperators get(final String operator) {
for (SupportedSearchBinaryOperators op : SupportedSearchBinaryOperators.values()) {
if (op.toString().equals(operator)) {
return op;
@@ -37,8 +42,5 @@ public enum SupportedSearchBinaryOperators {
return null;
}
- @Override
- public String toString() {
- return syntax;
- }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchUnaryOperators.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
index add5803..d62941c 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
@@ -32,7 +32,7 @@ public enum SupportedSearchUnaryOperators {
return syntax;
}
- public static SupportedSearchUnaryOperators get(String operator) {
+ public static SupportedSearchUnaryOperators get(final String operator) {
for (SupportedSearchUnaryOperators op : SupportedSearchUnaryOperators.values()) {
if (op.toString().equals(operator)) {
return op;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4 b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
index caf8d5a..c49d0bc 100644
--- a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
+++ b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
@@ -110,7 +110,7 @@ valueOnly : vV=commonExpr ;
nameValueList : WSP* vlNVP+=nameValuePair WSP* ( COMMA WSP* vlNVP+=nameValuePair WSP*)* ;
nameValuePair : vODI=odataIdentifier EQ (AT vALI=odataIdentifier | vCOM=commonExpr /*TODO | val2=enumX*/);
-constSegment : SLASH (vV=value | vC=count | vR=ref );
+constSegment : SLASH (vV=value | vC=count | vR=ref | vAll=allExpr | vAny=anyExpr);
count : COUNT;
ref : REF;
@@ -159,8 +159,10 @@ expand : EXPAND EQ vlEI+=expandItem ( COMMA vlEI+=expandItem )*;
expandItem : vS=STAR ( SLASH vR=ref | OPEN LEVELS EQ ( vL=INT | vM=MAX) CLOSE )?
| vEP=expandPath vEPE=expandPathExtension?;
-expandPath : expandPathSegment ( SLASH expandPathSegment )*;
-expandPathSegment : vNS=namespace? vODI=odataIdentifier;
+
+expandPath : vlPS+=pathSegment (SLASH vlPS+=pathSegment)*;
+//expandPath : expandPathSegment ( SLASH expandPathSegment )*;
+//expandPathSegment : vNS=namespace? vODI=odataIdentifier;
expandPathExtension : OPEN vlEO+=expandOption ( SEMI vlEO+=expandOption )* CLOSE
| SLASH vR=ref ( OPEN vlEOR+=expandRefOption ( SEMI vlEOR+=expandRefOption )* CLOSE )?
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorCollector.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorCollector.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorCollector.java
index 32c9c2e..834e743 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorCollector.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorCollector.java
@@ -18,7 +18,6 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri;
-
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
@@ -32,11 +31,10 @@ import org.antlr.v4.runtime.atn.ATNConfigSet;
import org.antlr.v4.runtime.dfa.DFA;
class ErrorCollector implements ANTLRErrorListener {
-
+
private List<Exception> exceptions = new ArrayList<Exception>();
- //private ParserValidator tokenValidator;
-
+ // private ParserValidator tokenValidator;
@Override
public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
@@ -49,7 +47,7 @@ class ErrorCollector implements ANTLRErrorListener {
System.out.println("syntaxError");
trace(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
- //fail("syntaxError");
+ // fail("syntaxError");
}
@Override
@@ -58,49 +56,53 @@ class ErrorCollector implements ANTLRErrorListener {
final BitSet ambigAlts, final ATNConfigSet configs) {
/*
- if (tokenValidator.logLevel > 0) {
- System.out.println("reportAmbiguity: ");
- System.out.println(" ambigAlts: " + ambigAlts);
- System.out.println(" configs: " + configs);
- System.out.println(" input: " + recognizer.getTokenStream().getText(Interval.of(startIndex, stopIndex)));
- }*/
-/*
- if (!tokenValidator.allowAmbiguity) {
- printStack(recognizer);
- fail("reportAmbiguity");
- }*/
+ * if (tokenValidator.logLevel > 0) {
+ * System.out.println("reportAmbiguity: ");
+ * System.out.println(" ambigAlts: " + ambigAlts);
+ * System.out.println(" configs: " + configs);
+ * System.out.println(" input: " + recognizer.getTokenStream().getText(Interval.of(startIndex, stopIndex)));
+ * }
+ */
+ /*
+ * if (!tokenValidator.allowAmbiguity) {
+ * printStack(recognizer);
+ * fail("reportAmbiguity");
+ * }
+ */
}
@Override
public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex,
final int stopIndex,
final BitSet conflictingAlts, final ATNConfigSet configs) {
-/*
- // The grammar should be written in order to avoid attempting a full context parse because its negative
- // impact on the performance, so trace and stop here
- if (tokenValidator.logLevel > 0) {
- System.out.println("allowed AttemptingFullContext");
- }
-
- if (!tokenValidator.allowFullContext) {
- printStack(recognizer);
- fail("reportAttemptingFullContext");
- }*/
+ /*
+ * // The grammar should be written in order to avoid attempting a full context parse because its negative
+ * // impact on the performance, so trace and stop here
+ * if (tokenValidator.logLevel > 0) {
+ * System.out.println("allowed AttemptingFullContext");
+ * }
+ *
+ * if (!tokenValidator.allowFullContext) {
+ * printStack(recognizer);
+ * fail("reportAttemptingFullContext");
+ * }
+ */
}
@Override
public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex,
final int stopIndex, final int prediction,
final ATNConfigSet configs) {
-/*
- if (tokenValidator.logLevel > 0) {
- System.out.println("allowed ContextSensitivity");
- }
-
- if (!tokenValidator.allowContextSensitifity) {
- printStack(recognizer);
- fail("reportContextSensitivity");
- }*/
+ /*
+ * if (tokenValidator.logLevel > 0) {
+ * System.out.println("allowed ContextSensitivity");
+ * }
+ *
+ * if (!tokenValidator.allowContextSensitifity) {
+ * printStack(recognizer);
+ * fail("reportContextSensitivity");
+ * }
+ */
}
/*
@@ -130,8 +132,8 @@ class ErrorCollector implements ANTLRErrorListener {
// String lexerTokenName = TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
String lexerTokenName = "";
try {
- //TODO check how the Lexer is accessed in the new package structure
- //lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
+ // TODO check how the Lexer is accessed in the new package structure
+ // lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
} catch (ArrayIndexOutOfBoundsException es) {
lexerTokenName = "token error";
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentCount.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentCount.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentCount.java
deleted file mode 100644
index 5c7e922..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentCount.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri;
-
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandSegment;
-
-public class ExpandSegmentCount extends ExpandSegment {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentIt.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentIt.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentIt.java
deleted file mode 100644
index 0d89c99..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentIt.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri;
-
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandSegment;
-
-public class ExpandSegmentIt extends ExpandSegment {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentRef.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentRef.java
deleted file mode 100644
index 9422db0..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ExpandSegmentRef.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri;
-
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandSegment;
-
-public class ExpandSegmentRef extends ExpandSegment {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ParserAdapter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ParserAdapter.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ParserAdapter.java
index ae248e7..3e9ce98 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ParserAdapter.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ParserAdapter.java
@@ -29,7 +29,7 @@ import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser;
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
public class ParserAdapter {
- public static UriInfoImpl parseUri(final String input, UriParseTreeVisitor uriParseTreeVisitor)
+ public static UriInfoImpl parseUri(final String input, final UriParseTreeVisitor uriParseTreeVisitor)
throws UriParserException {
try {
@@ -61,10 +61,9 @@ public class ParserAdapter {
// create parser
lexer = new UriLexer(new ANTLRInputStream(input));
parser = new UriParserParser(new CommonTokenStream(lexer));
-
+
// TODO create better error collector
parser.addErrorListener(new ErrorCollector());
-
// bail out of parser at first syntax error. --> proceeds in catch block with step 2
parser.setErrorHandler(new BailErrorStrategy());
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
index f60e0ff..abcbc32 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
@@ -44,21 +44,21 @@ import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SearchOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectOption;
import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipTokenOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEnum;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SkiptokenOption;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
import org.apache.olingo.odata4.producer.api.uri.queryoption.TopOption;
import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.FormatOptionImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.InlineCountImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.InlineCountOptionImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.OrderByImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.QueryOptionImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.SearchOptionImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.SkipOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SkipTokenOptionImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.SkiptokenOptionImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.SystemQueryOptionImpl;
import org.apache.olingo.odata4.producer.core.uri.queryoption.TopOptionImpl;
@@ -75,21 +75,17 @@ public class UriInfoImpl implements UriInfo {
private FilterOptionImpl filterOption;
private FormatOptionImpl formatOption;
private IdOption idOption;
- private InlineCountImpl inlineCountOption;
+ private InlineCountOptionImpl inlineCountOption;
private OrderByImpl orderByOption;
private SearchOptionImpl searchOption;
private SelectOptionImpl selectOption;
private SkipOptionImpl skipOption;
- private SkipTokenOptionImpl skipTokenOption;
+ private SkiptokenOptionImpl skipTokenOption;
private TopOptionImpl topOption;
- private UriResourcePart lastPathPart;
+ private UriResourcePart lastResourcePart;
private List<UriResourcePart> pathParts = new ArrayList<UriResourcePart>();
- public UriInfoImpl(Edm edm) {
- // this.edm = edm;
- }
-
@Override
public UriInfoAll asUriInfoAll() {
return this;
@@ -125,26 +121,27 @@ public class UriInfoImpl implements UriInfo {
return Collections.unmodifiableList(entitySetNames);
}
- public void addEntitySetName(String entitySet) {
+ public void addEntitySetName(final String entitySet) {
entitySetNames.add(entitySet);
}
@Override
public List<UriResourcePart> getUriResourceParts() {
List<UriResourcePart> returnList = new ArrayList<UriResourcePart>();
- for (UriResourcePart part : pathParts) {
- returnList.add(part);
+ for (UriResourcePart item : pathParts) {
+ returnList.add(item);
}
return Collections.unmodifiableList(returnList);
}
- public void addPathInfo(UriResourcePartImpl uriPathInfo) {
+ public void addPathInfo(final UriResourcePartImpl uriPathInfo) {
pathParts.add(uriPathInfo);
- lastPathPart = uriPathInfo;
+ lastResourcePart = uriPathInfo;
}
@Override
public String getContext() {
+ // TODO add support for UTI context part
return null;
}
@@ -192,13 +189,12 @@ public class UriInfoImpl implements UriInfo {
return kind;
}
- public UriResourcePart getLastUriPathInfo() {
- return lastPathPart;
+ public UriResourcePart getLastResourcePart() {
+ return lastResourcePart;
}
@Override
public OrderByOption getOrderByOption() {
-
return orderByOption;
}
@@ -219,7 +215,7 @@ public class UriInfoImpl implements UriInfo {
}
@Override
- public SkipTokenOption getSkipTokenOption() {
+ public SkiptokenOption getSkipTokenOption() {
return skipTokenOption;
}
@@ -228,13 +224,12 @@ public class UriInfoImpl implements UriInfo {
return topOption;
}
- public UriInfoImpl setEntityTypeCast(EdmEntityType type) {
-
+ public UriInfoImpl setEntityTypeCast(final EdmEntityType type) {
entityTypeCast = type;
return this;
}
- public UriInfoImpl setFormat(FormatOptionImpl formatOption) {
+ public UriInfoImpl setFormat(final FormatOptionImpl formatOption) {
this.formatOption = formatOption;
return this;
}
@@ -244,33 +239,33 @@ public class UriInfoImpl implements UriInfo {
return this;
}
- public UriInfoImpl setQueryOptions(List<QueryOptionImpl> list) {
+ public UriInfoImpl setQueryOptions(final List<QueryOptionImpl> list) {
for (QueryOptionImpl item : list) {
if (item instanceof SystemQueryOptionImpl) {
SystemQueryOptionImpl sysItem = (SystemQueryOptionImpl) item;
- if (sysItem.getKind() == SystemQueryOptionEnum.EXPAND) {
+ if (sysItem.getKind() == SupportedQueryOptions.EXPAND) {
expandOption = (ExpandOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.FILTER) {
+ } else if (sysItem.getKind() == SupportedQueryOptions.FILTER) {
filterOption = (FilterOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.FORMAT) {
+ } else if (sysItem.getKind() == SupportedQueryOptions.FORMAT) {
formatOption = (FormatOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.ID) {
+ } else if (sysItem.getKind() == SupportedQueryOptions.ID) {
idOption = (IdOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.INLINECOUNT) {
- inlineCountOption = (InlineCountImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.ORDERBY) {
+ } else if (sysItem.getKind() == SupportedQueryOptions.INLINECOUNT) {
+ inlineCountOption = (InlineCountOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.ORDERBY) {
orderByOption = (OrderByImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.SEARCH) {
+ } else if (sysItem.getKind() == SupportedQueryOptions.SEARCH) {
searchOption = (SearchOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.SELECT) {
+ } else if (sysItem.getKind() == SupportedQueryOptions.SELECT) {
selectOption = (SelectOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.SKIP) {
+ } else if (sysItem.getKind() == SupportedQueryOptions.SKIP) {
skipOption = (SkipOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.SKIPTOKEN) {
- skipTokenOption = (SkipTokenOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionEnum.TOP) {
+ } else if (sysItem.getKind() == SupportedQueryOptions.SKIPTOKEN) {
+ skipTokenOption = (SkiptokenOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.TOP) {
topOption = (TopOptionImpl) sysItem;
}
} else if (item instanceof CustomQueryOptionImpl) {
@@ -287,7 +282,5 @@ public class UriInfoImpl implements UriInfo {
public void clearPathInfo() {
pathParts.clear();
-
}
-
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/1ef03f92/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImpl.java
index 2fd0ef0..8f5e10f 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImpl.java
@@ -33,7 +33,7 @@ public class UriParameterImpl implements UriParameter {
return name;
}
- public UriParameterImpl setName(String name) {
+ public UriParameterImpl setName(final String name) {
this.name = name;
return this;
}
@@ -43,7 +43,7 @@ public class UriParameterImpl implements UriParameter {
return alias;
}
- public UriParameterImpl setAlias(String alias) {
+ public UriParameterImpl setAlias(final String alias) {
this.alias = alias;
return this;
}
@@ -53,7 +53,7 @@ public class UriParameterImpl implements UriParameter {
return text;
}
- public UriParameterImpl setText(String text) {
+ public UriParameterImpl setText(final String text) {
this.text = text;
return this;
}
@@ -64,7 +64,7 @@ public class UriParameterImpl implements UriParameter {
return expression;
}
- public UriParameterImpl setExpression(Expression expression) {
+ public UriParameterImpl setExpression(final Expression expression) {
this.expression = expression;
return this;
}