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:51 UTC
[1/4] [OLINGO-63] Uri Parser: Add support for $filter
Updated Branches:
refs/heads/master 10ac7ee37 -> 021afffb5
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechTestProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechTestProvider.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechTestProvider.java
new file mode 100644
index 0000000..e6acafa
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechTestProvider.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.Arrays;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.provider.ComplexType;
+import org.apache.olingo.odata4.commons.api.edm.provider.EntitySet;
+import org.apache.olingo.odata4.commons.api.edm.provider.EntityType;
+import org.apache.olingo.odata4.commons.api.edm.provider.Property;
+import org.apache.olingo.odata4.commons.api.edm.provider.PropertyRef;
+import org.apache.olingo.odata4.commons.api.exception.ODataException;
+
+//Adds a abc entity set with properties a,b,c,d,e,f to the technical reference scenario
+public class EdmTechTestProvider extends EdmTechProvider {
+
+ public static final FullQualifiedName nameCTabc = new FullQualifiedName(nameSpace, "CTabc");
+
+ Property propertyAInt16 = new Property().setName("a").setType(nameInt16);
+ Property propertyBInt16 = new Property().setName("b").setType(nameInt16);
+ Property propertyCInt16 = new Property().setName("c").setType(nameInt16);
+ Property propertyDInt16 = new Property().setName("d").setType(nameInt16);
+ Property propertyEInt16 = new Property().setName("e").setType(nameInt16);
+ Property propertyFInt16 = new Property().setName("f").setType(nameInt16);
+ public static final FullQualifiedName nameETabc = new FullQualifiedName(nameSpace, "ETabc");
+
+ @Override
+ public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
+ if (complexTypeName.equals(nameCTabc)) {
+ return new ComplexType()
+ .setName("CTabc")
+ .setProperties(Arrays.asList(
+ propertyAInt16, propertyBInt16, propertyCInt16,
+ propertyDInt16, propertyEInt16, propertyFInt16
+ ));
+
+ }
+
+ return super.getComplexType(complexTypeName);
+ }
+
+ @Override
+ public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException {
+ if (entityContainer == nameContainer) {
+ if (name.equals("ESabc")) {
+ return new EntitySet()
+ .setName("ESabc")
+ .setType(nameETabc);
+ }
+ }
+
+ return super.getEntitySet(entityContainer, name);
+ }
+
+ @Override
+ public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
+ List<PropertyRef> oneKeyPropertyInt16 = Arrays.asList(new PropertyRef().setPropertyName("a"));
+
+ if (entityTypeName.equals(nameETabc)) {
+ return new EntityType()
+ .setName("ETabc")
+ .setProperties(Arrays.asList(
+ propertyAInt16, propertyBInt16, propertyCInt16,
+ propertyDInt16, propertyEInt16, propertyFInt16))
+ .setKey(oneKeyPropertyInt16);
+ }
+
+ return super.getEntityType(entityTypeName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/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
new file mode 100644
index 0000000..459b0e4
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterTreeToText.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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.producer.core.uri.UriInfoImplPath;
+import org.apache.olingo.odata4.producer.core.uri.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.core.uri.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.producer.core.uri.expression.Literal;
+import org.apache.olingo.odata4.producer.core.uri.expression.Member;
+import org.apache.olingo.odata4.producer.core.uri.expression.SupportedBinaryOperators;
+import org.apache.olingo.odata4.producer.core.uri.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.producer.core.uri.expression.SupportedUnaryOperators;
+
+public class FilterTreeToText implements ExpressionVisitor<String> {
+
+ @Override
+ public String visitBinaryOperator(SupportedBinaryOperators operator, String left, String right)
+ throws ExceptionVisitExpression {
+ return "<" + left + " " + operator.toString() + " " + right + ">";
+ }
+
+ @Override
+ public String visitUnaryOperator(SupportedUnaryOperators operator, String operand) throws ExceptionVisitExpression {
+ return "<" + operator + " " + operand.toString() + ">";
+ }
+
+ @Override
+ public String visitMethoCall(SupportedMethodCalls methodCall, List<String> parameters)
+ throws ExceptionVisitExpression {
+ String text = "<" + methodCall + "(";
+ int i = 0;
+ while (i< parameters.size()) {
+ if (i > 0 ) {
+ text +=",";
+ }
+ text += parameters.get(i);
+ i++;
+ }
+ // TODO Auto-generated method stub
+ return text + ")";
+ }
+
+
+ @Override
+ public String visitLiteral(String literal) throws ExceptionVisitExpression {
+ return "" + literal + "";
+ }
+
+ @Override
+ public String visitMember(Member member) throws ExceptionVisitExpression {
+ String ret = "";
+ if (member.isIT()) {
+ ret += "$it";
+ }
+
+ UriInfoImplPath path = member.getPath();
+ if (path!= null) {
+ /*if (member.isIT()) {
+ ret +="/";
+ }*/
+
+ ret += path.toString();
+
+
+ }
+ return ret;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/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
new file mode 100644
index 0000000..b21c75c
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.producer.core.uri.UriInfoImplPath;
+import org.apache.olingo.odata4.producer.core.uri.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.core.uri.expression.Expression;
+
+public class FilterValidator {
+
+ UriResourcePathValidator uriResourcePathValidator;
+ Expression filterTree;
+
+ public FilterValidator(UriResourcePathValidator uriResourcePathValidator) {
+
+ this.uriResourcePathValidator = uriResourcePathValidator;
+
+ filterTree = ((UriInfoImplPath) uriResourcePathValidator.uriInfo).getFilter();
+ if (filterTree == null) {
+ fail("FilterValidator: no filter found");
+ }
+ return;
+ }
+
+ // Validates the serialized filterTree against a given filterString
+ // The given filterString is compressed before to allow better readable code in the unit tests
+ public FilterValidator isCompr(String toBeCompr) {
+ return is(compress(toBeCompr));
+ }
+
+ public FilterValidator is(String expectedFilterAsString) {
+ try {
+ String actualFilterAsText = filterTree.accept(new FilterTreeToText());
+ assertEquals(expectedFilterAsString, actualFilterAsText);
+ } catch (ExceptionVisitExpression e) {
+ fail("Exception occured while converting the filterTree into text" + "\n"
+ + " Exception: " + e.getMessage());
+
+ }
+
+ return this;
+ }
+
+ private String compress(String expected) {
+ String ret = expected.replaceAll("\\s+", " ");
+ ret = ret.replaceAll("< ", "<");
+ ret = ret.replaceAll(" >", ">");
+ return ret;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeSerializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeSerializer.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeSerializer.java
deleted file mode 100644
index 5bf44e2..0000000
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeSerializer.java
+++ /dev/null
@@ -1,82 +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.Arrays;
-import java.util.List;
-
-import org.antlr.v4.runtime.Token;
-import org.antlr.v4.runtime.misc.NotNull;
-import org.antlr.v4.runtime.misc.Nullable;
-import org.antlr.v4.runtime.misc.Utils;
-import org.antlr.v4.runtime.tree.ErrorNode;
-import org.antlr.v4.runtime.tree.RuleNode;
-import org.antlr.v4.runtime.tree.TerminalNode;
-import org.antlr.v4.runtime.tree.Tree;
-
-public class ParseTreeSerializer {
-
- public static String getTreeAsText(final Tree contextTree, final String[] ruleNames) {
- return toStringTree(contextTree, Arrays.asList(ruleNames));
- }
-
- private static String toStringTree(final Tree t, @Nullable final List<String> ruleNames) {
-
- if (t.getChildCount() == 0) {
- return Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
- }
-
- StringBuilder buf = new StringBuilder();
- String s = Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
- buf.append(s);
- buf.append("(");
-
- for (int i = 0; i < t.getChildCount(); i++) {
- if (i > 0) {
- buf.append(' ');
- }
- buf.append(toStringTree(t.getChild(i), ruleNames));
- }
- buf.append(")");
- return buf.toString();
- }
-
- private static String getNodeText(@NotNull final Tree t, @Nullable final List<String> ruleNames) {
- if (ruleNames != null) {
- if (t instanceof RuleNode) {
- int ruleIndex = ((RuleNode) t).getRuleContext().getRuleIndex();
- return ruleNames.get(ruleIndex);
- } else if (t instanceof ErrorNode) {
- return t.toString();
- } else if (t instanceof TerminalNode) {
- Token symbol = ((TerminalNode) t).getSymbol();
- if (symbol != null) {
- String s = symbol.getText();
- return s;
- }
- }
- }
- // no recog for rule names
- Object payload = t.getPayload();
- if (payload instanceof Token) {
- return ((Token) payload).getText();
- }
- return t.getPayload().toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeToText.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeToText.java
new file mode 100644
index 0000000..c7fa306
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeToText.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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.Arrays;
+import java.util.List;
+
+import org.antlr.v4.runtime.Token;
+import org.antlr.v4.runtime.misc.NotNull;
+import org.antlr.v4.runtime.misc.Nullable;
+import org.antlr.v4.runtime.misc.Utils;
+import org.antlr.v4.runtime.tree.ErrorNode;
+import org.antlr.v4.runtime.tree.RuleNode;
+import org.antlr.v4.runtime.tree.TerminalNode;
+import org.antlr.v4.runtime.tree.Tree;
+
+public class ParseTreeToText {
+
+ public static String getTreeAsText(final Tree contextTree, final String[] ruleNames) {
+ return toStringTree(contextTree, Arrays.asList(ruleNames));
+ }
+
+ private static String toStringTree(final Tree t, @Nullable final List<String> ruleNames) {
+
+ if (t.getChildCount() == 0) {
+ return Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
+ }
+
+ StringBuilder buf = new StringBuilder();
+ String s = Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
+ buf.append(s);
+ buf.append("(");
+
+ for (int i = 0; i < t.getChildCount(); i++) {
+ if (i > 0) {
+ buf.append(' ');
+ }
+ buf.append(toStringTree(t.getChild(i), ruleNames));
+ }
+ buf.append(")");
+ return buf.toString();
+ }
+
+ private static String getNodeText(@NotNull final Tree t, @Nullable final List<String> ruleNames) {
+ if (ruleNames != null) {
+ if (t instanceof RuleNode) {
+ int ruleIndex = ((RuleNode) t).getRuleContext().getRuleIndex();
+ return ruleNames.get(ruleIndex);
+ } else if (t instanceof ErrorNode) {
+ return t.toString();
+ } else if (t instanceof TerminalNode) {
+ Token symbol = ((TerminalNode) t).getSymbol();
+ if (symbol != null) {
+ String s = symbol.getText();
+ return s;
+ }
+ }
+ }
+ // no recog for rule names
+ Object payload = t.getPayload();
+ if (payload instanceof Token) {
+ return ((Token) payload).getText();
+ }
+ return t.getPayload().toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java
index 115e575..96f148f 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java
@@ -44,93 +44,35 @@ import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser;
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
-/**
- * @author d039346
- *
- */
+// TODO extend to test also exception which can occure while paring
public class ParserValidator {
- public class UriLexerTrace extends UriLexer {
- ParserValidator parserValidator = null;
-
- public UriLexerTrace(final ParserValidator parserValidator, final ANTLRInputStream antlrInputStream) {
- super(antlrInputStream);
- this.parserValidator = parserValidator;
- }
-
- @Override
- public Token emit() {
- Token t =
- _factory.create(_tokenFactorySourcePair, _type, _text, _channel, _tokenStartCharIndex, getCharIndex() - 1,
- _tokenStartLine, _tokenStartCharPositionInLine);
-
- if (parserValidator.logLevel > 1) {
- String out = String.format("%1$-" + 20 + "s", t.getText());
- ;
- int tokenType = t.getType();
- if (tokenType == -1) {
- out += "-1/EOF";
- } else {
- out += UriLexer.tokenNames[tokenType];
- }
- System.out.println(out);
- }
- emit(t);
-
- return t;
- }
-
- @Override
- public void pushMode(final int m) {
- String out = UriLexer.modeNames[_mode] + "-->";
- super.pushMode(m);
- out += UriLexer.modeNames[_mode];
- if (parserValidator.logLevel > 1) {
- System.out.print(out + " ");
- }
- ;
-
- }
-
- @Override
- public int popMode() {
- String out = UriLexer.modeNames[_mode] + "-->";
- int m = super.popMode();
- out += UriLexer.modeNames[_mode];
-
- if (parserValidator.logLevel > 1) {
- System.out.print(out + " ");
- }
-
- return m;
- }
-
- }
-
+
private List<Exception> exceptions = new ArrayList<Exception>();
private ParserRuleContext root;
private String input = null;
- // private int exceptionOnStage = -1;
private Exception curException = null;
+ // private int exceptionOnStage = -1;
// private Exception curWeakException = null;
private boolean allowFullContext;
private boolean allowContextSensitifity;
private boolean allowAmbiguity;
- private int logLevel = 0;
+ public int logLevel = 0;
private int lexerLogLevel = 0;
// private int lexerLogLevel = 0;
public ParserValidator run(final String uri) {
input = uri;
+ // just run a short lexer step. E.g. to print the tokens
if (lexerLogLevel > 0) {
- (new TokenValidator()).log(lexerLogLevel).run(input);
+ (new TokenValidator()).setLog(lexerLogLevel).run(input);
}
root = parseInput(uri);
// LOG > 0 - Write serialized tree
if (logLevel > 0) {
if (root != null) {
- System.out.println(ParseTreeSerializer.getTreeAsText(root, new UriParserParser(null).getRuleNames()));
+ System.out.println(ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames()));
} else {
System.out.println("root == null");
}
@@ -152,8 +94,9 @@ public class ParserValidator {
}
/**
+ * TODO verify
* Used in fast LL Parsing:
- * Don't stops the parsing process when the slower full context parsing (with prediction mode SLL) is
+ * Don't stop the parsing process when the slower full context parsing (with prediction mode SLL) is
* required
* @return
*/
@@ -163,6 +106,7 @@ public class ParserValidator {
}
/**
+ * TODO verify
* Used in fast LL Parsing:
* Allows ContextSensitifity Errors which occur often when using the slower full context parsing
* and indicate that there is a context sensitivity ( which may not be an error).
@@ -174,6 +118,7 @@ public class ParserValidator {
}
/**
+ * TODO verify
* Used in fast LL Parsing:
* Allows ambiguities
* @return
@@ -184,23 +129,25 @@ public class ParserValidator {
}
public ParserValidator isText(final String expected) {
- // make sure that there are no exceptions
+
assertEquals(null, curException);
+
assertEquals(0, exceptions.size());
- String text = ParseTreeSerializer.getTreeAsText(root, new UriParserParser(null).getRuleNames());
+ String text = ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames());
+
assertEquals(expected, text);
return this;
}
- public ParserValidator isExType(final Class<?> exClass) {
+ public ParserValidator isExeptionType(final Class<?> exClass) {
assertEquals(exClass, curException.getClass());
return this;
}
private OdataRelativeUriEOFContext parseInput(final String input) {
UriParserParser parser = null;
- UriLexer lexer = null;
+ UriLexerWithTrace lexer = null;
OdataRelativeUriEOFContext ret = null;
// Use 2 stage approach to improve performance
@@ -212,38 +159,42 @@ public class ParserValidator {
curException = null;
exceptions.clear();
// create parser
- lexer = new UriLexerTrace(this, new ANTLRInputStream(input));
+ lexer = new UriLexerWithTrace( new ANTLRInputStream(input), this.lexerLogLevel);
parser = new UriParserParser(new CommonTokenStream(lexer));
// write single tokens to System.out
if (logLevel > 1) {
- // can not be used because the listener is called bevore the mode changes
+ // can not be used because the listener is called before the mode changes
+ // TODO verify this
parser.addParseListener(new TokenWriter());
}
// write always a error message in case of syntax errors
- //parser.addErrorListener(new TestErrorHandler<Object>());
+ // parser.addErrorListener(new TestErrorHandler<Object>());
// check error message if whether they are allowed or not
parser.addErrorListener(new ErrorCollector(this));
- // Bail out of parser at first syntax error. --> procceds in catch block with step 2
+ // bail out of parser at first syntax error. --> proceed 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
if (logLevel > 1) {
- System.out.println("Step 1 (LL)");
+ System.out.println("Step 1");
+ System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode() + ")");
}
ret = parser.odataRelativeUriEOF();
- } catch (Exception ex) {
- curException = ex;
+ } catch (Exception exception) {
+ curException = exception;
try {
// clear status
curException = null;
exceptions.clear();
// create parser
- lexer = new UriLexerTrace(this, new ANTLRInputStream(input));
+ lexer = new UriLexerWithTrace(new ANTLRInputStream(input), this.lexerLogLevel);
parser = new UriParserParser(new CommonTokenStream(lexer));
// write single tokens to System.out
@@ -252,7 +203,7 @@ public class ParserValidator {
}
// write always a error message in case of syntax errors
- parser.addErrorListener(new TestErrorHandler<Object>());
+ parser.addErrorListener(new ErrorCollector(this));
// check error message if whether they are allowed or not
parser.addErrorListener(new ErrorCollector(this));
@@ -262,13 +213,15 @@ public class ParserValidator {
// User the slower SLL parsing
parser.getInterpreter().setPredictionMode(PredictionMode.LL);
+ // parse
if (logLevel > 1) {
- System.out.println("Step 2 (SLL)");
+ System.out.println("Step 2");
+ System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode() + ")");
}
ret = parser.odataRelativeUriEOF();
- } catch (Exception ex1) {
- curException = ex1;
+ } catch (Exception exception1) {
+ curException = exception1;
// exceptionOnStage = 2;
}
}
@@ -277,7 +230,7 @@ public class ParserValidator {
}
private static class ErrorCollector implements ANTLRErrorListener {
- ParserValidator tokenValidator;
+ private ParserValidator tokenValidator;
public ErrorCollector(final ParserValidator tokenValidator) {
this.tokenValidator = tokenValidator;
@@ -288,7 +241,10 @@ public class ParserValidator {
final int charPositionInLine,
final String msg, final RecognitionException e) {
+ // Collect the exception
+ // TODO needs to be improved
tokenValidator.exceptions.add(e);
+ System.out.println("syntaxError");
trace(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
fail("syntaxError");
@@ -299,16 +255,16 @@ public class ParserValidator {
final boolean exact,
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) {
- System.out.println("reportAmbiguity " +
- ambigAlts + ":" + configs +
- ", input=" + recognizer.getTokenStream().getText(Interval.of(startIndex, stopIndex)));
printStack(recognizer);
fail("reportAmbiguity");
- } else if (tokenValidator.logLevel > 0) {
- System.out.println("allowed Ambiguity " +
- ambigAlts + ":" + configs +
- ", input=" + recognizer.getTokenStream().getText(Interval.of(startIndex, stopIndex)));
}
}
@@ -316,14 +272,16 @@ public class ParserValidator {
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");
- } else if (tokenValidator.logLevel > 0) {
- System.out.println("allowed AttemptingFullContext");
}
}
@@ -331,41 +289,52 @@ public class ParserValidator {
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");
- } else if (tokenValidator.logLevel > 0) {
- System.out.println("allowed ContextSensitivity");
}
}
- private void printStack(final Parser recognizer) {
+ /*
+ * private void printStack(final Parser recognizer) {
+ * List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
+ * Collections.reverse(stack);
+ *
+ * System.out.println(" Rule stack: " + stack);
+ * }
+ */
+ private void printStack(final Recognizer<?, ?> recognizer) {
List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
Collections.reverse(stack);
-
- System.out.println("rule stack: " + stack);
+ System.out.println(" rule stack: " + stack);
}
public void trace(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
+
System.err.println("-");
- // check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
- List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
- Collections.reverse(stack);
- System.err.println("rule stack: " + stack);
+ // TODO check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
+
+ printStack(recognizer);
+
if (e != null && e.getOffendingToken() != null) {
- // String lexerTokenName =TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
+ //String lexerTokenName = TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
String lexerTokenName = "";
try {
lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
} catch (ArrayIndexOutOfBoundsException es) {
lexerTokenName = "token error";
}
- System.err.println("line " + line + ":" + charPositionInLine + " at " +
+ System.err.println(" line " + line + ":" + charPositionInLine + " at " +
offendingSymbol + "/" + lexerTokenName + ": " + msg);
} else {
- System.err.println("line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
+ System.err.println(" line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorHandler.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorHandler.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorHandler.java
deleted file mode 100644
index 625ac5d..0000000
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorHandler.java
+++ /dev/null
@@ -1,56 +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.Collections;
-import java.util.List;
-
-
-
-import org.antlr.v4.runtime.BaseErrorListener;
-import org.antlr.v4.runtime.Parser;
-import org.antlr.v4.runtime.RecognitionException;
-import org.antlr.v4.runtime.Recognizer;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
-
-public class TestErrorHandler<T> extends BaseErrorListener {
- @Override
- public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
- final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
- System.err.println("-");
- // check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
- List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
- Collections.reverse(stack);
- System.err.println("rule stack: " + stack);
- if (e != null && e.getOffendingToken() != null) {
-
- // String lexerTokenName =TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
- String lexerTokenName = "";
- try {
- lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
- } catch (ArrayIndexOutOfBoundsException es) {
- lexerTokenName = "token error";
- }
- System.err.println("line " + line + ":" + charPositionInLine + " at " +
- offendingSymbol + "/" + lexerTokenName + ": " + msg);
- } else {
- System.err.println("line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java
index 30becaf..6140a0c 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java
@@ -36,6 +36,7 @@ import org.antlr.v4.runtime.atn.ATNConfigSet;
import org.antlr.v4.runtime.dfa.DFA;
import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
+//TODO extend to test also exception which can occure while paring
public class TokenValidator {
private List<? extends Token> tokens = null;
private List<Exception> exceptions = new ArrayList<Exception>();
@@ -43,7 +44,6 @@ public class TokenValidator {
private Exception curException = null;
private String input = null;
private int logLevel = 0;
-
private int mode;
public TokenValidator run(final String uri) {
@@ -82,62 +82,20 @@ public class TokenValidator {
return this;
}
- public TokenValidator log(final int logLevel) {
+ public TokenValidator setLog(final int logLevel) {
this.logLevel = logLevel;
return this;
}
- public TokenValidator isText(final String expected) {
- assertEquals(expected, curToken.getText());
- return this;
- }
-
- public TokenValidator isAllText(final String expected) {
- String tmp = "";
-
- for (Token curToken : tokens) {
- tmp += curToken.getText();
- }
- assertEquals(expected, tmp);
- return this;
- }
-
- public TokenValidator isAllInput() {
- String tmp = "";
-
- for (Token curToken : tokens) {
- tmp += curToken.getText();
- }
- assertEquals(input, tmp);
- return this;
- }
-
- public TokenValidator isInput() {
- assertEquals(input, curToken.getText());
- return this;
- }
-
- public TokenValidator isType(final int expected) {
- // assertEquals(UriLexer.tokenNames[expected], UriLexer.tokenNames[curToken.getType()]);
- assertEquals(UriLexer.tokenNames[expected], UriLexer.tokenNames[curToken.getType()]);
- return this;
- }
-
- public TokenValidator isExType(final Class<?> exClass) {
- assertEquals(exClass, curException.getClass());
- return this;
- }
-
private List<? extends Token> parseInput(final String input) {
ANTLRInputStream inputStream = new ANTLRInputStream(input);
- UriLexer lexer = new TestUriLexer(this, inputStream, mode);
- // lexer.setInSearch(searchMode);
- // lexer.removeErrorListeners();
+ UriLexer lexer = new UriLexerWithTrace(inputStream, logLevel, mode);
lexer.addErrorListener(new ErrorCollector(this));
return lexer.getAllTokens();
}
+ // navigate within the tokenlist
public TokenValidator first() {
try {
curToken = tokens.get(0);
@@ -147,18 +105,17 @@ public class TokenValidator {
return this;
}
- public TokenValidator exFirst() {
- try {
- curException = exceptions.get(0);
- } catch (IndexOutOfBoundsException ex) {
- curException = null;
- }
+ public TokenValidator last() {
+ curToken = tokens.get(tokens.size() - 1);
return this;
-
}
- public TokenValidator last() {
- curToken = tokens.get(tokens.size() - 1);
+ public TokenValidator at(final int index) {
+ try {
+ curToken = tokens.get(index);
+ } catch (IndexOutOfBoundsException ex) {
+ curToken = null;
+ }
return this;
}
@@ -167,13 +124,15 @@ public class TokenValidator {
return this;
}
- public TokenValidator at(final int index) {
+ // navigate within the exception list
+ public TokenValidator exFirst() {
try {
- curToken = tokens.get(index);
+ curException = exceptions.get(0);
} catch (IndexOutOfBoundsException ex) {
- curToken = null;
+ curException = null;
}
return this;
+
}
public TokenValidator exAt(final int index) {
@@ -185,36 +144,48 @@ public class TokenValidator {
return this;
}
- private static class TestUriLexer extends UriLexer {
- private TokenValidator validator;
+ // test functions
+ public TokenValidator isText(final String expected) {
+ assertEquals(expected, curToken.getText());
+ return this;
+ }
- public TestUriLexer(final TokenValidator validator, final CharStream input, final int mode) {
- super(input);
- super.mode(mode);
- this.validator = validator;
+ public TokenValidator isAllText(final String expected) {
+ String actual = "";
+
+ for (Token curToken : tokens) {
+ actual += curToken.getText();
}
+ assertEquals(expected, actual);
+ return this;
+ }
- @Override
- public void pushMode(final int m) {
- if (validator.logLevel > 0) {
- System.out.println("OnMode" + ": " + UriLexer.modeNames[m]);
- }
- super.pushMode(m);
+ public TokenValidator isAllInput() {
+ String actual = "";
+ for (Token curToken : tokens) {
+ actual += curToken.getText();
}
+ assertEquals(input, actual);
+ return this;
+ }
- @Override
- public int popMode() {
- int m = super.popMode();
- if (validator.logLevel > 0) {
- System.out.println("OnMode" + ": " + UriLexer.modeNames[m]);
- }
+ public TokenValidator isInput() {
+ assertEquals(input, curToken.getText());
+ return this;
+ }
- return m;
- }
+ public TokenValidator isType(final int expected) {
+ assertEquals(UriLexer.tokenNames[expected], UriLexer.tokenNames[curToken.getType()]);
+ return this;
+ }
+ public TokenValidator isExType(final Class<?> exClass) {
+ assertEquals(exClass, curException.getClass());
+ return this;
}
+ // TODO create ErrorCollector for both ParserValidator and LexerValidator
private static class ErrorCollector implements ANTLRErrorListener {
TokenValidator tokenValidator;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TraceErrorHandler.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TraceErrorHandler.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TraceErrorHandler.java
deleted file mode 100644
index 76dabb5..0000000
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TraceErrorHandler.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.testutil;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.antlr.v4.runtime.BaseErrorListener;
-import org.antlr.v4.runtime.Parser;
-import org.antlr.v4.runtime.RecognitionException;
-import org.antlr.v4.runtime.Recognizer;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
-
-public class TraceErrorHandler<T> extends BaseErrorListener {
- @Override
- public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
- final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
- System.err.println("-");
- // check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
- List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
- Collections.reverse(stack);
- System.err.println("rule stack: " + stack);
- if (e != null && e.getOffendingToken() != null) {
-
- // String lexerTokenName =TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
- String lexerTokenName = "";
- try {
- lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
- } catch (ArrayIndexOutOfBoundsException es) {
- lexerTokenName = "token error";
- }
- System.err.println("line " + line + ":" + charPositionInLine + " at " +
- offendingSymbol + "/" + lexerTokenName + ": " + msg);
- } else {
- System.err.println("line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriLexerWithTrace.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriLexerWithTrace.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriLexerWithTrace.java
new file mode 100644
index 0000000..c333b6c
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriLexerWithTrace.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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 org.antlr.v4.runtime.ANTLRInputStream;
+import org.antlr.v4.runtime.Token;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
+
+public class UriLexerWithTrace extends UriLexer{
+ int logLevel = 0;
+
+
+ public UriLexerWithTrace( final ANTLRInputStream antlrInputStream, int logLevel) {
+ super(antlrInputStream);
+ this.logLevel = logLevel;
+ }
+
+ public UriLexerWithTrace( final ANTLRInputStream antlrInputStream, int logLevel, final int mode) {
+ super(antlrInputStream);
+ super.mode(mode);
+ this.logLevel = logLevel;
+ }
+
+ @Override
+ public void emit(Token token) {
+ if (logLevel > 1) {
+ String out = String.format("%1$-" + 20 + "s", token.getText());
+
+ int tokenType = token.getType();
+ if (tokenType == -1) {
+ out += "-1/EOF";
+ } else {
+ out += UriLexer.tokenNames[tokenType];
+ }
+ System.out.println("Lexer.emit(...):" + out);
+ }
+
+ super.emit(token);
+ }
+
+ @Override
+ public void pushMode(final int m) {
+
+ String out = UriLexer.modeNames[_mode] + "-->";
+
+ super.pushMode(m);
+
+ out += UriLexer.modeNames[_mode];
+
+ if (logLevel > 1) {
+ System.out.print(out + " ");
+ }
+ }
+
+ @Override
+ public int popMode() {
+
+ String out = UriLexer.modeNames[_mode] + "-->";
+
+ int m = super.popMode();
+
+ out += UriLexer.modeNames[_mode];
+
+ if (logLevel > 1) {
+ System.out.print(out + " ");
+ }
+
+ return m;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java
index f68345e..296df0a 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java
@@ -24,17 +24,7 @@ import static org.junit.Assert.fail;
import java.util.List;
-
-
-
-
-
-
-
-
-
import org.apache.olingo.odata4.commons.api.edm.Edm;
-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.EdmType;
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
@@ -47,37 +37,64 @@ import org.apache.olingo.odata4.producer.core.uri.UriParserException;
import org.apache.olingo.odata4.producer.core.uri.UriParserImpl;
import org.apache.olingo.odata4.producer.core.uri.UriPathInfoImpl;
import org.apache.olingo.odata4.producer.core.uri.UriPathInfoEntitySetImpl;
-
+import org.apache.olingo.odata4.producer.core.uri.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.core.uri.expression.Expression;
public class UriResourcePathValidator {
private Edm edm;
- private UriInfoImpl uriInfo = null;
+ // this validator can only be used on resourcePaths
+ public UriInfoImplPath uriInfo = null;
private UriPathInfoImpl uriPathInfo = null;
+ public UriResourcePathValidator run(String uri) {
+ UriInfoImpl uriInfoTmp = null;
+ uriPathInfo = null;
+ try {
+ uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
+ } catch (UriParserException e) {
+ fail("Exception occured while parsing the URI: " + uri + "\n"
+ + " Exception: " + e.getMessage());
+ }
+
+ if (!(uriInfoTmp instanceof UriInfoImplPath)) {
+ fail("Validator can only be used on resourcePaths");
+ }
+ this.uriInfo = (UriInfoImplPath) uriInfoTmp;
+
+ last();
+ return this;
+ }
+
+
+ // short cut which avoid adding the ESabc?$filter when testing filter to each URI
+ public FilterValidator runFilter(String filter) {
+ String uri = "ESabc?$filter=" + filter.trim(); // TODO check what to do with trailing spaces in the URI
+ this.run(uri);
+ return new FilterValidator(this);
+ }
+
public UriResourcePathValidator setEdm(final Edm edm) {
this.edm = edm;
return this;
}
-
- public UriResourcePathValidator run(String uri) {
+ // navigation for uriPathInfo
+ public UriResourcePathValidator at(int index) {
try {
- uriInfo = new UriParserImpl(edm).ParseUri(uri);
- } catch (UriParserException e) {
- fail("Exception occured");
+ uriPathInfo = uriInfo.getUriPathInfo(index);
+ } catch (IndexOutOfBoundsException ex) {
+ uriPathInfo = null;
}
- uriPathInfo = null;
- if (uriInfo instanceof UriInfoImplPath) {
- last();
- }
return this;
}
- public UriResourcePathValidator isUriPathInfoKind(UriPathInfoKind infoType) {
-
- assertNotNull(uriPathInfo);
- assertEquals(infoType, uriPathInfo.getKind());
+ public UriResourcePathValidator first() {
+ try {
+ uriPathInfo = ((UriInfoImplPath) uriInfo).getUriPathInfo(0);
+ } catch (IndexOutOfBoundsException ex) {
+ uriPathInfo = null;
+ }
return this;
}
@@ -91,79 +108,107 @@ public class UriResourcePathValidator {
return this;
}
+ // check types
- public UriResourcePathValidator at(int index) {
- if (uriInfo instanceof UriInfoImplPath) {
- try {
- uriPathInfo = ((UriInfoImplPath) uriInfo).getUriPathInfo(index);
- } catch (IndexOutOfBoundsException ex) {
- uriPathInfo = null;
- }
- } else {
- fail("UriInfo not instanceof UriInfoImplPath");
+ public UriResourcePathValidator isInitialType(FullQualifiedName expectedType) {
+ EdmType actualType = uriPathInfo.getInitialType();
+ if (actualType == null) {
+ fail("isInitialType: actualType == null");
+ }
+
+ FullQualifiedName actualTypeName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+ assertEquals(expectedType.toString(), actualTypeName.toString());
+ return this;
+ }
+
+ public UriResourcePathValidator isType(FullQualifiedName type) {
+ EdmType actualType = uriPathInfo.getType();
+ if (actualType == null) {
+ fail("type information not set");
}
+
+ FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+
+ assertEquals(type.toString(), actualName.toString());
return this;
}
- public UriResourcePathValidator first() {
- if (uriInfo instanceof UriInfoImplPath) {
- try {
- uriPathInfo = ((UriInfoImplPath) uriInfo).getUriPathInfo(0);
- } catch (IndexOutOfBoundsException ex) {
- uriPathInfo = null;
- }
+ public UriResourcePathValidator isSingleTypeFilter(FullQualifiedName type) {
+ // input parameter type may be null in order to assert that the singleTypeFilter is not set
+ EdmType actualType = uriPathInfo.getSingleTypeFilter();
+ if (type == null) {
+ assertEquals(type, actualType);
} else {
- fail("UriInfo not instanceof UriInfoImplPath");
+ assertEquals(type.toString(), new FullQualifiedName(actualType.getNamespace(), actualType.getName()).toString());
}
- return this;
+ return this;
}
-
- /*
- * blic void isKind(UriInfoKind batch) {
- * // TODO assertEquals(batch, uriInfo.getKind());
- * }
- */
- public UriResourcePathValidator isKeyPredicate(int index, String name, String value) {
- if (uriPathInfo instanceof UriPathInfoEntitySetImpl) {
- UriPathInfoEntitySetImpl info = (UriPathInfoEntitySetImpl) uriPathInfo;
- UriKeyPredicateList keyPredicates = info.getKeyPredicates();
- assertEquals(name, keyPredicates.getName(index));
- assertEquals(value, keyPredicates.getValue(index));
+ public UriResourcePathValidator isCollectionTypeFilter(FullQualifiedName expectedType) {
+ // input parameter type may be null in order to assert that the collectionTypeFilter is not set
+ EdmType actualType = uriPathInfo.getCollectionTypeFilter();
+ if (expectedType == null) {
+ assertEquals(expectedType, actualType);
+ } else {
+ FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+ assertEquals(expectedType.toString(), actualName.toString());
}
- return this;
+ return this;
}
- public UriResourcePathValidator isType(FullQualifiedName type) {
- EdmType actualType = uriPathInfo.getType();
- if (actualType == null ) {
- fail("type information not set");
+ // other functions
+ public UriResourcePathValidator hasQueryParameter(String parameter, int count) {
+ if (uriInfo == null) {
+ fail("hasQueryParameter: uriInfo == null");
}
- assertEquals(type, new FullQualifiedName(actualType.getNamespace(), actualType.getName()));
+
+ int actualCount = uriInfo.getQueryParameters(parameter).size();
+ assertEquals(count, actualCount);
return this;
}
-
+
public UriResourcePathValidator isCollection(boolean isCollection) {
- EdmType actualType = uriPathInfo.getType();
- if (actualType == null ) {
- fail("type information not set");
+ EdmType type = uriPathInfo.getType();
+ if (type == null) {
+ fail("isCollection: type == null");
}
assertEquals(isCollection, uriPathInfo.isCollection());
return this;
}
-
- public UriResourcePathValidator isInitialType(FullQualifiedName type) {
- EdmType actualType = uriPathInfo.getInitialType();
- if (actualType == null ) {
- fail("type information not set");
+
+ public UriResourcePathValidator isFilterString(String expectedFilterTreeAsString) {
+ Expression filterTree = this.uriInfo.getFilter();
+ try {
+ String filterTreeAsString = filterTree.accept(new FilterTreeToText());
+ assertEquals(expectedFilterTreeAsString, filterTreeAsString);
+ } catch (ExceptionVisitExpression e) {
+ fail("isFilterString: Exception " + e.getMessage() + " occured");
}
- assertEquals(type, new FullQualifiedName(actualType.getNamespace(), actualType.getName()));
+
return this;
}
+ public UriResourcePathValidator isKeyPredicate(int index, String name, String value) {
+ if (!(uriPathInfo instanceof UriPathInfoEntitySetImpl)) {
+ //TODO add and "or" for FunctionImports
+ fail("isKeyPredicate: uriPathInfo is not instanceof UriPathInfoEntitySetImpl");
+ }
+
+ UriPathInfoEntitySetImpl info = (UriPathInfoEntitySetImpl) uriPathInfo;
+ UriKeyPredicateList keyPredicates = info.getKeyPredicates();
+ assertEquals(name, keyPredicates.getName(index));
+ assertEquals(value, keyPredicates.getValue(index));
+ return this;
+
+ }
+
+ public UriResourcePathValidator isKind(UriInfoKind kind) {
+ assertEquals(kind, uriInfo.getKind());
+ return this;
+ }
public UriResourcePathValidator isProperties(List<String> asList) {
assertNotNull(uriPathInfo);
@@ -171,33 +216,33 @@ public class UriResourcePathValidator {
int index = 0;
while (index < asList.size()) {
String propertyName = uriPathInfo.getProperty(index).getName();
+
assertEquals(asList.get(index), propertyName);
+
index++;
}
return this;
-
-
}
- public void isKind(UriInfoKind kind) {
-
- assertEquals(kind, uriInfo.getKind());
- }
-
-
public UriResourcePathValidator isProperty(int index, String name, FullQualifiedName type) {
- if ( index >= uriPathInfo.getPropertyCount()) {
- fail("not enougth properties in pathinfo found");
+ if (index >= uriPathInfo.getPropertyCount()) {
+ fail("isProperty: invalid index");
}
+
EdmElement property = uriPathInfo.getProperty(index);
-
+
assertEquals(name, property.getName());
assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
return this;
-
}
+ public UriResourcePathValidator isUriPathInfoKind(UriPathInfoKind infoType) {
+ assertNotNull(uriPathInfo);
+ assertEquals(infoType, uriPathInfo.getKind());
+ return this;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
index 0a6e0df..4179137 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
@@ -40,7 +40,7 @@ public class TestParser {
@Test
public void test() {
- test.log(2).aAM().aFC().aCS().run("ODI?$filter=(1) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ test.aAM().aFC().aCS().run("ODI?$filter=(1) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ "queryOption(systemQueryOption("
+ "filter($filter = commonExpr("
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/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 e753744..6e15ee5 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
@@ -18,16 +18,24 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.antlr;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
import java.util.Arrays;
import org.apache.olingo.odata4.commons.api.edm.Edm;
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
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.UriPathInfoKind;
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.FilterTreeToText;
import org.apache.olingo.odata4.producer.core.testutil.UriResourcePathValidator;
+import org.apache.olingo.odata4.producer.core.uri.SystemQueryParameter;
+import org.apache.olingo.odata4.producer.core.uri.UriInfoImplPath;
+import org.apache.olingo.odata4.producer.core.uri.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.core.uri.expression.Expression;
import org.junit.Test;
public class TestUriParserImpl {
@@ -53,7 +61,7 @@ public class TestUriParserImpl {
public TestUriParserImpl() {
test = new UriResourcePathValidator();
- edm = new EdmProviderImpl(new EdmTechProvider());
+ edm = new EdmProviderImpl(new EdmTechTestProvider());
test.setEdm(edm);
}
@@ -68,9 +76,10 @@ public class TestUriParserImpl {
@Test
public void testShortUris() {
- test.run("$batch").isKind(UriInfoKind.batch);
- test.run("$all").isKind(UriInfoKind.all);
- test.run("$crossjoin(abc)").isKind(UriInfoKind.crossjoin);
+ //TODO create on validator for these URIs, because the will more complicated in future
+ //test.run("$batch").isKind(UriInfoKind.batch);
+ //test.run("$all").isKind(UriInfoKind.all);
+ //test.run("$crossjoin(abc)").isKind(UriInfoKind.crossjoin);
}
@Test
@@ -116,7 +125,9 @@ public class TestUriParserImpl {
.isKeyPredicate(10, "PropertyDuration", "duration'P10DT5H34M21.123456789012S'")
.isKeyPredicate(11, "PropertyGuid", "12345678-1234-1234-1234-123456789012")
.isKeyPredicate(12, "PropertyTimeOfDay", "12:34:55.123456789012");
+ }
+ public void testEntitySet_Prop() {
// with property
test.run("ESAllPrim(1)/PropertyString")
.isUriPathInfoKind(UriPathInfoKind.entitySet)
@@ -138,13 +149,14 @@ public class TestUriParserImpl {
}
@Test
- public void testEntitySetNav() {
+ public void testEntitySet_NavProp() {
test.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
.at(0)
.isUriPathInfoKind(UriPathInfoKind.entitySet)
- .isInitialType(EdmTechProvider.nameETKeyNav)
.isType(EdmTechProvider.nameETTwoKeyNav)
+ .isInitialType(EdmTechProvider.nameETKeyNav)
+
.isKeyPredicate(0, "PropertyInt16", "1")
.isProperty(0, "NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav)
.at(1)
@@ -200,17 +212,57 @@ public class TestUriParserImpl {
}
@Test
- public void testTypeFilter() {
- // test.run("ESTwoPrim");
+ public void testEntitySet_TypeFilter() {
+
+ // filter
test.run("ESTwoPrim/com.sap.odata.test1.ETBase")
.isUriPathInfoKind(UriPathInfoKind.entitySet)
- .isType(new FullQualifiedName("com.sap.odata.test1", "ETBase"));
+ .isInitialType(EdmTechProvider.nameETTwoPrim)
+ .isCollectionTypeFilter(EdmTechProvider.nameETBase)
+ .isSingleTypeFilter(null)
+ .isType(EdmTechProvider.nameETBase)
+ .isCollection(true);
- test.run("ESTwoPrim/com.sap.odata.test1.ETBase/AdditionalPropertyString_5")
+ // filter before key predicate
+ test.run("ESTwoPrim/com.sap.odata.test1.ETBase(PropertyInt16=1)")
.isUriPathInfoKind(UriPathInfoKind.entitySet)
- .isType(new FullQualifiedName("Edm", "String"))
- .isProperties(Arrays.asList("AdditionalPropertyString_5"))
- .isProperty(0, "AdditionalPropertyString_5", EdmTechProvider.nameString);
+ .isInitialType(EdmTechProvider.nameETTwoPrim)
+ .isCollectionTypeFilter(EdmTechProvider.nameETBase)
+ .isSingleTypeFilter(null)
+ .isType(EdmTechProvider.nameETBase)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isCollection(false);
+
+ test.run("ESTwoPrim/com.sap.odata.test1.ETBase(PropertyInt16=1)/AdditionalPropertyString_5")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isInitialType(EdmTechProvider.nameETTwoPrim)
+ .isCollectionTypeFilter(EdmTechProvider.nameETBase)
+ .isSingleTypeFilter(null)
+ .isType(EdmTechProvider.nameString)
+
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isProperty(0, "AdditionalPropertyString_5", EdmTechProvider.nameString)
+ .isCollection(false);
+
+ // filter after key predicate
+ test.run("ESTwoPrim(PropertyInt16=1)/com.sap.odata.test1.ETBase")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isInitialType(EdmTechProvider.nameETTwoPrim)
+ .isCollectionTypeFilter(null)
+ .isSingleTypeFilter(EdmTechProvider.nameETBase)
+ .isType(EdmTechProvider.nameETBase)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isCollection(false);
+
+ test.run("ESTwoPrim(PropertyInt16=1)/com.sap.odata.test1.ETBase/AdditionalPropertyString_5")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isType(EdmTechProvider.nameString)
+ .isInitialType(EdmTechProvider.nameETTwoPrim)
+ .isCollectionTypeFilter(null)
+ .isSingleTypeFilter(EdmTechProvider.nameETBase)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isProperty(0, "AdditionalPropertyString_5", EdmTechProvider.nameString)
+ .isCollection(false);
}
@Test
@@ -234,8 +286,8 @@ public class TestUriParserImpl {
test.run("SINav/NavPropertyETKeyNavOne")
.at(0)
.isUriPathInfoKind(UriPathInfoKind.singleton)
- .isType(EdmTechProvider.nameETKeyNav)
.isInitialType(EdmTechProvider.nameETTwoKeyNav)
+ .isType(EdmTechProvider.nameETKeyNav)
.isCollection(false)
.at(1)
.isType(EdmTechProvider.nameETKeyNav);
@@ -243,8 +295,8 @@ public class TestUriParserImpl {
test.run("SINav/NavPropertyETKeyNavOne/PropertyInt16")
.at(0)
.isUriPathInfoKind(UriPathInfoKind.singleton)
- .isType(EdmTechProvider.nameETKeyNav)
.isInitialType(EdmTechProvider.nameETTwoKeyNav)
+ .isType(EdmTechProvider.nameETKeyNav)
.isCollection(false)
.at(1)
.isInitialType(EdmTechProvider.nameETKeyNav)
@@ -253,8 +305,9 @@ public class TestUriParserImpl {
test.run("SINav/NavPropertyETKeyNavMany(1)")
.at(0)
.isUriPathInfoKind(UriPathInfoKind.singleton)
- .isType(EdmTechProvider.nameETKeyNav)
.isInitialType(EdmTechProvider.nameETTwoKeyNav)
+ .isType(EdmTechProvider.nameETKeyNav)
+
.isCollection(true)
.at(1)
.isType(EdmTechProvider.nameETKeyNav);
@@ -262,8 +315,8 @@ public class TestUriParserImpl {
test.run("SINav/NavPropertyETKeyNavMany(1)/PropertyInt16")
.at(0)
.isUriPathInfoKind(UriPathInfoKind.singleton)
- .isType(EdmTechProvider.nameETKeyNav)
.isInitialType(EdmTechProvider.nameETTwoKeyNav)
+ .isType(EdmTechProvider.nameETKeyNav)
.isCollection(true)
.at(1)
.isInitialType(EdmTechProvider.nameETKeyNav)
@@ -273,7 +326,7 @@ public class TestUriParserImpl {
@Test
public void testActionImport() {
-
+
test.run("AIRTPrimParam")
.isUriPathInfoKind(UriPathInfoKind.action)
.isType(EdmTechProvider.nameString);
@@ -293,16 +346,19 @@ public class TestUriParserImpl {
.isType(EdmTechProvider.nameETCollAllPrim)
.isCollection(true);
+ //the parser can to this, but should not, as defined per ABNF
+ /*
test.run("AIRTETCollAllPrimParam(1)")
.isUriPathInfoKind(UriPathInfoKind.action)
.isType(EdmTechProvider.nameETCollAllPrim)
.isKeyPredicate(0, "PropertyInt16", "1")
- .isCollection(false);
+ .isCollection(false);
test.run("AIRTETCollAllPrimParam(ParameterInt16=1)")
.isUriPathInfoKind(UriPathInfoKind.action)
.isType(EdmTechProvider.nameETCollAllPrim)
.isKeyPredicate(0, "PropertyInt16", "1")
.isCollection(false);
+ */
}
/*
@@ -346,9 +402,48 @@ public class TestUriParserImpl {
@Test
public void testErrors() {
- //the following is wrong and must throw an error behind an Action are not () allowed
- //test.run("AIRTPrimParam()");
+ // the following is wrong and must throw an error behind an Action are not () allowed
+ // test.run("AIRTPrimParam()");
+
+ }
+
+ @Test
+ public void testFilter() {
+ test.run("ESAllPrim?$filter=1")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .hasQueryParameter(SystemQueryParameter.FILTER.toString(), 1)
+ .isFilterString("1");
+
+ }
+
+ @Test
+ public void testFilterSimpleSameBinaryBinaryBinaryPriority() {
+
+ test.runFilter("1 add 2 add 3 add 4").is("<<<1 add 2> add 3> add 4>");
+ test.runFilter("1 add 2 add 3 div 4").is("<<1 add 2> add <3 div 4>>");
+ test.runFilter("1 add 2 div 3 add 4").is("<<1 add <2 div 3>> add 4>");
+ test.runFilter("1 add 2 div 3 div 4").is("<1 add <<2 div 3> div 4>>");
+ test.runFilter("1 div 2 add 3 add 4").is("<<<1 div 2> add 3> add 4>");
+ test.runFilter("1 div 2 add 3 div 4").is("<<1 div 2> add <3 div 4>>");
+ test.runFilter("1 div 2 div 3 add 4").is("<<<1 div 2> div 3> add 4>");
+ test.runFilter("1 div 2 div 3 div 4").is("<<<1 div 2> div 3> div 4>");
+
+ }
+
+ @Test
+ public void testFilterComplexMixedPriority() {
+ test.runFilter("a or c and e ").isCompr("< a or < c and e >>");
+ test.runFilter("a or c and e eq f").isCompr("< a or < c and <e eq f>>>");
+ test.runFilter("a or c eq d and e ").isCompr("< a or <<c eq d> and e >>");
+ test.runFilter("a or c eq d and e eq f").isCompr("< a or <<c eq d> and <e eq f>>>");
+ test.runFilter("a eq b or c and e ").isCompr("<<a eq b> or < c and e >>");
+ test.runFilter("a eq b or c and e eq f").isCompr("<<a eq b> or < c and <e eq f>>>");
+ test.runFilter("a eq b or c eq d and e ").isCompr("<<a eq b> or <<c eq d> and e >>");
+ test.runFilter("a eq b or c eq d and e eq f").isCompr("<<a eq b> or <<c eq d> and <e eq f>>>");
+ }
+
+ @Test
+ public void textFilterMember() {
+ test.runFilter("a").is("a");
}
-
-
}
[2/4] [OLINGO-63] Uri Parser: Add support for $filter
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/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 6051dbd..479c87d 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
@@ -23,6 +23,7 @@ import java.util.List;
import org.apache.olingo.odata4.commons.api.edm.helper.EntityContainerInfo;
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.provider.Action;
import org.apache.olingo.odata4.commons.api.edm.provider.ActionImport;
import org.apache.olingo.odata4.commons.api.edm.provider.ComplexType;
import org.apache.olingo.odata4.commons.api.edm.provider.EdmProviderAdapter;
@@ -39,261 +40,186 @@ import org.apache.olingo.odata4.commons.api.edm.provider.PropertyRef;
import org.apache.olingo.odata4.commons.api.edm.provider.ReferentialConstraint;
import org.apache.olingo.odata4.commons.api.edm.provider.ReturnType;
import org.apache.olingo.odata4.commons.api.edm.provider.Singleton;
-import org.apache.olingo.odata4.commons.api.edm.provider.Action;
import org.apache.olingo.odata4.commons.api.exception.ODataException;
-import org.apache.olingo.odata4.commons.api.exception.ODataNotImplementedException;
import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
public class EdmTechProvider extends EdmProviderAdapter {
- private static final String nameSpace = "com.sap.odata.test1";
+ public static final String nameSpace = "com.sap.odata.test1";
- private static final FullQualifiedName nameBFCCollCTPrimCompRTESAllPrim =
+ public static final FullQualifiedName nameBFCCollCTPrimCompRTESAllPrim =
new FullQualifiedName(nameSpace, "BFCCollCTPrimCompRTESAllPrim");
- private static final FullQualifiedName nameBFCCollStringRTESTwoKeyNav =
+ public static final FullQualifiedName nameBFCCollStringRTESTwoKeyNav =
new FullQualifiedName(nameSpace, "BFCCollStringRTESTwoKeyNav");
- private static final FullQualifiedName nameBFCCTPrimCompRTESBaseTwoKeyNav =
+ public static final FullQualifiedName nameBFCCTPrimCompRTESBaseTwoKeyNav =
new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESBaseTwoKeyNav");
- private static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNav =
+ public static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNav =
new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESTwoKeyNav");
- private static final FullQualifiedName nameBFCCTPrimCompRTETTwoKeyNavParam =
+ public static final FullQualifiedName nameBFCCTPrimCompRTETTwoKeyNavParam =
new FullQualifiedName(nameSpace, "BFCCTPrimCompRTETTwoKeyNavParam");
- private static final FullQualifiedName nameBFCESAllPrimRTCTAllPrim =
+ public static final FullQualifiedName nameBFCESAllPrimRTCTAllPrim =
new FullQualifiedName(nameSpace, "BFCESAllPrimRTCTAllPrim");
- private static final FullQualifiedName nameBFCESBaseTwoKeyNavRTESBaseTwoKey =
+ public static final FullQualifiedName nameBFCESBaseTwoKeyNavRTESBaseTwoKey =
new FullQualifiedName(nameSpace, "BFCESBaseTwoKeyNavRTESBaseTwoKey");
- private static final FullQualifiedName nameBFCESKeyNavRTETKeyNav = new FullQualifiedName(nameSpace,
- "BFCESKeyNavRTETKeyNav");
+ public static final FullQualifiedName nameBFCESKeyNavRTETKeyNav =
+ new FullQualifiedName(nameSpace, "BFCESKeyNavRTETKeyNav");
- private static final FullQualifiedName nameBFCESKeyNavRTETKeyNavParam =
+ public static final FullQualifiedName nameBFCESKeyNavRTETKeyNavParam =
new FullQualifiedName(nameSpace, "BFCESKeyNavRTETKeyNavParam");
- private static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTTwoPrim =
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTTwoPrim =
new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCollCTTwoPrim");
- private static final FullQualifiedName nameBFCESTwoKeyNavRTCollString =
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTCollString =
new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCollString");
- private static final FullQualifiedName nameBFCESTwoKeyNavRTCTTwoPrim =
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTCTTwoPrim =
new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCTTwoPrim");
- private static final FullQualifiedName nameBFCESTwoKeyNavRTESTwoKeyNav =
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTESTwoKeyNav =
new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTESTwoKeyNav");
- private static final FullQualifiedName nameBFCESTwoKeyNavRTString =
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTString =
new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTString");
- private static final FullQualifiedName nameBFCESTwoKeyNavRTStringParam =
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTStringParam =
new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTStringParam");
- private static final FullQualifiedName nameBFCESTwoKeyNavRTTwoKeyNav =
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTTwoKeyNav =
new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTTwoKeyNav");
- private static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESBaseTwoKey =
+ public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESBaseTwoKey =
new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTESBaseTwoKey");
- private static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESTwoKeyNav =
+ public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESTwoKeyNav =
new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTESTwoKeyNav");
- private static final FullQualifiedName nameBFCETBaseTwoKeyNavRTETTwoKeyNav =
+ public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTETTwoKeyNav =
new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTETTwoKeyNav");
- private static final FullQualifiedName nameBFCETKeyNavRTETKeyNav =
+ public static final FullQualifiedName nameBFCETKeyNavRTETKeyNav =
new FullQualifiedName(nameSpace, "BFCETKeyNavRTETKeyNav");
- private static final FullQualifiedName nameBFCETTwoKeyNavRTCTTwoPrim =
+ public static final FullQualifiedName nameBFCETTwoKeyNavRTCTTwoPrim =
new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTCTTwoPrim");
- private static final FullQualifiedName nameBFCETTwoKeyNavRTESTwoKeyNav =
+ public static final FullQualifiedName nameBFCETTwoKeyNavRTESTwoKeyNav =
new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTESTwoKeyNav");
- private static final FullQualifiedName nameBFCETTwoKeyNavRTETTwoKeyNav =
+ public static final FullQualifiedName nameBFCETTwoKeyNavRTETTwoKeyNav =
new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTETTwoKeyNav");
- private static final FullQualifiedName nameBFCSINavRTESTwoKeyNav =
+ public static final FullQualifiedName nameBFCSINavRTESTwoKeyNav =
new FullQualifiedName(nameSpace, "BFCSINavRTESTwoKeyNav");
- private static final FullQualifiedName nameBFCStringRTESTwoKeyNav =
+ public static final FullQualifiedName nameBFCStringRTESTwoKeyNav =
new FullQualifiedName(nameSpace, "BFCStringRTESTwoKeyNav");
- private static final FullQualifiedName nameBFESTwoKeyNavRTESTwoKeyNav =
+ public static final FullQualifiedName nameBFESTwoKeyNavRTESTwoKeyNav =
new FullQualifiedName(nameSpace, "BFESTwoKeyNavRTESTwoKeyNav");
- private static final FullQualifiedName nameBinary = EdmPrimitiveTypeKind.Binary.getFullQualifiedName();
-
- private static final FullQualifiedName nameBoolean = EdmPrimitiveTypeKind.Boolean.getFullQualifiedName();
-
- public static final FullQualifiedName nameByte = EdmPrimitiveTypeKind.Byte.getFullQualifiedName();
-
- private static final FullQualifiedName nameContainer = new FullQualifiedName(nameSpace, "Container");
- public static final FullQualifiedName nameCTPrim = new FullQualifiedName(nameSpace, "CTPrim");
public static final FullQualifiedName nameCTAllPrim = new FullQualifiedName(nameSpace, "CTAllPrim");
-
- private static final FullQualifiedName nameCTBase = new FullQualifiedName(nameSpace, "CTBase");
-
- public static final FullQualifiedName nameCTCollAllPrim =
- new FullQualifiedName(nameSpace, "CTCollAllPrim");
-
- public static final FullQualifiedName nameCTCompCollComp =
- new FullQualifiedName(nameSpace, "CTCompCollComp");
-
+ public static final FullQualifiedName nameCTBase = new FullQualifiedName(nameSpace, "CTBase");
+ public static final FullQualifiedName nameCTCollAllPrim = new FullQualifiedName(nameSpace, "CTCollAllPrim");
+ public static final FullQualifiedName nameCTCompCollComp = new FullQualifiedName(nameSpace, "CTCompCollComp");
public static final FullQualifiedName nameCTCompComp = new FullQualifiedName(nameSpace, "CTCompComp");
-
- private static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(nameSpace,
- "CTMixPrimCollComp");
-
- public static final FullQualifiedName nameCTNavFiveProp =
- new FullQualifiedName(nameSpace, "CTNavFiveProp");
-
+ public static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(nameSpace, "CTMixPrimCollComp");
+ public static final FullQualifiedName nameCTNavFiveProp = new FullQualifiedName(nameSpace, "CTNavFiveProp");
+ public static final FullQualifiedName nameCTPrim = new FullQualifiedName(nameSpace, "CTPrim");
public static final FullQualifiedName nameCTPrimComp = new FullQualifiedName(nameSpace, "CTPrimComp");
-
public static final FullQualifiedName nameCTPrimEnum = new FullQualifiedName(nameSpace, "CTPrimEnum");
-
- private static final FullQualifiedName nameCTTwoBase = new FullQualifiedName(nameSpace, "CTTwoBase");
-
+ public static final FullQualifiedName nameCTTwoBase = new FullQualifiedName(nameSpace, "CTTwoBase");
public static final FullQualifiedName nameCTTwoPrim = new FullQualifiedName(nameSpace, "CTTwoPrim");
+ public static final FullQualifiedName nameBinary = EdmPrimitiveTypeKind.Binary.getFullQualifiedName();
+ public static final FullQualifiedName nameBoolean = EdmPrimitiveTypeKind.Boolean.getFullQualifiedName();
+ public static final FullQualifiedName nameByte = EdmPrimitiveTypeKind.Byte.getFullQualifiedName();
+ public static final FullQualifiedName nameContainer = new FullQualifiedName(nameSpace, "Container");
public static final FullQualifiedName nameDate = EdmPrimitiveTypeKind.Date.getFullQualifiedName();
-
- public static final FullQualifiedName nameDateTimeOffset =
- EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName();
-
+ public static final FullQualifiedName nameDateTimeOffset = EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName();
public static final FullQualifiedName nameDecimal = EdmPrimitiveTypeKind.Decimal.getFullQualifiedName();
-
public static final FullQualifiedName nameDouble = EdmPrimitiveTypeKind.Double.getFullQualifiedName();
-
public static final FullQualifiedName nameDuration = EdmPrimitiveTypeKind.Duration.getFullQualifiedName();
-
public static final FullQualifiedName nameENString = new FullQualifiedName(nameSpace, "ENString");
- private static final FullQualifiedName nameETAllKey = new FullQualifiedName(nameSpace, "ETAllKey");
-
- private static final FullQualifiedName nameETAllNullable = new FullQualifiedName(nameSpace, "ETAllNullable");
-
- private static final FullQualifiedName nameETAllPrim = new FullQualifiedName(nameSpace, "ETAllPrim");
-
- private static final FullQualifiedName nameETBase = new FullQualifiedName(nameSpace, "ETBase");
-
- private static final FullQualifiedName nameETBaseTwoKeyNav = new FullQualifiedName(nameSpace, "ETBaseTwoKeyNav");
-
- private static final FullQualifiedName nameETBaseTwoKeyTwoPrim = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameETAllKey = new FullQualifiedName(nameSpace, "ETAllKey");
+ public static final FullQualifiedName nameETAllNullable = new FullQualifiedName(nameSpace, "ETAllNullable");
+ public static final FullQualifiedName nameETAllPrim = new FullQualifiedName(nameSpace, "ETAllPrim");
+ public static final FullQualifiedName nameETBase = new FullQualifiedName(nameSpace, "ETBase");
+ public static final FullQualifiedName nameETBaseTwoKeyNav = new FullQualifiedName(nameSpace, "ETBaseTwoKeyNav");
+ public static final FullQualifiedName nameETBaseTwoKeyTwoPrim = new FullQualifiedName(nameSpace,
"ETBaseTwoKeyTwoPrim");
-
public static final FullQualifiedName nameETCollAllPrim = new FullQualifiedName(nameSpace, "ETCollAllPrim");
-
- private static final FullQualifiedName nameETCompAllPrim = new FullQualifiedName(nameSpace, "ETCompAllPrim");
-
- private static final FullQualifiedName nameETCompCollAllPrim = new FullQualifiedName(nameSpace, "ETCompCollAllPrim");
-
- private static final FullQualifiedName nameETCompCollComp = new FullQualifiedName(nameSpace, "ETCompCollComp");
-
- private static final FullQualifiedName nameETCompComp = new FullQualifiedName(nameSpace, "ETCompComp");
-
- private static final FullQualifiedName nameETCompMixPrimCollComp = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameETCompAllPrim = new FullQualifiedName(nameSpace, "ETCompAllPrim");
+ public static final FullQualifiedName nameETCompCollAllPrim = new FullQualifiedName(nameSpace, "ETCompCollAllPrim");
+ public static final FullQualifiedName nameETCompCollComp = new FullQualifiedName(nameSpace, "ETCompCollComp");
+ public static final FullQualifiedName nameETCompComp = new FullQualifiedName(nameSpace, "ETCompComp");
+ public static final FullQualifiedName nameETCompMixPrimCollComp = new FullQualifiedName(nameSpace,
"ETCompMixPrimCollComp");
-
public static final FullQualifiedName nameETKeyNav = new FullQualifiedName(nameSpace, "ETKeyNav");
-
- private static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(nameSpace, "ETKeyTwoKeyComp");
-
- private static final FullQualifiedName nameETMedia = new FullQualifiedName(nameSpace, "ETMedia");
-
- private static final FullQualifiedName nameETMixPrimCollComp = new FullQualifiedName(nameSpace, "ETMixPrimCollComp");
-
- private static final FullQualifiedName nameETServerSidePaging =
+ public static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(nameSpace, "ETKeyTwoKeyComp");
+ public static final FullQualifiedName nameETMedia = new FullQualifiedName(nameSpace, "ETMedia");
+ public static final FullQualifiedName nameETMixPrimCollComp = new FullQualifiedName(nameSpace, "ETMixPrimCollComp");
+ public static final FullQualifiedName nameETServerSidePaging =
new FullQualifiedName(nameSpace, "ETServerSidePaging");
-
- private static final FullQualifiedName nameETTwoBase = new FullQualifiedName(nameSpace, "ETTwoBase");
-
- private static final FullQualifiedName nameETTwoBaseTwoKeyTwoPrim = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameETTwoBase = new FullQualifiedName(nameSpace, "ETTwoBase");
+ public static final FullQualifiedName nameETTwoBaseTwoKeyTwoPrim = new FullQualifiedName(nameSpace,
"ETTwoBaseTwoKeyTwoPrim");
-
public static final FullQualifiedName nameETTwoKeyNav = new FullQualifiedName(nameSpace, "ETTwoKeyNav");
-
public static final FullQualifiedName nameETTwoKeyTwoPrim = new FullQualifiedName(nameSpace, "ETTwoKeyTwoPrim");
-
public static final FullQualifiedName nameETTwoPrim = new FullQualifiedName(nameSpace, "ETTwoPrim");
- public static final FullQualifiedName nameGuit = EdmPrimitiveTypeKind.Guid.getFullQualifiedName();
-
+ public static final FullQualifiedName nameGuid = EdmPrimitiveTypeKind.Guid.getFullQualifiedName();
public static final FullQualifiedName nameInt16 = EdmPrimitiveTypeKind.Int16.getFullQualifiedName();
-
public static final FullQualifiedName nameInt32 = EdmPrimitiveTypeKind.Int32.getFullQualifiedName();
-
public static final FullQualifiedName nameInt64 = EdmPrimitiveTypeKind.Int64.getFullQualifiedName();
-
public static final FullQualifiedName nameSByte = EdmPrimitiveTypeKind.SByte.getFullQualifiedName();
-
public static final FullQualifiedName nameSingle = EdmPrimitiveTypeKind.Single.getFullQualifiedName();
-
public static final FullQualifiedName nameString = EdmPrimitiveTypeKind.String.getFullQualifiedName();
-
public static final FullQualifiedName nameTimeOfDay = EdmPrimitiveTypeKind.TimeOfDay.getFullQualifiedName();
- private static final FullQualifiedName nameUARTCompCollParam = new FullQualifiedName(nameSpace, "UARTCompCollParam");
-
- private static final FullQualifiedName nameUARTCompParam = new FullQualifiedName(nameSpace, "UARTCompParam");
-
- private static final FullQualifiedName nameUARTETCollAllPrimParam = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameUARTCompCollParam = new FullQualifiedName(nameSpace, "UARTCompCollParam");
+ public static final FullQualifiedName nameUARTCompParam = new FullQualifiedName(nameSpace, "UARTCompParam");
+ public static final FullQualifiedName nameUARTETCollAllPrimParam = new FullQualifiedName(nameSpace,
"UARTETCollAllPrimParam");
-
- private static final FullQualifiedName nameUARTETParam = new FullQualifiedName(nameSpace, "UARTETParam");
-
- private static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(nameSpace, "UARTPrimCollParam");
-
- private static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(nameSpace, "UARTPrimParam");
-
- private static final FullQualifiedName nameUFCRTCollCTTwoPrim =
+ public static final FullQualifiedName nameUARTETParam = new FullQualifiedName(nameSpace, "UARTETParam");
+ public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(nameSpace, "UARTPrimCollParam");
+ public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(nameSpace, "UARTPrimParam");
+ public static final FullQualifiedName nameUFCRTCollCTTwoPrim =
new FullQualifiedName(nameSpace, "UFCRTCollCTTwoPrim");
-
- private static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(nameSpace, "UFCRTCollString");
-
- private static final FullQualifiedName nameUFCRTCollStringTwoParam = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(nameSpace, "UFCRTCollString");
+ public static final FullQualifiedName nameUFCRTCollStringTwoParam = new FullQualifiedName(nameSpace,
"UFCRTCollStringTwoParam");
-
- private static final FullQualifiedName nameUFCRTCTAllPrimTwoParam = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameUFCRTCTAllPrimTwoParam = new FullQualifiedName(nameSpace,
"UFCRTCTAllPrimTwoParam");
-
- private static final FullQualifiedName nameUFCRTCTTwoPrim = new FullQualifiedName(nameSpace, "UFCRTCTTwoPrim");
-
- private static final FullQualifiedName nameUFCRTCTTwoPrimParam = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameUFCRTCTTwoPrim = new FullQualifiedName(nameSpace, "UFCRTCTTwoPrim");
+ public static final FullQualifiedName nameUFCRTCTTwoPrimParam = new FullQualifiedName(nameSpace,
"UFCRTCTTwoPrimParam");
-
- private static final FullQualifiedName nameUFCRTESMixPrimCollCompTwoParam = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameUFCRTESMixPrimCollCompTwoParam = new FullQualifiedName(nameSpace,
"UFCRTESMixPrimCollCompTwoParam");
-
- private static final FullQualifiedName nameUFCRTESTwoKeyNavParam = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameUFCRTESTwoKeyNavParam = new FullQualifiedName(nameSpace,
"UFCRTESTwoKeyNavParam");
-
- private static final FullQualifiedName nameUFCRTETAllPrimTwoParam = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameUFCRTETAllPrimTwoParam = new FullQualifiedName(nameSpace,
"UFCRTETAllPrimTwoParam");
-
- private static final FullQualifiedName nameUFCRTETKeyNav = new FullQualifiedName(nameSpace, "UFCRTETKeyNav");
-
- private static final FullQualifiedName nameUFCRTETMedia = new FullQualifiedName(nameSpace, "UFCRTETMedia");
-
- private static final FullQualifiedName nameUFCRTETTwoKeyNavParam = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameUFCRTETKeyNav = new FullQualifiedName(nameSpace, "UFCRTETKeyNav");
+ public static final FullQualifiedName nameUFCRTETMedia = new FullQualifiedName(nameSpace, "UFCRTETMedia");
+ public static final FullQualifiedName nameUFCRTETTwoKeyNavParam = new FullQualifiedName(nameSpace,
"UFCRTETTwoKeyNavParam");
-
- private static final FullQualifiedName nameUFCRTETTwoKeyNavParamCTTwoPrim = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameUFCRTETTwoKeyNavParamCTTwoPrim = new FullQualifiedName(nameSpace,
"UFCRTETTwoKeyNavParamCTTwoPrim");
-
- private static final FullQualifiedName nameUFCRTString = new FullQualifiedName(nameSpace, "UFCRTString");
-
- private static final FullQualifiedName nameUFCRTStringTwoParam = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameUFCRTString = new FullQualifiedName(nameSpace, "UFCRTString");
+ public static final FullQualifiedName nameUFCRTStringTwoParam = new FullQualifiedName(nameSpace,
"UFCRTStringTwoParam");
-
- private static final FullQualifiedName nameUFNRTESMixPrimCollCompTwoParam = new FullQualifiedName(nameSpace,
+ public static final FullQualifiedName nameUFNRTESMixPrimCollCompTwoParam = new FullQualifiedName(nameSpace,
"UFNRTESMixPrimCollCompTwoParam");
-
- private static final FullQualifiedName nameUFNRTInt16 = new FullQualifiedName(nameSpace, "UFNRTInt16");
+ public static final FullQualifiedName nameUFNRTInt16 = new FullQualifiedName(nameSpace, "UFNRTInt16");
NavigationProperty collectionNavPropertyETKeyNavMany_ETKeyNav = new NavigationProperty()
.setName("NavPropertyETKeyNavMany")
@@ -311,7 +237,6 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setCollection(true)
.setPartner("NavPropertyETKeyNavOne");
- // Properties typed as collection of simple types
Property collPropertyBinary = new Property()
.setName("CollPropertyBinary")
.setType(nameBinary)
@@ -364,7 +289,7 @@ public class EdmTechProvider extends EdmProviderAdapter {
Property collPropertyGuid = new Property()
.setName("CollPropertyGuid")
- .setType(nameGuit)
+ .setType(nameGuid)
.setCollection(true);
Property collPropertyInt16 = new Property()
@@ -484,7 +409,7 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setType(nameENString);
Property propertyGuid = new Property()
.setName("PropertyGuid")
- .setType(nameGuit);
+ .setType(nameGuid);
Property propertyInt16 = new Property()
.setName("PropertyInt16")
.setType(nameInt16);
@@ -527,6 +452,39 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setType(nameTimeOfDay);
@Override
+ public ActionImport getActionImport(final FullQualifiedName entityContainer, final String name) throws ODataException
+ {
+ if (entityContainer.equals(nameContainer)) {
+ if (name.equals("AIRTPrimParam")) {
+ return new ActionImport()
+ .setName("AIRTPrimParam")
+ .setAction(nameUARTPrimParam);
+ } else if (name.equals("AIRTPrimCollParam")) {
+ return new ActionImport()
+ .setName("AIRTPrimCollParam")
+ .setAction(nameUARTPrimCollParam);
+ } else if (name.equals("AIRTCompParam")) {
+ return new ActionImport()
+ .setName("AIRTCompParam")
+ .setAction(nameUARTCompParam);
+ } else if (name.equals("AIRTCompCollParam")) {
+ return new ActionImport()
+ .setName("AIRTCompCollParam")
+ .setAction(nameUARTCompCollParam);
+ } else if (name.equals("AIRTETParam")) {
+ return new ActionImport()
+ .setName("AIRTETParam")
+ .setAction(nameUARTETParam);
+ } else if (name.equals("AIRTETCollAllPrimParam")) {
+ return new ActionImport()
+ .setName("AIRTETCollAllPrimParam")
+ .setAction(nameUARTETCollAllPrimParam);
+ }
+ }
+ return null;
+ }
+
+ @Override
public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
if (actionName.equals(nameUARTPrimParam)) {
return Arrays.asList(
@@ -534,67 +492,52 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setBound(false)
.setReturnType(new ReturnType().setType(nameString))
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16")
- .setType(nameInt16)))
-
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
);
} else if (actionName.equals(nameUARTPrimCollParam)) {
return Arrays.asList(
new Action().setName("UARTPrimCollParam")
.setBound(false)
.setReturnType(
- new ReturnType()
- .setType(nameString).setCollection(true))
+ new ReturnType().setType(nameString).setCollection(true))
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16")
- .setType(nameInt16)))
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
);
} else if (actionName.equals(nameUARTCompParam)) {
return Arrays.asList(
new Action().setName("UARTCompParam")
.setBound(false)
.setReturnType(
- new ReturnType()
- .setType(nameCTTwoPrim))
+ new ReturnType().setType(nameCTTwoPrim))
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16")
- .setType(nameInt16)))
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
);
} else if (actionName.equals(nameUARTCompCollParam)) {
return Arrays.asList(
new Action().setName("UARTCompCollParam")
.setBound(false)
.setReturnType(
- new ReturnType()
- .setCollection(true)
- .setType(nameCTTwoPrim))
+ new ReturnType().setCollection(true).setType(nameCTTwoPrim))
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16")
- .setType(nameInt16)))
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
);
} else if (actionName.equals(nameUARTETParam)) {
return Arrays.asList(
new Action().setName("UARTCompCollParam")
.setBound(false)
.setReturnType(
- new ReturnType()
- .setType(nameETTwoKeyTwoPrim))
+ new ReturnType().setType(nameETTwoKeyTwoPrim))
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16")
- .setType(nameInt16)))
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
);
} else if (actionName.equals(nameUARTETCollAllPrimParam)) {
return Arrays.asList(
new Action().setName("UARTETCollAllPrimParam")
.setBound(false)
.setReturnType(
- new ReturnType()
- .setType(nameETCollAllPrim)
- .setCollection(true))
-
+ new ReturnType().setType(nameETCollAllPrim).setCollection(true))
.setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16")
- .setType(nameInt16)))
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
);
}
@@ -625,7 +568,8 @@ public class EdmTechProvider extends EdmProviderAdapter {
} else if (complexTypeName.equals(nameCTCollAllPrim)) {
return new ComplexType()
.setName("CTCollAllPrim")
- .setProperties(Arrays.asList(collPropertyString,
+ .setProperties(Arrays.asList(
+ collPropertyString,
collPropertyBoolean, collPropertyByte,
collPropertySByte,
collPropertyInt16, collPropertyInt32, collPropertyInt64,
@@ -641,20 +585,20 @@ public class EdmTechProvider extends EdmProviderAdapter {
} else if (complexTypeName.equals(nameCTMixPrimCollComp)) {
return new ComplexType()
.setName("CTMixPrimCollComp")
- .setProperties(Arrays.asList(propertyInt16, collPropertyString,
- propertyComplex_CTTwoPrim, collPropertyComplex_CTTwoPrim));
+ .setProperties(Arrays.asList(
+ propertyInt16, collPropertyString, propertyComplex_CTTwoPrim, collPropertyComplex_CTTwoPrim));
} else if (complexTypeName.equals(nameCTBase)) {
return new ComplexType()
.setName("CTBase")
- .setProperties(
- Arrays.asList(new Property().setName("AdditionalPropString").setType(
- new FullQualifiedName("Edm", "String"))));
+ .setProperties(Arrays.asList(
+ new Property().setName("AdditionalPropString")
+ .setType(new FullQualifiedName("Edm", "String"))));
} else if (complexTypeName.equals(nameCTTwoBase)) {
return new ComplexType()
.setName("CTTwoBase")
- .setProperties(
- Arrays.asList(new Property().setName("AdditionalPropString").setType(
- new FullQualifiedName("Edm", "String"))));
+ .setProperties(Arrays.asList(
+ new Property().setName("AdditionalPropString")
+ .setType(new FullQualifiedName("Edm", "String"))));
} else if (complexTypeName.equals(nameCTCompComp)) {
return new ComplexType()
.setName("CTCompComp")
@@ -800,7 +744,8 @@ public class EdmTechProvider extends EdmProviderAdapter {
if (entityTypeName.equals(nameETAllPrim)) {
return new EntityType()
.setName("ETAllPrim")
- .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString,
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, propertyString,
propertyBoolean, propertyByte, propertySByte,
propertyInt32, propertyInt64,
propertySingle, propertyDouble, propertyDecimal,
@@ -826,18 +771,21 @@ public class EdmTechProvider extends EdmProviderAdapter {
} else if (entityTypeName.equals(nameETTwoPrim)) {
return new EntityType()
.setName("ETTwoPrim")
- .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString))
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, propertyString))
.setKey(oneKeyPropertyInt16);
} else if (entityTypeName.equals(nameETMixPrimCollComp)) {
return new EntityType()
.setName("ETMixPrimCollComp")
- .setProperties(Arrays.asList(propertyInt16_NotNullable, collPropertyString,
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, collPropertyString,
propertyComplex_CTTwoPrim, collPropertyComplex_CTTwoPrim))
.setKey(oneKeyPropertyInt16);
} else if (entityTypeName.equals(nameETTwoKeyTwoPrim)) {
return new EntityType()
.setName("ETTwoKeyTwoPrim")
- .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString))
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, propertyString))
.setKey(Arrays.asList(
new PropertyRef().setPropertyName("PropertyInt16"),
new PropertyRef().setPropertyName("PropertyString")));
@@ -918,8 +866,8 @@ public class EdmTechProvider extends EdmProviderAdapter {
} else if (entityTypeName.equals(nameETKeyTwoKeyComp)) {
return new EntityType()
.setName("ETKeyTwoKeyComp")
- .setProperties(
- Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTTwoPrim, propertyComplexComplex_CTCompComp))
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, propertyComplex_CTTwoPrim, propertyComplexComplex_CTCompComp))
.setKey(Arrays.asList(
new PropertyRef().setPropertyName("PropertyInt16"),
new PropertyRef().setPropertyName("PropertyComplex/PropertyInt16").setAlias("KeyAlias1"),
@@ -934,8 +882,9 @@ public class EdmTechProvider extends EdmProviderAdapter {
} else if (entityTypeName.equals(nameETAllNullable)) {
return new EntityType()
.setName("ETAllNullable")
- .setProperties(Arrays.asList(new Property()
- .setName("PropertyKey").setType(nameInt16).setNullable(false),
+ .setProperties(Arrays.asList(
+ new Property()
+ .setName("PropertyKey").setType(nameInt16).setNullable(false),
propertyInt16,
propertyString, propertyBoolean,
propertyByte, propertySByte,
@@ -957,11 +906,10 @@ public class EdmTechProvider extends EdmProviderAdapter {
} else if (entityTypeName.equals(nameETKeyNav)) {
return new EntityType()
.setName("ETCollAllPrim")
- .setProperties(
- Arrays.asList(
- propertyInt16_NotNullable, propertyString_NotNullable, propertyComplex_CTNavFiveProp,
- propertyComplexAllPrim_CTAllPrim, propertyComplexTwoPrim_CTTwoPrim,
- collPropertyString, collPropertyInt16, collPropertyComplex_CTPrimComp))
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, propertyString_NotNullable, propertyComplex_CTNavFiveProp,
+ propertyComplexAllPrim_CTAllPrim, propertyComplexTwoPrim_CTTwoPrim,
+ collPropertyString, collPropertyInt16, collPropertyComplex_CTPrimComp))
.setNavigationProperties(Arrays.asList(
navPropertyETTwoKeyNavOne_ETTwoKeyNav, collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
navPropertyETKeyNavOne_ETKeyNav, collectionNavPropertyETKeyNavMany_ETKeyNav,
@@ -971,13 +919,13 @@ public class EdmTechProvider extends EdmProviderAdapter {
} else if (entityTypeName.equals(nameETTwoKeyNav)) {
return new EntityType()
.setName("ETTwoKeyNav")
- .setProperties(
- Arrays.asList(propertyInt16, propertyString, propertyComplex_CTPrimComp_NotNullable,
- propertyComplexEnum_CTPrimEnum_NotNullable,
- collPropertyComplex_CTPrimComp,
- collPropertyString, propertyComplexTwoPrim_CTTwoPrim,
- propertyEnumString_ENString
- ))
+ .setProperties(Arrays.asList(
+ propertyInt16, propertyString, propertyComplex_CTPrimComp_NotNullable,
+ propertyComplexEnum_CTPrimEnum_NotNullable,
+ collPropertyComplex_CTPrimComp,
+ collPropertyString, propertyComplexTwoPrim_CTTwoPrim,
+ propertyEnumString_ENString
+ ))
.setNavigationProperties(Arrays.asList(
new NavigationProperty()
.setName("NavPropertyETKeyNavOne")
@@ -996,7 +944,8 @@ public class EdmTechProvider extends EdmProviderAdapter {
} else if (entityTypeName.equals(nameETBaseTwoKeyNav)) {
return new EntityType()
.setName("ETBaseTwoKeyNav")
- .setProperties(Arrays.asList(propertyDate, propertyComplex_CTPrimComp_NotNullable))
+ .setProperties(Arrays.asList(
+ propertyDate, propertyComplex_CTPrimComp_NotNullable))
.setNavigationProperties(Arrays.asList(
collectionNavPropertyETKeyNavMany_ETKeyNav,
navPropertyETKeyNavOne_ETKeyNav,
@@ -1030,105 +979,243 @@ public class EdmTechProvider extends EdmProviderAdapter {
}
@Override
- public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
- ReturnType returnTypeString = new ReturnType()
- .setType(nameString);
-
- ReturnType returnTypeString_NotNullable = new ReturnType()
- .setType(nameString)
- .setNullable(false);
+ public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String name)
+ throws ODataException {
- ReturnType returnTypeETTwoKeyNav_NotNullable = new ReturnType()
- .setType(nameETTwoKeyNav)
- .setNullable(false);
+ if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FINRTInt16")) {
+ return new FunctionImport()
+ .setName("FINRTInt16")
+ .setFunction(nameUFNRTInt16)
+ .setIncludeInServiceDocument(true);
- ReturnType returnTypeCollectionETTwoKeyNav_NotNullable = new ReturnType()
- .setType(nameETTwoKeyNav)
- .setNullable(false)
- .setCollection(true);
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FINInvisibleRTInt16")) {
+ return new FunctionImport()
+ .setName("FINInvisibleRTInt16")
+ .setFunction(nameUFNRTInt16)
+ .setIncludeInServiceDocument(false);
- if (functionName.equals(nameUFNRTInt16)) {
- return Arrays.asList(
- new Function()
- .setName("UFNRTInt16")
- .setBound(false)
- .setReturnType(returnTypeString)
- );
- } else if (functionName.equals(nameUFCRTETKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTETKeyNav")
- .setBound(true)
- .setComposable(true)
- .setReturnType(
- new ReturnType()
- .setType(nameETKeyNav)
- .setNullable(false))
- );
- } else if (functionName.equals(nameUFCRTETTwoKeyNavParam)) {
- return Arrays.asList(
- new Function().setName("UFCRTETTwoKeyNavParam")
- .setBound(false)
- .setComposable(true)
- .setParameters(Arrays.asList(
- new Parameter()
- .setName("ParameterInt16")
- .setType(nameInt16)
- .setNullable(false)))
- .setReturnType(returnTypeETTwoKeyNav_NotNullable)
- );
- } else if (functionName.equals(nameUFCRTETTwoKeyNavParamCTTwoPrim)) {
- return Arrays.asList(
- new Function().setName("UFCRTETTwoKeyNavParamCTTwoPrim")
- .setBound(false)
- .setComposable(true)
- .setParameters(Arrays.asList(
- new Parameter()
- .setName("ParameterCTTwoPrim")
- .setType(nameCTTwoPrim)
- .setNullable(false)))
- .setReturnType(returnTypeETTwoKeyNav_NotNullable)
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FINInvisible2RTInt16")) {
+ return new FunctionImport()
+ .setName("FINInvisible2RTInt16")
+ .setFunction(nameUFNRTInt16);
- );
- } else if (functionName.equals(nameUFCRTStringTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTStringTwoParam")
- .setBound(false)
- .setComposable(true)
- .setParameters(Arrays.asList(
- new Parameter()
- .setName("ParameterString")
- .setType(nameString)
- .setNullable(false),
- new Parameter()
- .setName("ParameterInt16")
- .setType(nameInt16)
- .setNullable(false)))
- .setReturnType(returnTypeString_NotNullable)
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTETKeyNav")) {
+ return new FunctionImport()
+ .setName("FICRTETKeyNav")
+ .setFunction(nameUFCRTETKeyNav);
- );
- } else if (functionName.equals(nameUFCRTESTwoKeyNavParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTESTwoKeyNavParam")
- .setBound(false)
- .setComposable(true)
- .setParameters(Arrays.asList(
- new Parameter()
- .setName("ParameterInt16")
- .setType(nameInt16)
- .setNullable(false)))
- .setReturnType(
- new ReturnType()
- .setType(nameETTwoKeyNav)
- .setNullable(false).setCollection(true))
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTETTwoKeyNavParam")) {
+ return new FunctionImport()
+ .setName("FICRTETTwoKeyNavParam")
+ .setFunction(nameUFCRTETTwoKeyNavParam)
+ .setIncludeInServiceDocument(true);
- );
- } else if (functionName.equals(nameUFCRTString)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTString")
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTStringTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTStringTwoParam")
+ .setFunction(nameUFCRTStringTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCollStringTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTCollStringTwoParam")
+ .setFunction(nameUFCRTCollStringTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCTAllPrimTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTCTAllPrimTwoParam")
+ .setFunction(nameUFCRTCTAllPrimTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTESMixPrimCollCompTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTESMixPrimCollCompTwoParam")
+ .setFunction(nameUFCRTESMixPrimCollCompTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FINRTESMixPrimCollCompTwoParam")) {
+ return new FunctionImport()
+ .setName("FINRTESMixPrimCollCompTwoParam")
+ .setFunction(nameUFNRTESMixPrimCollCompTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCollCTTwoPrim")) {
+ return new FunctionImport()
+ .setName("FICRTCollCTTwoPrim")
+ .setFunction(nameUFCRTCollCTTwoPrim)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTETMedia")) {
+ return new FunctionImport()
+ .setName("FICRTETMedia")
+ .setFunction(nameUFCRTETMedia)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCTTwoPrimParam")) {
+ return new FunctionImport()
+ .setName("FICRTCTTwoPrimParam")
+ .setFunction(nameUFCRTCTTwoPrimParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCTTwoPrim")) {
+ return new FunctionImport()
+ .setName("FICRTCTTwoPrim")
+ .setFunction(nameUFCRTCTTwoPrim)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCollString")) {
+ return new FunctionImport()
+ .setName("FICRTCollString")
+ .setFunction(nameUFCRTCollString)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTString")) {
+ return new FunctionImport()
+ .setName("FICRTString")
+ .setFunction(nameUFCRTString)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTESTwoKeyNavParam")) {
+ return new FunctionImport()
+ .setName("FICRTESTwoKeyNavParam")
+ .setFunction(nameUFCRTESTwoKeyNavParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
+ ReturnType returnTypeString = new ReturnType()
+ .setType(nameString);
+
+ ReturnType returnTypeString_NotNullable = new ReturnType()
+ .setType(nameString)
+ .setNullable(false);
+
+ ReturnType returnTypeETTwoKeyNav_NotNullable = new ReturnType()
+ .setType(nameETTwoKeyNav)
+ .setNullable(false);
+
+ ReturnType returnTypeCollectionETTwoKeyNav_NotNullable = new ReturnType()
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true);
+
+ if (functionName.equals(nameUFNRTInt16)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFNRTInt16")
+ .setBound(false)
+ .setReturnType(returnTypeString)
+ );
+ } else if (functionName.equals(nameUFCRTETKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTETKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETKeyNav).setNullable(false))
+ );
+ } else if (functionName.equals(nameUFCRTETTwoKeyNavParam)) {
+ return Arrays.asList(
+ new Function().setName("UFCRTETTwoKeyNavParam")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(returnTypeETTwoKeyNav_NotNullable)
+ );
+ } else if (functionName.equals(nameUFCRTETTwoKeyNavParamCTTwoPrim)) {
+ return Arrays.asList(
+ new Function().setName("UFCRTETTwoKeyNavParamCTTwoPrim")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterCTTwoPrim")
+ .setType(nameCTTwoPrim)
+ .setNullable(false)))
+ .setReturnType(returnTypeETTwoKeyNav_NotNullable)
+
+ );
+ } else if (functionName.equals(nameUFCRTStringTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTStringTwoParam")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(returnTypeString_NotNullable)
+
+ );
+ } else if (functionName.equals(nameUFCRTESTwoKeyNavParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTESTwoKeyNavParam")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setNullable(false).setCollection(true))
+
+ );
+ } else if (functionName.equals(nameUFCRTString)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTString")
.setBound(true)
.setComposable(true)
.setReturnType(returnTypeString_NotNullable)
@@ -1149,10 +1236,7 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setType(nameInt16)
.setNullable(false)))
.setReturnType(
- new ReturnType()
- .setType(nameString)
- .setNullable(false)
- .setCollection(true))
+ new ReturnType().setType(nameString).setNullable(false).setCollection(true))
);
} else if (functionName.equals(nameUFCRTCollString)) {
@@ -1162,10 +1246,7 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setBound(false)
.setComposable(true)
.setReturnType(
- new ReturnType()
- .setType(nameString)
- .setNullable(false)
- .setCollection(true))
+ new ReturnType().setType(nameString).setNullable(false).setCollection(true))
);
} else if (functionName.equals(nameUFCRTCTAllPrimTwoParam)) {
@@ -1184,9 +1265,7 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setType(nameInt16)
.setNullable(false)))
.setReturnType(
- new ReturnType()
- .setType(nameCTAllPrim)
- .setNullable(false))
+ new ReturnType().setType(nameCTAllPrim).setNullable(false))
);
} else if (functionName.equals(nameUFCRTCTTwoPrimParam)) {
@@ -1205,9 +1284,7 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setType(nameInt16)
.setNullable(false)))
.setReturnType(
- new ReturnType()
- .setType(nameCTTwoPrim)
- .setNullable(false))
+ new ReturnType().setType(nameCTTwoPrim).setNullable(false))
);
} else if (functionName.equals(nameUFCRTCTTwoPrim)) {
@@ -1217,9 +1294,7 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setBound(false)
.setComposable(true)
.setReturnType(
- new ReturnType()
- .setType(nameCTTwoPrim)
- .setNullable(false))
+ new ReturnType().setType(nameCTTwoPrim).setNullable(false))
);
} else if (functionName.equals(nameUFCRTCollCTTwoPrim)) {
return Arrays.asList(
@@ -1227,10 +1302,7 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("UFCRTCTTwoPrim")
.setBound(false)
.setReturnType(
- new ReturnType()
- .setType(nameCTTwoPrim)
- .setNullable(false)
- .setCollection(true))
+ new ReturnType().setType(nameCTTwoPrim).setNullable(false).setCollection(true))
);
} else if (functionName.equals(nameUFCRTETMedia)) {
return Arrays.asList(
@@ -1238,9 +1310,7 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("UFCRTETMedia")
.setBound(false)
.setReturnType(
- new ReturnType()
- .setType(nameETMedia)
- .setNullable(false))
+ new ReturnType().setType(nameETMedia).setNullable(false))
);
} else if (functionName.equals(nameUFCRTString)) {
return Arrays.asList(
@@ -1256,10 +1326,7 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setBound(false)
.setComposable(true)
.setReturnType(
- new ReturnType()
- .setType(nameCTTwoPrim)
- .setNullable(false)
- .setCollection(true))
+ new ReturnType().setType(nameCTTwoPrim).setNullable(false).setCollection(true))
);
} else if (functionName.equals(nameUFNRTESMixPrimCollCompTwoParam)) {
return Arrays.asList(
@@ -1267,21 +1334,17 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("UFNRTESMixPrimCollCompTwoParam")
.setBound(false)
.setComposable(false)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("ParameterString")
- .setType(nameString)
- .setNullable(false),
- new Parameter()
- .setName("ParameterInt16")
- .setType(nameInt16)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
.setReturnType(
- new ReturnType()
- .setType(nameETMixPrimCollComp)
- .setNullable(false)
- .setCollection(true))
+ new ReturnType().setType(nameETMixPrimCollComp).setNullable(false).setCollection(true))
);
} else if (functionName.equals(nameUFCRTETAllPrimTwoParam)) {
@@ -1290,20 +1353,17 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("UFCRTETAllPrimTwoParam")
.setBound(false)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("ParameterString")
- .setType(nameString)
- .setNullable(false),
- new Parameter()
- .setName("ParameterInt16")
- .setType(nameInt16)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
.setReturnType(
- new ReturnType()
- .setType(nameETAllPrim)
- .setNullable(false))
+ new ReturnType().setType(nameETAllPrim).setNullable(false))
);
} else if (functionName.equals(nameUFCRTESMixPrimCollCompTwoParam)) {
return Arrays.asList(
@@ -1311,21 +1371,17 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("UFCRTESMixPrimCollCompTwoParam")
.setBound(false)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("ParameterString")
- .setType(nameString)
- .setNullable(false),
- new Parameter()
- .setName("ParameterInt16")
- .setType(nameInt16)
- .setNullable(false)))
- .setReturnType(
- new ReturnType()
- .setType(nameETMixPrimCollComp)
- .setNullable(false)
- .setCollection(true))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType().setType(nameETMixPrimCollComp).setNullable(false).setCollection(true))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTESTwoKeyNav)) {
return Arrays.asList(
@@ -1341,22 +1397,15 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setNullable(false)
.setCollection(false)))
.setReturnType(
- new ReturnType()
- .setType(nameETTwoKeyNav)
- .setNullable(false)
- .setCollection(true))
+ new ReturnType().setType(nameETTwoKeyNav).setNullable(false).setCollection(true))
);
} else if (functionName.equals(nameBFCStringRTESTwoKeyNav)) {
return Arrays.asList(
new Function().setName("BFCStringRTESTwoKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameString)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameString).setNullable(false)))
.setReturnType(returnTypeCollectionETTwoKeyNav_NotNullable)
);
} else if (functionName.equals(nameBFCETBaseTwoKeyNavRTETTwoKeyNav)) {
@@ -1365,12 +1414,8 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCETBaseTwoKeyNavRTETTwoKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETBaseTwoKeyNav)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav).setNullable(false)))
.setReturnType(returnTypeETTwoKeyNav_NotNullable)
);
} else if (functionName.equals(nameBFCESBaseTwoKeyNavRTESBaseTwoKey)) {
@@ -1379,18 +1424,14 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCESBaseTwoKeyNavRTESBaseTwoKey")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETBaseTwoKeyNav)
- .setNullable(false)
- .setCollection(true)))
- .setReturnType(
- new ReturnType()
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
.setType(nameETBaseTwoKeyNav)
.setNullable(false)
- .setCollection(true))
+ .setCollection(true)))
+ .setReturnType(
+ new ReturnType().setType(nameETBaseTwoKeyNav).setNullable(false).setCollection(true))
);
} else if (functionName.equals(nameBFCESAllPrimRTCTAllPrim)) {
return Arrays.asList(
@@ -1398,17 +1439,14 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCESAllPrimRTCTAllPrim")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETAllPrim)
- .setNullable(false)
- .setCollection(true)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETAllPrim)
+ .setNullable(false)
+ .setCollection(true)))
.setReturnType(
- new ReturnType()
- .setType(nameCTAllPrim)
- .setNullable(false))
+ new ReturnType().setType(nameCTAllPrim).setNullable(false))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTCTTwoPrim)) {
return Arrays.asList(
@@ -1416,17 +1454,14 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCESTwoKeyNavRTCTTwoPrim")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETTwoKeyNav)
- .setNullable(false)
- .setCollection(true)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true)))
.setReturnType(
- new ReturnType()
- .setType(nameCTTwoPrim)
- .setNullable(false))
+ new ReturnType().setType(nameCTTwoPrim).setNullable(false))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTTwoPrim)) {
return Arrays.asList(
@@ -1434,18 +1469,14 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCESTwoKeyNavRTCollCTTwoPrim")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETTwoKeyNav)
- .setNullable(false)
- .setCollection(true)))
- .setReturnType(
- new ReturnType()
- .setType(nameCTTwoPrim)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
.setNullable(false)
- .setCollection(true))
+ .setCollection(true)))
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim).setNullable(false).setCollection(true))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTString)) {
return Arrays.asList(
@@ -1453,13 +1484,12 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCESTwoKeyNavRTString")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETTwoKeyNav)
- .setNullable(false)
- .setCollection(true)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true)))
.setReturnType(returnTypeString_NotNullable)
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTCollString)) {
@@ -1468,17 +1498,13 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCESTwoKeyNavRTCollString")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETTwoKeyNav)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
.setReturnType(
- new ReturnType()
- .setType(nameString)
- .setNullable(false)
- .setCollection(true))
+ new ReturnType().setType(nameString).setNullable(false).setCollection(true))
);
} else if (functionName.equals(nameBFCETTwoKeyNavRTESTwoKeyNav)) {
return Arrays.asList(
@@ -1486,12 +1512,11 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCETTwoKeyNavRTESTwoKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETTwoKeyNav)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
.setReturnType(returnTypeCollectionETTwoKeyNav_NotNullable)
);
} else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESTwoKeyNav)) {
@@ -1500,12 +1525,11 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCETBaseTwoKeyNavRTESTwoKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETBaseTwoKeyNav)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETBaseTwoKeyNav)
+ .setNullable(false)))
.setReturnType(returnTypeCollectionETTwoKeyNav_NotNullable)
);
} else if (functionName.equals(nameBFCSINavRTESTwoKeyNav)) {
@@ -1514,12 +1538,11 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCSINavRTESTwoKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETTwoKeyNav)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
.setReturnType(returnTypeCollectionETTwoKeyNav_NotNullable)
);
} else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESBaseTwoKey)) {
@@ -1528,12 +1551,11 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCETBaseTwoKeyNavRTESBaseTwoKey")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETBaseTwoKeyNav)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETBaseTwoKeyNav)
+ .setNullable(false)))
.setReturnType(
new ReturnType()
.setType(nameETBaseTwoKeyNav)
@@ -1546,13 +1568,12 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCCollStringRTESTwoKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameString)
- .setNullable(false)
- .setCollection(true)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameString)
+ .setNullable(false)
+ .setCollection(true)))
.setReturnType(returnTypeETTwoKeyNav_NotNullable)
);
} else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNav)) {
@@ -1561,12 +1582,11 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCCTPrimCompRTESTwoKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameCTPrimComp)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameCTPrimComp)
+ .setNullable(false)))
.setReturnType(returnTypeETTwoKeyNav_NotNullable)
);
} else if (functionName.equals(nameBFCCTPrimCompRTESBaseTwoKeyNav)) {
@@ -1575,12 +1595,8 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCCTPrimCompRTESBaseTwoKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameCTPrimComp)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameCTPrimComp).setNullable(false)))
.setReturnType(
new ReturnType()
.setType(nameETBaseTwoKeyNav)
@@ -1593,18 +1609,14 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCCollCTPrimCompRTESAllPrim")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameCTPrimComp)
- .setNullable(false)
- .setCollection(true)))
- .setReturnType(
- new ReturnType()
- .setType(nameETAllPrim)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameCTPrimComp)
.setNullable(false)
- .setCollection(true))
+ .setCollection(true)))
+ .setReturnType(
+ new ReturnType().setType(nameETAllPrim).setNullable(false).setCollection(true))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTTwoKeyNav)) {
return Arrays.asList(
@@ -1612,16 +1624,13 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCESTwoKeyNavRTTwoKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETTwoKeyNav)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
.setReturnType(
- new ReturnType()
- .setType(nameETAllPrim)
- .setNullable(false))
+ new ReturnType().setType(nameETAllPrim).setNullable(false))
);
} else if (functionName.equals(nameBFCESKeyNavRTETKeyNav)) {
return Arrays.asList(
@@ -1629,17 +1638,14 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCESKeyNavRTETKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETKeyNav)
- .setNullable(false)
- .setCollection(true)))
- .setReturnType(
- new ReturnType()
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
.setType(nameETKeyNav)
- .setNullable(false))
+ .setNullable(false)
+ .setCollection(true)))
+ .setReturnType(
+ new ReturnType().setType(nameETKeyNav).setNullable(false))
);
} else if (functionName.equals(nameBFCETKeyNavRTETKeyNav)) {
return Arrays.asList(
@@ -1647,16 +1653,13 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCETKeyNavRTETKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETKeyNav)
- .setNullable(false)))
- .setReturnType(
- new ReturnType()
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
.setType(nameETKeyNav)
- .setNullable(false))
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType().setType(nameETKeyNav).setNullable(false))
);
} else if (functionName.equals(nameBFESTwoKeyNavRTESTwoKeyNav)) {
return Arrays.asList(
@@ -1664,13 +1667,12 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFESTwoKeyNavRTESTwoKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETTwoKeyNav)
- .setNullable(false)
- .setCollection(true)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true)))
.setReturnType(returnTypeCollectionETTwoKeyNav_NotNullable)
);
} else if (functionName.equals(nameBFCETTwoKeyNavRTETTwoKeyNav)) {
@@ -1679,12 +1681,11 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCETTwoKeyNavRTETTwoKeyNav")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETTwoKeyNav)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
.setReturnType(returnTypeETTwoKeyNav_NotNullable)
);
} else if (functionName.equals(nameBFCETTwoKeyNavRTCTTwoPrim)) {
@@ -1693,16 +1694,13 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCETTwoKeyNavRTCTTwoPrim")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETTwoKeyNav)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
.setReturnType(
- new ReturnType()
- .setType(nameCTTwoPrim)
- .setNullable(false))
+ new ReturnType().setType(nameCTTwoPrim).setNullable(false))
);
} else if (functionName.equals(nameBFCESTwoKeyNavRTStringParam)) {
return Arrays.asList(
@@ -1710,17 +1708,16 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCESTwoKeyNavRTStringParam")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETTwoKeyNav)
- .setNullable(false)
- .setCollection(true),
- new Parameter()
- .setName("ParameterComplex")
- .setType(nameCTTwoPrim)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true),
+ new Parameter()
+ .setName("ParameterComplex")
+ .setType(nameCTTwoPrim)
+ .setNullable(false)))
.setReturnType(returnTypeString_NotNullable)
);
} else if (functionName.equals(nameBFCESKeyNavRTETKeyNavParam)) {
@@ -1729,21 +1726,18 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCESKeyNavRTETKeyNavParam")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameETKeyNav)
- .setNullable(false)
- .setCollection(true),
- new Parameter()
- .setName("ParameterString")
- .setType(nameString)
- .setNullable(false)))
- .setReturnType(
- new ReturnType()
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
.setType(nameETKeyNav)
- .setNullable(false))
+ .setNullable(false)
+ .setCollection(true),
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType().setType(nameETKeyNav).setNullable(false))
);
} else if (functionName.equals(nameBFCCTPrimCompRTETTwoKeyNavParam)) {
return Arrays.asList(
@@ -1751,17 +1745,16 @@ public class EdmTechProvider extends EdmProviderAdapter {
.setName("BFCCTPrimCompRTETTwoKeyNavParam")
.setBound(true)
.setComposable(true)
- .setParameters(
- Arrays.asList(
- new Parameter()
- .setName("BindingParam")
- .setType(nameCTPrimComp)
- .setNullable(false)
- .setCollection(true),
- new Parameter()
- .setName("ParameterString")
- .setType(nameString)
- .setNullable(false)))
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameCTPrimComp)
+ .setNullable(false)
+ .setCollection(true),
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false)))
.setReturnType(returnTypeETTwoKeyNav_NotNullable)
);
}
@@ -1787,179 +1780,4 @@ public class EdmTechProvider extends EdmProviderAdapter {
return null;
}
- @Override
- public ActionImport getActionImport(final FullQualifiedName entityContainer, final String name) throws ODataException
- {
- if (entityContainer.equals(nameContainer)) {
- if (name.equals("AIRTPrimParam")) {
- return new ActionImport()
- .setName("AIRTPrimParam")
- .setAction(nameUARTPrimParam);
- } else if (name.equals("AIRTPrimCollParam")) {
- return new ActionImport()
- .setName("AIRTPrimCollParam")
- .setAction(nameUARTPrimCollParam);
- } else if (name.equals("AIRTCompParam")) {
- return new ActionImport()
- .setName("AIRTCompParam")
- .setAction(nameUARTCompParam);
- } else if (name.equals("AIRTCompCollParam")) {
- return new ActionImport()
- .setName("AIRTCompCollParam")
- .setAction(nameUARTCompCollParam);
- } else if (name.equals("AIRTETParam")) {
- return new ActionImport()
- .setName("AIRTETParam")
- .setAction(nameUARTETParam);
- } else if (name.equals("AIRTETCollAllPrimParam")) {
- return new ActionImport()
- .setName("AIRTETCollAllPrimParam")
- .setAction(nameUARTETCollAllPrimParam);
- }
- }
- return null;
- }
-
- @Override
- public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String name)
- throws ODataException {
-
- if (entityContainer.equals(nameContainer)) {
- if (name.equals("FINRTInt16")) {
- return new FunctionImport()
- .setName("FINRTInt16")
- .setFunction(nameUFNRTInt16)
- .setIncludeInServiceDocument(true);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FINInvisibleRTInt16")) {
- return new FunctionImport()
- .setName("FINInvisibleRTInt16")
- .setFunction(nameUFNRTInt16)
- .setIncludeInServiceDocument(false);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FINInvisible2RTInt16")) {
- return new FunctionImport()
- .setName("FINInvisible2RTInt16")
- .setFunction(nameUFNRTInt16);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FICRTETKeyNav")) {
- return new FunctionImport()
- .setName("FICRTETKeyNav")
- .setFunction(nameUFCRTETKeyNav);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FICRTETTwoKeyNavParam")) {
- return new FunctionImport()
- .setName("FICRTETTwoKeyNavParam")
- .setFunction(nameUFCRTETTwoKeyNavParam)
- .setIncludeInServiceDocument(true);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FICRTStringTwoParam")) {
- return new FunctionImport()
- .setName("FICRTStringTwoParam")
- .setFunction(nameUFCRTStringTwoParam)
- .setIncludeInServiceDocument(true);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FICRTCollStringTwoParam")) {
- return new FunctionImport()
- .setName("FICRTCollStringTwoParam")
- .setFunction(nameUFCRTCollStringTwoParam)
- .setIncludeInServiceDocument(true);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FICRTCTAllPrimTwoParam")) {
- return new FunctionImport()
- .setName("FICRTCTAllPrimTwoParam")
- .setFunction(nameUFCRTCTAllPrimTwoParam)
- .setIncludeInServiceDocument(true);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FICRTESMixPrimCollCompTwoParam")) {
- return new FunctionImport()
- .setName("FICRTESMixPrimCollCompTwoParam")
- .setFunction(nameUFCRTESMixPrimCollCompTwoParam)
- .setIncludeInServiceDocument(true);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FINRTESMixPrimCollCompTwoParam")) {
- return new FunctionImport()
- .setName("FINRTESMixPrimCollCompTwoParam")
- .setFunction(nameUFNRTESMixPrimCollCompTwoParam)
- .setIncludeInServiceDocument(true);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FICRTCollCTTwoPrim")) {
- return new FunctionImport()
- .setName("FICRTCollCTTwoPrim")
- .setFunction(nameUFCRTCollCTTwoPrim)
- .setIncludeInServiceDocument(true);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FICRTETMedia")) {
- return new FunctionImport()
- .setName("FICRTETMedia")
- .setFunction(nameUFCRTETMedia)
- .setIncludeInServiceDocument(true);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FICRTCTTwoPrimParam")) {
- return new FunctionImport()
- .setName("FICRTCTTwoPrimParam")
- .setFunction(nameUFCRTCTTwoPrimParam)
- .setIncludeInServiceDocument(true);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FICRTCTTwoPrim")) {
- return new FunctionImport()
- .setName("FICRTCTTwoPrim")
- .setFunction(nameUFCRTCTTwoPrim)
- .setIncludeInServiceDocument(true);
-
- }
- } else if (entityContainer.equals(nameContainer)) {
- if (name.equals("FICRTCollString")) {
- return new FunctionImport()
-
<TRUNCATED>
[3/4] [OLINGO-63] Uri Parser: Add support for $filter
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/021afffb/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmMock.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmMock.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmMock.java
deleted file mode 100644
index 426fc13..0000000
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmMock.java
+++ /dev/null
@@ -1,743 +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 static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-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.EdmActionImport;
-import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.odata4.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmReturnType;
-import org.apache.olingo.odata4.commons.api.edm.EdmServiceMetadata;
-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.EdmTypeDefinition;
-import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
-
-public class EdmMock implements Edm {
- public static final String NAMESPACE_SCHEMA = "RefScenario";
- public static final FullQualifiedName CONTAINER_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "Container1");
-
- public static final FullQualifiedName ACTION_IMPORT1_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "actionImport1");
- public static final FullQualifiedName COMPANY_SINGLETON_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "Company");
- public static final FullQualifiedName TEAMS_SET_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "Teams");
- public static final FullQualifiedName MANAGERS_SET_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "Managers");
- public static final FullQualifiedName EMPLOYEES_SET_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "Employees");
- public static final FullQualifiedName EMPLOYEES_TYPE_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "EmployeeType");
- public static final FullQualifiedName TEAMS_TYPE_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "TeamType");
- public static final FullQualifiedName MANAGERS_TYPE_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "ManagerType");
- public static final FullQualifiedName COMPANY_TYPE_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "CompanyType");
- public static final FullQualifiedName FUNCTION1_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "function1");
- public static final FullQualifiedName FUNCTION_MAXIMAL_AGE_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "MaximalAge");
- public static final FullQualifiedName FUNCTION_EMPLOYEE_SEARCH_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "EmployeeSearch");
- public static final FullQualifiedName FUNCTION_ALL_USED_ROOMS_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "AllUsedRoomIds");
- public static final FullQualifiedName FUNCTION_MOST_COMMON_LOCATION_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "MostCommonLocation");
- public static final FullQualifiedName FUNCTION_ALL_LOCATIONS_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "AllLocations");
- public static final FullQualifiedName ACTION1_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "action1");
- public static final FullQualifiedName TYPE_DEF1_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "tdtypeDef1");
- public static final FullQualifiedName RATING_ENUM_TYPE_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "eRating");
- public static final FullQualifiedName LOCATION_TYPE_NAME = new FullQualifiedName(NAMESPACE_SCHEMA, "cLocation");
- public static final FullQualifiedName NON_BINDING_PARAMETER = new FullQualifiedName(NAMESPACE_SCHEMA,
- "NonBindingParameter");
-
- public static final FullQualifiedName FUNCTION_IMPORT1_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "functionImport1");
- public static final FullQualifiedName FUNCTION_IMPORT_EMPLOYEE_SEARCH_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "EmployeeSearch");
- public static final FullQualifiedName FUNCTION_IMPORT_MAXIMAL_AGE_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "MaximalAge");
- public static final FullQualifiedName FUNCTION_IMPORT_ALL_USED_ROOMS_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "AllUsedRoomIds");
- public static final FullQualifiedName FUNCTION_IMPORT_MOST_COMMON_LOCATION_NAME = new FullQualifiedName(
- NAMESPACE_SCHEMA, "MostCommonLocation");
- public static final FullQualifiedName FUNCTION_IMPORT_ALL_LOCATIONS_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "AllLocations");
- public static final FullQualifiedName BOUND_FUNCTION_ENTITY_SET_RT_ENTITY_NAME = new FullQualifiedName(
- NAMESPACE_SCHEMA, "bf_entity_set_rt_entity");
- public static final FullQualifiedName BOUND_FUNCTION_ENTITY_SET_RT_ENTITY_SET_NAME = new FullQualifiedName(
- NAMESPACE_SCHEMA, "bf_entity_set_rt_entity_set");
- public static final FullQualifiedName BOUND_FUNCTION_PPROP_RT_ENTITY_SET_NAME = new FullQualifiedName(
- NAMESPACE_SCHEMA, "bf_pprop_rt_entity_set");
- public static final FullQualifiedName BOUND_FUNCTION_ENTITY_SET_RT_PPROP_NAME = new FullQualifiedName(
- NAMESPACE_SCHEMA, "bf_entity_set_rt_pprop");
- public static final FullQualifiedName BOUND_FUNCTION_ENTITY_SET_RT_CPROP_NAME = new FullQualifiedName(
- NAMESPACE_SCHEMA, "bf_entity_set_rt_cprop");
- public static final FullQualifiedName BOUND_FUNCTION_ENTITY_SET_RT_CPROP_COLL_NAME = new FullQualifiedName(
- NAMESPACE_SCHEMA, "bf_entity_set_rt_cprop_coll");
- public static final FullQualifiedName BOUND_FUNCTION_ENTITY_SET_RT_PPROP_COLL_NAME = new FullQualifiedName(
- NAMESPACE_SCHEMA, "bf_entity_set_rt_pprop_coll");
- public static final FullQualifiedName BOUND_FUNCTION_SINGLETON_RT_ENTITY_SET_NAME = new FullQualifiedName(
- NAMESPACE_SCHEMA, "bf_singleton_rt_entity_set");
- public static final FullQualifiedName BOUND_ACTION_PPROP_RT_ENTITY_SET_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "ba_pprop_rt_entity_set");
- public static final FullQualifiedName BOUND_ACTION_ENTITY_RT_ENTITY_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "ba_entity_rt_entity");
- public static final FullQualifiedName BOUND_ACTION_ENTITY_RT_PPROP_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "ba_entity_rt_pprop");
- public static final FullQualifiedName BOUND_ACTION_ENTITY_RT_PPROP_COLL_NAME = new FullQualifiedName(
- NAMESPACE_SCHEMA, "ba_entity_rt_pprop_coll");
- public static final FullQualifiedName BOUND_ACTION_ENTITY_SET_RT_CPROP_NAME = new FullQualifiedName(NAMESPACE_SCHEMA,
- "ba_entity_set_rt_cprop");
-
- private final EdmEntityType companyType = mock(EdmEntityType.class);
- private final EdmEntityType managerType = mock(EdmEntityType.class);
- private final EdmEntityType employeeType = mock(EdmEntityType.class);
- private final EdmEntityType teamType = mock(EdmEntityType.class);
-
- private final EdmFunction function1 = mock(EdmFunction.class);
- private final EdmFunction maximalAgeFunction = mock(EdmFunction.class);
- private final EdmFunction mostCommonLocationFunction = mock(EdmFunction.class);
- private final EdmFunction allUsedRoomIdsFunction = mock(EdmFunction.class);
- private final EdmFunction employeeSearchFunction = mock(EdmFunction.class);
- private final EdmFunction allLocationsFunction = mock(EdmFunction.class);
-
- private final EdmFunction boundFunctionEntitySetRtEntity = mock(EdmFunction.class);
- private final EdmFunction boundEntityColFunction = mock(EdmFunction.class);
- private final EdmFunction boundFunctionPPropRtEntitySet = mock(EdmFunction.class);
- private final EdmFunction boundFunctionEntitySetRtPProp = mock(EdmFunction.class);
- private final EdmFunction boundFunctionEntitySetRtCProp = mock(EdmFunction.class);
- private final EdmFunction boundFunctionEntitySetRtCPropColl = mock(EdmFunction.class);
- private final EdmFunction boundFunctionEntitySetRtPPropColl = mock(EdmFunction.class);
- private final EdmFunction boundFunctionSingletonRtEntitySet = mock(EdmFunction.class);
-
- private final EdmAction action1 = mock(EdmAction.class);
- private final EdmAction boundActionPpropRtEntitySet = mock(EdmAction.class);
- private final EdmAction boundActionEntityRtEntity = mock(EdmAction.class);
- private final EdmAction boundActionEntityRtPProp = mock(EdmAction.class);
- private final EdmAction boundActionEntityRtPPropColl = mock(EdmAction.class);
- private final EdmAction boundActionEntitySetRtCProp = mock(EdmAction.class);
- private final EdmEnumType ratingEnumType = mock(EdmEnumType.class);
- private final EdmTypeDefinition typeDef1 = mock(EdmTypeDefinition.class);
- private final EdmComplexType locationType = mock(EdmComplexType.class);
-
- private final EdmEntitySet employeesSet = mock(EdmEntitySet.class);
- private final EdmEntitySet managersSet = mock(EdmEntitySet.class);
- private final EdmEntitySet teamsSet = mock(EdmEntitySet.class);
- private final EdmSingleton company = mock(EdmSingleton.class);
- private final EdmActionImport actionImport1 = mock(EdmActionImport.class);
- private final EdmFunctionImport functionImport1 = mock(EdmFunctionImport.class);
- private final EdmFunctionImport employeeSearchFunctionImport = mock(EdmFunctionImport.class);
- private final EdmFunctionImport maximalAgeFunctionImport = mock(EdmFunctionImport.class);
- private final EdmFunctionImport mostCommonLocationFunctionImport = mock(EdmFunctionImport.class);
- private final EdmFunctionImport allUsedRoomIdsFunctionImport = mock(EdmFunctionImport.class);
- private final EdmFunctionImport allLocationsFunctionImport = mock(EdmFunctionImport.class);
- private final EdmEntityContainer container1 = mock(EdmEntityContainer.class);
-
- public EdmMock() {
- enhanceEmployeesEntitySet();
- enhanceManagersEntitySet();
- enhanceTeamsEntitySet();
- enhanceCompany();
- enhanceContainer1();
-
- enhanceEmployeeType();
- enhanceManagerType();
- enhanceTeamType();
- enhanceCompanyType();
- enhanceLocationType();
-
- enhanceActionImport1();
- enhanceFunctionImport1();
- enhanceFunctionImportEmployeeSearch();
- enhanceMaximalAgeFunctionImport();
- enhanceMostCommonLocationFunctionImport();
- enhanceAllUsedRoomIdsFunctionImport();
- enhanceAllLocationsFunctionImport();
-
- enhanceAction1();
- enhanceFunction1();
- enhanceFunctionEmployeeSearch();
- enhanceMaximalAgeFunction();
- enhanceMostCommonLocationFunction();
- enhanceAllUsedRoomIdsFunction();
- enhanceAllLocationsFunction();
- enhanceBoundEntityFunction();
- enhanceBoundFunctionEntitySetRtEntitySet();
- enhanceBoundFunctionPPropRtEntitySet();
- enhanceBoundFunctionEntitySetRtPProp();
- enhanceBoundFunctionEntitySetRtPPropColl();
- enhanceBoundFunctionEntitySetRtCProp();
- enhanceBoundFunctionEntitySetRtCPropColl();
- enhanceBoundFunctionSingletonRtEntitySet();
- enhanceBoundActionPPropRtEntitySet();
- enhanceBoundActionEntityRtEntity();
- enhanceBoundActionEntityRtPProp();
- enhanceBoundActionEntityRtPPropColl();
- enhanceBoundActionEntitySetRtCProp();
- }
-
- private void enhanceTeamType() {
- when(teamType.getName()).thenReturn(TEAMS_TYPE_NAME.getName());
- when(teamType.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(teamType.getKind()).thenReturn(EdmTypeKind.ENTITY);
- when(teamType.hasStream()).thenReturn(false);
- List<String> keyPredicateNames = new ArrayList<String>();
- when(teamType.getKeyPredicateNames()).thenReturn(keyPredicateNames);
- List<EdmKeyPropertyRef> keyPropertyRefs = new ArrayList<EdmKeyPropertyRef>();
- when(teamType.getKeyPropertyRefs()).thenReturn(keyPropertyRefs);
- List<String> navigationNames = new ArrayList<String>();
- when(teamType.getNavigationPropertyNames()).thenReturn(navigationNames);
- List<String> propertyNames = new ArrayList<String>();
- when(teamType.getPropertyNames()).thenReturn(propertyNames);
-
- addKeyProperty(teamType, "Id");
-
- addNavigationProperty(teamType, "nt_Employees", true, employeeType);
-
- addProperty(teamType, "Name", true, mock(EdmPrimitiveType.class));
- addProperty(teamType, "IsScrumTeam", true, mock(EdmPrimitiveType.class));
- addProperty(teamType, "Rating", true, mock(EdmPrimitiveType.class));
- }
-
- private void enhanceManagerType() {
- when(managerType.getName()).thenReturn(MANAGERS_TYPE_NAME.getName());
- when(managerType.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(managerType.getKind()).thenReturn(EdmTypeKind.ENTITY);
- when(managerType.hasStream()).thenReturn(true);
- when(managerType.getBaseType()).thenReturn(employeeType);
- List<String> keyPredicateNames = new ArrayList<String>();
- when(managerType.getKeyPredicateNames()).thenReturn(keyPredicateNames);
- List<EdmKeyPropertyRef> keyPropertyRefs = new ArrayList<EdmKeyPropertyRef>();
- when(managerType.getKeyPropertyRefs()).thenReturn(keyPropertyRefs);
- List<String> navigationNames = new ArrayList<String>();
- when(managerType.getNavigationPropertyNames()).thenReturn(navigationNames);
- List<String> propertyNames = new ArrayList<String>();
- when(managerType.getPropertyNames()).thenReturn(propertyNames);
-
- addKeyProperty(managerType, "EmployeeId");
-
- addNavigationProperty(managerType, "ne_Manager", false, managerType);
- addNavigationProperty(managerType, "ne_Team", false, teamType);
- addNavigationProperty(managerType, "nm_Employees", true, employeeType);
-
- addProperty(managerType, "EmployeeName", true, mock(EdmPrimitiveType.class));
- addProperty(managerType, "ManagerId", true, mock(EdmPrimitiveType.class));
- addProperty(managerType, "Location", false, locationType);
- addProperty(managerType, "Age", true, mock(EdmPrimitiveType.class));
- addProperty(managerType, "EntryDate", true, mock(EdmPrimitiveType.class));
- addProperty(managerType, "ImageUrl", true, mock(EdmPrimitiveType.class));
- }
-
- // when().thenReturn();
- private void enhanceEmployeeType() {
- when(employeeType.getName()).thenReturn(EMPLOYEES_TYPE_NAME.getName());
- when(employeeType.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(employeeType.getKind()).thenReturn(EdmTypeKind.ENTITY);
- when(employeeType.hasStream()).thenReturn(true);
- List<String> keyPredicateNames = new ArrayList<String>();
- when(employeeType.getKeyPredicateNames()).thenReturn(keyPredicateNames);
- List<EdmKeyPropertyRef> keyPropertyRefs = new ArrayList<EdmKeyPropertyRef>();
- when(employeeType.getKeyPropertyRefs()).thenReturn(keyPropertyRefs);
- List<String> navigationNames = new ArrayList<String>();
- when(employeeType.getNavigationPropertyNames()).thenReturn(navigationNames);
- List<String> propertyNames = new ArrayList<String>();
- when(employeeType.getPropertyNames()).thenReturn(propertyNames);
-
- addKeyProperty(employeeType, "EmployeeId");
-
- addNavigationProperty(employeeType, "ne_Manager", false, managerType);
- addNavigationProperty(employeeType, "ne_Team", false, teamType);
-
- addProperty(employeeType, "EmployeeName", true, mock(EdmPrimitiveType.class));
- addProperty(employeeType, "ManagerId", true, mock(EdmPrimitiveType.class));
- addProperty(employeeType, "Location", false, locationType);
- addProperty(employeeType, "Age", true, mock(EdmPrimitiveType.class));
- addProperty(employeeType, "EntryDate", true, mock(EdmPrimitiveType.class));
- addProperty(employeeType, "ImageUrl", true, mock(EdmPrimitiveType.class));
- }
-
- private void enhanceLocationType() {
- addProperty(locationType, "Country", true, mock(EdmPrimitiveType.class));
- when(locationType.getName()).thenReturn(LOCATION_TYPE_NAME.getName());
- }
-
- private void enhanceCompanyType() {
- when(companyType.getName()).thenReturn(COMPANY_TYPE_NAME.getName());
- when(companyType.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(companyType.getKind()).thenReturn(EdmTypeKind.ENTITY);
- }
-
- private void addNavigationProperty(final EdmEntityType entityType, final String propertyName,
- final boolean isCollection, final EdmType type) {
- EdmNavigationProperty property = mock(EdmNavigationProperty.class);
- entityType.getNavigationPropertyNames().add(propertyName);
- when(property.getName()).thenReturn(propertyName);
- when(entityType.getProperty(propertyName)).thenReturn(property);
- when(property.isCollection()).thenReturn(isCollection);
- when(property.getType()).thenReturn(type);
- }
-
- private void addKeyProperty(final EdmEntityType entityType, final String propertyName) {
- entityType.getKeyPredicateNames().add(propertyName);
- EdmProperty keyProp = addProperty(entityType, propertyName, true, mock(EdmPrimitiveType.class));
- EdmKeyPropertyRef keyRef = mock(EdmKeyPropertyRef.class);
- when(keyRef.getKeyPropertyName()).thenReturn(propertyName);
- when(keyRef.getProperty()).thenReturn(keyProp);
- entityType.getKeyPropertyRefs().add(keyRef);
- when(entityType.getKeyPropertyRef(propertyName)).thenReturn(keyRef);
- }
-
- private EdmProperty addProperty(final EdmStructuralType structuralType, final String propertyName,
- final boolean isPrimitive, final EdmType type) {
- EdmProperty property = mock(EdmProperty.class);
- when(property.getName()).thenReturn(propertyName);
- structuralType.getPropertyNames().add(propertyName);
- when(structuralType.getProperty(propertyName)).thenReturn(property);
- when(property.isPrimitive()).thenReturn(isPrimitive);
- when(property.getType()).thenReturn(type);
- return property;
- }
-
- private void enhanceContainer1() {
- when(container1.getName()).thenReturn(CONTAINER_NAME.getName());
- when(container1.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
-
- when(container1.getEntitySet(EMPLOYEES_SET_NAME.getName())).thenReturn(employeesSet);
- when(container1.getEntitySet(MANAGERS_SET_NAME.getName())).thenReturn(managersSet);
- when(container1.getEntitySet(TEAMS_SET_NAME.getName())).thenReturn(teamsSet);
- when(container1.getSingleton(COMPANY_SINGLETON_NAME.getName())).thenReturn(company);
- when(container1.getActionImport(ACTION_IMPORT1_NAME.getName())).thenReturn(actionImport1);
- when(container1.getFunctionImport(FUNCTION_IMPORT1_NAME.getName())).thenReturn(functionImport1);
- when(container1.getFunctionImport(FUNCTION_IMPORT_MAXIMAL_AGE_NAME.getName())).thenReturn(maximalAgeFunctionImport);
- when(container1.getFunctionImport(FUNCTION_IMPORT_MOST_COMMON_LOCATION_NAME.getName())).thenReturn(
- mostCommonLocationFunctionImport);
- when(container1.getFunctionImport(FUNCTION_IMPORT_ALL_USED_ROOMS_NAME.getName())).thenReturn(
- allUsedRoomIdsFunctionImport);
- when(container1.getFunctionImport(FUNCTION_IMPORT_EMPLOYEE_SEARCH_NAME.getName())).thenReturn(
- employeeSearchFunctionImport);
- when(container1.getFunctionImport(FUNCTION_IMPORT_ALL_LOCATIONS_NAME.getName())).thenReturn(
- allLocationsFunctionImport);
-
- /*
- * when(container1.getElement(EMPLOYEES_SET_NAME.getName())).thenReturn(employeesSet);
- * when(container1.getElement(TEAMS_SET_NAME.getName())).thenReturn(teamsSet);
- * when(container1.getElement(COMPANY_SINGLETON_NAME.getName())).thenReturn(company);
- * when(container1.getElement(ACTION_IMPORT1_NAME.getName())).thenReturn(actionImport1);
- * when(container1.getElement(FUNCTION_IMPORT_MAXIMAL_AGE_NAME.getName())).thenReturn(maximalAgeFunctionImport);
- */
- }
-
- private void enhanceActionImport1() {
- when(actionImport1.getName()).thenReturn(ACTION_IMPORT1_NAME.getName());
- when(actionImport1.getEntityContainer()).thenReturn(container1);
- when(actionImport1.getReturnedEntitySet()).thenReturn(employeesSet);
- when(actionImport1.getAction()).thenReturn(action1);
- }
-
- private void enhanceFunctionImport1() {
- when(functionImport1.getName()).thenReturn(FUNCTION_IMPORT1_NAME.getName());
- when(functionImport1.getEntityContainer()).thenReturn(container1);
- when(functionImport1.getReturnedEntitySet()).thenReturn(teamsSet);
- when(functionImport1.getFunction(null)).thenReturn(function1);
- }
-
- private void enhanceFunctionImportEmployeeSearch() {
- when(employeeSearchFunctionImport.getName()).thenReturn(FUNCTION_IMPORT_EMPLOYEE_SEARCH_NAME.getName());
- when(employeeSearchFunctionImport.getEntityContainer()).thenReturn(container1);
- when(employeeSearchFunctionImport.getReturnedEntitySet()).thenReturn(teamsSet);
- when(employeeSearchFunctionImport.getFunction(null)).thenReturn(employeeSearchFunction);
- }
-
- private void enhanceFunctionEmployeeSearch() {
- when(employeeSearchFunction.getName()).thenReturn(FUNCTION1_NAME.getName());
- when(employeeSearchFunction.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(employeeSearchFunction.getReturnType().isCollection()).thenReturn(true);
- when(employeeSearchFunction.getReturnType().getType()).thenReturn(employeeType);
- }
-
- private void enhanceMaximalAgeFunctionImport() {
- when(maximalAgeFunctionImport.getName()).thenReturn(FUNCTION_IMPORT_MAXIMAL_AGE_NAME.getName());
- when(maximalAgeFunctionImport.getEntityContainer()).thenReturn(container1);
- when(maximalAgeFunctionImport.getFunction(null)).thenReturn(maximalAgeFunction);
- }
-
- private void enhanceMaximalAgeFunction() {
- when(maximalAgeFunction.getName()).thenReturn(FUNCTION_MAXIMAL_AGE_NAME.getName());
- when(maximalAgeFunction.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(maximalAgeFunction.getReturnType().isCollection()).thenReturn(false);
- when(maximalAgeFunction.getReturnType().getType()).thenReturn(mock(EdmPrimitiveType.class));
-
- }
-
- private void enhanceAllUsedRoomIdsFunctionImport() {
- when(allUsedRoomIdsFunctionImport.getName()).thenReturn(FUNCTION_IMPORT_ALL_USED_ROOMS_NAME.getName());
- when(allUsedRoomIdsFunctionImport.getEntityContainer()).thenReturn(container1);
- when(allUsedRoomIdsFunctionImport.getFunction(null)).thenReturn(allUsedRoomIdsFunction);
- }
-
- private void enhanceAllUsedRoomIdsFunction() {
- when(allUsedRoomIdsFunction.getName()).thenReturn(FUNCTION_ALL_USED_ROOMS_NAME.getName());
- when(allUsedRoomIdsFunction.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(allUsedRoomIdsFunction.getReturnType().isCollection()).thenReturn(true);
- when(allUsedRoomIdsFunction.getReturnType().getType()).thenReturn(mock(EdmPrimitiveType.class));
-
- }
-
- private void enhanceMostCommonLocationFunctionImport() {
- when(mostCommonLocationFunctionImport.getName()).thenReturn(FUNCTION_IMPORT_MOST_COMMON_LOCATION_NAME.getName());
- when(mostCommonLocationFunctionImport.getEntityContainer()).thenReturn(container1);
- when(mostCommonLocationFunctionImport.getFunction(null)).thenReturn(mostCommonLocationFunction);
- }
-
- private void enhanceMostCommonLocationFunction() {
- when(mostCommonLocationFunction.getName()).thenReturn(FUNCTION_MOST_COMMON_LOCATION_NAME.getName());
- when(mostCommonLocationFunction.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(mostCommonLocationFunction.getReturnType().isCollection()).thenReturn(false);
- when(mostCommonLocationFunction.getReturnType().getType()).thenReturn(locationType);
-
- }
-
- private void enhanceAllLocationsFunctionImport() {
- when(allLocationsFunctionImport.getName()).thenReturn(FUNCTION_IMPORT_ALL_LOCATIONS_NAME.getName());
- when(allLocationsFunctionImport.getEntityContainer()).thenReturn(container1);
- when(allLocationsFunctionImport.getFunction(null)).thenReturn(allLocationsFunction);
- }
-
- private void enhanceAllLocationsFunction() {
- when(allLocationsFunction.getName()).thenReturn(FUNCTION_ALL_LOCATIONS_NAME.getName());
- when(allLocationsFunction.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(allLocationsFunction.getReturnType().isCollection()).thenReturn(true);
- when(allLocationsFunction.getReturnType().getType()).thenReturn(locationType);
-
- }
-
- private void enhanceBoundEntityFunction() {
- when(boundFunctionEntitySetRtEntity.getName()).thenReturn(BOUND_FUNCTION_ENTITY_SET_RT_ENTITY_NAME.getName());
- when(boundFunctionEntitySetRtEntity.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(boundFunctionEntitySetRtEntity.getReturnType().isCollection()).thenReturn(false);
- when(boundFunctionEntitySetRtEntity.getReturnType().getType()).thenReturn(employeeType);
- when(boundFunctionEntitySetRtEntity.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundFunctionEntitySetRtEntity.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundFunctionEntitySetRtEntitySet() {
- when(boundEntityColFunction.getName()).thenReturn(BOUND_FUNCTION_ENTITY_SET_RT_ENTITY_SET_NAME.getName());
- when(boundEntityColFunction.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(boundEntityColFunction.getReturnType().isCollection()).thenReturn(true);
- when(boundEntityColFunction.getReturnType().getType()).thenReturn(employeeType);
- when(boundEntityColFunction.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundEntityColFunction.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundFunctionPPropRtEntitySet() {
- when(boundFunctionPPropRtEntitySet.getName()).thenReturn(BOUND_FUNCTION_PPROP_RT_ENTITY_SET_NAME.getName());
- when(boundFunctionPPropRtEntitySet.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(boundFunctionPPropRtEntitySet.getReturnType().isCollection()).thenReturn(true);
- when(boundFunctionPPropRtEntitySet.getReturnType().getType()).thenReturn(employeeType);
- when(boundFunctionPPropRtEntitySet.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundFunctionPPropRtEntitySet.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundFunctionEntitySetRtPProp() {
- when(boundFunctionEntitySetRtPProp.getName()).thenReturn(BOUND_FUNCTION_ENTITY_SET_RT_PPROP_NAME.getName());
- when(boundFunctionEntitySetRtPProp.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(boundFunctionEntitySetRtPProp.getReturnType().isCollection()).thenReturn(false);
- EdmPrimitiveType primitiveType = mock(EdmPrimitiveType.class);
- when(boundFunctionEntitySetRtPProp.getReturnType().getType()).thenReturn(primitiveType);
- when(boundFunctionEntitySetRtPProp.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundFunctionEntitySetRtPProp.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundFunctionEntitySetRtPPropColl() {
- when(boundFunctionEntitySetRtPPropColl.getName())
- .thenReturn(BOUND_FUNCTION_ENTITY_SET_RT_PPROP_COLL_NAME.getName());
- when(boundFunctionEntitySetRtPPropColl.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(boundFunctionEntitySetRtPPropColl.getReturnType().isCollection()).thenReturn(true);
- EdmPrimitiveType primitiveType = mock(EdmPrimitiveType.class);
- when(boundFunctionEntitySetRtPPropColl.getReturnType().getType()).thenReturn(primitiveType);
- when(boundFunctionEntitySetRtPPropColl.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundFunctionEntitySetRtPPropColl.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundFunctionEntitySetRtCProp() {
- when(boundFunctionEntitySetRtCProp.getName()).thenReturn(BOUND_FUNCTION_ENTITY_SET_RT_CPROP_NAME.getName());
- when(boundFunctionEntitySetRtCProp.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(boundFunctionEntitySetRtCProp.getReturnType().isCollection()).thenReturn(false);
- when(boundFunctionEntitySetRtCProp.getReturnType().getType()).thenReturn(locationType);
- when(boundFunctionEntitySetRtCProp.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundFunctionEntitySetRtCProp.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundFunctionEntitySetRtCPropColl() {
- when(boundFunctionEntitySetRtCPropColl.getName())
- .thenReturn(BOUND_FUNCTION_ENTITY_SET_RT_CPROP_COLL_NAME.getName());
- when(boundFunctionEntitySetRtCPropColl.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(boundFunctionEntitySetRtCPropColl.getReturnType().isCollection()).thenReturn(true);
- when(boundFunctionEntitySetRtCPropColl.getReturnType().getType()).thenReturn(locationType);
- when(boundFunctionEntitySetRtCPropColl.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundFunctionEntitySetRtCPropColl.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundFunctionSingletonRtEntitySet() {
- when(boundFunctionSingletonRtEntitySet.getName()).thenReturn(BOUND_FUNCTION_SINGLETON_RT_ENTITY_SET_NAME.getName());
- when(boundFunctionSingletonRtEntitySet.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(boundFunctionSingletonRtEntitySet.getReturnType().isCollection()).thenReturn(true);
- when(boundFunctionSingletonRtEntitySet.getReturnType().getType()).thenReturn(employeeType);
- when(boundFunctionSingletonRtEntitySet.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundFunctionSingletonRtEntitySet.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundActionPPropRtEntitySet() {
- when(boundActionPpropRtEntitySet.getName()).thenReturn(BOUND_ACTION_PPROP_RT_ENTITY_SET_NAME.getName());
- when(boundActionPpropRtEntitySet.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(boundActionPpropRtEntitySet.getReturnType().isCollection()).thenReturn(true);
- when(boundActionPpropRtEntitySet.getReturnType().getType()).thenReturn(employeeType);
- when(boundActionPpropRtEntitySet.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundActionPpropRtEntitySet.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundActionEntityRtEntity() {
- when(boundActionEntityRtEntity.getName()).thenReturn(BOUND_ACTION_ENTITY_RT_ENTITY_NAME.getName());
- when(boundActionEntityRtEntity.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(boundActionEntityRtEntity.getReturnType().isCollection()).thenReturn(false);
- when(boundActionEntityRtEntity.getReturnType().getType()).thenReturn(employeeType);
- when(boundActionEntityRtEntity.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundActionEntityRtEntity.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundActionEntityRtPProp() {
- when(boundActionEntityRtPProp.getName()).thenReturn(BOUND_ACTION_ENTITY_RT_PPROP_NAME.getName());
- when(boundActionEntityRtPProp.getReturnType()).thenReturn(mock(EdmReturnType.class));
- EdmPrimitiveType primitiveType = mock(EdmPrimitiveType.class);
- when(boundActionEntityRtPProp.getReturnType().isCollection()).thenReturn(false);
- when(boundActionEntityRtPProp.getReturnType().getType()).thenReturn(primitiveType);
- when(boundActionEntityRtPProp.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundActionEntityRtPProp.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundActionEntityRtPPropColl() {
- when(boundActionEntityRtPPropColl.getName()).thenReturn(BOUND_ACTION_ENTITY_RT_PPROP_NAME.getName());
- when(boundActionEntityRtPPropColl.getReturnType()).thenReturn(mock(EdmReturnType.class));
- EdmPrimitiveType primitiveType = mock(EdmPrimitiveType.class);
- when(boundActionEntityRtPPropColl.getReturnType().isCollection()).thenReturn(true);
- when(boundActionEntityRtPPropColl.getReturnType().getType()).thenReturn(primitiveType);
- when(boundActionEntityRtPPropColl.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundActionEntityRtPPropColl.isBound()).thenReturn(true);
- }
-
- private void enhanceBoundActionEntitySetRtCProp() {
- when(boundActionEntitySetRtCProp.getName()).thenReturn(BOUND_ACTION_ENTITY_SET_RT_CPROP_NAME.getName());
- when(boundActionEntitySetRtCProp.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(boundActionEntitySetRtCProp.getReturnType().isCollection()).thenReturn(false);
- when(boundActionEntitySetRtCProp.getReturnType().getType()).thenReturn(locationType);
- when(boundActionEntitySetRtCProp.getNamespace()).thenReturn(NAMESPACE_SCHEMA);
- when(boundActionEntitySetRtCProp.isBound()).thenReturn(true);
- }
-
- private void enhanceFunction1() {
- when(function1.getName()).thenReturn(FUNCTION1_NAME.getName());
- when(function1.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(function1.getReturnType().isCollection()).thenReturn(false);
- when(function1.getReturnType().getType()).thenReturn(teamType);
- }
-
- private void enhanceAction1() {
- when(action1.getReturnType()).thenReturn(mock(EdmReturnType.class));
- when(action1.getReturnType().isCollection()).thenReturn(false);
- when(action1.getReturnType().getType()).thenReturn(employeeType);
- }
-
- private void enhanceCompany() {
- when(company.getName()).thenReturn(COMPANY_SINGLETON_NAME.getName());
- when(company.getEntityContainer()).thenReturn(container1);
- when(company.getEntityType()).thenReturn(companyType);
- }
-
- private void enhanceManagersEntitySet() {
- when(managersSet.getName()).thenReturn(MANAGERS_SET_NAME.getName());
- when(managersSet.getEntityContainer()).thenReturn(container1);
- when(managersSet.getEntityType()).thenReturn(managerType);
- }
-
- private void enhanceTeamsEntitySet() {
- when(teamsSet.getName()).thenReturn(TEAMS_SET_NAME.getName());
- when(teamsSet.getEntityContainer()).thenReturn(container1);
- when(teamsSet.getEntityType()).thenReturn(teamType);
- }
-
- private void enhanceEmployeesEntitySet() {
- when(employeesSet.getName()).thenReturn(EMPLOYEES_SET_NAME.getName());
- when(employeesSet.getEntityContainer()).thenReturn(container1);
- when(employeesSet.getEntityType()).thenReturn(employeeType);
- }
-
- @Override
- public EdmEntityContainer getEntityContainer(final FullQualifiedName fqn) {
-
- if (fqn == null || NAMESPACE_SCHEMA.equals(fqn.getNamespace()) && CONTAINER_NAME.equals(fqn.getName())) {
- return container1;
- }
-
- return null;
- }
-
- @Override
- public EdmEnumType getEnumType(final FullQualifiedName fqn) {
- if (RATING_ENUM_TYPE_NAME.equals(fqn)) {
- return ratingEnumType;
- }
-
- return null;
- }
-
- @Override
- public EdmTypeDefinition getTypeDefinition(final FullQualifiedName fqn) {
- if (TYPE_DEF1_NAME.equals(fqn)) {
- return typeDef1;
- }
- return null;
- }
-
- @Override
- public EdmEntityType getEntityType(final FullQualifiedName fqn) {
- if (NAMESPACE_SCHEMA.equals(fqn.getNamespace())) {
- if (EMPLOYEES_TYPE_NAME.equals(fqn)) {
- return employeeType;
- } else if (MANAGERS_TYPE_NAME.equals(fqn)) {
- return managerType;
- } else if (TEAMS_TYPE_NAME.equals(fqn)) {
- return teamType;
- } else if (COMPANY_TYPE_NAME.equals(fqn)) {
- return companyType;
- }
- }
- return null;
- }
-
- @Override
- public EdmComplexType getComplexType(final FullQualifiedName fqn) {
- if (LOCATION_TYPE_NAME.equals(fqn)) {
- return locationType;
- }
- return null;
- }
-
- @Override
- public EdmServiceMetadata getServiceMetadata() {
- return mock(EdmServiceMetadata.class);
- }
-
- @Override
- public EdmAction getAction(final FullQualifiedName actionFqn, final FullQualifiedName bindingParameterTypeFqn,
- final Boolean isBindingParameterTypeCollection) {
- if (NAMESPACE_SCHEMA.equals(actionFqn.getNamespace())) {
- if (ACTION1_NAME.equals(actionFqn)) {
- return action1;
- } else if (BOUND_ACTION_PPROP_RT_ENTITY_SET_NAME.equals(actionFqn)
- && Boolean.FALSE.equals(isBindingParameterTypeCollection)) {
- return boundActionPpropRtEntitySet;
- } else if (BOUND_ACTION_ENTITY_RT_ENTITY_NAME.equals(actionFqn)
- && EMPLOYEES_TYPE_NAME.equals(bindingParameterTypeFqn)
- && Boolean.FALSE.equals(isBindingParameterTypeCollection)) {
- return boundActionEntityRtEntity;
- } else if (BOUND_ACTION_ENTITY_RT_PPROP_NAME.equals(actionFqn)
- && EMPLOYEES_TYPE_NAME.equals(bindingParameterTypeFqn)
- && Boolean.FALSE.equals(isBindingParameterTypeCollection)) {
- return boundActionEntityRtPProp;
- } else if (BOUND_ACTION_ENTITY_RT_PPROP_COLL_NAME.equals(actionFqn)
- && EMPLOYEES_TYPE_NAME.equals(bindingParameterTypeFqn)
- && Boolean.FALSE.equals(isBindingParameterTypeCollection)) {
- return boundActionEntityRtPPropColl;
- } else if (BOUND_ACTION_ENTITY_SET_RT_CPROP_NAME.equals(actionFqn)
- && EMPLOYEES_TYPE_NAME.equals(bindingParameterTypeFqn)
- && Boolean.TRUE.equals(isBindingParameterTypeCollection)) {
- return boundActionEntitySetRtCProp;
- }
- }
- return null;
- }
-
- @Override
- public EdmFunction getFunction(final FullQualifiedName functionFqn,
- final FullQualifiedName bindingParameterTypeFqn,
- final Boolean isBindingParameterTypeCollection, final List<String> bindingParameterNames) {
- if (functionFqn != null) {
- if (NAMESPACE_SCHEMA.equals(functionFqn.getNamespace())) {
- if (FUNCTION1_NAME.equals(functionFqn)) {
- return function1;
- } else if (FUNCTION_ALL_LOCATIONS_NAME.equals(functionFqn)) {
- return allLocationsFunction;
- } else if (FUNCTION_EMPLOYEE_SEARCH_NAME.equals(functionFqn)) {
- return employeeSearchFunction;
- } else if (FUNCTION_MAXIMAL_AGE_NAME.equals(functionFqn)) {
- return maximalAgeFunction;
- } else if (FUNCTION_MOST_COMMON_LOCATION_NAME.equals(functionFqn)) {
- return mostCommonLocationFunction;
- } else if (FUNCTION_ALL_USED_ROOMS_NAME.equals(functionFqn)) {
- return allUsedRoomIdsFunction;
- } else if (BOUND_FUNCTION_ENTITY_SET_RT_ENTITY_NAME.equals(functionFqn)
- && EMPLOYEES_TYPE_NAME.equals(bindingParameterTypeFqn)
- && Boolean.TRUE.equals(isBindingParameterTypeCollection)) {
- return boundFunctionEntitySetRtEntity;
- } else if (BOUND_FUNCTION_ENTITY_SET_RT_ENTITY_SET_NAME.equals(functionFqn)
- && EMPLOYEES_TYPE_NAME.equals(bindingParameterTypeFqn)
- && Boolean.TRUE.equals(isBindingParameterTypeCollection)) {
- return boundEntityColFunction;
- } else if (BOUND_FUNCTION_PPROP_RT_ENTITY_SET_NAME.equals(functionFqn)
- && Boolean.FALSE.equals(isBindingParameterTypeCollection)) {
- return boundFunctionPPropRtEntitySet;
- } else if (BOUND_FUNCTION_ENTITY_SET_RT_PPROP_NAME.equals(functionFqn)
- && EMPLOYEES_TYPE_NAME.equals(bindingParameterTypeFqn)
- && Boolean.TRUE.equals(isBindingParameterTypeCollection)) {
- return boundFunctionEntitySetRtPProp;
- } else if (BOUND_FUNCTION_ENTITY_SET_RT_PPROP_COLL_NAME.equals(functionFqn)
- && EMPLOYEES_TYPE_NAME.equals(bindingParameterTypeFqn)
- && Boolean.TRUE.equals(isBindingParameterTypeCollection)) {
- return boundFunctionEntitySetRtPPropColl;
- } else if (BOUND_FUNCTION_ENTITY_SET_RT_CPROP_NAME.equals(functionFqn)
- && EMPLOYEES_TYPE_NAME.equals(bindingParameterTypeFqn)
- && Boolean.TRUE.equals(isBindingParameterTypeCollection)) {
- return boundFunctionEntitySetRtCProp;
- } else if (BOUND_FUNCTION_ENTITY_SET_RT_CPROP_COLL_NAME.equals(functionFqn)
- && EMPLOYEES_TYPE_NAME.equals(bindingParameterTypeFqn)
- && Boolean.TRUE.equals(isBindingParameterTypeCollection)) {
- return boundFunctionEntitySetRtCPropColl;
- } else if (BOUND_FUNCTION_SINGLETON_RT_ENTITY_SET_NAME.equals(functionFqn)
- && COMPANY_TYPE_NAME.equals(bindingParameterTypeFqn)
- && Boolean.FALSE.equals(isBindingParameterTypeCollection)) {
- return boundFunctionSingletonRtEntitySet;
- }
- }
- }
- return null;
- }
-
-}
[4/4] git commit: [OLINGO-63] Uri Parser: Add support for $filter
Posted by ko...@apache.org.
[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 {
+
+}