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 2013/12/18 11:22:54 UTC
[4/4] git commit: [OLINGO-63] Uri Parser: Add support for $filter
[OLINGO-63] Uri Parser: Add support for $filter
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/021afffb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/021afffb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/021afffb
Branch: refs/heads/master
Commit: 021afffb5001abf6ff4ca2fa0a5a13b7ced80538
Parents: 10ac7ee
Author: Sven Kobler <sv...@sap.com>
Authored: Mon Dec 16 12:16:26 2013 +0100
Committer: Sven Kobler <sv...@sap.com>
Committed: Wed Dec 18 10:20:52 2013 +0100
----------------------------------------------------------------------
.../olingo/odata4/commons/api/edm/EdmType.java | 3 +
.../producer/api/uri/UriPathInfoKind.java | 2 +-
.../odata4/producer/core/uri/antlr/UriLexer.g4 | 8 +-
.../odata4/producer/core/uri/antlr/UriParser.g4 | 22 +-
.../odata4/producer/core/uri/ParserAdapter.java | 8 +-
.../producer/core/uri/SystemQueryParameter.java | 43 +
.../odata4/producer/core/uri/UriInfoImpl.java | 19 +
.../producer/core/uri/UriInfoImplPath.java | 39 +-
.../odata4/producer/core/uri/UriParserImpl.java | 202 ++-
.../core/uri/UriPathInfoActionImpl.java | 5 +
.../core/uri/UriPathInfoEntitySetImpl.java | 8 +
.../core/uri/UriPathInfoFunctionImpl.java | 7 +
.../odata4/producer/core/uri/UriPathInfoIT.java | 53 +
.../producer/core/uri/UriPathInfoImpl.java | 28 +-
.../core/uri/UriPathInfoNavEntitySet.java | 5 +
.../core/uri/UriPathInfoSingletonImpl.java | 9 +-
.../producer/core/uri/expression/Alias.java | 37 +
.../core/uri/expression/BinaryOperator.java | 50 +
.../expression/ExceptionVisitExpression.java | 23 +
.../core/uri/expression/Expression.java | 25 +
.../core/uri/expression/ExpressionVisitor.java | 34 +
.../producer/core/uri/expression/Literal.java | 35 +
.../producer/core/uri/expression/Member.java | 51 +
.../core/uri/expression/MethodCall.java | 43 +
.../expression/SupportedBinaryOperators.java | 48 +
.../uri/expression/SupportedMethodCalls.java | 48 +
.../uri/expression/SupportedUnaryOperators.java | 44 +
.../core/uri/expression/UnaryOperator.java | 42 +
.../producer/core/uri/expression/Visitable.java | 51 +
.../producer/core/uri/queryoption/Filter.java | 23 +
.../core/uri/queryoption/QueryOption.java | 23 +
.../core/uri/queryoption/SystemQueryOption.java | 23 +
.../odata4/producer/core/testutil/EdmMock.java | 743 ----------
.../producer/core/testutil/EdmTechProvider.java | 1352 ++++++++----------
.../core/testutil/EdmTechTestProvider.java | 89 ++
.../core/testutil/FilterTreeToText.java | 87 ++
.../producer/core/testutil/FilterValidator.java | 69 +
.../core/testutil/ParseTreeSerializer.java | 82 --
.../producer/core/testutil/ParseTreeToText.java | 82 ++
.../producer/core/testutil/ParserValidator.java | 179 +--
.../core/testutil/TestErrorHandler.java | 56 -
.../producer/core/testutil/TokenValidator.java | 127 +-
.../core/testutil/TraceErrorHandler.java | 54 -
.../core/testutil/UriLexerWithTrace.java | 86 ++
.../core/testutil/UriResourcePathValidator.java | 211 +--
.../producer/core/uri/antlr/TestParser.java | 2 +-
.../core/uri/antlr/TestUriParserImpl.java | 143 +-
47 files changed, 2399 insertions(+), 2024 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmType.java b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmType.java
index 7c7a688..0248a19 100644
--- a/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmType.java
+++ b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmType.java
@@ -35,4 +35,7 @@ public interface EdmType extends EdmNamed {
* @return {@link EdmTypeKind} of this {@link EdmType}
*/
EdmTypeKind getKind();
+
+
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java
index 8ae5a31..27bb8b9 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java
@@ -20,5 +20,5 @@
package org.apache.olingo.odata4.producer.api.uri;
public enum UriPathInfoKind {
- entitySet, navEntitySet, singleton, action, function;
+ entitySet, navEntitySet, singleton, action, function, it;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4 b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
index 68eb855..74c2f98 100644
--- a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
+++ b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
@@ -158,17 +158,23 @@ DESC : 'desc';
MUL : 'mul';
DIV : 'div';
MOD : 'mod';
+
ADD : 'add';
SUB : 'sub';
+
GT : 'gt';
GE : 'ge';
LT : 'lt';
LE : 'le';
+ISOF : 'isof';
+
EQ_ALPHA : 'eq';
NE : 'ne';
+
AND : 'and';
OR : 'or';
-ISOF : 'isof';
+
+
NOT : 'not';
MINUS :'-';
NANINFINITY : 'NaN' | '-INF' | 'INF';
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/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 24dd1a0..f46e0cd 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
@@ -124,19 +124,16 @@ value : VALUE;
queryOptions : qo+=queryOption ( AMP qo+=queryOption )*;
-queryOption : systemQueryOption
- | AT aliasAndValue
- | customQueryOption
+queryOption : systemQueryOption
+ | AT aliasAndValue
+ | customQueryOption
;
entityOptions : (eob+=entityOption AMP )* ID EQ REST ( AMP eoa+=entityOption )*;
entityOption : ( expand | format | select )
| customQueryOption
-
;
-
-
systemQueryOption : expand
| filter
| format
@@ -273,12 +270,12 @@ commonExpr : OPEN commonExpr CLOSE
| methodCallExpr #altMethod
| ( unary WSP ) commonExpr #altUnary
| memberExpr #altMember
- | commonExpr (WSP MUL WSP | WSP DIV WSP | WSP MOD WSP ) commonExpr #altMult
- | commonExpr (WSP ADD WSP | WSP SUB WSP) commonExpr #altAdd
+ | commonExpr (WSP MUL WSP | WSP DIV WSP | WSP MOD WSP ) commonExpr #altMult
+ | commonExpr (WSP ADD WSP | WSP SUB WSP) commonExpr #altAdd
| commonExpr (WSP GT WSP | WSP GE WSP | WSP LT WSP | WSP LE WSP | WSP ISOF WSP) commonExpr #altComparism
- | commonExpr (WSP EQ_ALPHA WSP | WSP NE WSP) commonExpr #altEquality
- | commonExpr (WSP AND WSP) commonExpr #altAnd
- | commonExpr (WSP OR WSP) commonExpr #altOr
+ | commonExpr (WSP EQ_ALPHA WSP | WSP NE WSP) commonExpr #altEquality
+ | commonExpr (WSP AND WSP) commonExpr #altAnd
+ | commonExpr (WSP OR WSP) commonExpr #altOr
| rootExpr #altRoot //; $...
| AT odataIdentifier #altAlias // @...
| primitiveLiteral #altLiteral // ...
@@ -288,7 +285,8 @@ unary : (MINUS| NOT) ;
rootExpr : ROOT pathSegments;
-memberExpr : '$it' | '$it/'? pathSegments;
+memberExpr : '$it'
+ | '$it/'? ps=pathSegments;
anyExpr : 'any' OPEN WSP /* [ lambdaVariableExpr BWS COLON BWS lambdaPredicateExpr ] WS* */ CLOSE;
allExpr : 'all' OPEN WSP /* lambdaVariableExpr BWS COLON BWS lambdaPredicateExpr WS* */ CLOSE;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/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 30c7440..0a6c9a0 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
@@ -43,11 +43,13 @@ public class ParserAdapter {
lexer = new UriLexer(new ANTLRInputStream(input));
parser = new UriParserParser(new CommonTokenStream(lexer));
- // Bail out of parser at first syntax error. --> proceeds in catch block with step 2
+ // bail out of parser at first syntax error. --> proceeds in catch block with step 2
parser.setErrorHandler(new BailErrorStrategy());
- // User the faster LL parsing
+ // user the faster LL parsing
parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
+
+ // parse
ret = parser.odataRelativeUriEOF();
} catch (ParseCancellationException hardException) {
@@ -56,7 +58,6 @@ public class ParserAdapter {
// create parser
lexer = new UriLexer(new ANTLRInputStream(input));
parser = new UriParserParser(new CommonTokenStream(lexer));
-
// Used default error strategy
parser.setErrorHandler(new DefaultErrorStrategy());
@@ -64,6 +65,7 @@ public class ParserAdapter {
// User the slower SLL parsing
parser.getInterpreter().setPredictionMode(PredictionMode.LL);
+ // parse
ret = parser.odataRelativeUriEOF();
} catch (Exception weakException) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/SystemQueryParameter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/SystemQueryParameter.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/SystemQueryParameter.java
new file mode 100644
index 0000000..2545422
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/SystemQueryParameter.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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;
+
+public enum SystemQueryParameter {
+ FILTER("$filter"),
+ FORMAT("$format"),
+ ID("$id"),
+ INLINECOUNT("$inlinecount"),
+ ORDERBY("$orderby"),
+ SEARCH("$search"),
+ SELECT("$select"),
+ SKIP("$skip"),
+ SKIPTOKEN("$skiptoken"),
+ TOP("$top");
+
+ String syntax;
+
+ private SystemQueryParameter(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/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 a6c28d3..9f047c6 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
@@ -18,12 +18,19 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
public class UriInfoImpl {
private UriInfoKind kind;
+ private Map<String, List<Object>> queryParameter = new HashMap<String, List<Object>>();
+
public UriInfoImpl setKind(final UriInfoKind kind) {
this.kind = kind;
return this;
@@ -33,4 +40,16 @@ public class UriInfoImpl {
return kind;
}
+ public List<Object> getQueryParameters(String name) {
+ return queryParameter.get(name);
+ }
+
+ public void addQueryParameter(String name, Object object) {
+ List<Object> entry = queryParameter.get(name);
+ if (entry != null) {
+ entry.add(object);
+ } else {
+ queryParameter.put(name, Arrays.asList(object));
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplPath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplPath.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplPath.java
index 9a66876..156704a 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplPath.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplPath.java
@@ -19,13 +19,19 @@
package org.apache.olingo.odata4.producer.core.uri;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.producer.core.uri.expression.Expression;
public class UriInfoImplPath extends UriInfoImpl {
- List<UriPathInfoImpl> pathInfos = new ArrayList<UriPathInfoImpl>();
+ private List<UriPathInfoImpl> pathInfos = new ArrayList<UriPathInfoImpl>();
+
+ private Expression spFilter;
public UriInfoImplPath() {
this.setKind(UriInfoKind.path);
@@ -47,4 +53,35 @@ public class UriInfoImplPath extends UriInfoImpl {
return pathInfos.get(index);
}
+ public void setSystemParameter(SystemQueryParameter filter, Expression expression) {
+ spFilter = expression;
+ addQueryParameter(filter.toString(), expression);
+ }
+
+ public Expression getFilter() {
+ return this.spFilter;
+ }
+
+ @Override
+ public String toString() {
+ String ret = "";
+ int i = 0;
+ while (i < pathInfos.size()) {
+ if ( i > 0 ) {
+ ret += "/";
+ }
+
+ ret += pathInfos.get(i).toString();
+
+
+
+ i++;
+
+ }
+
+
+
+ return ret;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
index 2ea0db9..e1f8afd 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
@@ -21,6 +21,9 @@ package org.apache.olingo.odata4.producer.core.uri;
import java.util.List;
+import javax.annotation.processing.SupportedAnnotationTypes;
+
+import org.antlr.v4.runtime.tree.ParseTree;
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.EdmActionImport;
@@ -37,24 +40,54 @@ import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAddContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAliasContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAndContext;
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.AltMemberContext;
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMetadataContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMethodContext;
+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.AltPharenthesisContext;
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltResourcePathContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltRootContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltUnaryContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CustomQueryOptionContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FilterContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FormatContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IdContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.InlinecountContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MemberExprContext;
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NameValueListContext;
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.OdataRelativeUriContext;
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.SearchContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SelectContext;
+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.SystemQueryOptionContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TopContext;
+import org.apache.olingo.odata4.producer.core.uri.expression.*;
public class UriParserImpl {
private Edm edm = null;
private EdmEntityContainer edmEntityContainer = null;
+ private UriPathInfoImpl lastUriPathInfo;
public UriParserImpl(Edm edm) {
this.edm = edm;
@@ -68,7 +101,9 @@ public class UriParserImpl {
private UriInfoImpl readODataRelativeUriEOF(OdataRelativeUriEOFContext node) {
OdataRelativeUriContext first = (OdataRelativeUriContext) node.getChild(0);
- return readODataRelativeUri(first);
+
+ UriInfoImpl uriInfo = readODataRelativeUri(first);
+ return uriInfo;
}
private UriInfoImpl readODataRelativeUri(OdataRelativeUriContext node) {
@@ -94,7 +129,12 @@ public class UriParserImpl {
QueryOptionsContext qoc = (QueryOptionsContext) node.getChild(2); // is null if there are no options
if (rpc.vPSs != null) {
- return readPathSegments(rpc.vPSs);
+ UriInfoImplPath uriInfo = readPathSegments(rpc.vPSs, null);
+
+ if (qoc != null) {
+ readQueryParameter(uriInfo, qoc);
+ }
+ return uriInfo;
} else if (rpc.vCJ != null) {
return new UriInfoImplCrossjoin();
} else if (rpc.vAll != null) {
@@ -104,21 +144,165 @@ public class UriParserImpl {
return null;
}
- private UriInfoImpl readPathSegments(PathSegmentsContext pathSegments) {
- int iSegment = 0;
- UriInfoImplPath infoImpl = new UriInfoImplPath();
- PathSegmentContext firstChild = (PathSegmentContext) pathSegments.vlPS.get(iSegment);
- UriPathInfoImpl firstPathInfo = readFirstPathSegment(infoImpl, firstChild);
+ private void readQueryParameter(UriInfoImplPath uriInfoImplPath, QueryOptionsContext qoc) {
+ for (QueryOptionContext queryOption : qoc.qo) {
+ readQueryOption(uriInfoImplPath, queryOption);
+ }
+ }
- iSegment++;
+ private void readQueryOption(UriInfoImplPath uriInfoImplPath, QueryOptionContext queryOption) {
+ ParseTree firstChild = queryOption.getChild(0);
- UriPathInfoImpl prevPathInfo = firstPathInfo;
+ if (firstChild instanceof SystemQueryOptionContext) {
+ readSystemQueryOption(uriInfoImplPath, firstChild);
+ } else if (firstChild instanceof CustomQueryOptionContext) {
+ // TODO read custom request option
+ } else if (firstChild.getText().equals("@")) {
+ // TODO read ailas and value
+ }
+
+ }
+
+ private void readSystemQueryOption(UriInfoImplPath uriInfoImplPath, ParseTree systemQueryOption) {
+ ParseTree firstChild = systemQueryOption.getChild(0);
+ if (firstChild instanceof ExpandContext) {
+ // TODO implement
+ } else if (firstChild instanceof FilterContext) {
+ Expression expression = readFilterOption(firstChild);
+ uriInfoImplPath.setSystemParameter(SystemQueryParameter.FILTER, expression);
+ return;
+ } else if (firstChild instanceof FormatContext) {
+ // TODO implement
+ } else if (firstChild instanceof IdContext) {
+ // TODO implement
+ } else if (firstChild instanceof InlinecountContext) {
+ // TODO implement
+ } else if (firstChild instanceof OrderbyContext) {
+ // TODO implement
+ } else if (firstChild instanceof SearchContext) {
+ // TODO implement
+ } else if (firstChild instanceof SelectContext) {
+ // TODO implement
+ } else if (firstChild instanceof SkipContext) {
+ // TODO implement
+ } else if (firstChild instanceof SkiptokenContext) {
+ // TODO implement
+ } else if (firstChild instanceof TopContext) {
+ // TODO implement
+ }
+ }
+
+ private Expression readFilterOption(ParseTree filter) {
+ return readCommonExpression(filter.getChild(2));
+ }
+
+ private Expression readCommonExpression(ParseTree expressionContext) {
+ // Expression ret = null;
+
+ if (expressionContext instanceof AltPharenthesisContext) {
+ return readCommonExpression(expressionContext.getChild(1));
+ } else if (expressionContext instanceof AltMethodContext) {
+ return readMethod(expressionContext);
+ } else if (expressionContext instanceof AltUnaryContext) {
+ UnaryOperator unary = new UnaryOperator();
+ unary.setOperator(SupportedUnaryOperators.get(expressionContext.getChild(0).getText()));
+ unary.setOperand(readCommonExpression(expressionContext.getChild(1)));
+ return unary;
+ } else if (expressionContext instanceof AltMemberContext) {
+ return readMember(expressionContext);
+ } else if (expressionContext instanceof AltMultContext) {
+ return readBinary(expressionContext);
+ } else if (expressionContext instanceof AltAddContext) {
+ return readBinary(expressionContext);
+ } else if (expressionContext instanceof AltComparismContext) {
+ return readBinary(expressionContext);
+ } else if (expressionContext instanceof AltEqualityContext) {
+ return readBinary(expressionContext);
+ } else if (expressionContext instanceof AltAndContext) {
+ return readBinary(expressionContext);
+ } else if (expressionContext instanceof AltOrContext) {
+ return readBinary(expressionContext);
+ } else if (expressionContext instanceof AltRootContext) {
+ // TODO
+ } else if (expressionContext instanceof AltAliasContext) {
+ Alias alias = new Alias();
+ alias.setReference(expressionContext.getChild(1).getText());
+ // TODO collect all aliases and verify them afterwards
+ return alias;
+ } else if (expressionContext instanceof AltLiteralContext) {
+ Literal literal = new Literal();
+ literal.setText(expressionContext.getText());
+ return literal;
+ }
+ return null;
+ }
+
+ private Expression readMember(ParseTree expressionContext) {
+ MemberExprContext context = (MemberExprContext) expressionContext.getChild(0);
+
+ Member member = new Member();
+
+ UriPathInfoIT pathInfoIT = new UriPathInfoIT();
+
+
+ if (context.ps!= null) {
+ if (context.getChild(0).getText().startsWith("$it/")) {
+ member.setIT(true); // TODO check if this is required
+ pathInfoIT.setIsExplicitIT(true);
+ }
+ UriParserImpl parser = new UriParserImpl(this.edm);
+
+ UriInfoImplPath path = parser.readPathSegments(context.ps,
+ new UriPathInfoIT().setType(lastUriPathInfo.getType()));
+ member.setPath(path);
+ } else {
+ member.setIT(true);
+ }
+ return member;
+
+ }
+
+ private Expression readMethod(ParseTree expressionContext) {
+ MethodCall expression = new MethodCall();
+ expression.setMethod(SupportedMethodCalls.get(expressionContext.getChild(0).getText()));
+ int i = 1;
+ while (i < expressionContext.getChildCount()) {
+ expression.addParameter(readCommonExpression(expressionContext.getChild(i)));
+ i++;
+ }
+ return expression;
+ }
+
+ private Expression readBinary(ParseTree expressionContext) {
+ BinaryOperator expression = new BinaryOperator();
+ expression.setLeftOperand(readCommonExpression(expressionContext.getChild(0)));
+ expression.setOperator(SupportedBinaryOperators.get(expressionContext.getChild(2).getText()));
+ expression.setRightOperand(readCommonExpression(expressionContext.getChild(4)));
+ return expression;
+ }
+
+ private UriInfoImplPath readPathSegments(PathSegmentsContext pathSegments, UriPathInfoImpl usePrevPathInfo) {
+
+ UriPathInfoImpl prevPathInfo = usePrevPathInfo;
+ UriInfoImplPath infoImpl = new UriInfoImplPath();
+
+ int iSegment = 0;
+
+ if (prevPathInfo == null) {
+ PathSegmentContext firstChild = (PathSegmentContext) pathSegments.vlPS.get(iSegment);
+ UriPathInfoImpl firstPathInfo = readFirstPathSegment(infoImpl, firstChild);
+ iSegment++;
+ prevPathInfo = firstPathInfo;
+ } else {
+ infoImpl.addPathInfo(prevPathInfo);
+ }
while (iSegment < pathSegments.vlPS.size()) {
PathSegmentContext nextChild = (PathSegmentContext) pathSegments.vlPS.get(iSegment);
prevPathInfo = readNextPathSegment(infoImpl, nextChild, prevPathInfo);
iSegment++;
}
+ lastUriPathInfo = prevPathInfo;
return infoImpl;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java
index 50aa554..90ca1d6 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java
@@ -40,5 +40,10 @@ public class UriPathInfoActionImpl extends UriPathInfoImpl {
return this;
}
+
+ @Override
+ public String toString() {
+ return action.getName() + super.toString();
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
index f47b66f..f8e1ca8 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
@@ -33,8 +33,16 @@ public class UriPathInfoEntitySetImpl extends UriPathInfoImpl {
this.edmEntitySet = edmES;
this.setType(edmES.getEntityType());
+ this.setCollection(true);
return this;
}
+
+
+ @Override
+ public String toString() {
+ return edmEntitySet.getName() + super.toString();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java
index 3d607bd..f65f681 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java
@@ -54,4 +54,11 @@ public class UriPathInfoFunctionImpl extends UriPathInfoImpl {
this.keyPredicates = keyPredicates;
return this;
}
+
+ @Override
+ public String toString() {
+ return function.getName() + super.toString();
+ }
+
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoIT.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoIT.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoIT.java
new file mode 100644
index 0000000..12da4e3
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoIT.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.EdmAction;
+import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
+
+/**
+ * Covers Functionimports and BoundFunction in URI
+ */
+public class UriPathInfoIT extends UriPathInfoImpl {
+
+ private boolean explicitIT;
+
+
+ public UriPathInfoIT() {
+ this.setKind(UriPathInfoKind.it);
+ this.setCollection(false);
+ }
+ @Override
+ public String toString() {
+
+ if (explicitIT) {
+ return "$it" + super.toString();
+ }
+ return super.toString();
+ }
+
+
+ public UriPathInfoIT setIsExplicitIT(boolean explicitIT) {
+ this.explicitIT =explicitIT;
+ return this;
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
index 1a4f67c..4417a01 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
@@ -28,6 +28,7 @@ import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
+import org.apache.olingo.odata4.producer.core.uri.expression.Expression;
public abstract class UriPathInfoImpl {
@@ -64,6 +65,14 @@ public abstract class UriPathInfoImpl {
return initialType;
}
+ public EdmType getCollectionTypeFilter() {
+ return collectionTypeFilter;
+ }
+
+ public EdmType getSingleTypeFilter() {
+ return singleTypeFilter;
+ }
+
public FullQualifiedName getFullType() {
return new FullQualifiedName(finalType.getNamespace(), finalType.getName());
}
@@ -78,7 +87,7 @@ public abstract class UriPathInfoImpl {
}
public UriPathInfoImpl setKeyPredicates(UriKeyPredicateList keyPredicates) {
- if ( this.isCollection()!= true) {
+ if (this.isCollection() != true) {
// throw exception
}
this.keyPredicates = keyPredicates;
@@ -165,7 +174,7 @@ public abstract class UriPathInfoImpl {
return pathList.get(index).property;
}
-
+
public UriPathInfoImpl setCollection(boolean isCollection) {
this.isCollection = isCollection;
return this;
@@ -175,4 +184,19 @@ public abstract class UriPathInfoImpl {
return isCollection;
}
+
+ @Override
+ public String toString() {
+ String ret = "";
+ int i = 0;
+ while (i < pathList.size()) {
+ if (i > 0) {
+ ret += "/";
+ }
+ ret += pathList.get(i).property.getName();
+ i++;
+ }
+ return ret;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java
index 3383e69..d81e2bc 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java
@@ -34,5 +34,10 @@ public class UriPathInfoNavEntitySet extends UriPathInfoImpl {
this.setType(sourceNavigationProperty.getType());
return this;
}
+
+ @Override
+ public String toString() {
+ return sourceNavigationProperty.getName()+super.toString();
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java
index c6aa2b0..649860f 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java
@@ -24,16 +24,21 @@ import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
public class UriPathInfoSingletonImpl extends UriPathInfoImpl {
private EdmSingleton singleton;
-
+
public UriPathInfoSingletonImpl() {
this.setKind(UriPathInfoKind.singleton);
}
public UriPathInfoSingletonImpl setSingleton(EdmSingleton singleton) {
-
+
this.singleton = singleton;
this.setType(singleton.getEntityType());
return this;
}
+
+ @Override
+ public String toString() {
+ return singleton.getName() + super.toString();
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Alias.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Alias.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Alias.java
new file mode 100644
index 0000000..c494ece
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Alias.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.expression;
+
+
+public class Alias extends Expression {
+
+ private String referenceName;
+ //TODO add object which is referenced
+
+ public void setReference(String referenceName) {
+ this.referenceName = referenceName;
+ }
+
+ @Override
+ public Object accept(ExpressionVisitor visitor) throws ExceptionVisitExpression {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/BinaryOperator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/BinaryOperator.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/BinaryOperator.java
new file mode 100644
index 0000000..0d437a4
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/BinaryOperator.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.expression;
+
+public class BinaryOperator extends Expression implements Visitable {
+
+ private SupportedBinaryOperators operator;
+ private Expression left;
+ private Expression right;
+
+ public BinaryOperator setOperator(SupportedBinaryOperators operator) {
+ this.operator = operator;
+ return this;
+ }
+
+ public void setLeftOperand(Expression operand) {
+ this.left = operand;
+
+ }
+
+ public void setRightOperand(Expression operand) {
+ this.right = operand;
+
+ }
+
+ @Override
+ public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
+ 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/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/ExceptionVisitExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/ExceptionVisitExpression.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/ExceptionVisitExpression.java
new file mode 100644
index 0000000..4619add
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/ExceptionVisitExpression.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.expression;
+
+public class ExceptionVisitExpression extends Exception {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Expression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Expression.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Expression.java
new file mode 100644
index 0000000..0d3c517
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Expression.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.core.uri.expression;
+
+public abstract class Expression implements Visitable{
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/ExpressionVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/ExpressionVisitor.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/ExpressionVisitor.java
new file mode 100644
index 0000000..105a330
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/ExpressionVisitor.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.expression;
+
+import java.util.List;
+
+public interface ExpressionVisitor<T> {
+
+ T visitBinaryOperator(SupportedBinaryOperators operator, T left, T right) throws ExceptionVisitExpression;
+
+ T visitUnaryOperator( SupportedUnaryOperators operator, T operand) throws ExceptionVisitExpression;
+
+ T visitMethoCall( SupportedMethodCalls methodCall, List<T> parameters)throws ExceptionVisitExpression;
+
+ T visitLiteral(String literal) throws ExceptionVisitExpression;
+
+ T visitMember(Member member) throws ExceptionVisitExpression;;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Literal.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Literal.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Literal.java
new file mode 100644
index 0000000..ed830ba
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Literal.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.expression;
+
+public class Literal extends Expression implements Visitable {
+
+ private String text;
+
+ public void setText(String text) {
+ this.text = text;
+
+ }
+
+ @Override
+ public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
+ return visitor.visitLiteral(text);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Member.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Member.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Member.java
new file mode 100644
index 0000000..0ea4511
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Member.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.expression;
+
+import org.apache.olingo.odata4.producer.core.uri.UriInfoImplPath;
+
+public class Member extends Expression implements Visitable {
+
+ private boolean isIT;
+ UriInfoImplPath path;
+
+ public Member setIT(boolean isIT) {
+ this.isIT = isIT;
+ return this;
+ }
+
+ public boolean isIT() {
+ return isIT;
+ }
+
+ public Member setPath(UriInfoImplPath pathSegments) {
+ this.path = pathSegments;
+ return this;
+ }
+
+ @Override
+ public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression {
+ return visitor.visitMember(this);
+
+ }
+
+ public UriInfoImplPath getPath() {
+ return path;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/MethodCall.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/MethodCall.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/MethodCall.java
new file mode 100644
index 0000000..185c8bb
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/MethodCall.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.expression;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MethodCall extends Expression implements Visitable{
+
+ private SupportedMethodCalls method;
+ private List<Expression> parameters = new ArrayList<Expression>();
+
+ public void setMethod(SupportedMethodCalls methodCalls) {
+ this.method = methodCalls;
+ }
+
+ public void addParameter(Expression readCommonExpression) {
+ parameters.add(readCommonExpression);
+ }
+
+ @Override
+ public Object accept(ExpressionVisitor visitor) throws ExceptionVisitExpression {
+
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedBinaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedBinaryOperators.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedBinaryOperators.java
new file mode 100644
index 0000000..71ce440
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedBinaryOperators.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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.expression;
+
+public enum SupportedBinaryOperators {
+ MUL("mul"), DIV("div"), MOD("mod"),
+ ADD("add"), SUB("sub"), GT("gt"), GE("ge"), LT("lt"), LE("le"),
+ ISOF("isof"),
+ EQ("eq"), NE("ne"),
+ AND("and"), OR("or");
+
+ private String syntax;
+
+ private SupportedBinaryOperators(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+
+ public static SupportedBinaryOperators get(String operator) {
+ for (SupportedBinaryOperators op : SupportedBinaryOperators.values()) {
+ if (op.toString().equals(operator)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedMethodCalls.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedMethodCalls.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedMethodCalls.java
new file mode 100644
index 0000000..949992b
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedMethodCalls.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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.expression;
+
+public enum SupportedMethodCalls {
+ MUL("mul"), DIV("div"), MOD("mod"),
+ ADD("add"), SUB("sub"), GT("gt"), GE("ge"), LT("lt"), LE("le"),
+ ISOF("isof"),
+ EQ("eq"), NE("ne"),
+ AND("and"), OR("or");
+
+ private String syntax;
+
+ private SupportedMethodCalls(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+
+ public static SupportedMethodCalls get(String operator) {
+ for (SupportedMethodCalls op : SupportedMethodCalls.values()) {
+ if (op.toString().equals(operator)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedUnaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedUnaryOperators.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedUnaryOperators.java
new file mode 100644
index 0000000..3f2318f
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/SupportedUnaryOperators.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.expression;
+
+public enum SupportedUnaryOperators {
+ MINUS("-"), NOT("not");
+
+ private String syntax;
+
+ private SupportedUnaryOperators(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+
+ public static SupportedUnaryOperators get(String operator) {
+ for (SupportedUnaryOperators op : SupportedUnaryOperators.values()) {
+ if (op.toString().equals(operator)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/UnaryOperator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/UnaryOperator.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/UnaryOperator.java
new file mode 100644
index 0000000..b6a405b
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/UnaryOperator.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.expression;
+
+public class UnaryOperator extends Expression implements Visitable {
+
+ private SupportedUnaryOperators operator;
+ private Expression expression;
+
+ public void setOperand(Expression expression) {
+ this.expression = expression;
+
+ }
+
+ public void setOperator(SupportedUnaryOperators operator) {
+ this.operator = operator;
+
+ }
+
+ @Override
+ public Object accept(ExpressionVisitor visitor) throws ExceptionVisitExpression {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Visitable.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Visitable.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Visitable.java
new file mode 100644
index 0000000..4316c47
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/expression/Visitable.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.expression;
+
+import org.antlr.v4.runtime.tree.ParseTreeVisitor;
+
+
+
+/* TODO update documentation*/
+public interface Visitable {
+
+ /**
+ * 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/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/Filter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/Filter.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/Filter.java
new file mode 100644
index 0000000..37ad276
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/Filter.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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 class Filter extends SystemQueryOption {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOption.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOption.java
new file mode 100644
index 0000000..f1a40a3
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOption.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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 class QueryOption {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOption.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOption.java
new file mode 100644
index 0000000..a5454fd
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOption.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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 class SystemQueryOption extends QueryOption {
+
+}