You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/02/21 17:28:04 UTC
[01/14] [OLINGO-63] Uri Parser: add unit tests for errors
Repository: incubator-olingo-odata4
Updated Branches:
refs/heads/olingo169 f094e109d -> 7f76d8a7b
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
index 77dc1ac..9dc5768 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
@@ -104,69 +104,57 @@ public class TestUriParserImpl {
testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()")
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
.at(1)
.isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameString)
- .isCollection(false);
+ .isType(EdmTechProvider.nameString, false);
// returning collection of primitive
testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()")
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
.at(1)
.isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameString)
- .isCollection(true);
+ .isType(EdmTechProvider.nameString, true);
// returning single complex
testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()")
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
.at(1)
.isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameCTTwoPrim)
- .isCollection(false);
+ .isType(EdmTechProvider.nameCTTwoPrim, false);
// returning collection of complex
testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
.at(1)
.isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameCTTwoPrim)
- .isCollection(true);
+ .isType(EdmTechProvider.nameCTTwoPrim, true);
// returning single entity
testRes.run(
esTwoKeyNav + "/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .isCollection(false)
.at(1)
.isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(false);
+ .isType(EdmTechProvider.nameETTwoKeyNav, false);
// returning collection of entity (aka entitySet)
testRes.run(esTwoKeyNav + "/com.sap.odata.test1.BFCSINavRTESTwoKeyNav()")
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(false)
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
.at(1)
.isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true);
+ .isType(EdmTechProvider.nameETTwoKeyNav, true);
}
@Test
@@ -212,8 +200,7 @@ public class TestUriParserImpl {
testRes.run("ESAllPrim/$count")
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETAllPrim)
- .isCollection(true)
+ .isType(EdmTechProvider.nameETAllPrim,true)
.at(1)
.isUriPathInfoKind(UriResourceKind.count);
@@ -517,10 +504,9 @@ public class TestUriParserImpl {
testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase")
.at(0)
.isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim)
+ .isType(EdmTechProvider.nameETTwoPrim,true)
.isTypeFilterOnCollection(EdmTechProvider.nameETBase)
- .isTypeFilterOnEntry(null)
- .isCollection(true);
+ .isTypeFilterOnEntry(null);
// filter before key predicate
testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase(PropertyInt16=1)")
@@ -531,10 +517,9 @@ public class TestUriParserImpl {
.isTypeFilterOnCollection(EdmTechProvider.nameETBase)
.isTypeFilterOnEntry(null)
.at(0)
- .isType(EdmTechProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isCollection(false);
-
+ .isType(EdmTechProvider.nameETTwoPrim,false)
+ .isKeyPredicate(0, "PropertyInt16", "1");
+
// filter before key predicate; property of sub type
testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase(PropertyInt16=1)/AdditionalPropertyString_5")
.at(0)
@@ -553,11 +538,10 @@ public class TestUriParserImpl {
.at(0)
.isEntitySet("ESTwoPrim")
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoPrim)
+ .isType(EdmTechProvider.nameETTwoPrim,false)
.isTypeFilterOnCollection(null)
.isTypeFilterOnEntry(EdmTechProvider.nameETBase)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isCollection(false);
+ .isKeyPredicate(0, "PropertyInt16", "1");
// filter after key predicate; property of sub type
testRes.run("ESTwoPrim(PropertyInt16=1)/com.sap.odata.test1.ETBase/AdditionalPropertyString_5")
@@ -1027,10 +1011,10 @@ public class TestUriParserImpl {
+ "$filter=com.sap.odata.test1.CTBase/AdditionalPropString")
.goFilter().root().isMember()
.isMemberStartType(EdmTechProvider.nameCTBase).goPath()
- //.at(0)
- //.isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- //.isType(EdmTechProvider.nameCTTwoPrim, false)
- //.isTypeFilterOnEntry(EdmTechProvider.nameCTBase)
+ // .at(0)
+ // .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+ // .isType(EdmTechProvider.nameCTTwoPrim, false)
+ // .isTypeFilterOnEntry(EdmTechProvider.nameCTBase)
.at(0).isType(EdmTechProvider.nameString);
// on Complex collection
@@ -1038,10 +1022,10 @@ public class TestUriParserImpl {
+ "$filter=com.sap.odata.test1.CTBase/AdditionalPropString")
.goFilter().root().isMember()
.isMemberStartType(EdmTechProvider.nameCTBase).goPath()
- //.at(0)
- //.isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- //.isType(EdmTechProvider.nameCTTwoPrim, true)
- //.isTypeFilterOnCollection(EdmTechProvider.nameCTBase)
+ // .at(0)
+ // .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+ // .isType(EdmTechProvider.nameCTTwoPrim, true)
+ // .isTypeFilterOnCollection(EdmTechProvider.nameCTBase)
.at(0).isType(EdmTechProvider.nameString);
}
@@ -1120,10 +1104,10 @@ public class TestUriParserImpl {
.isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false);
testUri.run("ESTwoKeyNav?$select=com.sap.odata.test1.ETBaseTwoKeyNav")
- .isSelectStartType(0,EdmTechProvider.nameETBaseTwoKeyNav);
+ .isSelectStartType(0, EdmTechProvider.nameETBaseTwoKeyNav);
testUri.run("ESTwoKeyNav/PropertyComplexNav?$select=com.sap.odata.test1.CTTwoBasePrimCompNav")
- .isSelectStartType(0,EdmTechProvider.nameCTTwoBasePrimCompNav);
+ .isSelectStartType(0, EdmTechProvider.nameCTTwoBasePrimCompNav);
testUri.run("ESTwoKeyNav?$select=PropertyComplexNav/com.sap.odata.test1.CTTwoBasePrimCompNav")
.goSelectItemPath(0)
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
index 2939395..52f89f4 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
@@ -161,7 +161,7 @@ public class QueryOptionTest {
@Test
public void testInlineCountImpl() {
CountOptionImpl option = new CountOptionImpl();
- assertEquals(SupportedQueryOptions.INLINECOUNT, option.getKind());
+ assertEquals(SupportedQueryOptions.COUNT, option.getKind());
assertEquals(false, option.getValue());
option.setValue(true);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
index 280f0a1..5fc6d72 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
@@ -26,7 +26,6 @@ import java.util.List;
import org.antlr.v4.runtime.ParserRuleContext;
import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
-// TODO extend to test also exception which can occure while paring
public class ParserValidator {
private String input = null;
@@ -55,7 +54,6 @@ public class ParserValidator {
}
/**
- * TODO verify
* Used in fast LL Parsing:
* Don't stop the parsing process when the slower full context parsing (with prediction mode SLL) is
* required
@@ -67,8 +65,6 @@ 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).
@@ -80,7 +76,6 @@ public class ParserValidator {
}
/**
- * TODO verify
* Used in fast LL Parsing:
* Allows ambiguities
* @return
@@ -164,80 +159,4 @@ public class ParserValidator {
return this;
}
- // --- Helper ---
- /*
- * private OdataRelativeUriEOFContext parseInput(final String input) {
- * UriParserParser parser = null;
- * UriLexerWithTrace lexer = null;
- * OdataRelativeUriEOFContext ret = null;
- *
- * // Use 2 stage approach to improve performance
- * // see https://github.com/antlr/antlr4/issues/192
- * // TODO verify this
- *
- * // stage= 1
- * try {
- * curException = null;
- * exceptions.clear();
- *
- * // create parser
- * lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
- * parser = new UriParserParser(new CommonTokenStream(lexer));
- *
- * // write always a error message in case of syntax errors
- * // parser.addErrorListener(new TestErrorHandler<Object>());
- * // check error message if whether they are allowed or not
- * // parser.addErrorListener(new ErrorCollector());
- *
- * // bail out of parser at first syntax error. --> proceed in catch block with step 2
- * parser.setErrorHandler(new BailErrorStrategy());
- *
- * // user the faster SLL parsing
- * parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
- *
- * // parse
- * if (logLevel > 0) {
- * System.out.println("Step 1");
- * System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode());
- * }
- * ret = parser.odataRelativeUriEOF();
- *
- * } catch (Exception exception) {
- * curException = exception;
- * try {
- * // clear status
- * curException = null;
- * exceptions.clear();
- *
- * // create parser
- * lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
- * parser = new UriParserParser(new CommonTokenStream(lexer));
- *
- * // write always a error message in case of syntax errors
- * // parser.addErrorListener(new ErrorCollector(this));
- * // check error message if whether they are allowed or not
- * // parser.addErrorListener(new ErrorCollector(this));
- *
- * // Used default error strategy
- * parser.setErrorHandler(new DefaultErrorStrategy());
- *
- * // User the slower SLL parsing
- * parser.getInterpreter().setPredictionMode(PredictionMode.LL);
- *
- * // parse
- * if (logLevel > 1) {
- * System.out.println("Step 2");
- * System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode() + ")");
- * }
- * ret = parser.odataRelativeUriEOF();
- *
- * } catch (Exception exception1) {
- * curException = exception1;
- * // exceptionOnStage = 2;
- * }
- * }
- *
- * return ret;
- * }
- */
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
index ff090fd..66b6d1a 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
@@ -327,7 +327,7 @@ public class ResourceValidator implements Validator {
}
// TODO remove
- public ResourceValidator isCollection(final boolean isCollection) {
+ /*public ResourceValidator isCollection(final boolean isCollection) {
if (!(uriPathInfo instanceof UriResourcePartTyped)) {
fail("invalid resource kind: " + uriPathInfo.getKind().toString());
}
@@ -339,7 +339,7 @@ public class ResourceValidator implements Validator {
}
assertEquals(isCollection, uriPathInfoTyped.isCollection());
return this;
- }
+ }*/
public ResourceValidator isFilterString(final String expectedFilterTreeAsString) {
@@ -368,6 +368,19 @@ public class ResourceValidator implements Validator {
return this;
}
+
+ public ResourceValidator isKeyPredicateAlias(final int index, final String name, final String alias) {
+ if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
+ List<UriParameter> keyPredicates = info.getKeyPredicates();
+ assertEquals(name, keyPredicates.get(index).getName());
+ assertEquals(alias, keyPredicates.get(index).getAlias());
+ return this;
+
+ }
public ResourceValidator isKeyPredicate(final int index, final String name, final String text) {
if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
[02/14] [OLINGO-63] Uri Parser: add unit tests for errors
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
deleted file mode 100644
index a856e89..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
+++ /dev/null
@@ -1,1359 +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.server.core.uri.antlr;
-
-import org.apache.olingo.odata4.server.core.uri.testutil.ParserValidator;
-import org.junit.Test;
-
-/**
- * The class {@link TestParser} contains regression tests which work directly on the
- * output of the parser (which is generated by ANTLR). These tests should only test the
- * parser and must NOT require any EDM in order to ensure that the parser can run in a
- * context free manner.
- * The single test cases are written according the ABNF (not the parser) since we
- * want if the parser works as defined in the ABNF.
- *
- * Ideally these test detect any (wrong) change on the grammar files
- */
-public class TestParser {
- private ParserValidator test = null;
-
- public TestParser() {
- test = new ParserValidator();
- }
-
- @Test
- public void test() {
- // test.aAM().aFC().aCS().log(1).run("ODI?$filter=PropertyEnumString has com.sap.odata.test1.ENString'String1'");
- }
-
- // ;------------------------------------------------------------------------------
- // ; 0. URI
- // ;------------------------------------------------------------------------------
- // @Test
- public void testUri() {
- // Test parser rule odataRelativeUri
-
- test.run("$batch").isText("odataRelativeUriEOF(odataRelativeUri(altBatch($batch)) <EOF>)");
-
- // TODO do more tests on entity
- test.run("$entity?$id=ODI").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
- + "entityOptions(id($id = ODI))) <EOF>)");
-
- test.run("$entity?$id=ODI&$format=json").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
- + "entityOptions(id($id = ODI) & entityOption(format($format = json)))) <EOF>)");
-
- // TODO do more tests on entity
- test.run("$metadata").isText("odataRelativeUriEOF(odataRelativeUri(altMetadata($metadata)) <EOF>)");
-
- test.run("ODI").isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI))))) <EOF>)");
-
- // Test parser rule resourcePath
- test.run("$all").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath($all)) <EOF>)");
-
- test.run("$crossjoin(ODI)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath("
- + "crossjoin($crossjoin ( odataIdentifier(ODI) )))) <EOF>)");
-
- // Test parser rule pathSegments
- test.run("ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI)) / "
- + "pathSegment(odataIdentifier(ODI))))) <EOF>)");
- test.run("NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
- test.run("NS.ODI/ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "pathSegment(odataIdentifier(ODI)) / "
- + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
- // Test parser rule constSegment
- test.run("ODI/$value").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)) constSegmentSL(/ constSegment(value($value)))))) <EOF>)");
- test.run("ODI/$count").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)) constSegmentSL(/ constSegment(count($count)))))) <EOF>)");
- test.run("ODI/$ref").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)) constSegmentSL(/ constSegment(ref($ref)))))) <EOF>)");
-
- // Test parser rule pathSegment
- test.run("NS.ODI")
- .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
- test.run("ODI(1)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )))))) <EOF>)");
-
- test.run("ODI('ABC')")
- .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(string('ABC')))) )))))) <EOF>)");
-
- test.run("ODI(K1=1)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
- + "commonExpr(primitiveLiteral(1)))) )))))) <EOF>)");
-
- test.run("ODI(K1='ABC')")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
- + "commonExpr(primitiveLiteral(string('ABC'))))) )))))) <EOF>)");
-
- test.run("ODI(K1='ABC',K2=123)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
- + "commonExpr(primitiveLiteral(string('ABC')))) , nameValuePair(odataIdentifier(K2) = "
- + "commonExpr(primitiveLiteral(123)))) )))))) <EOF>)");
-
- test.run("ODI(K1=1)(P1=1)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
- + "commonExpr(primitiveLiteral(1)))) )) nameValueOptList(( "
- + "nameValueList(nameValuePair(odataIdentifier(P1) = commonExpr(primitiveLiteral(1)))) )))))) <EOF>)");
-
- test.run("ODI(K1='ABC',K2=123)(P1='ABC',P2=123)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
- + "commonExpr(primitiveLiteral(string('ABC')))) , nameValuePair(odataIdentifier(K2) = "
- + "commonExpr(primitiveLiteral(123)))) )) nameValueOptList(( "
- + "nameValueList(nameValuePair(odataIdentifier(P1) = commonExpr(primitiveLiteral(string('ABC')))) ,"
- + " nameValuePair(odataIdentifier(P2) = commonExpr(primitiveLiteral(123)))) )))))) <EOF>)");
-
- test.run("NS.ODI(K1='ABC',K2=123)(P1='ABC',P2=123)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
- + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
- + "commonExpr(primitiveLiteral(string('ABC')))) , nameValuePair(odataIdentifier(K2) = "
- + "commonExpr(primitiveLiteral(123)))) )) nameValueOptList(( "
- + "nameValueList(nameValuePair(odataIdentifier(P1) = commonExpr(primitiveLiteral(string('ABC')))) , "
- + "nameValuePair(odataIdentifier(P2) = commonExpr(primitiveLiteral(123)))) )))))) <EOF>)");
-
- test.run("ODI(K1=@ABC)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath("
- + "pathSegments(pathSegment(odataIdentifier(ODI) nameValueOptList(( nameValueList("
- + "nameValuePair(odataIdentifier(K1) = @ odataIdentifier(ABC))) )))))) <EOF>)");
-
- test.run("ODI(K1=1,K2=@ABC)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI) nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
- + "commonExpr(primitiveLiteral(1))) , nameValuePair(odataIdentifier(K2) = @ "
- + "odataIdentifier(ABC))) )))))) <EOF>)");
-
- }
-
- // TODO error testing
- @Test
- public void testUriError() {
- // test.run("$entity").isExType(InputMismatchException.class);
- // test.run("$entity").isText("");
- }
-
- // ;------------------------------------------------------------------------------
- // ; 2. Query Options
- // ;------------------------------------------------------------------------------
-
- // @Test
- public void testQueryOptions() {
-
- // Test parser rule expand
- test.run("ODI?$expand=*").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItem(*)))))) <EOF>)");
-
- test.run("ODI?$expand=*,*,*").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = "
- + "expandItem(*) , "
- + "expandItem(*) , "
- + "expandItem(*)))))) <EOF>)");
-
- test.run("ODI?$expand=*/$ref").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = "
- + "expandItem(* / ref($ref))))))) <EOF>)");
-
- test.run("ODI?$expand=*/$ref,*,*/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItem(* / ref($ref)) , "
- + "expandItem(*) , "
- + "expandItem(* / ref($ref))))))) <EOF>)");
-
- // Test parser rules expand -> levels
- test.run("ODI?$expand=*($levels=12)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = "
- + "expandItem(* ( $levels = 12 ))))))) <EOF>)");
- test.run("ODI?$expand=*($levels=max)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(expand($expand = expandItem(* ( $levels = max ))))))) <EOF>)");
-
- // Test parser rules expand -> expandPath
- test.run("ODI?$expand=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(expand($expand = "
- + "expandItem(expandPath(expandPathSegment(odataIdentifier(ODI))))))))) <EOF>)");
-
- test.run("ODI?$expand=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(expand($expand = "
- + "expandItem(expandPath("
- + "expandPathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(expand($expand = "
- + "expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI)) / "
- + "expandPathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(expand($expand = "
- + "expandItem(expandPath(expandPathSegment(odataIdentifier(ODI)) / "
- + "expandPathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "expandPathSegment(odataIdentifier(ODI))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(expand($expand = "
- + "expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ ref($ref)))))))) <EOF>)");
-
- // Test options for expand items
- test.run("ODI?$expand=ODI/$ref($skip=1)").isText("odataRelativeUriEOF(odataRelativeUri"
- + "(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(expand($expand = expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ ref($ref) ( "
- + "expandRefOption(skip($skip = 1)) )))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$count").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(expand($expand = "
- + "expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ count($count)))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$count($filter=1)").isText("odataRelativeUriEOF("
- + "odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
- + "queryOptions(queryOption(systemQueryOption(expand($expand = expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ count($count) ( "
- + "expandCountOption(filter($filter = commonExpr(primitiveLiteral(1)))) )))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$count($search=\"abc\")").isText("odataRelativeUriEOF("
- + "odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
- + "queryOptions(queryOption(systemQueryOption(expand($expand = expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ count($count) ( "
- + "expandCountOption($search = \"abc\") )))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$ref($skip=1;$filter=true)").isText("odataRelativeUriEOF("
- + "odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
- + "queryOptions(queryOption(systemQueryOption(expand($expand = expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ ref($ref) ( "
- + "expandRefOption(skip($skip = 1)) ; expandRefOption(expandCountOption(filter($filter = "
- + "commonExpr(primitiveLiteral(booleanNonCase(true)))))) )))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI($skip=1;$filter=true)").isText("odataRelativeUriEOF("
- + "odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
- + "queryOptions(queryOption(systemQueryOption(expand($expand = expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(( expandOption("
- + "expandRefOption(skip($skip = 1))) ; expandOption(expandRefOption(expandCountOption(filter($filter = "
- + "commonExpr(primitiveLiteral(booleanNonCase(true))))))) )))))))) <EOF>)");
-
- // Test parser rule filter ( more filter test in method testExpressions)
- test.run("ODI?$filter=true")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
-
- // Test parser rule format
- test.run("ODI?$format=atom").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(format($format = atom))))) <EOF>)");
-
- test.run("ODI?$format=json").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(format($format = json))))) <EOF>)");
-
- test.run("ODI?$format=xml").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(format($format = xml))))) <EOF>)");
-
- // Test parser rule id
- test.run("ODI?$id=abc")
- .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI)))) ? "
- + "queryOptions(queryOption(systemQueryOption(id($id = abc))))) <EOF>)");
-
- // Test parser rule count
- /*
- * TODO add count to new mode based lexer
- * test.lexerlog(1).run("ODI?$count=true").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- * + "systemQueryOption("
- * + "inlinecount($count = booleanNonCase(true)))))) <EOF>)");
- */
- test.run("ODI?$count=false").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption("
- + "inlinecount($count = booleanNonCase(false)))))) <EOF>)");
-
- test.run("ODI?$count=TrUe").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption("
- + "inlinecount($count = booleanNonCase(TrUe)))))) <EOF>)");
-
- // Test parser rule orderby
- test.run("ODI?$orderby=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(orderBy($orderby = orderByItem(commonExpr(memberExpr("
- + "pathSegments(pathSegment(odataIdentifier(ODI))))))))))) <EOF>)");
-
- test.run("ODI?$orderby=ODI asc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(orderBy($orderby = orderByItem(commonExpr(memberExpr("
- + "pathSegments(pathSegment(odataIdentifier(ODI))))) asc)))))) <EOF>)");
-
- test.run("ODI?$orderby=ODI desc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(orderBy($orderby = orderByItem(commonExpr(memberExpr("
- + "pathSegments(pathSegment(odataIdentifier(ODI))))) desc)))))) <EOF>)");
-
- test.run("ODI?$orderby=ODI desc,ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(orderBy($orderby = orderByItem(commonExpr(memberExpr("
- + "pathSegments(pathSegment(odataIdentifier(ODI))))) desc) , orderByItem(commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))))))))) <EOF>)");
-
- test.run("ODI?$orderby=ODI desc,ODI asc").isText("odataRelativeUriEOF(odataRelativeUri"
- + "(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(orderBy($orderby = orderByItem(commonExpr(memberExpr("
- + "pathSegments(pathSegment(odataIdentifier(ODI))))) desc) , orderByItem(commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) asc)))))) <EOF>)");
-
- test.aFC().aAM().aCS().run("ODI?$orderby=3 add 4,ODI asc").isText("odataRelativeUriEOF("
- + "odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
- + "queryOptions(queryOption(systemQueryOption(orderBy($orderby = orderByItem(commonExpr("
- + "commonExpr(primitiveLiteral(3)) add commonExpr(primitiveLiteral(4)))) , orderByItem("
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) asc)))))) <EOF>)");
-
- // Test parser rule skiptoken
- test.run("ODI?$skiptoken=abc").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(skiptoken($skiptoken = abc))))) <EOF>)");
-
- // Test parser rule search
- test.run("ODI?$search=abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= searchExpr(searchWord(abc)))))))) <EOF>)");
-
- test.run("ODI?$search=NOT abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= searchExpr(NOT searchExpr(searchWord(abc))))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$search=abc abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc)) s"
- + "earchExpr(searchWord(abc))))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$search=abc AND abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc)) AND "
- + "searchExpr(searchWord(abc))))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$search=abc OR abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search($search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc)) OR "
- + "searchExpr(searchWord(abc))))))))) <EOF>)");
-
- test.run("ODI?$search=\"a%20b%20c\"").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(search("
- + "$search searchSpecialToken(= searchExpr(searchPhrase(\"a%20b%20c\")))))))) <EOF>)");
-
- // Test parser rule search
- test.run("ODI?$select=*").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(selectSegment(*))))))) <EOF>)");
-
- test.run("ODI?$select=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(selectSegment(odataIdentifier(ODI)))))))) <EOF>)");
-
- test.run("ODI?$select=NS.*").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(selectSegment(namespace(odataIdentifier(NS) .) *))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(odataIdentifier(ODI)))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)))))))) <EOF>)");
-
- test.run("ODI?$select=ODI,ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select($select = "
- + "selectItem(selectSegment(odataIdentifier(ODI))) , "
- + "selectItem(selectSegment(odataIdentifier(ODI)))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI,NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select($select = "
- + "selectItem(selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) , "
- + "selectItem(selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI/ODIm,NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select($select = "
- + "selectItem("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(odataIdentifier(ODIm))) , "
- + "selectItem("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(odataIdentifier(ODI)))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI/NS.ODI,NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select($select = "
- + "selectItem("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) , "
- + "selectItem("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)))))))) <EOF>)");
-
- test.run("ODI?$skip=123").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(skip($skip = 123))))) <EOF>)");
-
- test.run("ODI?$skiptoken=abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(skiptoken($skiptoken = abc))))) <EOF>)");
-
- test.run("ODI?$top=123").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(top($top = 123))))) <EOF>)");
-
- // test.run("ODI?customparameter=abc");
-
- // test.run("ODI").isText("");
- };
-
- // @Test
- public void testExpressions() {
- // Test parser rule commonExpr -> primitiveLiteral
- test.run("ODI?$filter=null").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
- + "queryOptions(queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(nullrule(null)))))))) <EOF>)");
-
- test.run("ODI?$filter=true").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
-
- test.run("ODI?$filter=false").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(booleanNonCase(false)))))))) <EOF>)");
-
- test.run("ODI?$filter=1").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(1))))))) <EOF>)");
-
- test.run("ODI?$filter=-1").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(-1))))))) <EOF>)");
-
- test.run("ODI?$filter=1.1").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(1.1))))))) <EOF>)");
-
- test.run("ODI?$filter=-1.2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(-1.2))))))) <EOF>)");
-
- test.run("ODI?$filter=-1.2e3").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(-1.2e3))))))) <EOF>)");
-
- test.run("ODI?$filter=-1.2e-3").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(-1.2e-3))))))) <EOF>)");
-
- test.run("ODI?$filter=binary'12AB'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(binary'12AB'))))))) <EOF>)");
-
- test.run("ODI?$filter=BiNaRy'12AB'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(BiNaRy'12AB'))))))) <EOF>)");
-
- test.run("ODI?$filter=2013-11-15").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(2013-11-15))))))) <EOF>)");
-
- test.run("ODI?$filter=2013-11-15T13:35Z").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(2013-11-15T13:35Z))))))) <EOF>)");
-
- test.run("ODI?$filter=duration'PT67S'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(duration'PT67S'))))))) <EOF>)");
-
- test.run("ODI?$filter=1234ABCD-12AB-23CD-45EF-123456780ABC").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(1234ABCD-12AB-23CD-45EF-123456780ABC))))))) <EOF>)");
-
- test.run("ODI?$filter='ABC'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(string('ABC')))))))) <EOF>)");
-
- test.run("ODI?$filter=20:00").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(20:00))))))) <EOF>)");
-
- // Test enum
- test.run("ODI?$filter=NS.ODI'1'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
- + "queryOptions(queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(primitiveLiteral(enumLit(namespace(odataIdentifier(NS) .) "
- + "odataIdentifier(ODI) '1')))))))) <EOF>)");
- test.run("ODI?$filter=NS.ODI'1,3'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
- + "queryOptions(queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(primitiveLiteral(enumLit(namespace(odataIdentifier(NS) .) "
- + "odataIdentifier(ODI) '1,3')))))))) <EOF>)");
- test.run("ODI?$filter=NS.ODI'ODI,3'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri"
- + "(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
- + "queryOptions(queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(primitiveLiteral(enumLit(namespace(odataIdentifier(NS) .) "
- + "odataIdentifier(ODI) 'ODI,3')))))))) <EOF>)");
-
- // Test Geometry
-
- // Rule GeographyCollection
-
- test.run("ODI?$filter=geography'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'")
- .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyCollection("
- + "geography' fullCollectionLiteral(sridLiteral(SRID = 0 ;) collectionLiteral("
- + "Collection ( geoLiteral(lineStringLiteral("
- + "LineString lineStringData(( "
- + "positionLiteral(142.1 64.1) , "
- + "positionLiteral(3.14 2.78) )))) ))) ')))))))) <EOF>)");
-
- // Rule GeographyLineString
- test.run("ODI?$filter=geography'SRID=0;LineString(142.1 64.1,3.14 2.78)'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyLineString("
- + "geography' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
- + "LineString lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )))) '"
- + ")))))))) <EOF>)");
-
- // Rule GeographyMultiLineString
- test.run("ODI?$filter=geography'SRID=0;MultiLineString((142.1 64.1,3.14 2.78),(142.1 64.1,3.14 2.78))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyMultilineString("
- + "geography' fullMultilineStringLiteral(sridLiteral(SRID = 0 ;) multilineStringLiteral("
- + "MultiLineString ( "
- + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) , "
- + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) ))) '"
- + ")))))))) <EOF>)");
-
- // Rule GeographyMultiPoint
- test.run("ODI?$filter=geography'SRID=0;MultiPoint()'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyMultipoint("
- + "geography' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral("
- + "MultiPoint ( ))) ')))))))) <EOF>)");
- // Rule GeographyMultiPoint
- test.run("ODI?$filter=geography'SRID=0;MultiPoint((142.1 64.1),(1 2))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyMultipoint("
- + "geography' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral("
- + "MultiPoint ( "
- + "pointData(( positionLiteral(142.1 64.1) )) , "
- + "pointData(( positionLiteral(1 2) )) ))) ')))))))) <EOF>)");
- // Rule GeographyMultiPolygon
- test.run("ODI?$filter=geography'SRID=0;MultiPolygon(((1 1,1 1),(1 1,2 2,3 3,1 1)))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyMultipolygon("
- + "geography' fullmultipolygonLiteral(sridLiteral(SRID = 0 ;) multipolygonLiteral("
- + "MultiPolygon ( polygonData(( "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
- + "positionLiteral(3 3) , positionLiteral(1 1) )) )) ))) ')))))))) <EOF>)");
- // Rule GeographyPoint
- test.run("ODI?$filter=geography'SRID=0;Point(142.1 64.1)'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyPoint("
- + "geography' fullpointLiteral(sridLiteral(SRID = 0 ;) pointLiteral("
- + "Point pointData(( positionLiteral(142.1 64.1) )))) ')))))))) <EOF>)");
- // Rule GeographyPolygon
- test.run("ODI?$filter=geography'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyPolygon("
- + "geography' fullPolygonLiteral(sridLiteral(SRID = 0 ;) polygonLiteral("
- + "Polygon polygonData(( "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
- + "positionLiteral(3 3) , positionLiteral(1 1) )) )))) ')))))))) <EOF>)");
- // Rule GeometryCollection
- test.run("ODI?$filter=geometry'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryCollection("
- + "geometry' fullCollectionLiteral(sridLiteral(SRID = 0 ;) collectionLiteral("
- + "Collection ( geoLiteral(lineStringLiteral(LineString lineStringData(( "
- + "positionLiteral(142.1 64.1) , "
- + "positionLiteral(3.14 2.78) )))) ))) ')))))))) <EOF>)");
- // Rule GeometryLineString
- test.run("ODI?$filter=geometry'SRID=0;LineString(142.1 64.1,3.14 2.78)'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryLineString("
- + "geometry' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
- + "LineString lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )))) '"
- + ")))))))) <EOF>)");
- // Rule GeometryMultiLineString
- test.run("ODI?$filter=geometry'SRID=0;MultiLineString((142.1 64.1,3.14 2.78),(142.1 64.1,3.14 2.78))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryMultilineString("
- + "geometry' fullMultilineStringLiteral(sridLiteral(SRID = 0 ;) multilineStringLiteral("
- + "MultiLineString ( "
- + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) , "
- + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) ))) '"
- + ")))))))) <EOF>)");
- // Rule GeometryMultiPoint
- test.run("ODI?$filter=geometry'SRID=0;MultiPoint()'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryMultipoint("
- + "geometry' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral(MultiPoint ( ))) '"
- + ")))))))) <EOF>)");
- // Rule GeometryMultiPoint
- test.run("ODI?$filter=geometry'SRID=0;MultiPoint((142.1 64.1),(1 2))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryMultipoint("
- + "geometry' fullMultipointLiteral(sridLiteral(SRID = 0 ;) "
- + "multipointLiteral(MultiPoint ( "
- + "pointData(( positionLiteral(142.1 64.1) )) , "
- + "pointData(( positionLiteral(1 2) )) ))) ')))))))) <EOF>)");
- // Rule GeometryMultiPolygon
- test.run("ODI?$filter=geometry'SRID=0;MultiPolygon(((1 1,1 1),(1 1,2 2,3 3,1 1)))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryMultipolygon("
- + "geometry' fullmultipolygonLiteral(sridLiteral(SRID = 0 ;) "
- + "multipolygonLiteral(MultiPolygon ( polygonData(( "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
- + "positionLiteral(3 3) , positionLiteral(1 1) )) )) ))) ')))))))) <EOF>)");
- // Rule GeometryPoint
- test.run("ODI?$filter=geometry'SRID=0;Point(142.1 64.1)'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryPoint("
- + "geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) pointLiteral("
- + "Point pointData(( positionLiteral(142.1 64.1) )))) ')))))))) <EOF>)");
- // Rule GeometryPolygon
- test.run("ODI?$filter=geometry'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryPolygon("
- + "geometry' fullPolygonLiteral(sridLiteral(SRID = 0 ;) polygonLiteral("
- + "Polygon polygonData(( "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
- + "positionLiteral(3 3) , positionLiteral(1 1) )) )))) ')))))))) <EOF>)");
-
- // Parsing expression required in some cases a FullContextParsing and a report of a ContextSensitivity is fine
-
- // Test commonExpr - parenthesis
- test.aAM().aFC().aCS().run("ODI?$filter=(1) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr("
- + "commonExpr(( commonExpr(primitiveLiteral(1)) )) "
- + "mul "
- + "commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$filter=((((1)))) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(( commonExpr(( commonExpr(( commonExpr(( commonExpr("
- + "primitiveLiteral(1)) )) )) )) )) "
- + "mul commonExpr(primitiveLiteral(2)))))))) <EOF>)");
- test.aAM().aFC().aCS().run("ODI?$filter=(1 add 2)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr(( commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(primitiveLiteral(2))) ))))))) <EOF>)");
- test.aAM().aFC().aCS().run("ODI?$filter=1 mul (2 add 3)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(( commonExpr(commonExpr(primitiveLiteral(2)) "
- + "add commonExpr(primitiveLiteral(3))) )))))))) <EOF>)");
-
- // Test commonExpr - methodCallExpr
- test.run("ODI?$filter=indexof('ABCXYZ','CXY')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "indexOfMethodCallExpr(indexof( "
- + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
- + "commonExpr(primitiveLiteral(string('CXY'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=tolower('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "toLowerMethodCallExpr(tolower( "
- + "commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=toupper('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "toUpperMethodCallExpr(toupper( "
- + "commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=trim('%20%20%20ABC%20%20%20')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "trimMethodCallExpr(trim( "
- + "commonExpr(primitiveLiteral(string('%20%20%20ABC%20%20%20'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=substring('ABC',1)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "substringMethodCallExpr(substring( "
- + "commonExpr(primitiveLiteral(string('ABC'))) , "
- + "commonExpr(primitiveLiteral(1)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=substring('ABC',1,2)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "substringMethodCallExpr(substring( "
- + "commonExpr(primitiveLiteral(string('ABC'))) , "
- + "commonExpr(primitiveLiteral(1)) , "
- + "commonExpr(primitiveLiteral(2)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=concat('ABC','XYZ')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "concatMethodCallExpr(concat( "
- + "commonExpr(primitiveLiteral(string('ABC'))) , "
- + "commonExpr(primitiveLiteral(string('XYZ'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=length('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "lengthMethodCallExpr(length( commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=year(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "yearMethodCallExpr(year( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=month(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "monthMethodCallExpr(month( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=day(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "dayMethodCallExpr(day( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=hour(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "hourMethodCallExpr(hour( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=minute(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "minuteMethodCallExpr(minute( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=second(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "secondMethodCallExpr(second( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=fractionalseconds(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "fractionalsecondsMethodCallExpr(fractionalseconds( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=totalseconds(duration'PT67S')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "totalsecondsMethodCallExpr(totalseconds( commonExpr(primitiveLiteral(duration'PT67S')) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=date(2013-11-15T13:35Z)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "dateMethodCallExpr(date( commonExpr(primitiveLiteral(2013-11-15T13:35Z)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=time(2013-11-15T13:35Z)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "timeMethodCallExpr(time( commonExpr(primitiveLiteral(2013-11-15T13:35Z)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=round(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "roundMethodCallExpr(round( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=floor(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "floorMethodCallExpr(floor( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=ceiling(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "ceilingMethodCallExpr(ceiling( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=geo.distance(geometry'SRID=0;Point(142.1 64.1)',geometry'SRID=0;Point(142.1 64.1)')")
- .isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "geoDistanceMethodCallExpr("
- + "geo.distance( "
- + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
- + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) , "
- + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
- + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) ))))))))) <EOF>)");
-
- // TODO check this
- /*
- * test.run("ODI?$filter=geo.length(geometry'SRID=0;LineString(142.1 64.1,3.14 2.78)')")
- * .isText("odataRelativeUriEOF(odataRelativeUri("
- * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- * + "queryOption(systemQueryOption(filter($filter = commonExpr(methodCallExpr("
- * + "geoLengthMethodCallExpr(geo.length ( commonExpr(primitiveLiteral("
- * + "geometryLineString(geometry' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
- * + "LineString lineStringData(( positionLiteral(142.1 64.1) , "
- * + "positionLiteral(3.14 2.78) )))) '))) ))))))))) <EOF>)");
- */
- test.run("ODI?$filter=totaloffsetminutes(2013-11-15T13:35Z)")
- .isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr(methodCallExpr("
- + "totalOffsetMinutesMethodCallExpr(totaloffsetminutes( commonExpr("
- + "primitiveLiteral(2013-11-15T13:35Z)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=mindatetime()").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr(minDateTimeMethodCallExpr(mindatetime( ))))))))) <EOF>)");
-
- test.run("ODI?$filter=maxdatetime()").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr(maxDateTimeMethodCallExpr(maxdatetime( ))))))))) <EOF>)");
-
- test.run("ODI?$filter=now()").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr(nowMethodCallExpr(now( ))))))))) <EOF>)");
-
- // from boolean
- test.run("ODI?$filter=isof(Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(filter($filter = commonExpr(methodCallExpr(isofExpr(isof( namespace("
- + "odataIdentifier(Model) .) odataIdentifier(Employee) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=isof(ODI,Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(filter($filter = commonExpr(methodCallExpr(isofExpr(isof( commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) , namespace(odataIdentifier(Model) .) "
- + "odataIdentifier(Employee) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=cast(Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(filter($filter = commonExpr(methodCallExpr(castExpr(cast( namespace("
- + "odataIdentifier(Model) .) odataIdentifier(Employee) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=cast(ODI,Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(filter($filter = commonExpr(methodCallExpr(castExpr(cast( commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) , namespace(odataIdentifier(Model) .) "
- + "odataIdentifier(Employee) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=endswith('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "endsWithMethodCallExpr(endswith( "
- + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
- + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=startswith('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "startsWithMethodCallExpr(startswith( "
- + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
- + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
- test.run("ODI?$filter=contains('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "containsMethodCallExpr(contains( "
- + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
- + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
- /*
- * test.run("ODI?$filter=geo.intersects("
- * + "geometry'SRID=0;Point(142.1 64.1)',"
- * + "geometry'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))')").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- * + "queryOption(systemQueryOption("
- * + "filter($filter = commonExpr(methodCallExpr("
- * + "intersectsMethodCallExpr(geo.intersects ( "
- * + "commonExpr(primitiveLiteral("
- * + "geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
- * + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) , "
- * + "commonExpr(primitiveLiteral("
- * + "geometryPolygon(geometry' fullPolygonLiteral(sridLiteral(SRID = 0 ;) "
- * + "polygonLiteral(Polygon polygonData(( "
- * + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
- * + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
- * + "positionLiteral(3 3) , positionLiteral(1 1) )) )))) '))) ))))))))) <EOF>)");
- */
- // Test commonExpr - unary
- test.run("ODI?$filter=true").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
-
- // Test commonExpr - member
- test.run("ODI?$filter=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))))))) <EOF>)");
-
- // Test commonExpr - mathematical
- test.aAM().aFC().aCS().run("ODI?$filter=1 mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$filter=1 div 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "div commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$filter=1 mod 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mod commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$filter=1 add 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$filter=1 sub 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "sub commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$filter=1 gt 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "gt commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$filter=1 ge 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "ge commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$filter=1 lt 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "lt commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$filter=1 le 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "le commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$filter=true and false").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(booleanNonCase(true))) "
- + "and commonExpr(primitiveLiteral(booleanNonCase(false))))))))) <EOF>)");
-
- test.aAM().aFC().aCS().run("ODI?$filter=true or false").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(booleanNonCase(true))) "
- + "or commonExpr(primitiveLiteral(booleanNonCase(false))))))))) <EOF>)");
-
- // Test commonExpr - $root
- test.run("ODI?$filter=$root/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr("
- + "rootExpr($root/ pathSegments(pathSegment(odataIdentifier(ODI)))))))))) <EOF>)");
-
- // Test concatenated parenthesis
- test.run("ODI?$filter=not true").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr("
- + "unary(not) commonExpr(primitiveLiteral(booleanNonCase(true))))))))) <EOF>)");
- }
-
- @Test
- public void testFragment() {
-
- /*
- * test.run("$metadata#Collection($ref)").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "$metadata # contextFragment(Collection($ref))) <EOF>)");
- */
- /*
- * test.run("$metadata#Collection(Edm.EntityType)").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "$metadata # contextFragment(Collection(Edm.EntityType))) <EOF>)");
- *
- * test.run("$metadata#Collection(Edm.ComplexType)").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "$metadata # contextFragment(Collection(Edm.ComplexType))) <EOF>)");
- *
- * test.run("$metadata#singletonEntity").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "$metadata # contextFragment(singletonEntity)) <EOF>)");
- *
- * test.run("$metadata#NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "$metadata # contextFragment(NS . ODI)) <EOF>)");
- *
- * test.run("$metadata#Edm.Boolean").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "$metadata # contextFragment(Edm . Boolean)) <EOF>)");
- *
- * test.run("$metadata#ODI/$deletedEntity").isText("odataRelativeUriEOF("
- * + "odataRelativeUri($metadata # contextFragment(ODI / $deletedEntity)) <EOF>)");
- *
- * test.run("$metadata#ODI/$link").isText("odataRelativeUriEOF("
- * + "odataRelativeUri($metadata # contextFragment(ODI / $link)) <EOF>)");
- *
- * test.run("$metadata#ODI/$deletedLink").isText("odataRelativeUriEOF("
- * + "odataRelativeUri($metadata # contextFragment(ODI / $deletedLink)) <EOF>)");
- *
- * test.run("$metadata#ODI(1)/ODI")
- * .isText(
- * "odataRelativeUriEOF(odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) "
- * + "nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) / odataIdentifier(ODI))) <EOF>)");
- *
- * test.run("$metadata#ODI(1)/NS.ODI")
- * .isText(
- * "odataRelativeUriEOF(odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) "
- * + "nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) / namespace(odataIdentifier(NS) .) "
- * + "odataIdentifier(ODI))) <EOF>)");
- *
- * test.run("$metadata#ODI(1)/NS.ODI/ODI")
- * .isText(
- * "odataRelativeUriEOF(odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) "
- * + "nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) / namespace(odataIdentifier(NS) .) "
- * + "odataIdentifier(ODI) / odataIdentifier(ODI))) <EOF>)");
- *
- * test.run("$metadata#NS.ODI(*)").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "$metadata # contextFragment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
- * + "propertyList(( propertyListItem(*) )))) <EOF>)");
- *
- * test.run("$metadata#ODI(1)")
- * .isText(
- * "odataRelativeUriEOF(odataRelativeUri($metadata "
- * + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr("
- * + "primitiveLiteral(1))) )))) <EOF>)");
- *
- * test.run("$metadata#ODI(1)/ODI").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- * + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- * + "/ odataIdentifier(ODI))) <EOF>)");
- *
- * test.run("$metadata#ODI(1)/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- * + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- * + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) <EOF>)");
- *
- * test.run("$metadata#ODI(1)/NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri($metadata"
- * + " # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- * + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI) / odataIdentifier(ODI))) <EOF>)");
- *
- * test.run("$metadata#ODI(1)(*)").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- * + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- * + "propertyList(( propertyListItem(*) )))) <EOF>)");
- *
- * test.run("$metadata#ODI(1)(PROP)").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- * + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- * + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(PROP))) )))) <EOF>)");
- * test.run("$metadata#ODI(1)(NAVPROP+)").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- * + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- * + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) +)) )))) <EOF>)");
- * test.run("$metadata#ODI(1)(NAVPROP+(*))").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- * + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- * + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + propertyList(( "
- * + "propertyListItem(*) )))) )))) <EOF>)");
- * test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- * + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- * + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + propertyList(( "
- * + "propertyListItem(propertyListProperty(odataIdentifier(A))) , propertyListItem(propertyListProperty("
- * + "odataIdentifier(B))) , propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )))) <EOF>)");
- *
- * test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$delta").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- * + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- * + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + propertyList(( "
- * + "propertyListItem(propertyListProperty(odataIdentifier(A))) , propertyListItem(propertyListProperty("
- * + "odataIdentifier(B))) , propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )) / "
- * + "$delta)) <EOF>)");
- *
- * test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$entity").isText("odataRelativeUriEOF(odataRelativeUri($metadata # "
- * + "contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- * + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + propertyList(( "
- * + "propertyListItem(propertyListProperty(odataIdentifier(A))) , propertyListItem(propertyListProperty("
- * + "odataIdentifier(B))) , propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )) / "
- * + "$entity)) <EOF>)");
- * test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$delta/$entity").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr("
- * + "primitiveLiteral(1))) )) propertyList(( propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
- * + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(A))) , propertyListItem("
- * + "propertyListProperty(odataIdentifier(B))) , propertyListItem(propertyListProperty("
- * + "odataIdentifier(C))) )))) )) / $delta / $entity)) <EOF>)");
- */
- }
-
- // @Test
- public void testPrecedence() {
- // Test operator precedence
-
- test.aFC().aCS().aAM().run("ODI?$filter=(1 add 2) mul 3").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(( commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(primitiveLiteral(2))) )) "
- + "mul commonExpr(primitiveLiteral(3)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 add (2 mul 3)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(( commonExpr(commonExpr(primitiveLiteral(2)) "
- + "mul commonExpr(primitiveLiteral(3))) )))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 add 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(primitiveLiteral(2))) "
- + "add commonExpr(primitiveLiteral(3))) "
- + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(primitiveLiteral(2))) "
- + "add commonExpr(commonExpr(primitiveLiteral(3)) "
- + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 mul 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(commonExpr(primitiveLiteral(2)) "
- + "mul commonExpr(primitiveLiteral(3)))) "
- + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 mul 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(commonExpr(commonExpr(primitiveLiteral(2)) "
- + "mul commonExpr(primitiveLiteral(3))) "
- + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
- test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2))) "
- + "add commonExpr(primitiveLiteral(3))) "
- + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2))) "
- + "add commonExpr(commonExpr(primitiveLiteral(3)) "
- + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 mul 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2))) "
- + "mul commonExpr(primitiveLiteral(3))) "
- + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 mul 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2))) "
- + "mul commonExpr(primitiveLiteral(3))) "
- + "mul commonExpr(primitiveLiteral(4)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = "
- + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2))) "
- + "add commonExpr(commonExpr(primitiveLiteral(3)) "
- + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
-
- // Test parser rule search
- test.aFC().aCS().aAM().run("ODI?$search=abc OR abc AND abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= "
- + "searchExpr(searchExpr(searchWord(abc)) OR "
- + "searchExpr("
- + "searchExpr(searchWord(abc)) AND "
- + "searchExpr(searchWord(abc)))))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$search=abc OR abc abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= "
- + "searchExpr(searchExpr(searchWord(abc)) OR "
- + "searchExpr("
- + "searchExpr(searchWord(abc)) "
- + "searchExpr(searchWord(abc)))))))))) <EOF>)");
- }
-
-}
[13/14] git commit: [OLINGO-169] First huge import from ODataJClient:
for the moment,
it just build (no tests yet) and dummy Edm interfaces are used instead of the
ones from commons-api
Posted by il...@apache.org.
[OLINGO-169] First huge import from ODataJClient: for the moment, it just build (no tests yet) and dummy Edm interfaces are used instead of the ones from commons-api
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/4f927e76
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/4f927e76
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/4f927e76
Branch: refs/heads/olingo169
Commit: 4f927e7640812df94c460b624c0eeaff25c9cd9b
Parents: f094e10
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Feb 21 17:25:07 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Feb 21 17:25:07 2014 +0100
----------------------------------------------------------------------
.../odatajclient/engine/v4/metadata.xml | 212 +++++++-
odata4-lib/odata4-client-api/pom.xml | 5 +
.../olingo/odata4/client/api/Configuration.java | 201 ++++++++
.../olingo/odata4/client/api/Constants.java | 217 +++++++++
.../olingo/odata4/client/api/ODataClient.java | 52 +-
.../olingo/odata4/client/api/ODataError.java | 67 +++
.../client/api/data/ODataDeserializer.java | 90 ++++
.../odata4/client/api/data/ODataReader.java | 102 ++++
.../odata4/client/api/data/ODataSerializer.java | 120 +++++
.../odata4/client/api/edm/ComplexType.java | 32 ++
.../odata4/client/api/edm/EdmMetadata.java | 59 +++
.../olingo/odata4/client/api/edm/Edmx.java | 23 +
.../odata4/client/api/edm/EntityContainer.java | 24 +
.../olingo/odata4/client/api/edm/EntityKey.java | 23 +
.../olingo/odata4/client/api/edm/EntitySet.java | 23 +
.../odata4/client/api/edm/EntityType.java | 23 +
.../olingo/odata4/client/api/edm/EnumType.java | 42 ++
.../odata4/client/api/edm/FunctionImport.java | 23 +
.../olingo/odata4/client/api/edm/Member.java | 26 +
.../client/api/edm/NavigationProperty.java | 23 +
.../api/edm/NavigationPropertyBinding.java | 23 +
.../olingo/odata4/client/api/edm/OnDelete.java | 23 +
.../olingo/odata4/client/api/edm/Parameter.java | 23 +
.../olingo/odata4/client/api/edm/Property.java | 24 +
.../odata4/client/api/edm/PropertyRef.java | 23 +
.../olingo/odata4/client/api/edm/Schema.java | 79 +++
.../odata4/client/api/edm/v3/Annotations.java | 24 +
.../odata4/client/api/edm/v3/Association.java | 23 +
.../client/api/edm/v3/AssociationEnd.java | 23 +
.../client/api/edm/v3/AssociationSet.java | 23 +
.../client/api/edm/v3/AssociationSetEnd.java | 23 +
.../odata4/client/api/edm/v3/ParameterMode.java | 27 +
.../odata4/client/api/edm/v3/PropertyValue.java | 23 +
.../api/edm/v3/ReferentialConstraint.java | 23 +
.../client/api/edm/v3/TypeAnnotation.java | 23 +
.../olingo/odata4/client/api/edm/v3/Using.java | 23 +
.../client/api/edm/v3/ValueAnnotation.java | 23 +
.../odata4/client/api/edm/v3/ValueTerm.java | 23 +
.../olingo/odata4/client/api/edm/v4/Action.java | 23 +
.../odata4/client/api/edm/v4/ActionImport.java | 23 +
.../odata4/client/api/edm/v4/Annotation.java | 23 +
.../odata4/client/api/edm/v4/Annotations.java | 23 +
.../odata4/client/api/edm/v4/CSDLElement.java | 37 ++
.../odata4/client/api/edm/v4/Include.java | 23 +
.../client/api/edm/v4/IncludeAnnotations.java | 23 +
.../client/api/edm/v4/OnDeleteAction.java | 28 ++
.../odata4/client/api/edm/v4/Reference.java | 23 +
.../api/edm/v4/ReferentialConstraint.java | 23 +
.../odata4/client/api/edm/v4/ReturnType.java | 23 +
.../odata4/client/api/edm/v4/Singleton.java | 23 +
.../olingo/odata4/client/api/edm/v4/Term.java | 23 +
.../client/api/edm/v4/TypeDefinition.java | 23 +
.../odata4/client/api/format/ODataFormat.java | 97 ++++
.../client/api/format/ODataMediaFormat.java | 71 +++
.../client/api/format/ODataPubFormat.java | 97 ++++
.../client/api/format/ODataValueFormat.java | 76 +++
.../client/api/http/HttpClientException.java | 68 +++
.../client/api/http/HttpClientFactory.java | 30 ++
.../odata4/client/api/http/HttpMethod.java | 33 ++
.../client/api/http/HttpUriRequestFactory.java | 30 ++
.../client/api/http/NoContentException.java | 36 ++
odata4-lib/odata4-client-core/pom.xml | 31 +-
.../client/core/AbstractConfiguration.java | 209 ++++++++
.../odata4/client/core/AbstractODataClient.java | 37 ++
.../odata4/client/core/ODataClientFactory.java | 34 ++
.../odata4/client/core/ODataClientImpl.java | 25 -
.../odata4/client/core/ODataV3Client.java | 138 ++++++
.../odata4/client/core/ODataV4Client.java | 137 ++++++
.../odata4/client/core/V3Configuration.java | 29 ++
.../odata4/client/core/V4Configuration.java | 29 ++
.../odata4/client/core/data/EdmSimpleType.java | 288 +++++++++++
.../client/core/data/ODataCollectionValue.java | 98 ++++
.../client/core/data/ODataComplexValue.java | 97 ++++
.../odata4/client/core/data/ODataDuration.java | 80 +++
.../client/core/data/ODataGeospatialValue.java | 488 +++++++++++++++++++
.../client/core/data/ODataInvokeResult.java | 30 ++
.../client/core/data/ODataPrimitiveValue.java | 376 ++++++++++++++
.../odata4/client/core/data/ODataProperty.java | 192 ++++++++
.../odata4/client/core/data/ODataTimestamp.java | 141 ++++++
.../odata4/client/core/data/ODataValue.java | 111 +++++
.../data/geospatial/ComposedGeospatial.java | 75 +++
.../client/core/data/geospatial/Geospatial.java | 156 ++++++
.../data/geospatial/GeospatialCollection.java | 47 ++
.../client/core/data/geospatial/LineString.java | 38 ++
.../core/data/geospatial/MultiLineString.java | 38 ++
.../client/core/data/geospatial/MultiPoint.java | 38 ++
.../core/data/geospatial/MultiPolygon.java | 38 ++
.../client/core/data/geospatial/Point.java | 77 +++
.../client/core/data/geospatial/Polygon.java | 72 +++
.../core/data/impl/AbstractEdmDeserializer.java | 69 +++
.../core/data/impl/AbstractJacksonTool.java | 83 ++++
.../data/impl/AbstractODataDeserializer.java | 177 +++++++
.../core/data/impl/AbstractODataReader.java | 138 ++++++
.../core/data/impl/AbstractODataSerializer.java | 160 ++++++
.../core/data/impl/ComplexTypeDeserializer.java | 81 +++
.../data/impl/EntityContainerDeserializer.java | 100 ++++
.../core/data/impl/EntityKeyDeserializer.java | 48 ++
.../core/data/impl/EntitySetDeserializer.java | 68 +++
.../core/data/impl/EntityTypeDeserializer.java | 90 ++++
.../core/data/impl/EnumTypeDeserializer.java | 71 +++
.../data/impl/InjectableSerializerProvider.java | 43 ++
.../core/data/impl/SchemaDeserializer.java | 147 ++++++
.../data/impl/v3/ODataDeserializerImpl.java | 63 +++
.../core/data/impl/v3/ODataReaderImpl.java | 44 ++
.../core/data/impl/v3/ODataSerializerImpl.java | 32 ++
.../data/impl/v4/ODataDeserializerImpl.java | 63 +++
.../core/data/impl/v4/ODataReaderImpl.java | 44 ++
.../core/data/impl/v4/ODataSerializerImpl.java | 32 ++
.../deserializer/PropertyCollectionBuilder.java | 11 +-
.../client/core/edm/AbstractAnnotations.java | 49 ++
.../client/core/edm/AbstractComplexType.java | 41 ++
.../client/core/edm/AbstractDataServices.java | 52 ++
.../odata4/client/core/edm/AbstractEdmItem.java | 42 ++
.../client/core/edm/AbstractEdmMetadata.java | 106 ++++
.../odata4/client/core/edm/AbstractEdmx.java | 51 ++
.../core/edm/AbstractEntityContainer.java | 107 ++++
.../client/core/edm/AbstractEntitySet.java | 49 ++
.../client/core/edm/AbstractEntityType.java | 85 ++++
.../client/core/edm/AbstractEnumType.java | 65 +++
.../client/core/edm/AbstractFunctionImport.java | 30 ++
.../odata4/client/core/edm/AbstractMember.java | 51 ++
.../core/edm/AbstractNavigationProperty.java | 38 ++
.../client/core/edm/AbstractParameter.java | 94 ++++
.../client/core/edm/AbstractProperty.java | 240 +++++++++
.../odata4/client/core/edm/AbstractSchema.java | 128 +++++
.../core/edm/DataServicesDeserializer.java | 64 +++
.../client/core/edm/EdmxDeserializer.java | 67 +++
.../odata4/client/core/edm/EntityKeyImpl.java | 41 ++
.../odata4/client/core/edm/EntitySetImpl.java | 25 +
.../odata4/client/core/edm/OnDeleteImpl.java | 40 ++
.../odata4/client/core/edm/PropertyRefImpl.java | 50 ++
.../core/edm/v3/AnnotationsDeserializer.java | 55 +++
.../client/core/edm/v3/AnnotationsImpl.java | 43 ++
.../core/edm/v3/AssociationDeserializer.java | 53 ++
.../client/core/edm/v3/AssociationEndImpl.java | 73 +++
.../client/core/edm/v3/AssociationImpl.java | 61 +++
.../core/edm/v3/AssociationSetDeserializer.java | 52 ++
.../core/edm/v3/AssociationSetEndImpl.java | 50 ++
.../client/core/edm/v3/AssociationSetImpl.java | 57 +++
.../client/core/edm/v3/ComplexTypeImpl.java | 48 ++
.../client/core/edm/v3/DataServicesImpl.java | 37 ++
.../client/core/edm/v3/EdmMetadataImpl.java | 35 ++
.../odata4/client/core/edm/v3/EdmxImpl.java | 28 ++
.../client/core/edm/v3/EntityContainerImpl.java | 60 +++
.../client/core/edm/v3/EntitySetImpl.java | 27 +
.../client/core/edm/v3/EntityTypeImpl.java | 65 +++
.../odata4/client/core/edm/v3/EnumTypeImpl.java | 58 +++
.../core/edm/v3/FunctionImportDeserializer.java | 67 +++
.../client/core/edm/v3/FunctionImportImpl.java | 129 +++++
.../odata4/client/core/edm/v3/MemberImpl.java | 28 ++
.../core/edm/v3/NavigationPropertyImpl.java | 61 +++
.../client/core/edm/v3/ParameterImpl.java | 40 ++
.../odata4/client/core/edm/v3/PropertyImpl.java | 27 +
.../client/core/edm/v3/PropertyValueImpl.java | 119 +++++
.../core/edm/v3/ReferentialConstraintImpl.java | 50 ++
.../core/edm/v3/ReferentialConstraintRole.java | 51 ++
.../ReferentialConstraintRoleDeserializer.java | 51 ++
.../odata4/client/core/edm/v3/SchemaImpl.java | 138 ++++++
.../core/edm/v3/TypeAnnotationDeserializer.java | 52 ++
.../client/core/edm/v3/TypeAnnotationImpl.java | 58 +++
.../odata4/client/core/edm/v3/UsingImpl.java | 50 ++
.../client/core/edm/v3/ValueAnnotationImpl.java | 129 +++++
.../client/core/edm/v3/ValueTermImpl.java | 50 ++
.../core/edm/v4/AbstractAnnotatedEdmItem.java | 42 ++
.../client/core/edm/v4/ActionDeserializer.java | 60 +++
.../odata4/client/core/edm/v4/ActionImpl.java | 87 ++++
.../client/core/edm/v4/ActionImportImpl.java | 60 +++
.../client/core/edm/v4/AnnotatedEdmItem.java | 28 ++
.../core/edm/v4/AnnotationDeserializer.java | 57 +++
.../client/core/edm/v4/AnnotationImpl.java | 72 +++
.../core/edm/v4/AnnotationsDeserializer.java | 53 ++
.../client/core/edm/v4/AnnotationsImpl.java | 47 ++
.../client/core/edm/v4/ComplexTypeImpl.java | 107 ++++
.../client/core/edm/v4/DataServicesImpl.java | 37 ++
.../client/core/edm/v4/EdmMetadataImpl.java | 39 ++
.../odata4/client/core/edm/v4/EdmxImpl.java | 36 ++
.../client/core/edm/v4/EntityContainerImpl.java | 128 +++++
.../client/core/edm/v4/EntitySetImpl.java | 60 +++
.../client/core/edm/v4/EntityTypeImpl.java | 78 +++
.../odata4/client/core/edm/v4/EnumTypeImpl.java | 71 +++
.../core/edm/v4/FunctionDeserializer.java | 62 +++
.../odata4/client/core/edm/v4/FunctionImpl.java | 38 ++
.../client/core/edm/v4/FunctionImportImpl.java | 88 ++++
.../core/edm/v4/IncludeAnnotationsImpl.java | 62 +++
.../odata4/client/core/edm/v4/IncludeImpl.java | 51 ++
.../odata4/client/core/edm/v4/MemberImpl.java | 43 ++
.../edm/v4/NavigationPropertyBindingImpl.java | 51 ++
.../edm/v4/NavigationPropertyDeserializer.java | 67 +++
.../core/edm/v4/NavigationPropertyImpl.java | 102 ++++
.../client/core/edm/v4/ParameterImpl.java | 39 ++
.../odata4/client/core/edm/v4/PropertyImpl.java | 41 ++
.../core/edm/v4/ReferenceDeserializer.java | 58 +++
.../client/core/edm/v4/ReferenceImpl.java | 62 +++
.../core/edm/v4/ReferentialConstraintImpl.java | 50 ++
.../client/core/edm/v4/ReturnTypeImpl.java | 96 ++++
.../odata4/client/core/edm/v4/SchemaImpl.java | 173 +++++++
.../core/edm/v4/SingletonDeserializer.java | 57 +++
.../client/core/edm/v4/SingletonImpl.java | 59 +++
.../client/core/edm/v4/TermDeserializer.java | 75 +++
.../odata4/client/core/edm/v4/TermImpl.java | 129 +++++
.../core/edm/v4/TypeDefinitionDeserializer.java | 65 +++
.../client/core/edm/v4/TypeDefinitionImpl.java | 108 ++++
.../annotation/AbstractElOrAttrConstruct.java | 37 ++
.../annotation/AnnotatedDynExprConstruct.java | 39 ++
.../core/edm/v4/annotation/AnnotationPath.java | 25 +
.../client/core/edm/v4/annotation/Apply.java | 52 ++
.../edm/v4/annotation/ApplyDeserializer.java | 55 +++
.../client/core/edm/v4/annotation/Cast.java | 89 ++++
.../edm/v4/annotation/CastDeserializer.java | 62 +++
.../core/edm/v4/annotation/Collection.java | 36 ++
.../v4/annotation/CollectionDeserializer.java | 50 ++
.../edm/v4/annotation/ConstExprConstruct.java | 71 +++
.../edm/v4/annotation/DynExprConstruct.java | 28 ++
.../DynExprConstructDeserializer.java | 145 ++++++
.../edm/v4/annotation/DynExprDoubleParamOp.java | 71 +++
.../edm/v4/annotation/DynExprSingleParamOp.java | 67 +++
.../core/edm/v4/annotation/ExprConstruct.java | 27 +
.../client/core/edm/v4/annotation/If.java | 55 +++
.../client/core/edm/v4/annotation/IsOf.java | 89 ++++
.../edm/v4/annotation/IsOfDeserializer.java | 62 +++
.../core/edm/v4/annotation/LabeledElement.java | 48 ++
.../annotation/LabeledElementDeserializer.java | 53 ++
.../v4/annotation/LabeledElementReference.java | 25 +
.../v4/annotation/NavigationPropertyPath.java | 25 +
.../client/core/edm/v4/annotation/Null.java | 28 ++
.../edm/v4/annotation/NullDeserializer.java | 49 ++
.../client/core/edm/v4/annotation/Path.java | 25 +
.../core/edm/v4/annotation/PropertyPath.java | 25 +
.../core/edm/v4/annotation/PropertyValue.java | 48 ++
.../annotation/PropertyValueDeserializer.java | 55 +++
.../client/core/edm/v4/annotation/Record.java | 46 ++
.../edm/v4/annotation/RecordDeserializer.java | 53 ++
.../client/core/edm/v4/annotation/UrlRef.java | 38 ++
.../edm/v4/annotation/UrlRefDeserializer.java | 50 ++
.../AbstractBasicAuthHttpClientFactory.java | 50 ++
.../http/AbstractNTLMAuthHttpClientFactory.java | 62 +++
.../core/http/DefaultHttpClientFactory.java | 39 ++
.../core/http/DefaultHttpUriRequestFactory.java | 68 +++
.../odata4/client/core/http/HttpMerge.java | 70 +++
.../odata4/client/core/http/HttpPatch.java | 70 +++
.../client/core/utils/AbstractDOMParser.java | 46 ++
.../client/core/utils/AndroidDOMParserImpl.java | 49 ++
.../client/core/utils/DefaultDOMParserImpl.java | 78 +++
.../odata4/client/core/utils/XMLUtils.java | 186 +++++++
.../odata4/client/core/ODataClientTest.java | 9 +-
.../deserializer/JsonReaderPerformance.java | 22 +-
.../client/core/testutil/StringHelper.java | 108 ----
.../api/edm/constants/ConcurrencyMode.java | 26 +
.../api/edm/constants/EdmContentKind.java | 30 ++
.../api/edm/constants/ODataServiceVersion.java | 85 +++-
.../edm/constants/StoreGeneratedPattern.java | 27 +
.../edm/provider/EdmServiceMetadataImpl.java | 2 +-
.../provider/EdmServiceMetadataImplTest.java | 2 +-
pom.xml | 73 ++-
254 files changed, 16033 insertions(+), 207 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/ODataJClient/engine/src/test/resources/com/msopentech/odatajclient/engine/v4/metadata.xml
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/test/resources/com/msopentech/odatajclient/engine/v4/metadata.xml b/ODataJClient/engine/src/test/resources/com/msopentech/odatajclient/engine/v4/metadata.xml
index 5f4c512..3f992ac 100644
--- a/ODataJClient/engine/src/test/resources/com/msopentech/odatajclient/engine/v4/metadata.xml
+++ b/ODataJClient/engine/src/test/resources/com/msopentech/odatajclient/engine/v4/metadata.xml
@@ -19,4 +19,214 @@
under the License.
-->
-<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices m:DataServiceVersion="4.0" m:MaxDataServiceVersion="4.0" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"><Schema Namespace="Microsoft.Exchange.Services.OData.Model" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EnumType Name="BodyType"><Member Name="Text" Value="0" /><Member Name="HTML" Value="1" /></EnumType><EnumType Name="Importance"><Member Name="Normal" Value="0" /><Member Name="Low" Value="1" /><Member Name="High" Value="2" /></EnumType><EnumType Name="AttendeeType"><Member Name="Required" Value="1" /><Member Name="Optional" Value="2" /><Member Name="Resource" Value="3" /></EnumType><EnumType Name="ResponseType"><Member Name="None" Value="0" /><Member Name="Organizer" Value="1" /><Member Name="TentativelyAccepted" Value="2" /><Member Name="Accepted" Value="3" /><Member Name="Declined" Value="4" /><Member Name="NotResponded" Value="5" /></EnumType><EnumType Name="EventTyp
e"><Member Name="SingleInstance" Value="0" /><Member Name="Occurrence" Value="1" /><Member Name="Exception" Value="2" /><Member Name="SeriesMaster" Value="3" /></EnumType><EnumType Name="FreeBusyStatus"><Member Name="Free" Value="0" /><Member Name="Tentative" Value="1" /><Member Name="Busy" Value="2" /><Member Name="Oof" Value="3" /><Member Name="WorkingElsewhere" Value="4" /><Member Name="Unknown" Value="-1" /></EnumType><ComplexType Name="Recipient"><Property Name="Name" Type="Edm.String" /><Property Name="Address" Type="Edm.String" /></ComplexType><ComplexType Name="Attendee" BaseType="Microsoft.Exchange.Services.OData.Model.Recipient"><Property Name="Status" Type="Microsoft.Exchange.Services.OData.Model.ResponseStatus" /><Property Name="Type" Type="Microsoft.Exchange.Services.OData.Model.AttendeeType" /></ComplexType><ComplexType Name="ItemBody"><Property Name="ContentType" Type="Microsoft.Exchange.Services.OData.Model.BodyType" /><Property Name="Content" Type="Edm.String" /></C
omplexType><ComplexType Name="Location"><Property Name="DisplayName" Type="Edm.String" /></ComplexType><ComplexType Name="ResponseStatus" BaseType="Microsoft.Exchange.Services.OData.Model.Recipient"><Property Name="Response" Type="Microsoft.Exchange.Services.OData.Model.ResponseType" /><Property Name="Time" Type="Edm.DateTimeOffset" /></ComplexType><EntityType Name="Entity" Abstract="true"><Key><PropertyRef Name="Id" /></Key><Property Name="Id" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="User" BaseType="Microsoft.Exchange.Services.OData.Model.Entity"><Property Name="DisplayName" Type="Edm.String" /><Property Name="Alias" Type="Edm.String" /><Property Name="MailboxGuid" Type="Edm.Guid" /><NavigationProperty Name="Folders" Type="Collection(Microsoft.Exchange.Services.OData.Model.Folder)" /><NavigationProperty Name="Messages" Type="Collection(Microsoft.Exchange.Services.OData.Model.EmailMessage)" /><NavigationProperty Name="RootFolder" Type="Microsoft.Exchange.S
ervices.OData.Model.Folder" /><NavigationProperty Name="Inbox" Type="Microsoft.Exchange.Services.OData.Model.Folder" /><NavigationProperty Name="Drafts" Type="Microsoft.Exchange.Services.OData.Model.Folder" /><NavigationProperty Name="SentItems" Type="Microsoft.Exchange.Services.OData.Model.Folder" /><NavigationProperty Name="DeletedItems" Type="Microsoft.Exchange.Services.OData.Model.Folder" /><NavigationProperty Name="Calendars" Type="Collection(Microsoft.Exchange.Services.OData.Model.Calendar)" /><NavigationProperty Name="CalendarGroups" Type="Collection(Microsoft.Exchange.Services.OData.Model.CalendarGroup)" /><NavigationProperty Name="Events" Type="Collection(Microsoft.Exchange.Services.OData.Model.Event)" /></EntityType><EntityType Name="Folder" BaseType="Microsoft.Exchange.Services.OData.Model.Entity"><Property Name="ParentFolderId" Type="Edm.String" /><Property Name="DisplayName" Type="Edm.String" /><Property Name="ClassName" Type="Edm.String" /><Property Name="TotalCount" T
ype="Edm.Int32" /><Property Name="ChildFolderCount" Type="Edm.Int32" /><Property Name="UnreadItemCount" Type="Edm.Int32" /><NavigationProperty Name="ChildFolders" Type="Collection(Microsoft.Exchange.Services.OData.Model.Folder)" /><NavigationProperty Name="Messages" Type="Collection(Microsoft.Exchange.Services.OData.Model.EmailMessage)" /></EntityType><Action Name="Copy" IsBound="true" EntitySetPath="bindingParameter" ReturnType="Microsoft.Exchange.Services.OData.Model.Folder"><Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Folder" /><Parameter Name="DestinationId" Type="Edm.String" /></Action><Action Name="Move" IsBound="true" EntitySetPath="bindingParameter" ReturnType="Microsoft.Exchange.Services.OData.Model.Folder"><Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Folder" /><Parameter Name="DestinationId" Type="Edm.String" /></Action><EntityType Name="Item" BaseType="Microsoft.Exchange.Services.OData.Model.Entity" A
bstract="true"><Property Name="ChangeKey" Type="Edm.String" /><Property Name="ClassName" Type="Edm.String" /><Property Name="Subject" Type="Edm.String" /><Property Name="Body" Type="Microsoft.Exchange.Services.OData.Model.ItemBody" /><Property Name="BodyPreview" Type="Edm.String" /><Property Name="Importance" Type="Microsoft.Exchange.Services.OData.Model.Importance" /><Property Name="Categories" Type="Collection(Edm.String)" /><Property Name="HasAttachments" Type="Edm.Boolean" /><Property Name="DateTimeCreated" Type="Edm.DateTimeOffset" /><Property Name="LastModifiedTime" Type="Edm.DateTimeOffset" /><NavigationProperty Name="Attachments" Type="Collection(Microsoft.Exchange.Services.OData.Model.Attachment)" /></EntityType><EntityType Name="EmailMessage" BaseType="Microsoft.Exchange.Services.OData.Model.Item"><Property Name="ParentFolderId" Type="Edm.String" /><Property Name="From" Type="Microsoft.Exchange.Services.OData.Model.Recipient" /><Property Name="Sender" Type="Microsoft.Excha
nge.Services.OData.Model.Recipient" /><Property Name="ToRecipients" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" /><Property Name="CcRecipients" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" /><Property Name="BccRecipients" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" /><Property Name="ReplyTo" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" /><Property Name="ConversationIndex" Type="Edm.String" /><Property Name="UniqueBody" Type="Microsoft.Exchange.Services.OData.Model.ItemBody" /><Property Name="DateTimeReceived" Type="Edm.DateTimeOffset" /><Property Name="DateTimeSent" Type="Edm.DateTimeOffset" /><Property Name="IsDeliveryReceiptRequested" Type="Edm.Boolean" /><Property Name="IsReadReceiptRequested" Type="Edm.Boolean" /><Property Name="IsDraft" Type="Edm.Boolean" /><Property Name="IsRead" Type="Edm.Boolean" /></EntityType><Action Name="Copy" IsBound="true" EntitySetPath="bindingParameter"
ReturnType="Microsoft.Exchange.Services.OData.Model.EmailMessage"><Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.EmailMessage" /><Parameter Name="DestinationId" Type="Edm.String" /></Action><Action Name="Move" IsBound="true" EntitySetPath="bindingParameter" ReturnType="Microsoft.Exchange.Services.OData.Model.EmailMessage"><Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.EmailMessage" /><Parameter Name="DestinationId" Type="Edm.String" /></Action><EntityType Name="Attachment" BaseType="Microsoft.Exchange.Services.OData.Model.Entity" Abstract="true"><Property Name="Name" Type="Edm.String" /><Property Name="ContentType" Type="Edm.String" /><Property Name="IsInline" Type="Edm.Boolean" Nullable="false" /><Property Name="LastModifiedTime" Type="Edm.DateTimeOffset" /></EntityType><EntityType Name="FileAttachment" BaseType="Microsoft.Exchange.Services.OData.Model.Attachment"><Property Name="ContentId" Type="Edm.String" /><Pro
perty Name="ContentLocation" Type="Edm.String" /><Property Name="Size" Type="Edm.Int32" Nullable="false" /><Property Name="IsContactPhoto" Type="Edm.Boolean" Nullable="false" /><Property Name="ContentBytes" Type="Edm.Binary" MaxLength="Max" FixedLength="false" /></EntityType><EntityType Name="ItemAttachment" BaseType="Microsoft.Exchange.Services.OData.Model.Attachment"><NavigationProperty Name="Item" Type="Microsoft.Exchange.Services.OData.Model.Item" /></EntityType><EntityType Name="Calendar" BaseType="Microsoft.Exchange.Services.OData.Model.Entity"><Property Name="Name" Type="Edm.String" /><Property Name="ChangeKey" Type="Edm.String" /><NavigationProperty Name="Events" Type="Collection(Microsoft.Exchange.Services.OData.Model.Event)" /></EntityType><EntityType Name="CalendarGroup" BaseType="Microsoft.Exchange.Services.OData.Model.Entity"><Property Name="Name" Type="Edm.String" /><Property Name="ChangeKey" Type="Edm.String" /><Property Name="ClassId" Type="Edm.Guid" /></EntityType><
EntityType Name="Event" BaseType="Microsoft.Exchange.Services.OData.Model.Item"><Property Name="Start" Type="Edm.DateTimeOffset" /><Property Name="End" Type="Edm.DateTimeOffset" /><Property Name="Location" Type="Microsoft.Exchange.Services.OData.Model.Location" /><Property Name="ShowAs" Type="Microsoft.Exchange.Services.OData.Model.FreeBusyStatus" /><Property Name="IsAllDay" Type="Edm.Boolean" /><Property Name="IsCancelled" Type="Edm.Boolean" /><Property Name="IsOrganizer" Type="Edm.Boolean" /><Property Name="ResponseRequested" Type="Edm.Boolean" /><Property Name="Type" Type="Microsoft.Exchange.Services.OData.Model.EventType" /><Property Name="SeriesId" Type="Edm.String" /><Property Name="Attendees" Type="Collection(Microsoft.Exchange.Services.OData.Model.Attendee)" /><NavigationProperty Name="Calendar" Type="Microsoft.Exchange.Services.OData.Model.Calendar" /></EntityType><EntityContainer Name="EntityContainer" m:IsDefaultEntityContainer="true"><EntitySet Name="Users" EntityType="M
icrosoft.Exchange.Services.OData.Model.User"><NavigationPropertyBinding Path="Folders" Target="Folders" /><NavigationPropertyBinding Path="Messages" Target="Messages" /><NavigationPropertyBinding Path="RootFolder" Target="Folders" /><NavigationPropertyBinding Path="Inbox" Target="Folders" /><NavigationPropertyBinding Path="Drafts" Target="Folders" /><NavigationPropertyBinding Path="SentItems" Target="Folders" /><NavigationPropertyBinding Path="DeletedItems" Target="Folders" /><NavigationPropertyBinding Path="Calendars" Target="Calendars" /><NavigationPropertyBinding Path="CalendarGroups" Target="CalendarGroups" /><NavigationPropertyBinding Path="Events" Target="Events" /></EntitySet><EntitySet Name="Folders" EntityType="Microsoft.Exchange.Services.OData.Model.Folder"><NavigationPropertyBinding Path="ChildFolders" Target="Folders" /><NavigationPropertyBinding Path="Messages" Target="Messages" /></EntitySet><EntitySet Name="Items" EntityType="Microsoft.Exchange.Services.OData.Model.It
em" /><EntitySet Name="Messages" EntityType="Microsoft.Exchange.Services.OData.Model.EmailMessage"><NavigationPropertyBinding Path="Attachments" Target="Attachments" /></EntitySet><EntitySet Name="Attachments" EntityType="Microsoft.Exchange.Services.OData.Model.Attachment"><NavigationPropertyBinding Path="Microsoft.Exchange.Services.OData.Model.ItemAttachment/Item" Target="Items" /></EntitySet><EntitySet Name="Calendars" EntityType="Microsoft.Exchange.Services.OData.Model.Calendar"><NavigationPropertyBinding Path="Events" Target="Events" /></EntitySet><EntitySet Name="CalendarGroups" EntityType="Microsoft.Exchange.Services.OData.Model.CalendarGroup" /><EntitySet Name="Events" EntityType="Microsoft.Exchange.Services.OData.Model.Event"><NavigationPropertyBinding Path="Attachments" Target="Attachments" /><NavigationPropertyBinding Path="Calendar" Target="Calendars" /></EntitySet></EntityContainer></Schema></edmx:DataServices></edmx:Edmx>
\ No newline at end of file
+<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
+ <edmx:DataServices m:DataServiceVersion="4.0" m:MaxDataServiceVersion="4.0" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata">
+ <Schema Namespace="Microsoft.Exchange.Services.OData.Model" xmlns="http://docs.oasis-open.org/odata/ns/edm">
+ <EnumType Name="BodyType">
+ <Member Name="Text" Value="0" />
+ <Member Name="HTML" Value="1" />
+ </EnumType>
+ <EnumType Name="Importance">
+ <Member Name="Normal" Value="0" />
+ <Member Name="Low" Value="1" />
+ <Member Name="High" Value="2" />
+ </EnumType>
+ <EnumType Name="AttendeeType">
+ <Member Name="Required" Value="1" />
+ <Member Name="Optional" Value="2" />
+ <Member Name="Resource" Value="3" />
+ </EnumType>
+ <EnumType Name="ResponseType">
+ <Member Name="None" Value="0" />
+ <Member Name="Organizer" Value="1" />
+ <Member Name="TentativelyAccepted" Value="2" />
+ <Member Name="Accepted" Value="3" />
+ <Member Name="Declined" Value="4" />
+ <Member Name="NotResponded" Value="5" />
+ </EnumType>
+ <EnumType Name="EventType">
+ <Member Name="SingleInstance" Value="0" />
+ <Member Name="Occurrence" Value="1" />
+ <Member Name="Exception" Value="2" />
+ <Member Name="SeriesMaster" Value="3" />
+ </EnumType>
+ <EnumType Name="FreeBusyStatus">
+ <Member Name="Free" Value="0" />
+ <Member Name="Tentative" Value="1" />
+ <Member Name="Busy" Value="2" />
+ <Member Name="Oof" Value="3" />
+ <Member Name="WorkingElsewhere" Value="4" />
+ <Member Name="Unknown" Value="-1" />
+ </EnumType>
+ <ComplexType Name="Recipient">
+ <Property Name="Name" Type="Edm.String" />
+ <Property Name="Address" Type="Edm.String" />
+ </ComplexType>
+ <ComplexType Name="Attendee" BaseType="Microsoft.Exchange.Services.OData.Model.Recipient">
+ <Property Name="Status" Type="Microsoft.Exchange.Services.OData.Model.ResponseStatus" />
+ <Property Name="Type" Type="Microsoft.Exchange.Services.OData.Model.AttendeeType" />
+ </ComplexType>
+ <ComplexType Name="ItemBody">
+ <Property Name="ContentType" Type="Microsoft.Exchange.Services.OData.Model.BodyType" />
+ <Property Name="Content" Type="Edm.String" />
+ </ComplexType>
+ <ComplexType Name="Location">
+ <Property Name="DisplayName" Type="Edm.String" />
+ </ComplexType>
+ <ComplexType Name="ResponseStatus" BaseType="Microsoft.Exchange.Services.OData.Model.Recipient">
+ <Property Name="Response" Type="Microsoft.Exchange.Services.OData.Model.ResponseType" />
+ <Property Name="Time" Type="Edm.DateTimeOffset" />
+ </ComplexType>
+ <EntityType Name="Entity" Abstract="true">
+ <Key>
+ <PropertyRef Name="Id" />
+ </Key>
+ <Property Name="Id" Type="Edm.String" Nullable="false" />
+ </EntityType>
+ <EntityType Name="User" BaseType="Microsoft.Exchange.Services.OData.Model.Entity">
+ <Property Name="DisplayName" Type="Edm.String" />
+ <Property Name="Alias" Type="Edm.String" />
+ <Property Name="MailboxGuid" Type="Edm.Guid" />
+ <NavigationProperty Name="Folders" Type="Collection(Microsoft.Exchange.Services.OData.Model.Folder)" />
+ <NavigationProperty Name="Messages" Type="Collection(Microsoft.Exchange.Services.OData.Model.EmailMessage)" />
+ <NavigationProperty Name="RootFolder" Type="Microsoft.Exchange.Services.OData.Model.Folder" />
+ <NavigationProperty Name="Inbox" Type="Microsoft.Exchange.Services.OData.Model.Folder" />
+ <NavigationProperty Name="Drafts" Type="Microsoft.Exchange.Services.OData.Model.Folder" />
+ <NavigationProperty Name="SentItems" Type="Microsoft.Exchange.Services.OData.Model.Folder" />
+ <NavigationProperty Name="DeletedItems" Type="Microsoft.Exchange.Services.OData.Model.Folder" />
+ <NavigationProperty Name="Calendars" Type="Collection(Microsoft.Exchange.Services.OData.Model.Calendar)" />
+ <NavigationProperty Name="CalendarGroups" Type="Collection(Microsoft.Exchange.Services.OData.Model.CalendarGroup)" />
+ <NavigationProperty Name="Events" Type="Collection(Microsoft.Exchange.Services.OData.Model.Event)" />
+ </EntityType>
+ <EntityType Name="Folder" BaseType="Microsoft.Exchange.Services.OData.Model.Entity">
+ <Property Name="ParentFolderId" Type="Edm.String" />
+ <Property Name="DisplayName" Type="Edm.String" />
+ <Property Name="ClassName" Type="Edm.String" />
+ <Property Name="TotalCount" Type="Edm.Int32" />
+ <Property Name="ChildFolderCount" Type="Edm.Int32" />
+ <Property Name="UnreadItemCount" Type="Edm.Int32" />
+ <NavigationProperty Name="ChildFolders" Type="Collection(Microsoft.Exchange.Services.OData.Model.Folder)" />
+ <NavigationProperty Name="Messages" Type="Collection(Microsoft.Exchange.Services.OData.Model.EmailMessage)" />
+ </EntityType>
+ <Action Name="Copy" IsBound="true" EntitySetPath="bindingParameter" ReturnType="Microsoft.Exchange.Services.OData.Model.Folder">
+ <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Folder" />
+ <Parameter Name="DestinationId" Type="Edm.String" />
+ </Action>
+ <Action Name="Move" IsBound="true" EntitySetPath="bindingParameter" ReturnType="Microsoft.Exchange.Services.OData.Model.Folder">
+ <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.Folder" />
+ <Parameter Name="DestinationId" Type="Edm.String" />
+ </Action>
+ <EntityType Name="Item" BaseType="Microsoft.Exchange.Services.OData.Model.Entity" Abstract="true">
+ <Property Name="ChangeKey" Type="Edm.String" />
+ <Property Name="ClassName" Type="Edm.String" />
+ <Property Name="Subject" Type="Edm.String" />
+ <Property Name="Body" Type="Microsoft.Exchange.Services.OData.Model.ItemBody" />
+ <Property Name="BodyPreview" Type="Edm.String" />
+ <Property Name="Importance" Type="Microsoft.Exchange.Services.OData.Model.Importance" />
+ <Property Name="Categories" Type="Collection(Edm.String)" />
+ <Property Name="HasAttachments" Type="Edm.Boolean" />
+ <Property Name="DateTimeCreated" Type="Edm.DateTimeOffset" />
+ <Property Name="LastModifiedTime" Type="Edm.DateTimeOffset" />
+ <NavigationProperty Name="Attachments" Type="Collection(Microsoft.Exchange.Services.OData.Model.Attachment)" />
+ </EntityType>
+ <EntityType Name="EmailMessage" BaseType="Microsoft.Exchange.Services.OData.Model.Item">
+ <Property Name="ParentFolderId" Type="Edm.String" />
+ <Property Name="From" Type="Microsoft.Exchange.Services.OData.Model.Recipient" />
+ <Property Name="Sender" Type="Microsoft.Exchange.Services.OData.Model.Recipient" />
+ <Property Name="ToRecipients" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" />
+ <Property Name="CcRecipients" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" />
+ <Property Name="BccRecipients" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" />
+ <Property Name="ReplyTo" Type="Collection(Microsoft.Exchange.Services.OData.Model.Recipient)" />
+ <Property Name="ConversationIndex" Type="Edm.String" />
+ <Property Name="UniqueBody" Type="Microsoft.Exchange.Services.OData.Model.ItemBody" />
+ <Property Name="DateTimeReceived" Type="Edm.DateTimeOffset" />
+ <Property Name="DateTimeSent" Type="Edm.DateTimeOffset" />
+ <Property Name="IsDeliveryReceiptRequested" Type="Edm.Boolean" />
+ <Property Name="IsReadReceiptRequested" Type="Edm.Boolean" />
+ <Property Name="IsDraft" Type="Edm.Boolean" />
+ <Property Name="IsRead" Type="Edm.Boolean" />
+ </EntityType>
+ <Action Name="Copy" IsBound="true" EntitySetPath="bindingParameter" ReturnType="Microsoft.Exchange.Services.OData.Model.EmailMessage">
+ <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.EmailMessage" />
+ <Parameter Name="DestinationId" Type="Edm.String" />
+ </Action>
+ <Action Name="Move" IsBound="true" EntitySetPath="bindingParameter" ReturnType="Microsoft.Exchange.Services.OData.Model.EmailMessage">
+ <Parameter Name="bindingParameter" Type="Microsoft.Exchange.Services.OData.Model.EmailMessage" />
+ <Parameter Name="DestinationId" Type="Edm.String" />
+ </Action>
+ <EntityType Name="Attachment" BaseType="Microsoft.Exchange.Services.OData.Model.Entity" Abstract="true">
+ <Property Name="Name" Type="Edm.String" />
+ <Property Name="ContentType" Type="Edm.String" />
+ <Property Name="IsInline" Type="Edm.Boolean" Nullable="false" />
+ <Property Name="LastModifiedTime" Type="Edm.DateTimeOffset" />
+ </EntityType>
+ <EntityType Name="FileAttachment" BaseType="Microsoft.Exchange.Services.OData.Model.Attachment">
+ <Property Name="ContentId" Type="Edm.String" />
+ <Property Name="ContentLocation" Type="Edm.String" />
+ <Property Name="Size" Type="Edm.Int32" Nullable="false" />
+ <Property Name="IsContactPhoto" Type="Edm.Boolean" Nullable="false" />
+ <Property Name="ContentBytes" Type="Edm.Binary" MaxLength="Max" FixedLength="false" />
+ </EntityType>
+ <EntityType Name="ItemAttachment" BaseType="Microsoft.Exchange.Services.OData.Model.Attachment">
+ <NavigationProperty Name="Item" Type="Microsoft.Exchange.Services.OData.Model.Item" />
+ </EntityType>
+ <EntityType Name="Calendar" BaseType="Microsoft.Exchange.Services.OData.Model.Entity">
+ <Property Name="Name" Type="Edm.String" />
+ <Property Name="ChangeKey" Type="Edm.String" />
+ <NavigationProperty Name="Events" Type="Collection(Microsoft.Exchange.Services.OData.Model.Event)" />
+ </EntityType>
+ <EntityType Name="CalendarGroup" BaseType="Microsoft.Exchange.Services.OData.Model.Entity">
+ <Property Name="Name" Type="Edm.String" />
+ <Property Name="ChangeKey" Type="Edm.String" />
+ <Property Name="ClassId" Type="Edm.Guid" />
+ </EntityType>
+ <EntityType Name="Event" BaseType="Microsoft.Exchange.Services.OData.Model.Item">
+ <Property Name="Start" Type="Edm.DateTimeOffset" />
+ <Property Name="End" Type="Edm.DateTimeOffset" />
+ <Property Name="Location" Type="Microsoft.Exchange.Services.OData.Model.Location" />
+ <Property Name="ShowAs" Type="Microsoft.Exchange.Services.OData.Model.FreeBusyStatus" />
+ <Property Name="IsAllDay" Type="Edm.Boolean" />
+ <Property Name="IsCancelled" Type="Edm.Boolean" />
+ <Property Name="IsOrganizer" Type="Edm.Boolean" />
+ <Property Name="ResponseRequested" Type="Edm.Boolean" />
+ <Property Name="Type" Type="Microsoft.Exchange.Services.OData.Model.EventType" />
+ <Property Name="SeriesId" Type="Edm.String" />
+ <Property Name="Attendees" Type="Collection(Microsoft.Exchange.Services.OData.Model.Attendee)" />
+ <NavigationProperty Name="Calendar" Type="Microsoft.Exchange.Services.OData.Model.Calendar" />
+ </EntityType>
+ <EntityContainer Name="EntityContainer" m:IsDefaultEntityContainer="true">
+ <EntitySet Name="Users" EntityType="Microsoft.Exchange.Services.OData.Model.User">
+ <NavigationPropertyBinding Path="Folders" Target="Folders" />
+ <NavigationPropertyBinding Path="Messages" Target="Messages" />
+ <NavigationPropertyBinding Path="RootFolder" Target="Folders" />
+ <NavigationPropertyBinding Path="Inbox" Target="Folders" />
+ <NavigationPropertyBinding Path="Drafts" Target="Folders" />
+ <NavigationPropertyBinding Path="SentItems" Target="Folders" />
+ <NavigationPropertyBinding Path="DeletedItems" Target="Folders" />
+ <NavigationPropertyBinding Path="Calendars" Target="Calendars" />
+ <NavigationPropertyBinding Path="CalendarGroups" Target="CalendarGroups" />
+ <NavigationPropertyBinding Path="Events" Target="Events" />
+ </EntitySet>
+ <EntitySet Name="Folders" EntityType="Microsoft.Exchange.Services.OData.Model.Folder">
+ <NavigationPropertyBinding Path="ChildFolders" Target="Folders" />
+ <NavigationPropertyBinding Path="Messages" Target="Messages" />
+ </EntitySet>
+ <EntitySet Name="Items" EntityType="Microsoft.Exchange.Services.OData.Model.Item" />
+ <EntitySet Name="Messages" EntityType="Microsoft.Exchange.Services.OData.Model.EmailMessage">
+ <NavigationPropertyBinding Path="Attachments" Target="Attachments" />
+ </EntitySet>
+ <EntitySet Name="Attachments" EntityType="Microsoft.Exchange.Services.OData.Model.Attachment">
+ <NavigationPropertyBinding Path="Microsoft.Exchange.Services.OData.Model.ItemAttachment/Item" Target="Items" />
+ </EntitySet>
+ <EntitySet Name="Calendars" EntityType="Microsoft.Exchange.Services.OData.Model.Calendar">
+ <NavigationPropertyBinding Path="Events" Target="Events" />
+ </EntitySet>
+ <EntitySet Name="CalendarGroups" EntityType="Microsoft.Exchange.Services.OData.Model.CalendarGroup" />
+ <EntitySet Name="Events" EntityType="Microsoft.Exchange.Services.OData.Model.Event">
+ <NavigationPropertyBinding Path="Attachments" Target="Attachments" />
+ <NavigationPropertyBinding Path="Calendar" Target="Calendars" />
+ </EntitySet>
+ </EntityContainer>
+ </Schema>
+ </edmx:DataServices>
+</edmx:Edmx>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/pom.xml
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/pom.xml b/odata4-lib/odata4-client-api/pom.xml
index c8bcbf7..5d56f03 100644
--- a/odata4-lib/odata4-client-api/pom.xml
+++ b/odata4-lib/odata4-client-api/pom.xml
@@ -40,6 +40,11 @@
<artifactId>olingo-odata4-commons-api-incubating</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/Configuration.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/Configuration.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/Configuration.java
new file mode 100644
index 0000000..521c5a7
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/Configuration.java
@@ -0,0 +1,201 @@
+/*
+ * 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.client.api;
+
+import org.apache.olingo.odata4.client.api.http.HttpUriRequestFactory;
+import org.apache.olingo.odata4.client.api.http.HttpClientFactory;
+import java.io.Serializable;
+import java.util.concurrent.ExecutorService;
+import org.apache.olingo.odata4.client.api.format.ODataFormat;
+import org.apache.olingo.odata4.client.api.format.ODataMediaFormat;
+import org.apache.olingo.odata4.client.api.format.ODataPubFormat;
+import org.apache.olingo.odata4.client.api.format.ODataValueFormat;
+
+/**
+ * Configuration wrapper.
+ */
+public interface Configuration extends Serializable {
+
+ /**
+ * Gets the configured OData format for AtomPub exchanges. If this configuration parameter doesn't exist the
+ * JSON_FULL_METADATA format will be used as default.
+ *
+ * @return configured OData format for AtomPub if specified; JSON_FULL_METADATA format otherwise.
+ * @see ODataPubFormat#JSON_FULL_METADATA
+ */
+ ODataPubFormat getDefaultPubFormat();
+
+ /**
+ * Sets the default OData format for AtomPub exchanges.
+ *
+ * @param format default format.
+ */
+ void setDefaultPubFormat(ODataPubFormat format);
+
+ /**
+ * Gets the configured OData format. This value depends on what is returned from <tt>getDefaultPubFormat()</tt>.
+ *
+ * @return configured OData format
+ * @see #getDefaultPubFormat()
+ */
+ ODataFormat getDefaultFormat();
+
+ /**
+ * Gets the configured OData value format. If this configuration parameter doesn't exist the TEXT format will be used
+ * as default.
+ *
+ * @return configured OData value format if specified; TEXT format otherwise.
+ * @see ODataValueFormat#TEXT
+ */
+ ODataValueFormat getDefaultValueFormat();
+
+ /**
+ * Sets the default OData value format.
+ *
+ * @param format default format.
+ */
+ void setDefaultValueFormat(ODataValueFormat format);
+
+ /**
+ * Gets the configured OData media format. If this configuration parameter doesn't exist the APPLICATION_OCTET_STREAM
+ * format will be used as default.
+ *
+ * @return configured OData media format if specified; APPLICATION_OCTET_STREAM format otherwise.
+ * @see ODataMediaFormat#WILDCARD
+ */
+ ODataMediaFormat getDefaultMediaFormat();
+
+ /**
+ * Sets the default OData media format.
+ *
+ * @param format default format.
+ */
+ void setDefaultMediaFormat(ODataMediaFormat format);
+
+ /**
+ * Gets the HttpClient factory to be used for executing requests.
+ *
+ * @return provided implementation (if configured via <tt>setHttpClientFactory</tt> or default.
+ * @see DefaultHttpClientFactory
+ */
+ HttpClientFactory getHttpClientFactory();
+
+ /**
+ * Sets the HttpClient factory to be used for executing requests.
+ *
+ * @param factory implementation of <tt>HttpClientFactory</tt>.
+ * @see HttpClientFactory
+ */
+ void setHttpClientFactory(HttpClientFactory factory);
+
+ /**
+ * Gets the HttpUriRequest factory for generating requests to be executed.
+ *
+ * @return provided implementation (if configured via <tt>setHttpUriRequestFactory</tt> or default.
+ * @see DefaultHttpUriRequestFactory
+ */
+ HttpUriRequestFactory getHttpUriRequestFactory();
+
+ /**
+ * Sets the HttpUriRequest factory generating requests to be executed.
+ *
+ * @param factory implementation of <tt>HttpUriRequestFactory</tt>.
+ * @see HttpUriRequestFactory
+ */
+ void setHttpUriRequestFactory(HttpUriRequestFactory factory);
+
+ /**
+ * Gets whether <tt>PUT</tt>, <tt>MERGE</tt>, <tt>PATCH</tt>, <tt>DELETE</tt> HTTP methods need to be translated to
+ * <tt>POST</tt> with additional <tt>X-HTTTP-Method</tt> header.
+ *
+ * @return whether <tt>X-HTTTP-Method</tt> header is to be used
+ */
+ boolean isUseXHTTPMethod();
+
+ /**
+ * Sets whether <tt>PUT</tt>, <tt>MERGE</tt>, <tt>PATCH</tt>, <tt>DELETE</tt> HTTP methods need to be translated to
+ * <tt>POST</tt> with additional <tt>X-HTTTP-Method</tt> header.
+ *
+ * @param value 'TRUE' to use tunneling.
+ */
+ void setUseXHTTPMethod(boolean value);
+
+ /**
+ * Checks whether URIs contain entity key between parentheses (standard) or instead as additional segment. Example:
+ * http://services.odata.org/V4/OData/OData.svc/Products(0) or http://services.odata.org/V4/OData/OData.svc/Products/0
+ *
+ * @return whether URIs shall be built with entity key between parentheses (standard) or instead as additional
+ * segment.
+ */
+ boolean isKeyAsSegment();
+
+ /**
+ * Sets whether URIs shall be built with entity key between parentheses (standard) or instead as additional segment.
+ * Example: http://services.odata.org/V4/OData/OData.svc/Products(0) or
+ * http://services.odata.org/V4/OData/OData.svc/Products/0
+ *
+ * @param value 'TRUE' to use this feature.
+ */
+ void setKeyAsSegment(boolean value);
+
+ /**
+ * Checks whether Gzip compression (e.g. support for <tt>Accept-Encoding: gzip</tt> and
+ * <tt>Content-Encoding: gzip</tt> HTTP headers) is enabled.
+ *
+ * @return whether HTTP Gzip compression is enabled
+ */
+ boolean isGzipCompression();
+
+ /**
+ * Sets Gzip compression (e.g. support for <tt>Accept-Encoding: gzip</tt> and
+ * <tt>Content-Encoding: gzip</tt> HTTP headers) enabled or disabled.
+ *
+ * @param value whether to use Gzip compression.
+ */
+ void setGzipCompression(boolean value);
+
+ /**
+ * Checks whether chunk HTTP encoding is being used.
+ *
+ * @return whether chunk HTTP encoding is being used
+ */
+ boolean isUseChuncked();
+
+ /**
+ * Sets chunk HTTP encoding enabled or disabled.
+ *
+ * @param value whether to use chunk HTTP encoding.
+ */
+ void setUseChuncked(boolean value);
+
+ /**
+ * Retrieves request executor service.
+ *
+ * @return request executor service.
+ */
+ ExecutorService getExecutor();
+
+ /**
+ * Sets request executor service.
+ *
+ * @param executorService new executor services.
+ */
+ void setExecutor(ExecutorService executorService);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/Constants.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/Constants.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/Constants.java
new file mode 100644
index 0000000..9345057
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/Constants.java
@@ -0,0 +1,217 @@
+/*
+ * 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.client.api;
+
+import javax.xml.XMLConstants;
+
+/**
+ * Constant values related to the OData protocol.
+ */
+public class Constants {
+
+ // Other stuff
+ public final static String UTF8 = "UTF-8";
+
+ public final static String NAME = "name";
+
+ public final static String PROPERTIES = "properties";
+
+ // XML namespaces and prefixes
+ public final static String NS_ATOM = "http://www.w3.org/2005/Atom";
+
+ public static final String NS_GEORSS = "http://www.georss.org/georss";
+
+ public static final String NS_GML = "http://www.opengis.net/gml";
+
+ public static final String XMLNS_DATASERVICES = XMLConstants.XMLNS_ATTRIBUTE + ":d";
+
+ public static final String PREFIX_DATASERVICES = "d:";
+
+ public static final String XMLNS_METADATA = XMLConstants.XMLNS_ATTRIBUTE + ":m";
+
+ public static final String PREFIX_METADATA = "m:";
+
+ public static final String XMLNS_GEORSS = XMLConstants.XMLNS_ATTRIBUTE + ":georss";
+
+ public static final String PREFIX_GEORSS = "georss:";
+
+ public static final String XMLNS_GML = XMLConstants.XMLNS_ATTRIBUTE + ":gml";
+
+ public static final String PREFIX_GML = "gml:";
+
+ /**
+ * Edit link rel value.
+ */
+ public static final String EDIT_LINK_REL = "edit";
+
+ /**
+ * Self link rel value.
+ */
+ public static final String SELF_LINK_REL = "self";
+
+ public static final String NEXT_LINK_REL = "next";
+
+ // XML elements and attributes
+ public static final String ELEM_PROPERTIES = PREFIX_METADATA + PROPERTIES;
+
+ public static final String ELEM_ELEMENT = "element";
+
+ public final static String ATTR_TYPE = "type";
+
+ public static final String ATTR_M_TYPE = PREFIX_METADATA + ATTR_TYPE;
+
+ public static final String ATTR_NULL = PREFIX_METADATA + "null";
+
+ public static final String ATTR_XMLBASE = "xml:base";
+
+ public static final String ATTR_REL = "rel";
+
+ public static final String ATTR_HREF = "href";
+
+ public static final String ATTR_METADATA = "metadata";
+
+ public static final String ATTR_TITLE = "title";
+
+ public static final String ATTR_TARGET = "target";
+
+ public static final String ELEM_COLLECTION = "collection";
+
+ public static final String ATTR_SRSNAME = PREFIX_GML + "srsName";
+
+ public static final String ELEM_POINT = PREFIX_GML + "Point";
+
+ public static final String ELEM_MULTIPOINT = PREFIX_GML + "MultiPoint";
+
+ public static final String ELEM_POINTMEMBERS = PREFIX_GML + "pointMembers";
+
+ public static final String ELEM_LINESTRING = PREFIX_GML + "LineString";
+
+ public static final String ELEM_MULTILINESTRING = PREFIX_GML + "MultiCurve";
+
+ public static final String ELEM_LINESTRINGMEMBERS = PREFIX_GML + "curveMembers";
+
+ public static final String ELEM_POLYGON = PREFIX_GML + "Polygon";
+
+ public static final String ELEM_POLYGON_EXTERIOR = PREFIX_GML + "exterior";
+
+ public static final String ELEM_POLYGON_INTERIOR = PREFIX_GML + "interior";
+
+ public static final String ELEM_POLYGON_LINEARRING = PREFIX_GML + "LinearRing";
+
+ public static final String ELEM_MULTIPOLYGON = PREFIX_GML + "MultiSurface";
+
+ public static final String ELEM_SURFACEMEMBERS = PREFIX_GML + "surfaceMembers";
+
+ public static final String ELEM_GEOCOLLECTION = PREFIX_GML + "MultiGeometry";
+
+ public static final String ELEM_GEOMEMBERS = PREFIX_GML + "geometryMembers";
+
+ public static final String ELEM_POS = PREFIX_GML + "pos";
+
+ public static final String ELEM_POSLIST = PREFIX_GML + "posList";
+
+ public static final String ELEM_PROPERTY = "property";
+
+ public static final String ELEM_URI = "uri";
+
+ // JSON stuff
+ public final static String JSON_METADATA = "odata.metadata";
+
+ public final static String JSON_TYPE = "odata.type";
+
+ public final static String JSON_ETAG = "odata.etag";
+
+ public final static String JSON_MEDIA_ETAG = "odata.mediaETag";
+
+ public final static String JSON_ID = "odata.id";
+
+ public final static String JSON_READ_LINK = "odata.readLink";
+
+ public final static String JSON_EDIT_LINK = "odata.editLink";
+
+ public final static String JSON_MEDIAREAD_LINK = "odata.mediaReadLink";
+
+ public final static String JSON_MEDIAEDIT_LINK = "odata.mediaEditLink";
+
+ public final static String JSON_MEDIA_CONTENT_TYPE = "odata.mediaContentType";
+
+ public final static String JSON_NAVIGATION_LINK_SUFFIX = "@odata.navigationLinkUrl";
+
+ public final static String JSON_BIND_LINK_SUFFIX = "@odata.bind";
+
+ public final static String JSON_ASSOCIATION_LINK_SUFFIX = "@odata.associationLinkUrl";
+
+ public final static String JSON_MEDIAEDIT_LINK_SUFFIX = "@odata.mediaEditLink";
+
+ public final static String JSON_VALUE = "value";
+
+ public final static String JSON_URL = "url";
+
+ public final static String JSON_COORDINATES = "coordinates";
+
+ public final static String JSON_GEOMETRIES = "geometries";
+
+ public final static String JSON_CRS = "crs";
+
+ public final static String JSON_GIS_URLPREFIX = "http://www.opengis.net/def/crs/EPSG/0/";
+
+ // Atom stuff
+ public final static String ATOM_ELEM_ENTRY = "entry";
+
+ public final static String ATOM_ELEM_FEED = "feed";
+
+ public final static String ATOM_ELEM_CATEGORY = "category";
+
+ public final static String ATOM_ELEM_ID = "id";
+
+ public final static String ATOM_ELEM_LINK = "link";
+
+ public final static String ATOM_ELEM_CONTENT = "content";
+
+ public static final String ATOM_ELEM_TITLE = "title";
+
+ public static final String ATOM_ELEM_SUMMARY = "summary";
+
+ public static final String ATOM_ELEM_UPDATED = "updated";
+
+ public static final String ATOM_ELEM_AUTHOR = "author";
+
+ public static final String ATOM_ELEM_AUTHOR_NAME = "name";
+
+ public static final String ATOM_ELEM_AUTHOR_URI = "uri";
+
+ public static final String ATOM_ELEM_AUTHOR_EMAIL = "email";
+
+ public static final String ATOM_ELEM_ACTION = PREFIX_METADATA + "action";
+
+ public static final String ATOM_ELEM_INLINE = PREFIX_METADATA + "inline";
+
+ public static final String ATOM_ATTR_TITLE = "atom:title";
+
+ public static final String ATOM_ATTR_TERM = "term";
+
+ public static final String ATOM_ATTR_SCHEME = "scheme";
+
+ public static final String ATOM_ATTR_SRC = "src";
+
+ public static final String ATOM_ATTR_ETAG = PREFIX_METADATA + "etag";
+
+ public static final String ATOM_ATTR_COUNT = PREFIX_METADATA + "count";
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataClient.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataClient.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataClient.java
index 8ee2146..b5a8dec 100644
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataClient.java
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataClient.java
@@ -1,4 +1,4 @@
-/*
+/*
* 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
@@ -18,27 +18,41 @@
*/
package org.apache.olingo.odata4.client.api;
-//TODO: Exceptionhandling
-public abstract class ODataClient {
+import org.apache.olingo.odata4.client.api.data.ODataDeserializer;
+import org.apache.olingo.odata4.client.api.data.ODataReader;
+import org.apache.olingo.odata4.client.api.data.ODataSerializer;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
- private static final String IMPLEMENTATION = "org.apache.olingo.odata4.client.core.ODataClientImpl";
+public interface ODataClient {
- public static ODataClient create() {
- ODataClient instance;
+ ODataServiceVersion getServiceVersion();
- try {
- final Class<?> clazz = Class.forName(ODataClient.IMPLEMENTATION);
+ //ODataHeaders getVersionHeaders();
+ Configuration getConfiguration();
- /*
- * We explicitly do not use the singleton pattern to keep the server state free
- * and avoid class loading issues also during hot deployment.
- */
- final Object object = clazz.newInstance();
- instance = (ODataClient) object;
+// URIBuilder getURIBuilder(String serviceRoot);
+//
+// FilterFactory getFilterFactory();
+//
+ ODataSerializer getSerializer();
+//
+ ODataDeserializer getDeserializer();
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- return instance;
- }
+ ODataReader getReader();
+
+// ODataWriter getWriter();
+//
+// ODataBinder getBinder();
+//
+// ODataObjectFactory getObjectFactory();
+//
+// RetrieveRequestFactory getRetrieveRequestFactory();
+//
+// CUDRequestFactory getCUDRequestFactory();
+//
+// StreamedRequestFactory getStreamedRequestFactory();
+//
+// InvokeRequestFactory<?, ?, ?, ?, ?, ?, ?, ?> getInvokeRequestFactory();
+//
+// BatchRequestFactory getBatchRequestFactory();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataError.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataError.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataError.java
new file mode 100644
index 0000000..4e45cfd
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataError.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.api;
+
+/**
+ * OData error.
+ */
+public interface ODataError {
+
+ /**
+ * Gets error code.
+ *
+ * @return error code.
+ */
+ String getCode();
+
+ /**
+ * Gets error message language.
+ *
+ * @return error message language.
+ */
+ String getMessageLang();
+
+ /**
+ * Gets error message.
+ *
+ * @return error message.
+ */
+ String getMessageValue();
+
+ /**
+ * Gets inner error message.
+ *
+ * @return inner error message.
+ */
+ String getInnerErrorMessage();
+
+ /**
+ * Gets inner error type.
+ *
+ * @return inner error type.
+ */
+ String getInnerErrorType();
+
+ /**
+ * Gets inner error stack-trace.
+ *
+ * @return inner error stack-trace
+ */
+ String getInnerErrorStacktrace();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataDeserializer.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataDeserializer.java
new file mode 100644
index 0000000..8884a58
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataDeserializer.java
@@ -0,0 +1,90 @@
+/*
+ * 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.client.api.data;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import org.apache.olingo.odata4.client.api.edm.Edmx;
+import org.w3c.dom.Element;
+
+/**
+ * Utility class for serialization.
+ */
+public interface ODataDeserializer extends Serializable {
+
+ Edmx toMetadata(InputStream input);
+
+ /**
+ * Gets the ServiceDocumentResource object represented by the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @param format OData service document format.
+ * @return ServiceDocumentResource object.
+ */
+// ServiceDocument toServiceDocument(InputStream input, ODataFormat format);
+ /**
+ * Gets a feed object from the given InputStream.
+ *
+ * @param <T> reference class type
+ * @param input stream to be de-serialized.
+ * @param reference reference class (AtomFeed.class, JSONFeed.class).
+ * @return FeedResource instance.
+ */
+// <T extends Feed> T toFeed(InputStream input, Class<T> reference);
+ /**
+ * Gets an entry object from the given InputStream.
+ *
+ * @param <T> reference class type
+ * @param input stream to be de-serialized.
+ * @param reference reference class (AtomEntry.class, JSONV3Entry.class).
+ * @return EntryResource instance.
+ */
+// <T extends Entry> T toEntry(InputStream input, Class<T> reference);
+ /**
+ * Gets a DOM representation of the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @param format OData format.
+ * @return DOM.
+ */
+// Element toPropertyDOM(InputStream input, ODataFormat format);
+ /**
+ * Gets a list of links from the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @param format OData format.
+ * @return de-serialized links.
+ */
+// LinkCollection toLinkCollection(InputStream input, ODataFormat format);
+ /**
+ * Gets the ODataError object represented by the given InputStream.
+ *
+ * @param input stream to be parsed and de-serialized.
+ * @param isXML 'TRUE' if the error is represented by XML; 'FALSE' otherwise.
+ * @return
+ */
+// ODataError toODataError(InputStream input, boolean isXML);
+ /**
+ * Parses the given input into a DOM tree.
+ *
+ * @param input stream to be parsed and de-serialized.
+ * @return DOM tree
+ */
+ Element toDOM(InputStream input);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataReader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataReader.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataReader.java
new file mode 100644
index 0000000..df0ec9a
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataReader.java
@@ -0,0 +1,102 @@
+/*
+ * 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.client.api.data;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import org.apache.olingo.odata4.client.api.ODataError;
+import org.apache.olingo.odata4.client.api.edm.EdmMetadata;
+
+/**
+ * OData reader.
+ * <br/>
+ * Use this class to de-serialize an OData response body.
+ * <br/>
+ * This class provides method helpers to de-serialize an entire feed, a set of entities and a single entity as well.
+ */
+public interface ODataReader extends Serializable {
+
+ /**
+ * Parses a stream into metadata representation.
+ *
+ * @param input stream to de-serialize.
+ * @return metadata representation.
+ */
+ EdmMetadata readMetadata(InputStream input);
+
+ /**
+ * Parses an OData service document.
+ *
+ * @param input stream to de-serialize.
+ * @param format de-serialize as XML or JSON
+ * @return List of URIs.
+ */
+ //ODataServiceDocument readServiceDocument(InputStream input, ODataFormat format);
+ /**
+ * De-Serializes a stream into an OData entity set.
+ *
+ * @param input stream to de-serialize.
+ * @param format de-serialize as AtomFeed or JSONFeed
+ * @return de-serialized entity set.
+ */
+ //ODataEntitySet readEntitySet(InputStream input, ODataPubFormat format);
+ /**
+ * Parses a stream taking care to de-serializes the first OData entity found.
+ *
+ * @param input stream to de-serialize.
+ * @param format de-serialize as AtomEntry or JSONEntry
+ * @return entity de-serialized.
+ */
+ //ODataEntity readEntity(InputStream input, ODataPubFormat format);
+ /**
+ * Parses a stream taking care to de-serialize the first OData entity property found.
+ *
+ * @param input stream to de-serialize.
+ * @param format de-serialize as XML or JSON
+ * @return OData entity property de-serialized.
+ */
+ //ODataProperty readProperty(InputStream input, ODataFormat format);
+ /**
+ * Parses a $links request response.
+ *
+ * @param input stream to de-serialize.
+ * @param format de-serialize as XML or JSON
+ * @return List of URIs.
+ */
+ //ODataLinkCollection readLinks(InputStream input, ODataFormat format);
+ /**
+ * Parses a stream into an OData error.
+ *
+ * @param inputStream stream to de-serialize.
+ * @param isXML 'TRUE' if the error is in XML format.
+ * @return OData error.
+ */
+// ODataError readError(InputStream inputStream, boolean isXML);
+
+ /**
+ * Parses a stream into the object type specified by the given reference.
+ *
+ * @param <T> expected object type.
+ * @param src input stream.
+ * @param format format
+ * @param reference reference.
+ * @return read object.
+ */
+ //<T> T read(InputStream src, String format, Class<T> reference);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataSerializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataSerializer.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataSerializer.java
new file mode 100644
index 0000000..8553371
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/data/ODataSerializer.java
@@ -0,0 +1,120 @@
+/**
+ * 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.client.api.data;
+
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.io.Writer;
+import org.apache.olingo.odata4.client.api.format.ODataFormat;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Utility class for serialization.
+ */
+public interface ODataSerializer extends Serializable {
+
+ /**
+ * Writes <tt>FeedResource</tt> object onto the given stream.
+ *
+ * @param <T> feed resource type.
+ * @param obj object to be streamed.
+ * @param out output stream.
+ */
+// <T extends Feed> void feed(T obj, OutputStream out);
+
+ /**
+ * Writes <tt>FeedResource</tt> object by the given writer.
+ *
+ * @param <T> feed resource type.
+ * @param obj object to be streamed.
+ * @param writer writer.
+ */
+// <T extends Feed> void feed(T obj, Writer writer);
+
+ /**
+ * Writes <tt>EntryResource</tt> object onto the given stream.
+ *
+ * @param <T> entry resource type.
+ * @param obj object to be streamed.
+ * @param out output stream.
+ */
+// <T extends Entry> void entry(T obj, OutputStream out);
+
+ /**
+ * Writes <tt>EntryResource</tt> object by the given writer.
+ *
+ * @param <T> entry resource type.
+ * @param obj object to be streamed.
+ * @param writer writer.
+ */
+// <T extends Entry> void entry(T obj, Writer writer);
+
+ /**
+ * Writes entry content onto the given stream.
+ *
+ * @param element element to be streamed.
+ * @param format streaming format.
+ * @param out output stream.
+ */
+// void property(Element element, ODataFormat format, OutputStream out);
+
+ /**
+ * Writes entry content by the given writer.
+ *
+ * @param element element to be streamed.
+ * @param format streaming format.
+ * @param writer writer.
+ */
+// void property(Element element, ODataFormat format, Writer writer);
+
+ /**
+ * Writes OData link onto the given stream.
+ *
+ * @param link OData link to be streamed.
+ * @param format streaming format.
+ * @param out output stream.
+ */
+// void link(ODataLink link, ODataFormat format, OutputStream out);
+
+ /**
+ * Writes OData link by the given writer.
+ *
+ * @param link OData link to be streamed.
+ * @param format streaming format.
+ * @param writer writer.
+ */
+// void link(ODataLink link, ODataFormat format, Writer writer);
+
+ /**
+ * Writes DOM object onto the given stream.
+ *
+ * @param content DOM to be streamed.
+ * @param out output stream.
+ */
+ void dom(Node content, OutputStream out);
+
+ /**
+ * Writes DOM object by the given writer.
+ *
+ * @param content DOM to be streamed.
+ * @param writer writer.
+ */
+ void dom(Node content, Writer writer);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/ComplexType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/ComplexType.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/ComplexType.java
new file mode 100644
index 0000000..3771d5c
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/ComplexType.java
@@ -0,0 +1,32 @@
+/*
+ * 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.client.api.edm;
+
+import java.util.List;
+
+public interface ComplexType {
+
+ String getName();
+
+ void setName(String name);
+
+ public abstract List<? extends Property> getProperties();
+
+ public abstract Property getProperty(String name);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EdmMetadata.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EdmMetadata.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EdmMetadata.java
new file mode 100644
index 0000000..a75515d
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EdmMetadata.java
@@ -0,0 +1,59 @@
+/*
+ * 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.client.api.edm;
+
+import java.util.List;
+
+/**
+ * Entry point for access information about EDM metadata.
+ */
+public interface EdmMetadata {
+
+ /**
+ * Checks whether the given key is a valid namespace or alias in the EdM metadata document.
+ *
+ * @param key namespace or alias
+ * @return true if key is valid namespace or alias
+ */
+ boolean isNsOrAlias(String key);
+
+ /**
+ * Returns the Schema at the specified position in the EdM metadata document.
+ *
+ * @param index index of the Schema to return
+ * @return the Schema at the specified position in the EdM metadata document
+ */
+ Schema getSchema(final int index);
+
+ /**
+ * Returns the Schema with the specified key (namespace or alias) in the EdM metadata document.
+ *
+ * @param key namespace or alias
+ * @return the Schema with the specified key in the EdM metadata document
+ */
+ Schema getSchema(final String key);
+
+ /**
+ * Returns all Schema objects defined in the EdM metadata document.
+ *
+ * @return all Schema objects defined in the EdM metadata document
+ */
+ List<? extends Schema> getSchemas();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Edmx.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Edmx.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Edmx.java
new file mode 100644
index 0000000..df5250b
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Edmx.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.client.api.edm;
+
+public interface Edmx {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityContainer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityContainer.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityContainer.java
new file mode 100644
index 0000000..e497d3e
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityContainer.java
@@ -0,0 +1,24 @@
+/*
+ * 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.client.api.edm;
+
+public interface EntityContainer {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityKey.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityKey.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityKey.java
new file mode 100644
index 0000000..ca903e9
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityKey.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.client.api.edm;
+
+public interface EntityKey {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntitySet.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntitySet.java
new file mode 100644
index 0000000..de64e11
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntitySet.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.client.api.edm;
+
+public interface EntitySet {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityType.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityType.java
new file mode 100644
index 0000000..c769b27
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EntityType.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.client.api.edm;
+
+public interface EntityType {
+
+}
[06/14] [OLINGO-169] First huge import from ODataJClient: for the
moment,
it just build (no tests yet) and dummy Edm interfaces are used instead of the
ones from commons-api
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SchemaImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SchemaImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SchemaImpl.java
new file mode 100644
index 0000000..16b9c63
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SchemaImpl.java
@@ -0,0 +1,173 @@
+/*
+ * 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.client.core.edm.v4;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.Schema;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractSchema;
+
+public class SchemaImpl extends AbstractSchema<EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl>
+ implements Schema, AnnotatedEdmItem {
+
+ private static final long serialVersionUID = 4453992249818796144L;
+
+ private final List<ActionImpl> actions = new ArrayList<ActionImpl>();
+
+ private final List<AnnotationsImpl> annotationsList = new ArrayList<AnnotationsImpl>();
+
+ private final List<AnnotationImpl> annotations = new ArrayList<AnnotationImpl>();
+
+ private final List<ComplexTypeImpl> complexTypes = new ArrayList<ComplexTypeImpl>();
+
+ private EntityContainerImpl entityContainer;
+
+ private final List<EnumTypeImpl> enumTypes = new ArrayList<EnumTypeImpl>();
+
+ private final List<EntityTypeImpl> entityTypes = new ArrayList<EntityTypeImpl>();
+
+ private final List<FunctionImpl> functions = new ArrayList<FunctionImpl>();
+
+ private final List<TermImpl> terms = new ArrayList<TermImpl>();
+
+ private final List<TypeDefinitionImpl> typeDefinitions = new ArrayList<TypeDefinitionImpl>();
+
+ private Annotation annotation;
+
+ public List<ActionImpl> getActions() {
+ return actions;
+ }
+
+ public List<ActionImpl> getActions(final String name) {
+ final List<ActionImpl> result = new ArrayList<ActionImpl>();
+ for (ActionImpl action : getActions()) {
+ if (name.equals(action.getName())) {
+ result.add(action);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public List<AnnotationsImpl> getAnnotationsList() {
+ return annotationsList;
+ }
+
+ @Override
+ public AnnotationsImpl getAnnotationsList(final String target) {
+ AnnotationsImpl result = null;
+ for (AnnotationsImpl annots : getAnnotationsList()) {
+ if (target.equals(annots.getTarget())) {
+ result = annots;
+ }
+ }
+ return result;
+ }
+
+ public List<AnnotationImpl> getAnnotations() {
+ return annotations;
+ }
+
+ @Override
+ public List<EnumTypeImpl> getEnumTypes() {
+ return enumTypes;
+ }
+
+ @Override
+ public EnumTypeImpl getEnumType(final String name) {
+ EnumTypeImpl result = null;
+ for (EnumTypeImpl type : getEnumTypes()) {
+ if (name.equals(type.getName())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+
+ public List<FunctionImpl> getFunctions() {
+ return functions;
+ }
+
+ public List<FunctionImpl> getFunctions(final String name) {
+ final List<FunctionImpl> result = new ArrayList<FunctionImpl>();
+ for (FunctionImpl function : getFunctions()) {
+ if (name.equals(function.getName())) {
+ result.add(function);
+ }
+ }
+ return result;
+ }
+
+ public List<TermImpl> getTerms() {
+ return terms;
+ }
+
+ public List<TypeDefinitionImpl> getTypeDefinitions() {
+ return typeDefinitions;
+ }
+
+ public EntityContainerImpl getEntityContainer() {
+ return entityContainer;
+ }
+
+ public void setEntityContainer(final EntityContainerImpl entityContainer) {
+ this.entityContainer = entityContainer;
+ }
+
+ @Override
+ public List<EntityContainerImpl> getEntityContainers() {
+ return entityContainer == null
+ ? Collections.<EntityContainerImpl>emptyList() : Collections.singletonList(entityContainer);
+ }
+
+ @Override
+ public EntityContainerImpl getDefaultEntityContainer() {
+ return entityContainer;
+ }
+
+ @Override
+ public EntityContainerImpl getEntityContainer(final String name) {
+ if (entityContainer != null && name.equals(entityContainer.getName())) {
+ return entityContainer;
+ }
+ throw new IllegalArgumentException("No EntityContainer found with name " + name);
+ }
+
+ @Override
+ public List<EntityTypeImpl> getEntityTypes() {
+ return entityTypes;
+ }
+
+ @Override
+ public List<ComplexTypeImpl> getComplexTypes() {
+ return complexTypes;
+ }
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonDeserializer.java
new file mode 100644
index 0000000..306aabb
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonDeserializer.java
@@ -0,0 +1,57 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class SingletonDeserializer extends AbstractEdmDeserializer<SingletonImpl> {
+
+ @Override
+ protected SingletonImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final SingletonImpl singleton = new SingletonImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ singleton.setName(jp.nextTextValue());
+ } else if ("Type".equals(jp.getCurrentName())) {
+ singleton.setType(jp.nextTextValue());
+ } else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ singleton.getNavigationPropertyBindings().add(
+ jp.getCodec().readValue(jp, NavigationPropertyBindingImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ singleton.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return singleton;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonImpl.java
new file mode 100644
index 0000000..6c62467
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/SingletonImpl.java
@@ -0,0 +1,59 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.NavigationPropertyBinding;
+import org.apache.olingo.odata4.client.api.edm.v4.Singleton;
+
+@JsonDeserialize(using = SingletonDeserializer.class)
+public class SingletonImpl extends AbstractAnnotatedEdmItem implements Singleton {
+
+ private static final long serialVersionUID = 941802518279658559L;
+
+ private String name;
+
+ private String type;
+
+ private final List<NavigationPropertyBinding> navigationPropertyBindings
+ = new ArrayList<NavigationPropertyBinding>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public List<NavigationPropertyBinding> getNavigationPropertyBindings() {
+ return navigationPropertyBindings;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TermDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TermDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TermDeserializer.java
new file mode 100644
index 0000000..af18cf4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TermDeserializer.java
@@ -0,0 +1,75 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import java.math.BigInteger;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.odata4.client.api.edm.v4.CSDLElement;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class TermDeserializer extends AbstractEdmDeserializer<TermImpl> {
+
+ @Override
+ protected TermImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final TermImpl term = new TermImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ term.setName(jp.nextTextValue());
+ } else if ("Type".equals(jp.getCurrentName())) {
+ term.setType(jp.nextTextValue());
+ } else if ("BaseTerm".equals(jp.getCurrentName())) {
+ term.setBaseTerm(jp.nextTextValue());
+ } else if ("DefaultValue".equals(jp.getCurrentName())) {
+ term.setDefaultValue(jp.nextTextValue());
+ } else if ("Nullable".equals(jp.getCurrentName())) {
+ term.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ term.setMaxLength(jp.nextTextValue());
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ term.setPrecision(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ term.setScale(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ term.setSrid(jp.nextTextValue());
+ } else if ("AppliesTo".equals(jp.getCurrentName())) {
+ for (String split : StringUtils.split(jp.nextTextValue())) {
+ term.getAppliesTo().add(CSDLElement.valueOf(split));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ term.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return term;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TermImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TermImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TermImpl.java
new file mode 100644
index 0000000..28e3f4f
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TermImpl.java
@@ -0,0 +1,129 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v4.CSDLElement;
+import org.apache.olingo.odata4.client.api.edm.v4.Term;
+
+@JsonDeserialize(using = TermDeserializer.class)
+public class TermImpl extends AbstractAnnotatedEdmItem implements Term {
+
+ private static final long serialVersionUID = -5888231162358116515L;
+
+ private String name;
+
+ private String type;
+
+ private String baseTerm;
+
+ private String defaultValue;
+
+ private boolean nullable = true;
+
+ private String maxLength;
+
+ private BigInteger precision;
+
+ private BigInteger scale;
+
+ private String srid;
+
+ private final List<CSDLElement> appliesTo = new ArrayList<CSDLElement>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public String getBaseTerm() {
+ return baseTerm;
+ }
+
+ public void setBaseTerm(final String baseTerm) {
+ this.baseTerm = baseTerm;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(final String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public boolean isNullable() {
+ return nullable;
+ }
+
+ public void setNullable(final boolean nullable) {
+ this.nullable = nullable;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+ public List<CSDLElement> getAppliesTo() {
+ return appliesTo;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TypeDefinitionDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TypeDefinitionDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TypeDefinitionDeserializer.java
new file mode 100644
index 0000000..df340f1
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TypeDefinitionDeserializer.java
@@ -0,0 +1,65 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import java.math.BigInteger;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class TypeDefinitionDeserializer extends AbstractEdmDeserializer<TypeDefinitionImpl> {
+
+ @Override
+ protected TypeDefinitionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final TypeDefinitionImpl typeDefinition = new TypeDefinitionImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ typeDefinition.setName(jp.nextTextValue());
+ } else if ("UnderlyingType".equals(jp.getCurrentName())) {
+ typeDefinition.setUnderlyingType(jp.nextTextValue());
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ typeDefinition.setMaxLength(jp.nextTextValue());
+ } else if ("Unicode".equals(jp.getCurrentName())) {
+ typeDefinition.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ typeDefinition.setPrecision(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ typeDefinition.setScale(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ typeDefinition.setSrid(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ typeDefinition.getAnnotations().add(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return typeDefinition;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TypeDefinitionImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TypeDefinitionImpl.java
new file mode 100644
index 0000000..08ba6b2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/TypeDefinitionImpl.java
@@ -0,0 +1,108 @@
+/*
+ * 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.client.core.edm.v4;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.api.edm.v4.TypeDefinition;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class TypeDefinitionImpl extends AbstractEdmItem implements TypeDefinition {
+
+ private static final long serialVersionUID = -5888231162358116515L;
+
+ private String name;
+
+ private String underlyingType;
+
+ private String maxLength;
+
+ private BigInteger precision;
+
+ private BigInteger scale;
+
+ private boolean unicode = true;
+
+ private String srid;
+
+ private final List<Annotation> annotations = new ArrayList<Annotation>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getUnderlyingType() {
+ return underlyingType;
+ }
+
+ public void setUnderlyingType(final String underlyingType) {
+ this.underlyingType = underlyingType;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+
+ public boolean isUnicode() {
+ return unicode;
+ }
+
+ public void setUnicode(final boolean unicode) {
+ this.unicode = unicode;
+ }
+
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+ public List<Annotation> getAnnotations() {
+ return annotations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.java
new file mode 100644
index 0000000..f8e7725
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.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.client.core.edm.v4.annotation;
+
+/**
+ * Groups dynamic expressions that may be provided using element notation or attribute notation.
+ */
+abstract class AbstractElOrAttrConstruct extends DynExprConstruct {
+
+ private static final long serialVersionUID = 5503275111425750339L;
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(final String value) {
+ this.value = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java
new file mode 100644
index 0000000..1f9adfb
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java
@@ -0,0 +1,39 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotatedEdmItem;
+
+public abstract class AnnotatedDynExprConstruct extends DynExprConstruct implements AnnotatedEdmItem {
+
+ private static final long serialVersionUID = -8117155475397749038L;
+
+ private Annotation annotation;
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotationPath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotationPath.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotationPath.java
new file mode 100644
index 0000000..f04778c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotationPath.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.client.core.edm.v4.annotation;
+
+public class AnnotationPath extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = 6198019768659098819L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java
new file mode 100644
index 0000000..3f05ec1
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+
+@JsonDeserialize(using = ApplyDeserializer.class)
+public class Apply extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 6198019768659098819L;
+
+ public static final String CANONICAL_FUNCTION_CONCAT = "odata.concat";
+
+ public static final String CANONICAL_FUNCTION_FILLURITEMPLATE = "odata.fillUriTemplate";
+
+ public static final String CANONICAL_FUNCTION_URIENCODE = "odata.uriEncode";
+
+ private String function;
+
+ private final List<ExprConstruct> parameters = new ArrayList<ExprConstruct>();
+
+ public String getFunction() {
+ return function;
+ }
+
+ public void setFunction(final String function) {
+ this.function = function;
+ }
+
+ public List<ExprConstruct> getParameters() {
+ return parameters;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java
new file mode 100644
index 0000000..2c427ea
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java
@@ -0,0 +1,55 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+
+public class ApplyDeserializer extends AbstractEdmDeserializer<Apply> {
+
+ @Override
+ protected Apply doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Apply apply = new Apply();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Function".equals(jp.getCurrentName())) {
+ apply.setFunction(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ apply.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ } else if (isAnnotationConstExprConstruct(jp)) {
+ apply.getParameters().add(parseAnnotationConstExprConstruct(jp));
+ } else {
+ apply.getParameters().add(jp.getCodec().readValue(jp, DynExprConstruct.class));
+ }
+ }
+ }
+
+ return apply;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.java
new file mode 100644
index 0000000..efb00d4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.math.BigInteger;
+
+@JsonDeserialize(using = CastDeserializer.class)
+public class Cast extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = -7836626668653004926L;
+
+ private String type;
+
+ private String maxLength;
+
+ private BigInteger precision;
+
+ private BigInteger scale;
+
+ private String srid;
+
+ private DynExprConstruct value;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+ public DynExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final DynExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java
new file mode 100644
index 0000000..7721171
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java
@@ -0,0 +1,62 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import java.math.BigInteger;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+
+public class CastDeserializer extends AbstractEdmDeserializer<Cast> {
+
+ @Override
+ protected Cast doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Cast cast = new Cast();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Type".equals(jp.getCurrentName())) {
+ cast.setType(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ cast.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ cast.setMaxLength(jp.nextTextValue());
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ cast.setPrecision(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ cast.setScale(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ cast.setSrid(jp.nextTextValue());
+ } else {
+ cast.setValue(jp.getCodec().readValue(jp, DynExprConstruct.class));
+ }
+ }
+ }
+
+ return cast;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java
new file mode 100644
index 0000000..dd2efb7
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+
+@JsonDeserialize(using = CollectionDeserializer.class)
+public class Collection extends DynExprConstruct {
+
+ private static final long serialVersionUID = -4975881520695477686L;
+
+ private final List<ExprConstruct> items = new ArrayList<ExprConstruct>();
+
+ public List<ExprConstruct> getItems() {
+ return items;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.java
new file mode 100644
index 0000000..e117536
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class CollectionDeserializer extends AbstractEdmDeserializer<Collection> {
+
+ @Override
+ protected Collection doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Collection collection = new Collection();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if (isAnnotationConstExprConstruct(jp)) {
+ collection.getItems().add(parseAnnotationConstExprConstruct(jp));
+ } else {
+ collection.getItems().add(jp.getCodec().readValue(jp, DynExprConstruct.class));
+ }
+ }
+ }
+
+ return collection;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstruct.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstruct.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstruct.java
new file mode 100644
index 0000000..d7ff53b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstruct.java
@@ -0,0 +1,71 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+public class ConstExprConstruct extends ExprConstruct {
+
+ private static final long serialVersionUID = 2250072064504668969L;
+
+ public enum Type {
+
+ Binary,
+ Bool,
+ Date,
+ DateTimeOffset,
+ Decimal,
+ Duration,
+ EnumMember,
+ Float,
+ Guid,
+ Int,
+ String,
+ TimeOfDay;
+
+ public static Type fromString(final String value) {
+ Type result = null;
+ try {
+ result = valueOf(value);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+ return result;
+ }
+ }
+
+ private Type type;
+
+ private String value;
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(final String value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstruct.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstruct.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstruct.java
new file mode 100644
index 0000000..0316674
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstruct.java
@@ -0,0 +1,28 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = DynExprConstructDeserializer.class)
+public abstract class DynExprConstruct extends ExprConstruct {
+
+ private static final long serialVersionUID = -642012862023177349L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstructDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstructDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstructDeserializer.java
new file mode 100644
index 0000000..01ea538
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprConstructDeserializer.java
@@ -0,0 +1,145 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonLocation;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.ClassUtils;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class DynExprConstructDeserializer extends AbstractEdmDeserializer<DynExprConstruct> {
+
+ private static final String[] EL_OR_ATTR = { AnnotationPath.class.getSimpleName(), Path.class.getSimpleName() };
+
+ private static final String APPLY = Apply.class.getSimpleName();
+
+ private static final String CAST = Cast.class.getSimpleName();
+
+ private static final String COLLECTION = Collection.class.getSimpleName();
+
+ private static final String IF = If.class.getSimpleName();
+
+ private static final String IS_OF = IsOf.class.getSimpleName();
+
+ private static final String LABELED_ELEMENT = LabeledElement.class.getSimpleName();
+
+ private static final String NULL = Null.class.getSimpleName();
+
+ private static final String RECORD = Record.class.getSimpleName();
+
+ private static final String URL_REF = UrlRef.class.getSimpleName();
+
+ private AbstractElOrAttrConstruct getElOrAttrInstance(final String simpleClassName) throws JsonParseException {
+ try {
+ @SuppressWarnings("unchecked")
+ Class<? extends AbstractElOrAttrConstruct> elOrAttrClass =
+ (Class<? extends AbstractElOrAttrConstruct>) ClassUtils.getClass(
+ getClass().getPackage().getName() + "." + simpleClassName);
+ return elOrAttrClass.newInstance();
+ } catch (Exception e) {
+ throw new JsonParseException("Could not instantiate " + simpleClassName, JsonLocation.NA, e);
+ }
+ }
+
+ private ExprConstruct parseConstOrEnumExprConstruct(final JsonParser jp) throws IOException {
+ ExprConstruct result;
+ if (isAnnotationConstExprConstruct(jp)) {
+ result = parseAnnotationConstExprConstruct(jp);
+ } else {
+ result = jp.getCodec().readValue(jp, DynExprConstruct.class);
+ }
+ jp.nextToken();
+
+ return result;
+ }
+
+ @Override
+ protected DynExprConstruct doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ DynExprConstruct construct = null;
+
+ if (DynExprSingleParamOp.Type.fromString(jp.getCurrentName()) != null) {
+ final DynExprSingleParamOp dynExprSingleParamOp = new DynExprSingleParamOp();
+ dynExprSingleParamOp.setType(DynExprSingleParamOp.Type.fromString(jp.getCurrentName()));
+
+ jp.nextToken();
+ jp.nextToken();
+ dynExprSingleParamOp.setExpression(jp.getCodec().readValue(jp, DynExprConstruct.class));
+
+ construct = dynExprSingleParamOp;
+ } else if (DynExprDoubleParamOp.Type.fromString(jp.getCurrentName()) != null) {
+ final DynExprDoubleParamOp dynExprDoubleParamOp = new DynExprDoubleParamOp();
+ dynExprDoubleParamOp.setType(DynExprDoubleParamOp.Type.fromString(jp.getCurrentName()));
+
+ jp.nextToken();
+ jp.nextToken();
+ dynExprDoubleParamOp.setLeft(jp.getCodec().readValue(jp, DynExprConstruct.class));
+ dynExprDoubleParamOp.setRight(jp.getCodec().readValue(jp, DynExprConstruct.class));
+
+ construct = dynExprDoubleParamOp;
+ } else if (ArrayUtils.contains(EL_OR_ATTR, jp.getCurrentName())) {
+ final AbstractElOrAttrConstruct elOrAttr = getElOrAttrInstance(jp.getCurrentName());
+ elOrAttr.setValue(jp.nextTextValue());
+
+ construct = elOrAttr;
+ } else if (APPLY.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.getCodec().readValue(jp, Apply.class);
+ } else if (CAST.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.getCodec().readValue(jp, Cast.class);
+ } else if (COLLECTION.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.getCodec().readValue(jp, Collection.class);
+ } else if (IF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ jp.nextToken();
+
+ final If _if = new If();
+ _if.setGuard(parseConstOrEnumExprConstruct(jp));
+ _if.setThen(parseConstOrEnumExprConstruct(jp));
+ _if.setElse(parseConstOrEnumExprConstruct(jp));
+
+ construct = _if;
+ } else if (IS_OF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.getCodec().readValue(jp, IsOf.class);
+ } else if (LABELED_ELEMENT.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.getCodec().readValue(jp, LabeledElement.class);
+ } else if (NULL.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.getCodec().readValue(jp, Null.class);
+ } else if (RECORD.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.getCodec().readValue(jp, Record.class);
+ } else if (URL_REF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.getCodec().readValue(jp, UrlRef.class);
+ }
+
+ return construct;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprDoubleParamOp.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprDoubleParamOp.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprDoubleParamOp.java
new file mode 100644
index 0000000..a2dbc0a
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprDoubleParamOp.java
@@ -0,0 +1,71 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+public class DynExprDoubleParamOp extends DynExprConstruct {
+
+ private static final long serialVersionUID = -7974475975925167731L;
+
+ public static enum Type {
+
+ And,
+ Or;
+
+ public static Type fromString(final String value) {
+ Type result = null;
+ for (Type type : values()) {
+ if (value.equals(type.name())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+ }
+
+ private Type type;
+
+ private DynExprConstruct left;
+
+ private DynExprConstruct right;
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ public DynExprConstruct getLeft() {
+ return left;
+ }
+
+ public void setLeft(final DynExprConstruct left) {
+ this.left = left;
+ }
+
+ public DynExprConstruct getRight() {
+ return right;
+ }
+
+ public void setRight(final DynExprConstruct right) {
+ this.right = right;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprSingleParamOp.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprSingleParamOp.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprSingleParamOp.java
new file mode 100644
index 0000000..06fc03a
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/DynExprSingleParamOp.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v4.annotation;
+
+public class DynExprSingleParamOp extends DynExprConstruct {
+
+ private static final long serialVersionUID = -7974475975925167731L;
+
+ public static enum Type {
+
+ Not,
+ Eq,
+ Ne,
+ Gt,
+ Ge,
+ Lt,
+ Le;
+
+ public static Type fromString(final String value) {
+ Type result = null;
+ for (Type type : values()) {
+ if (value.equals(type.name())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+
+ }
+
+ private Type type;
+
+ private DynExprConstruct expression;
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ public DynExprConstruct getExpression() {
+ return expression;
+ }
+
+ public void setExpression(final DynExprConstruct expression) {
+ this.expression = expression;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ExprConstruct.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ExprConstruct.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ExprConstruct.java
new file mode 100644
index 0000000..597edf2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ExprConstruct.java
@@ -0,0 +1,27 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public abstract class ExprConstruct extends AbstractEdmItem {
+
+ private static final long serialVersionUID = 7108626008005050492L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/If.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/If.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/If.java
new file mode 100644
index 0000000..e08a5a4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/If.java
@@ -0,0 +1,55 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+public class If extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 6752952406406218936L;
+
+ private ExprConstruct guard;
+
+ private ExprConstruct _then;
+
+ private ExprConstruct _else;
+
+ public ExprConstruct getGuard() {
+ return guard;
+ }
+
+ public void setGuard(final ExprConstruct guard) {
+ this.guard = guard;
+ }
+
+ public ExprConstruct getThen() {
+ return _then;
+ }
+
+ public void setThen(final ExprConstruct _then) {
+ this._then = _then;
+ }
+
+ public ExprConstruct getElse() {
+ return _else;
+ }
+
+ public void setElse(final ExprConstruct _else) {
+ this._else = _else;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/IsOf.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/IsOf.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/IsOf.java
new file mode 100644
index 0000000..6258ea9
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/IsOf.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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.math.BigInteger;
+
+@JsonDeserialize(using = IsOfDeserializer.class)
+public class IsOf extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 6958304670385303776L;
+
+ private String type;
+
+ private String maxLength;
+
+ private BigInteger precision;
+
+ private BigInteger scale;
+
+ private String srid;
+
+ private DynExprConstruct value;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+ public DynExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final DynExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/IsOfDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/IsOfDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/IsOfDeserializer.java
new file mode 100644
index 0000000..52187f4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/IsOfDeserializer.java
@@ -0,0 +1,62 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import java.math.BigInteger;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+
+public class IsOfDeserializer extends AbstractEdmDeserializer<IsOf> {
+
+ @Override
+ protected IsOf doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final IsOf isof = new IsOf();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Type".equals(jp.getCurrentName())) {
+ isof.setType(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ isof.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ isof.setMaxLength(jp.nextTextValue());
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ isof.setPrecision(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ isof.setScale(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ isof.setSrid(jp.nextTextValue());
+ } else {
+ isof.setValue(jp.getCodec().readValue(jp, DynExprConstruct.class));
+ }
+ }
+ }
+
+ return isof;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElement.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElement.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElement.java
new file mode 100644
index 0000000..cfd4929
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElement.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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = LabeledElementDeserializer.class)
+public class LabeledElement extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 6938971787086282939L;
+
+ private String name;
+
+ private DynExprConstruct value;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public DynExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final DynExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementDeserializer.java
new file mode 100644
index 0000000..ae70f55
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementDeserializer.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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+
+public class LabeledElementDeserializer extends AbstractEdmDeserializer<LabeledElement> {
+
+ @Override
+ protected LabeledElement doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final LabeledElement element = new LabeledElement();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ element.setName(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ element.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ } else {
+ element.setValue(jp.getCodec().readValue(jp, DynExprConstruct.class));
+ }
+ }
+ }
+
+ return element;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementReference.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementReference.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementReference.java
new file mode 100644
index 0000000..c6f3b35
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/LabeledElementReference.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.client.core.edm.v4.annotation;
+
+public class LabeledElementReference extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = 3649068436729494270L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/NavigationPropertyPath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/NavigationPropertyPath.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/NavigationPropertyPath.java
new file mode 100644
index 0000000..8105b3e
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/NavigationPropertyPath.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.client.core.edm.v4.annotation;
+
+public class NavigationPropertyPath extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = -8066400142504963043L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Null.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Null.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Null.java
new file mode 100644
index 0000000..d6d6bb0
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Null.java
@@ -0,0 +1,28 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = NullDeserializer.class)
+public class Null extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = -3611384710172781951L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/NullDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/NullDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/NullDeserializer.java
new file mode 100644
index 0000000..f61ce50
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/NullDeserializer.java
@@ -0,0 +1,49 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+
+public class NullDeserializer extends AbstractEdmDeserializer<Null> {
+
+ @Override
+ protected Null doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Null _null = new Null();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Annotation".equals(jp.getCurrentName())) {
+ _null.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return _null;
+ }
+
+}
[12/14] [OLINGO-169] First huge import from ODataJClient: for the
moment,
it just build (no tests yet) and dummy Edm interfaces are used instead of the
ones from commons-api
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EnumType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EnumType.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EnumType.java
new file mode 100644
index 0000000..854da14
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/EnumType.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.client.api.edm;
+
+import java.util.List;
+
+public interface EnumType {
+
+ String getName();
+
+ void setName(String name);
+
+ String getUnderlyingType();
+
+ void setUnderlyingType(String underlyingType);
+
+ boolean isFlags();
+
+ void setFlags(boolean flags);
+
+ List<? extends Member> getMembers();
+
+ Member getMember(String name);
+
+ Member getMember(Integer value);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/FunctionImport.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/FunctionImport.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/FunctionImport.java
new file mode 100644
index 0000000..3b23a30
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/FunctionImport.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.client.api.edm;
+
+public interface FunctionImport {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Member.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Member.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Member.java
new file mode 100644
index 0000000..8d91cff
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Member.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.api.edm;
+
+public interface Member {
+
+ String getName();
+
+ Integer getValue();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/NavigationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/NavigationProperty.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/NavigationProperty.java
new file mode 100644
index 0000000..1980a5f
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/NavigationProperty.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.client.api.edm;
+
+public interface NavigationProperty {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/NavigationPropertyBinding.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/NavigationPropertyBinding.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/NavigationPropertyBinding.java
new file mode 100644
index 0000000..311e321
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/NavigationPropertyBinding.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.client.api.edm;
+
+public interface NavigationPropertyBinding {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/OnDelete.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/OnDelete.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/OnDelete.java
new file mode 100644
index 0000000..85e1289
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/OnDelete.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.client.api.edm;
+
+public interface OnDelete {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Parameter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Parameter.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Parameter.java
new file mode 100644
index 0000000..e831f51
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Parameter.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.client.api.edm;
+
+public interface Parameter {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Property.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Property.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Property.java
new file mode 100644
index 0000000..6492f87
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Property.java
@@ -0,0 +1,24 @@
+/*
+ * 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.client.api.edm;
+
+public interface Property {
+
+ String getName();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/PropertyRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/PropertyRef.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/PropertyRef.java
new file mode 100644
index 0000000..e79ea84
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/PropertyRef.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.client.api.edm;
+
+public interface PropertyRef {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Schema.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Schema.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Schema.java
new file mode 100644
index 0000000..83abf79
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/Schema.java
@@ -0,0 +1,79 @@
+/*
+ * 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.client.api.edm;
+
+import org.apache.olingo.odata4.client.api.edm.v3.Annotations;
+import java.util.List;
+
+public interface Schema {
+
+ String getNamespace();
+
+ void setNamespace(String namespace);
+
+ String getAlias();
+
+ void setAlias(String alias);
+
+ List<? extends EntityType> getEntityTypes();
+
+ List<? extends EnumType> getEnumTypes();
+
+ EnumType getEnumType(String name);
+
+ List<? extends Annotations> getAnnotationsList();
+
+ Annotations getAnnotationsList(String target);
+
+ List<? extends ComplexType> getComplexTypes();
+
+ List<? extends EntityContainer> getEntityContainers();
+
+ /**
+ * Gets default entity container.
+ *
+ * @return default entity container.
+ */
+ EntityContainer getDefaultEntityContainer();
+
+ /**
+ * Gets entity container with the given name.
+ *
+ * @param name name.
+ * @return entity container.
+ */
+ EntityContainer getEntityContainer(String name);
+
+ /**
+ * Gets entity type with the given name.
+ *
+ * @param name name.
+ * @return entity type.
+ */
+ EntityType getEntityType(String name);
+
+ /**
+ * Gets complex type with the given name.
+ *
+ * @param name name.
+ * @return complex type.
+ */
+ ComplexType getComplexType(String name);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Annotations.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Annotations.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Annotations.java
new file mode 100644
index 0000000..893894c
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Annotations.java
@@ -0,0 +1,24 @@
+/*
+ * 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.client.api.edm.v3;
+
+public interface Annotations {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Association.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Association.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Association.java
new file mode 100644
index 0000000..598c268
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Association.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.client.api.edm.v3;
+
+public interface Association {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationEnd.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationEnd.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationEnd.java
new file mode 100644
index 0000000..486ce4b
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationEnd.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.client.api.edm.v3;
+
+public interface AssociationEnd {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationSet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationSet.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationSet.java
new file mode 100644
index 0000000..c186b4b
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationSet.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.client.api.edm.v3;
+
+public interface AssociationSet {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationSetEnd.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationSetEnd.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationSetEnd.java
new file mode 100644
index 0000000..e5da2cf
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/AssociationSetEnd.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.client.api.edm.v3;
+
+public interface AssociationSetEnd {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ParameterMode.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ParameterMode.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ParameterMode.java
new file mode 100644
index 0000000..0d81505
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ParameterMode.java
@@ -0,0 +1,27 @@
+/*
+ * 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.client.api.edm.v3;
+
+public enum ParameterMode {
+
+ In,
+ Out,
+ InOut
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/PropertyValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/PropertyValue.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/PropertyValue.java
new file mode 100644
index 0000000..7fc7ba2
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/PropertyValue.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.client.api.edm.v3;
+
+public interface PropertyValue {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ReferentialConstraint.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ReferentialConstraint.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ReferentialConstraint.java
new file mode 100644
index 0000000..146ea4f
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ReferentialConstraint.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.client.api.edm.v3;
+
+public interface ReferentialConstraint {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/TypeAnnotation.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/TypeAnnotation.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/TypeAnnotation.java
new file mode 100644
index 0000000..c72b663
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/TypeAnnotation.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.client.api.edm.v3;
+
+public interface TypeAnnotation {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Using.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Using.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Using.java
new file mode 100644
index 0000000..d4d965c
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/Using.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.client.api.edm.v3;
+
+public interface Using {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ValueAnnotation.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ValueAnnotation.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ValueAnnotation.java
new file mode 100644
index 0000000..42e1a1c
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ValueAnnotation.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.client.api.edm.v3;
+
+public interface ValueAnnotation {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ValueTerm.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ValueTerm.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ValueTerm.java
new file mode 100644
index 0000000..84cb65d
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v3/ValueTerm.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.client.api.edm.v3;
+
+public interface ValueTerm {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Action.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Action.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Action.java
new file mode 100644
index 0000000..d967ec1
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Action.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.client.api.edm.v4;
+
+public interface Action {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ActionImport.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ActionImport.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ActionImport.java
new file mode 100644
index 0000000..23731f1
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ActionImport.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.client.api.edm.v4;
+
+public interface ActionImport {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotation.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotation.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotation.java
new file mode 100644
index 0000000..a59cbc8
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotation.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.client.api.edm.v4;
+
+public interface Annotation {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotations.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotations.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotations.java
new file mode 100644
index 0000000..b92b649
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Annotations.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.client.api.edm.v4;
+
+public interface Annotations {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/CSDLElement.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/CSDLElement.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/CSDLElement.java
new file mode 100644
index 0000000..b29e4e4
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/CSDLElement.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.client.api.edm.v4;
+
+public enum CSDLElement {
+
+ ActionImport,
+ ComplexType,
+ EntityContainer,
+ EntitySet,
+ EntityType,
+ EnumType,
+ FunctionImport,
+ Member,
+ NavigationProperty,
+ Property,
+ Singleton,
+ Term,
+ TypeDefinition
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Include.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Include.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Include.java
new file mode 100644
index 0000000..7a777b9
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Include.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.client.api.edm.v4;
+
+public interface Include {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/IncludeAnnotations.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/IncludeAnnotations.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/IncludeAnnotations.java
new file mode 100644
index 0000000..0458260
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/IncludeAnnotations.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.client.api.edm.v4;
+
+public interface IncludeAnnotations {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/OnDeleteAction.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/OnDeleteAction.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/OnDeleteAction.java
new file mode 100644
index 0000000..6116df0
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/OnDeleteAction.java
@@ -0,0 +1,28 @@
+/*
+ * 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.client.api.edm.v4;
+
+public enum OnDeleteAction {
+
+ Cascade,
+ None,
+ SetNull,
+ SetDefault;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Reference.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Reference.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Reference.java
new file mode 100644
index 0000000..9ef0556
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Reference.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.client.api.edm.v4;
+
+public interface Reference {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ReferentialConstraint.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ReferentialConstraint.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ReferentialConstraint.java
new file mode 100644
index 0000000..f6aa5a6
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ReferentialConstraint.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.client.api.edm.v4;
+
+public interface ReferentialConstraint {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ReturnType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ReturnType.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ReturnType.java
new file mode 100644
index 0000000..b2dbc2b
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/ReturnType.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.client.api.edm.v4;
+
+public interface ReturnType {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Singleton.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Singleton.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Singleton.java
new file mode 100644
index 0000000..154303a
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Singleton.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.client.api.edm.v4;
+
+public interface Singleton {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Term.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Term.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Term.java
new file mode 100644
index 0000000..6c01571
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/Term.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.client.api.edm.v4;
+
+public interface Term {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/TypeDefinition.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/TypeDefinition.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/TypeDefinition.java
new file mode 100644
index 0000000..128507c
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/edm/v4/TypeDefinition.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.client.api.edm.v4;
+
+public interface TypeDefinition {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataFormat.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataFormat.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataFormat.java
new file mode 100644
index 0000000..939c5a0
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataFormat.java
@@ -0,0 +1,97 @@
+/*
+ * 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.client.api.format;
+
+import org.apache.http.entity.ContentType;
+
+/**
+ * Available formats to be used in various contexts.
+ */
+public enum ODataFormat {
+
+ /**
+ * JSON format with no metadata.
+ */
+ JSON_NO_METADATA(ContentType.APPLICATION_JSON.getMimeType() + ";odata=nometadata"),
+ /**
+ * JSON format with minimal metadata (default).
+ */
+ JSON(ContentType.APPLICATION_JSON.getMimeType() + ";odata=minimalmetadata"),
+ /**
+ * JSON format with no metadata.
+ */
+ JSON_FULL_METADATA(ContentType.APPLICATION_JSON.getMimeType() + ";odata=fullmetadata"),
+ /**
+ * XML format.
+ */
+ XML(ContentType.APPLICATION_XML.getMimeType());
+
+ private final String format;
+
+ ODataFormat(final String format) {
+ this.format = format;
+ }
+
+ /**
+ * Gets format as a string.
+ *
+ * @return format as a string.
+ */
+ @Override
+ public String toString() {
+ return format;
+ }
+
+ /**
+ * Gets OData format from its string representation.
+ *
+ * @param format string representation of the format.
+ * @return OData format.
+ */
+ public static ODataFormat fromString(final String format) {
+ ODataFormat result = null;
+
+ final StringBuffer _format = new StringBuffer();
+
+ final String[] parts = format.split(";");
+ _format.append(parts[0]);
+ if (ContentType.APPLICATION_JSON.getMimeType().equals(parts[0])) {
+ if (parts.length > 1) {
+ _format.append(';').append(parts[1]);
+ } else {
+ result = ODataFormat.JSON;
+ }
+ }
+
+ if (result == null) {
+ final String candidate = _format.toString();
+ for (ODataFormat value : values()) {
+ if (candidate.equals(value.toString())) {
+ result = value;
+ }
+ }
+ }
+
+ if (result == null) {
+ throw new IllegalArgumentException("Unsupported format: " + format);
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataMediaFormat.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataMediaFormat.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataMediaFormat.java
new file mode 100644
index 0000000..415c669
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataMediaFormat.java
@@ -0,0 +1,71 @@
+/*
+ * 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.client.api.format;
+
+import org.apache.http.entity.ContentType;
+
+/**
+ * Available formats for media.
+ */
+public enum ODataMediaFormat {
+
+ CHARSET_PARAMETER("charset"),
+ MEDIA_TYPE_WILDCARD("*"),
+ WILDCARD("*/*"),
+ APPLICATION_XML(ContentType.APPLICATION_XML.getMimeType()),
+ APPLICATION_ATOM_XML(ContentType.APPLICATION_ATOM_XML.getMimeType()),
+ APPLICATION_XHTML_XML(ContentType.APPLICATION_XHTML_XML.getMimeType()),
+ APPLICATION_SVG_XML(ContentType.APPLICATION_SVG_XML.getMimeType()),
+ APPLICATION_JSON(ContentType.APPLICATION_JSON.getMimeType()),
+ APPLICATION_FORM_URLENCODED(ContentType.APPLICATION_FORM_URLENCODED.getMimeType()),
+ MULTIPART_FORM_DATA(ContentType.MULTIPART_FORM_DATA.getMimeType()),
+ APPLICATION_OCTET_STREAM(ContentType.APPLICATION_OCTET_STREAM.getMimeType()),
+ TEXT_PLAIN(ContentType.TEXT_PLAIN.getMimeType()),
+ TEXT_XML(ContentType.TEXT_XML.getMimeType()),
+ TEXT_HTML(ContentType.TEXT_HTML.getMimeType());
+
+ private final String format;
+
+ private ODataMediaFormat(final String format) {
+ this.format = format;
+ }
+
+ @Override
+ public String toString() {
+ return format;
+ }
+
+ public static ODataMediaFormat fromFormat(final String format) {
+ final String _format = format.split(";")[0];
+
+ ODataMediaFormat result = null;
+
+ for (ODataMediaFormat value : values()) {
+ if (_format.equals(value.toString())) {
+ result = value;
+ }
+ }
+
+ if (result == null) {
+ throw new IllegalArgumentException("Unsupported format: " + format);
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataPubFormat.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataPubFormat.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataPubFormat.java
new file mode 100644
index 0000000..10ef838
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataPubFormat.java
@@ -0,0 +1,97 @@
+/*
+ * 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.client.api.format;
+
+import org.apache.http.entity.ContentType;
+
+/**
+ * Available formats for AtomPub exchange.
+ */
+public enum ODataPubFormat {
+
+ /**
+ * JSON format with no metadata.
+ */
+ JSON_NO_METADATA(ContentType.APPLICATION_JSON.getMimeType() + ";odata=nometadata"),
+ /**
+ * JSON format with minimal metadata (default).
+ */
+ JSON(ContentType.APPLICATION_JSON.getMimeType() + ";odata=minimalmetadata"),
+ /**
+ * JSON format with no metadata.
+ */
+ JSON_FULL_METADATA(ContentType.APPLICATION_JSON.getMimeType() + ";odata=fullmetadata"),
+ /**
+ * Atom format.
+ */
+ ATOM(ContentType.APPLICATION_ATOM_XML.getMimeType());
+
+ private final String format;
+
+ ODataPubFormat(final String format) {
+ this.format = format;
+ }
+
+ /**
+ * Gets format as a string.
+ *
+ * @return format as a string.
+ */
+ @Override
+ public String toString() {
+ return format;
+ }
+
+ /**
+ * Gets OData format from its string representation.
+ *
+ * @param format string representation of the format.
+ * @return OData format.
+ */
+ public static ODataPubFormat fromString(final String format) {
+ ODataPubFormat result = null;
+
+ final StringBuffer _format = new StringBuffer();
+
+ final String[] parts = format.split(";");
+ _format.append(parts[0]);
+ if (ContentType.APPLICATION_JSON.getMimeType().equals(parts[0])) {
+ if (parts.length > 1 && parts[1].startsWith("odata=")) {
+ _format.append(';').append(parts[1]);
+ } else {
+ result = ODataPubFormat.JSON;
+ }
+ }
+
+ if (result == null) {
+ final String candidate = _format.toString();
+ for (ODataPubFormat value : values()) {
+ if (candidate.equals(value.toString())) {
+ result = value;
+ }
+ }
+ }
+
+ if (result == null) {
+ throw new IllegalArgumentException("Unsupported format: " + format);
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataValueFormat.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataValueFormat.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataValueFormat.java
new file mode 100644
index 0000000..b4db6a3
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/format/ODataValueFormat.java
@@ -0,0 +1,76 @@
+/*
+ * 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.client.api.format;
+
+import org.apache.http.entity.ContentType;
+
+/**
+ * Available formats for property values.
+ */
+public enum ODataValueFormat {
+
+ /**
+ * Application octet stream.
+ */
+ STREAM(ContentType.APPLICATION_OCTET_STREAM.getMimeType()),
+ /**
+ * Plain text format.
+ */
+ TEXT(ContentType.TEXT_PLAIN.getMimeType());
+
+ private final String format;
+
+ ODataValueFormat(final String format) {
+ this.format = format;
+ }
+
+ /**
+ * Gets format as a string.
+ *
+ * @return format as a string.
+ */
+ @Override
+ public String toString() {
+ return format;
+ }
+
+ /**
+ * Gets format from its string representation.
+ *
+ * @param format string representation of the format.
+ * @return OData format.
+ */
+ public static ODataValueFormat fromString(final String format) {
+ final String _format = format.split(";")[0];
+
+ ODataValueFormat result = null;
+
+ for (ODataValueFormat value : values()) {
+ if (_format.equals(value.toString())) {
+ result = value;
+ }
+ }
+
+ if (result == null) {
+ throw new IllegalArgumentException("Unsupported format: " + format);
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpClientException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpClientException.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpClientException.java
new file mode 100644
index 0000000..9261059
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpClientException.java
@@ -0,0 +1,68 @@
+/*
+ * 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.client.api.http;
+
+/**
+ * A client-side processing runtime exception.
+ *
+ * The exception is thrown during HTTP request invocation processing, to signal a failure to process the HTTP request or
+ * response. The exception message or nested {@link Throwable} cause SHOULD contain additional information about the
+ * reason of the processing failure.
+ */
+public class HttpClientException extends RuntimeException {
+
+ private static final long serialVersionUID = -4232431597816056514L;
+
+ /**
+ * Constructs a new client-side runtime exception with the specified cause and a detail message of
+ * {@code (cause==null ? null : cause.toString())} (which typically contains the class and detail message of
+ * {@code cause}). This constructor is useful for runtime exceptions that are little more than wrappers for other
+ * throwables.
+ *
+ * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null}
+ * value is permitted, and indicates that the cause is nonexistent or unknown.)
+ */
+ public HttpClientException(final Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new client-side runtime exception with the specified detail message and cause.
+ * <br/>
+ * Note that the detail message associated with {@code cause} is <i>not</i>
+ * automatically incorporated in this runtime exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null}
+ * value is permitted, and indicates that the cause is nonexistent or unknown.)
+ */
+ public HttpClientException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new client-side runtime exception with the specified detail message. The cause is not initialized, and
+ * may subsequently be initialized by a call to {@link #initCause}.
+ *
+ * @param message the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
+ */
+ public HttpClientException(final String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpClientFactory.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpClientFactory.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpClientFactory.java
new file mode 100644
index 0000000..e73f1b4
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpClientFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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.client.api.http;
+
+import java.net.URI;
+import org.apache.http.client.HttpClient;
+
+/**
+ * Interface used by ODataRequest implementations to instantiate HttpClient.
+ */
+public interface HttpClientFactory {
+
+ HttpClient createHttpClient(HttpMethod method, URI uri);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpMethod.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpMethod.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpMethod.java
new file mode 100644
index 0000000..266b52b
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpMethod.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.api.http;
+
+/**
+ * Supported HTTP methods.
+ */
+public enum HttpMethod {
+
+ GET,
+ POST,
+ PUT,
+ PATCH,
+ MERGE,
+ DELETE;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpUriRequestFactory.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpUriRequestFactory.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpUriRequestFactory.java
new file mode 100644
index 0000000..c36e26a
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/HttpUriRequestFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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.client.api.http;
+
+import java.net.URI;
+import org.apache.http.client.methods.HttpUriRequest;
+
+/**
+ * Interface used by ODataRequest implementations to create the HttpUriRequest.
+ */
+public interface HttpUriRequestFactory {
+
+ HttpUriRequest createHttpUriRequest(HttpMethod method, URI uri);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/NoContentException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/NoContentException.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/NoContentException.java
new file mode 100644
index 0000000..e202234
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/http/NoContentException.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.api.http;
+
+import org.apache.http.HttpStatus;
+
+/**
+ * Exception to be thrown when trying to read content with HTTP status 204.
+ */
+public class NoContentException extends HttpClientException {
+
+ private static final long serialVersionUID = 7947066635285809192L;
+
+ /**
+ * Constructs a new client-side runtime exception, with fixed message.
+ */
+ public NoContentException() {
+ super("No content found when HTTP status is " + HttpStatus.SC_NO_CONTENT);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/pom.xml
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/pom.xml b/odata4-lib/odata4-client-core/pom.xml
index 1a4a4b2..eff6a18 100644
--- a/odata4-lib/odata4-client-core/pom.xml
+++ b/odata4-lib/odata4-client-core/pom.xml
@@ -45,7 +45,21 @@
<artifactId>olingo-odata4-commons-core-incubating</artifactId>
<version>${project.version}</version>
</dependency>
-
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
@@ -58,7 +72,20 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml</groupId>
+ <artifactId>aalto-xml</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
[08/14] [OLINGO-169] First huge import from ODataJClient: for the
moment,
it just build (no tests yet) and dummy Edm interfaces are used instead of the
ones from commons-api
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/PropertyRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/PropertyRefImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/PropertyRefImpl.java
new file mode 100644
index 0000000..f31b1a1
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/PropertyRefImpl.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.client.core.edm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.PropertyRef;
+
+public class PropertyRefImpl extends AbstractEdmItem implements PropertyRef {
+
+ private static final long serialVersionUID = 6738212067449628983L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ @JsonProperty(value = "Alias")
+ private String alias;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(final String alias) {
+ this.alias = alias;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AnnotationsDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AnnotationsDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AnnotationsDeserializer.java
new file mode 100644
index 0000000..77ae3a9
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AnnotationsDeserializer.java
@@ -0,0 +1,55 @@
+/*
+ * 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.client.core.edm.v3;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class AnnotationsDeserializer extends AbstractEdmDeserializer<AnnotationsImpl> {
+
+ @Override
+ protected AnnotationsImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AnnotationsImpl annotations = new AnnotationsImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Target".equals(jp.getCurrentName())) {
+ annotations.setTarget(jp.nextTextValue());
+ } else if ("Qualifier".equals(jp.getCurrentName())) {
+ annotations.setQualifier(jp.nextTextValue());
+ } else if ("typeAnnotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ annotations.getTypeAnnotations().add(jp.getCodec().readValue(jp, TypeAnnotationImpl.class));
+ } else if ("ValueAnnotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ annotations.getValueAnnotations().add(jp.getCodec().readValue(jp, ValueAnnotationImpl.class));
+ }
+ }
+ }
+
+ return annotations;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AnnotationsImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AnnotationsImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AnnotationsImpl.java
new file mode 100644
index 0000000..0057dca
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AnnotationsImpl.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.client.core.edm.v3;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.core.edm.AbstractAnnotations;
+
+@JsonDeserialize(using = AnnotationsDeserializer.class)
+public class AnnotationsImpl extends AbstractAnnotations {
+
+ private static final long serialVersionUID = 3877353656301805410L;
+
+ private final List<TypeAnnotationImpl> typeAnnotations = new ArrayList<TypeAnnotationImpl>();
+
+ private final List<ValueAnnotationImpl> valueAnnotations = new ArrayList<ValueAnnotationImpl>();
+
+ public List<TypeAnnotationImpl> getTypeAnnotations() {
+ return typeAnnotations;
+ }
+
+ public List<ValueAnnotationImpl> getValueAnnotations() {
+ return valueAnnotations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationDeserializer.java
new file mode 100644
index 0000000..8700490
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationDeserializer.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.client.core.edm.v3;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class AssociationDeserializer extends AbstractEdmDeserializer<AssociationImpl> {
+
+ @Override
+ protected AssociationImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AssociationImpl association = new AssociationImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ association.setName(jp.nextTextValue());
+ } else if ("ReferentialConstraint".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ association.setReferentialConstraint(jp.getCodec().readValue(jp, ReferentialConstraintImpl.class));
+ } else if ("End".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ association.getEnds().add(jp.getCodec().readValue(jp, AssociationEndImpl.class));
+ }
+ }
+ }
+
+ return association;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationEndImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationEndImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationEndImpl.java
new file mode 100644
index 0000000..ea3b40e
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationEndImpl.java
@@ -0,0 +1,73 @@
+/*
+ * 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.client.core.edm.v3;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.OnDelete;
+import org.apache.olingo.odata4.client.api.edm.v3.AssociationEnd;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class AssociationEndImpl extends AbstractEdmItem implements AssociationEnd {
+
+ private static final long serialVersionUID = 3305394053564979376L;
+
+ @JsonProperty(value = "Type", required = true)
+ private String type;
+
+ @JsonProperty(value = "Role")
+ private String role;
+
+ @JsonProperty(value = "Multiplicity")
+ private String multiplicity;
+
+ @JsonProperty(value = "OnDelete")
+ private OnDelete onDelete;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(final String role) {
+ this.role = role;
+ }
+
+ public String getMultiplicity() {
+ return multiplicity;
+ }
+
+ public void setMultiplicity(final String multiplicity) {
+ this.multiplicity = multiplicity;
+ }
+
+ public OnDelete getOnDelete() {
+ return onDelete;
+ }
+
+ public void setOnDelete(final OnDelete onDelete) {
+ this.onDelete = onDelete;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationImpl.java
new file mode 100644
index 0000000..edd69a9
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationImpl.java
@@ -0,0 +1,61 @@
+/*
+ * 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.client.core.edm.v3;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v3.ReferentialConstraint;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+@JsonDeserialize(using = AssociationDeserializer.class)
+public class AssociationImpl extends AbstractEdmItem {
+
+ private static final long serialVersionUID = 73763231919532482L;
+
+ private String name;
+
+ private ReferentialConstraint referentialConstraint;
+
+ private List<AssociationEndImpl> ends = new ArrayList<AssociationEndImpl>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public ReferentialConstraint getReferentialConstraint() {
+ return referentialConstraint;
+ }
+
+ public void setReferentialConstraint(final ReferentialConstraint referentialConstraint) {
+ this.referentialConstraint = referentialConstraint;
+ }
+
+ public List<AssociationEndImpl> getEnds() {
+ return ends;
+ }
+
+ public void setEnds(final List<AssociationEndImpl> ends) {
+ this.ends = ends;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetDeserializer.java
new file mode 100644
index 0000000..ea23648
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetDeserializer.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v3;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class AssociationSetDeserializer extends AbstractEdmDeserializer<AssociationSetImpl> {
+
+ @Override
+ protected AssociationSetImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AssociationSetImpl associationSet = new AssociationSetImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ associationSet.setName(jp.nextTextValue());
+ } else if ("Association".equals(jp.getCurrentName())) {
+ associationSet.setAssociation(jp.nextTextValue());
+ } else if ("End".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ associationSet.getEnds().add(jp.getCodec().readValue(jp, AssociationSetEndImpl.class));
+ }
+ }
+ }
+
+ return associationSet;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetEndImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetEndImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetEndImpl.java
new file mode 100644
index 0000000..8eca2a6
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetEndImpl.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.client.core.edm.v3;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v3.AssociationSetEnd;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class AssociationSetEndImpl extends AbstractEdmItem implements AssociationSetEnd {
+
+ private static final long serialVersionUID = -6238344152962217446L;
+
+ @JsonProperty("Role")
+ private String role;
+
+ @JsonProperty(value = "EntitySet", required = true)
+ private String entitySet;
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(final String role) {
+ this.role = role;
+ }
+
+ public String getEntitySet() {
+ return entitySet;
+ }
+
+ public void setEntitySet(final String entitySet) {
+ this.entitySet = entitySet;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetImpl.java
new file mode 100644
index 0000000..06a603a
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/AssociationSetImpl.java
@@ -0,0 +1,57 @@
+/*
+ * 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.client.core.edm.v3;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v3.AssociationSet;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+@JsonDeserialize(using = AssociationSetDeserializer.class)
+public class AssociationSetImpl extends AbstractEdmItem implements AssociationSet {
+
+ private static final long serialVersionUID = 1248430921598774799L;
+
+ private String name;
+
+ private String association;
+
+ private List<AssociationSetEndImpl> ends = new ArrayList<AssociationSetEndImpl>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getAssociation() {
+ return association;
+ }
+
+ public void setAssociation(final String association) {
+ this.association = association;
+ }
+
+ public List<AssociationSetEndImpl> getEnds() {
+ return ends;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ComplexTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ComplexTypeImpl.java
new file mode 100644
index 0000000..044afa2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ComplexTypeImpl.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.client.core.edm.v3;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.ComplexType;
+import org.apache.olingo.odata4.client.api.edm.Property;
+import org.apache.olingo.odata4.client.core.edm.AbstractComplexType;
+
+public class ComplexTypeImpl extends AbstractComplexType implements ComplexType {
+
+ private static final long serialVersionUID = -1251230308269425962L;
+
+ private final List<Property> properties = new ArrayList<Property>();
+
+ @Override
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public Property getProperty(final String name) {
+ Property result = null;
+ for (Property property : getProperties()) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/DataServicesImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/DataServicesImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/DataServicesImpl.java
new file mode 100644
index 0000000..4272b2c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/DataServicesImpl.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.client.core.edm.v3;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.core.edm.AbstractDataServices;
+
+public class DataServicesImpl extends AbstractDataServices<
+ SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl> {
+
+ private static final long serialVersionUID = 633129618050875211L;
+
+ private final List<SchemaImpl> schemas = new ArrayList<SchemaImpl>();
+
+ @Override
+ public List<SchemaImpl> getSchemas() {
+ return schemas;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.java
new file mode 100644
index 0000000..29c6f0b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.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.client.core.edm.v3;
+
+import java.io.InputStream;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmMetadata;
+
+public class EdmMetadataImpl extends AbstractEdmMetadata<
+ EdmxImpl, DataServicesImpl, SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl,
+ FunctionImportImpl> {
+
+ private static final long serialVersionUID = -7765327879691528010L;
+
+ public EdmMetadataImpl(final ODataClient client, final InputStream inputStream) {
+ super(client, inputStream);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmxImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmxImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmxImpl.java
new file mode 100644
index 0000000..b9ebbc1
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmxImpl.java
@@ -0,0 +1,28 @@
+/*
+ * 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.client.core.edm.v3;
+
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmx;
+
+public class EdmxImpl extends AbstractEdmx<
+ DataServicesImpl, SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl> {
+
+ private static final long serialVersionUID = -8031883176876401375L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityContainerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityContainerImpl.java
new file mode 100644
index 0000000..f97b97e
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityContainerImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.client.core.edm.v3;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.core.edm.AbstractEntityContainer;
+
+public class EntityContainerImpl extends AbstractEntityContainer<FunctionImportImpl> {
+
+ private static final long serialVersionUID = 8934431875078180370L;
+
+ private final List<EntitySetImpl> entitySets = new ArrayList<EntitySetImpl>();
+
+ private final List<AssociationSetImpl> associationSets = new ArrayList<AssociationSetImpl>();
+
+ private final List<FunctionImportImpl> functionImports = new ArrayList<FunctionImportImpl>();
+
+ @Override
+ public List<EntitySetImpl> getEntitySets() {
+ return entitySets;
+ }
+
+ @Override
+ public EntitySetImpl getEntitySet(final String name) {
+ EntitySetImpl result = null;
+ for (EntitySetImpl entitySet : getEntitySets()) {
+ if (name.equals(entitySet.getName())) {
+ result = entitySet;
+ }
+ }
+ return result;
+ }
+
+ public List<AssociationSetImpl> getAssociationSets() {
+ return associationSets;
+ }
+
+ @Override
+ public List<FunctionImportImpl> getFunctionImports() {
+ return functionImports;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntitySetImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntitySetImpl.java
new file mode 100644
index 0000000..c5ce28b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntitySetImpl.java
@@ -0,0 +1,27 @@
+/*
+ * 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.client.core.edm.v3;
+
+import org.apache.olingo.odata4.client.core.edm.AbstractEntitySet;
+
+public class EntitySetImpl extends AbstractEntitySet {
+
+ private static final long serialVersionUID = 5570833733884884012L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityTypeImpl.java
new file mode 100644
index 0000000..7622f04
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EntityTypeImpl.java
@@ -0,0 +1,65 @@
+/*
+ * 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.client.core.edm.v3;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.core.edm.AbstractEntityType;
+
+public class EntityTypeImpl extends AbstractEntityType {
+
+ private static final long serialVersionUID = 8727765036150269547L;
+
+ private final List<PropertyImpl> properties = new ArrayList<PropertyImpl>();
+
+ private final List<NavigationPropertyImpl> navigationProperties = new ArrayList<NavigationPropertyImpl>();
+
+ @Override
+ public List<PropertyImpl> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public PropertyImpl getProperty(final String name) {
+ PropertyImpl result = null;
+ for (PropertyImpl property : getProperties()) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public List<NavigationPropertyImpl> getNavigationProperties() {
+ return navigationProperties;
+ }
+
+ @Override
+ public NavigationPropertyImpl getNavigationProperty(final String name) {
+ NavigationPropertyImpl result = null;
+ for (NavigationPropertyImpl property : getNavigationProperties()) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ return result;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EnumTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EnumTypeImpl.java
new file mode 100644
index 0000000..45f38cb
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EnumTypeImpl.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v3;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.core.edm.AbstractEnumType;
+
+public class EnumTypeImpl extends AbstractEnumType {
+
+ private static final long serialVersionUID = 8967396195669128419L;
+
+ private final List<MemberImpl> members = new ArrayList<MemberImpl>();
+
+ @Override
+ public List<MemberImpl> getMembers() {
+ return members;
+ }
+
+ @Override
+ public MemberImpl getMember(final String name) {
+ MemberImpl result = null;
+ for (MemberImpl member : getMembers()) {
+ if (name.equals(member.getName())) {
+ result = member;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public MemberImpl getMember(final Integer value) {
+ MemberImpl result = null;
+ for (MemberImpl member : getMembers()) {
+ if (value.equals(member.getValue())) {
+ result = member;
+ }
+ }
+ return result;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/FunctionImportDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/FunctionImportDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/FunctionImportDeserializer.java
new file mode 100644
index 0000000..1fbc2b7
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/FunctionImportDeserializer.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v3;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class FunctionImportDeserializer extends AbstractEdmDeserializer<FunctionImportImpl> {
+
+ @Override
+ protected FunctionImportImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final FunctionImportImpl funcImp = new FunctionImportImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ funcImp.setName(jp.nextTextValue());
+ } else if ("ReturnType".equals(jp.getCurrentName())) {
+ funcImp.setReturnType(jp.nextTextValue());
+ } else if ("EntitySet".equals(jp.getCurrentName())) {
+ funcImp.setEntitySet(jp.nextTextValue());
+ } else if ("EntitySetPath".equals(jp.getCurrentName())) {
+ funcImp.setEntitySetPath(jp.nextTextValue());
+ } else if ("IsComposable".equals(jp.getCurrentName())) {
+ funcImp.setComposable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("IsSideEffecting".equals(jp.getCurrentName())) {
+ funcImp.setSideEffecting(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("IsBindable".equals(jp.getCurrentName())) {
+ funcImp.setBindable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("IsAlwaysBindable".equals(jp.getCurrentName())) {
+ funcImp.setAlwaysBindable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("HttpMethod".equals(jp.getCurrentName())) {
+ funcImp.setHttpMethod(jp.nextTextValue());
+ } else if ("Parameter".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ funcImp.getParameters().add(jp.getCodec().readValue(jp, ParameterImpl.class));
+ }
+ }
+ }
+
+ return funcImp;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/FunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/FunctionImportImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/FunctionImportImpl.java
new file mode 100644
index 0000000..bbdc314
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/FunctionImportImpl.java
@@ -0,0 +1,129 @@
+/*
+ * 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.client.core.edm.v3;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.core.edm.AbstractFunctionImport;
+
+@JsonDeserialize(using = FunctionImportDeserializer.class)
+public class FunctionImportImpl extends AbstractFunctionImport {
+
+ private static final long serialVersionUID = -6214472528425935461L;
+
+ private String name;
+
+ private String returnType;
+
+ private String entitySet;
+
+ private String entitySetPath;
+
+ private boolean composable;
+
+ private boolean sideEffecting = true;
+
+ private boolean bindable;
+
+ private boolean alwaysBindable;
+
+ private String httpMethod;
+
+ private final List<ParameterImpl> parameters = new ArrayList<ParameterImpl>();
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getReturnType() {
+ return returnType;
+ }
+
+ public void setReturnType(final String returnType) {
+ this.returnType = returnType;
+ }
+
+ @Override
+ public String getEntitySet() {
+ return entitySet;
+ }
+
+ public void setEntitySet(final String entitySet) {
+ this.entitySet = entitySet;
+ }
+
+ public String getEntitySetPath() {
+ return entitySetPath;
+ }
+
+ public void setEntitySetPath(final String entitySetPath) {
+ this.entitySetPath = entitySetPath;
+ }
+
+ public boolean isComposable() {
+ return composable;
+ }
+
+ public void setComposable(final boolean composable) {
+ this.composable = composable;
+ }
+
+ public boolean isSideEffecting() {
+ return sideEffecting;
+ }
+
+ public void setSideEffecting(final boolean sideEffecting) {
+ this.sideEffecting = sideEffecting;
+ }
+
+ public boolean isBindable() {
+ return bindable;
+ }
+
+ public void setBindable(final boolean bindable) {
+ this.bindable = bindable;
+ }
+
+ public boolean isAlwaysBindable() {
+ return alwaysBindable;
+ }
+
+ public void setAlwaysBindable(final boolean alwaysBindable) {
+ this.alwaysBindable = alwaysBindable;
+ }
+
+ public String getHttpMethod() {
+ return httpMethod;
+ }
+
+ public void setHttpMethod(final String httpMethod) {
+ this.httpMethod = httpMethod;
+ }
+
+ public List<ParameterImpl> getParameters() {
+ return parameters;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/MemberImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/MemberImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/MemberImpl.java
new file mode 100644
index 0000000..f1092e5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/MemberImpl.java
@@ -0,0 +1,28 @@
+/*
+ * 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.client.core.edm.v3;
+
+import org.apache.olingo.odata4.client.api.edm.Member;
+import org.apache.olingo.odata4.client.core.edm.AbstractMember;
+
+public class MemberImpl extends AbstractMember implements Member {
+
+ private static final long serialVersionUID = 6605381518349837929L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/NavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/NavigationPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/NavigationPropertyImpl.java
new file mode 100644
index 0000000..306950e
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/NavigationPropertyImpl.java
@@ -0,0 +1,61 @@
+/*
+ * 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.client.core.edm.v3;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.core.edm.AbstractNavigationProperty;
+
+public class NavigationPropertyImpl extends AbstractNavigationProperty {
+
+ private static final long serialVersionUID = -2889417442815563307L;
+
+ @JsonProperty(value = "Relationship", required = true)
+ private String relationship;
+
+ @JsonProperty(value = "ToRole", required = true)
+ private String toRole;
+
+ @JsonProperty(value = "FromRole", required = true)
+ private String fromRole;
+
+ public String getRelationship() {
+ return relationship;
+ }
+
+ public void setRelationship(final String relationship) {
+ this.relationship = relationship;
+ }
+
+ public String getToRole() {
+ return toRole;
+ }
+
+ public void setToRole(final String toRole) {
+ this.toRole = toRole;
+ }
+
+ public String getFromRole() {
+ return fromRole;
+ }
+
+ public void setFromRole(final String fromRole) {
+ this.fromRole = fromRole;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ParameterImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ParameterImpl.java
new file mode 100644
index 0000000..55fb720
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ParameterImpl.java
@@ -0,0 +1,40 @@
+/*
+ * 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.client.core.edm.v3;
+
+import org.apache.olingo.odata4.client.api.edm.v3.ParameterMode;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.core.edm.AbstractParameter;
+
+public class ParameterImpl extends AbstractParameter {
+
+ private static final long serialVersionUID = 7596724999614891358L;
+
+ @JsonProperty("Mode")
+ private ParameterMode mode;
+
+ public ParameterMode getMode() {
+ return mode;
+ }
+
+ public void setMode(final ParameterMode mode) {
+ this.mode = mode;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/PropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/PropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/PropertyImpl.java
new file mode 100644
index 0000000..f7b8f5c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/PropertyImpl.java
@@ -0,0 +1,27 @@
+/*
+ * 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.client.core.edm.v3;
+
+import org.apache.olingo.odata4.client.core.edm.AbstractProperty;
+
+public class PropertyImpl extends AbstractProperty {
+
+ private static final long serialVersionUID = 6224524803474652100L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/PropertyValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/PropertyValueImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/PropertyValueImpl.java
new file mode 100644
index 0000000..a3607a6
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/PropertyValueImpl.java
@@ -0,0 +1,119 @@
+/*
+ * 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.client.core.edm.v3;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+import org.apache.olingo.odata4.client.api.edm.v3.PropertyValue;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class PropertyValueImpl extends AbstractEdmItem implements PropertyValue {
+
+ private static final long serialVersionUID = -6580934436491418564L;
+
+ @JsonProperty(value = "Property", required = true)
+ private String property;
+
+ @JsonProperty("Path")
+ private String path;
+
+ @JsonProperty("String")
+ private String string;
+
+ @JsonProperty("Int")
+ private BigInteger _int;
+
+ @JsonProperty("Float")
+ private Double _float;
+
+ @JsonProperty("Decimal")
+ private BigDecimal decimal;
+
+ @JsonProperty("Bool")
+ private Boolean bool;
+
+ @JsonProperty("DateTime")
+ private Date dateTime;
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(final String property) {
+ this.property = property;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(final String path) {
+ this.path = path;
+ }
+
+ public String getString() {
+ return string;
+ }
+
+ public void setString(final String string) {
+ this.string = string;
+ }
+
+ public BigInteger getInt() {
+ return _int;
+ }
+
+ public void setInt(final BigInteger _int) {
+ this._int = _int;
+ }
+
+ public Double getFloat() {
+ return _float;
+ }
+
+ public void setFloat(final Double _float) {
+ this._float = _float;
+ }
+
+ public BigDecimal getDecimal() {
+ return decimal;
+ }
+
+ public void setDecimal(final BigDecimal decimal) {
+ this.decimal = decimal;
+ }
+
+ public Boolean getBool() {
+ return bool;
+ }
+
+ public void setBool(final Boolean bool) {
+ this.bool = bool;
+ }
+
+ public Date getDateTime() {
+ return dateTime;
+ }
+
+ public void setDateTime(final Date dateTime) {
+ this.dateTime = dateTime;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintImpl.java
new file mode 100644
index 0000000..c03bea7
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintImpl.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.client.core.edm.v3;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v3.ReferentialConstraint;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class ReferentialConstraintImpl extends AbstractEdmItem implements ReferentialConstraint {
+
+ private static final long serialVersionUID = 9067893732765127269L;
+
+ @JsonProperty(value = "Principal", required = true)
+ private ReferentialConstraintRole principal;
+
+ @JsonProperty(value = "Dependent", required = true)
+ private ReferentialConstraintRole dependent;
+
+ public ReferentialConstraintRole getPrincipal() {
+ return principal;
+ }
+
+ public void setPrincipal(final ReferentialConstraintRole principal) {
+ this.principal = principal;
+ }
+
+ public ReferentialConstraintRole getDependent() {
+ return dependent;
+ }
+
+ public void setDependent(final ReferentialConstraintRole dependent) {
+ this.dependent = dependent;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintRole.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintRole.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintRole.java
new file mode 100644
index 0000000..d274115
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintRole.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.client.core.edm.v3;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.PropertyRef;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+@JsonDeserialize(using = ReferentialConstraintRoleDeserializer.class)
+public class ReferentialConstraintRole extends AbstractEdmItem {
+
+ private static final long serialVersionUID = -3712887115248634164L;
+
+ private String role;
+
+ private List<PropertyRef> propertyRefs = new ArrayList<PropertyRef>();
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(final String role) {
+ this.role = role;
+ }
+
+ public List<PropertyRef> getPropertyRefs() {
+ return propertyRefs;
+ }
+
+ public void setPropertyRefs(final List<PropertyRef> propertyRefs) {
+ this.propertyRefs = propertyRefs;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintRoleDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintRoleDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintRoleDeserializer.java
new file mode 100644
index 0000000..600763c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ReferentialConstraintRoleDeserializer.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.client.core.edm.v3;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.PropertyRefImpl;
+
+public class ReferentialConstraintRoleDeserializer extends AbstractEdmDeserializer<ReferentialConstraintRole> {
+
+ @Override
+ protected ReferentialConstraintRole doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final ReferentialConstraintRole refConstRole = new ReferentialConstraintRole();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Role".equals(jp.getCurrentName())) {
+ refConstRole.setRole(jp.nextTextValue());
+ } else if ("PropertyRef".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ refConstRole.getPropertyRefs().add(jp.getCodec().readValue(jp, PropertyRefImpl.class));
+ }
+ }
+ }
+
+ return refConstRole;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/SchemaImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/SchemaImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/SchemaImpl.java
new file mode 100644
index 0000000..f0436ac
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/SchemaImpl.java
@@ -0,0 +1,138 @@
+/*
+ * 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.client.core.edm.v3;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.Schema;
+import org.apache.olingo.odata4.client.core.edm.AbstractSchema;
+
+public class SchemaImpl extends AbstractSchema<EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl>
+ implements Schema {
+
+ private static final long serialVersionUID = 4453992249818796144L;
+
+ private final List<AnnotationsImpl> annotationList = new ArrayList<AnnotationsImpl>();
+
+ private final List<AssociationImpl> associations = new ArrayList<AssociationImpl>();
+
+ private final List<ComplexTypeImpl> complexTypes = new ArrayList<ComplexTypeImpl>();
+
+ private final List<EntityContainerImpl> entityContainers = new ArrayList<EntityContainerImpl>();
+
+ private final List<EntityTypeImpl> entityTypes = new ArrayList<EntityTypeImpl>();
+
+ private final List<EnumTypeImpl> enumTypes = new ArrayList<EnumTypeImpl>();
+
+ private final List<UsingImpl> usings = new ArrayList<UsingImpl>();
+
+ private final List<ValueTermImpl> valueTerms = new ArrayList<ValueTermImpl>();
+
+ public AssociationImpl getAssociation(final String name) {
+ AssociationImpl result = null;
+ for (AssociationImpl association : getAssociations()) {
+ if (name.equals(association.getName())) {
+ result = association;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public List<AnnotationsImpl> getAnnotationsList() {
+ return annotationList;
+ }
+
+ @Override
+ public AnnotationsImpl getAnnotationsList(final String target) {
+ AnnotationsImpl result = null;
+ for (AnnotationsImpl annots : getAnnotationsList()) {
+ if (target.equals(annots.getTarget())) {
+ result = annots;
+ }
+ }
+ return result;
+ }
+
+ public List<AssociationImpl> getAssociations() {
+ return associations;
+ }
+
+ public List<UsingImpl> getUsings() {
+ return usings;
+ }
+
+ public List<ValueTermImpl> getValueTerms() {
+ return valueTerms;
+ }
+
+ @Override
+ public List<EnumTypeImpl> getEnumTypes() {
+ return enumTypes;
+ }
+
+ @Override
+ public EnumTypeImpl getEnumType(final String name) {
+ EnumTypeImpl result = null;
+ for (EnumTypeImpl type : getEnumTypes()) {
+ if (name.equals(type.getName())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public List<EntityContainerImpl> getEntityContainers() {
+ return entityContainers;
+ }
+
+ @Override
+ public EntityContainerImpl getDefaultEntityContainer() {
+ EntityContainerImpl result = null;
+ for (EntityContainerImpl container : getEntityContainers()) {
+ if (container.isDefaultEntityContainer()) {
+ result = container;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public EntityContainerImpl getEntityContainer(final String name) {
+ EntityContainerImpl result = null;
+ for (EntityContainerImpl container : getEntityContainers()) {
+ if (name.equals(container.getName())) {
+ result = container;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public List<EntityTypeImpl> getEntityTypes() {
+ return entityTypes;
+ }
+
+ @Override
+ public List<ComplexTypeImpl> getComplexTypes() {
+ return complexTypes;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/TypeAnnotationDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/TypeAnnotationDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/TypeAnnotationDeserializer.java
new file mode 100644
index 0000000..58985d3
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/TypeAnnotationDeserializer.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v3;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class TypeAnnotationDeserializer extends AbstractEdmDeserializer<TypeAnnotationImpl> {
+
+ @Override
+ protected TypeAnnotationImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final TypeAnnotationImpl typeAnnot = new TypeAnnotationImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Term".equals(jp.getCurrentName())) {
+ typeAnnot.setTerm(jp.nextTextValue());
+ } else if ("Qualifier".equals(jp.getCurrentName())) {
+ typeAnnot.setQualifier(jp.nextTextValue());
+ } else if ("PropertyValue".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ typeAnnot.getPropertyValues().add(jp.getCodec().readValue(jp, PropertyValueImpl.class));
+ }
+ }
+ }
+
+ return typeAnnot;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/TypeAnnotationImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/TypeAnnotationImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/TypeAnnotationImpl.java
new file mode 100644
index 0000000..23a2586
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/TypeAnnotationImpl.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v3;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v3.TypeAnnotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+@JsonDeserialize(using = TypeAnnotationDeserializer.class)
+public class TypeAnnotationImpl extends AbstractEdmItem implements TypeAnnotation {
+
+ private static final long serialVersionUID = -7585489230017331877L;
+
+ private String term;
+
+ private String qualifier;
+
+ private List<PropertyValueImpl> propertyValues = new ArrayList<PropertyValueImpl>();
+
+ public String getTerm() {
+ return term;
+ }
+
+ public void setTerm(final String term) {
+ this.term = term;
+ }
+
+ public String getQualifier() {
+ return qualifier;
+ }
+
+ public void setQualifier(final String qualifier) {
+ this.qualifier = qualifier;
+ }
+
+ public List<PropertyValueImpl> getPropertyValues() {
+ return propertyValues;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/UsingImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/UsingImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/UsingImpl.java
new file mode 100644
index 0000000..0cd06c4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/UsingImpl.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.client.core.edm.v3;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v3.Using;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class UsingImpl extends AbstractEdmItem implements Using {
+
+ private static final long serialVersionUID = 2086957510154443445L;
+
+ @JsonProperty(value = "Namespace", required = true)
+ private String namespace;
+
+ @JsonProperty("Alias")
+ private String alias;
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(final String namespace) {
+ this.namespace = namespace;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(final String alias) {
+ this.alias = alias;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ValueAnnotationImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ValueAnnotationImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ValueAnnotationImpl.java
new file mode 100644
index 0000000..bc5566f
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ValueAnnotationImpl.java
@@ -0,0 +1,129 @@
+/*
+ * 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.client.core.edm.v3;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class ValueAnnotationImpl extends AbstractEdmItem {
+
+ private static final long serialVersionUID = -1826414005417952278L;
+
+ @JsonProperty(value = "Term", required = true)
+ private String term;
+
+ @JsonProperty("Qualifier")
+ private String qualifier;
+
+ @JsonProperty("Path")
+ private String path;
+
+ @JsonProperty("String")
+ private String string;
+
+ @JsonProperty("Int")
+ private BigInteger _int;
+
+ @JsonProperty("Float")
+ private Double _float;
+
+ @JsonProperty("Decimal")
+ private BigDecimal decimal;
+
+ @JsonProperty("Bool")
+ private Boolean bool;
+
+ @JsonProperty("DateTime")
+ private Date dateTime;
+
+ public String getTerm() {
+ return term;
+ }
+
+ public void setTerm(final String term) {
+ this.term = term;
+ }
+
+ public String getQualifier() {
+ return qualifier;
+ }
+
+ public void setQualifier(final String qualifier) {
+ this.qualifier = qualifier;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(final String path) {
+ this.path = path;
+ }
+
+ public String getString() {
+ return string;
+ }
+
+ public void setString(final String string) {
+ this.string = string;
+ }
+
+ public BigInteger getInt() {
+ return _int;
+ }
+
+ public void setInt(final BigInteger _int) {
+ this._int = _int;
+ }
+
+ public Double getFloat() {
+ return _float;
+ }
+
+ public void setFloat(final Double _float) {
+ this._float = _float;
+ }
+
+ public BigDecimal getDecimal() {
+ return decimal;
+ }
+
+ public void setDecimal(final BigDecimal decimal) {
+ this.decimal = decimal;
+ }
+
+ public Boolean getBool() {
+ return bool;
+ }
+
+ public void setBool(final Boolean bool) {
+ this.bool = bool;
+ }
+
+ public Date getDateTime() {
+ return dateTime == null ? null : new Date(dateTime.getTime());
+ }
+
+ public void setDateTime(final Date dateTime) {
+ this.dateTime = dateTime == null ? null : new Date(dateTime.getTime());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ValueTermImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ValueTermImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ValueTermImpl.java
new file mode 100644
index 0000000..141d18f
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/ValueTermImpl.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.client.core.edm.v3;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v3.ValueTerm;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class ValueTermImpl extends AbstractEdmItem implements ValueTerm {
+
+ private static final long serialVersionUID = 6149019886137610604L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ @JsonProperty(value = "Type", required = true)
+ private String type;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+}
[03/14] [OLINGO-63] Uri Parser: add unit tests for errors
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
index 77aa204..796dffa 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
@@ -68,29 +68,20 @@ public class TestLexer {
test.run("$skip=2").isAllText("$skip=2").isType(UriLexer.SKIP);
test.run("$skip=123").isAllText("$skip=123").isType(UriLexer.SKIP);
- // TODO check and add error handling
- // test.run("$skip=A").isExType(LexerNoViableAltException.class);
-
test.run("$top=1").isAllText("$top=1").isType(UriLexer.TOP);
test.run("$top=2").isAllText("$top=2").isType(UriLexer.TOP);
test.run("$top=123").isAllText("$top=123").isType(UriLexer.TOP);
- // TODO check and add error handling
- // test.run("$top=A").isExType(LexerNoViableAltException.class);
-
+
test.run("$levels=1").isAllText("$levels=1").isType(UriLexer.LEVELS);
test.run("$levels=2").isAllText("$levels=2").isType(UriLexer.LEVELS);
test.run("$levels=123").isAllText("$levels=123").isType(UriLexer.LEVELS);
test.run("$levels=max").isAllText("$levels=max").isType(UriLexer.LEVELS);
- // TODO check and add error handling
- // test.run("$levels=A").isExType(LexerNoViableAltException.class);
-
+
test.run("$format=atom").isAllText("$format=atom").isType(UriLexer.FORMAT);
test.run("$format=json").isAllText("$format=json").isType(UriLexer.FORMAT);
test.run("$format=xml").isAllText("$format=xml").isType(UriLexer.FORMAT);
test.run("$format=abc/def").isAllText("$format=abc/def").isType(UriLexer.FORMAT);
- // TODO check and add error handling
- // test.run("$format=abc").isExType(LexerNoViableAltException.class);
-
+
test.run("$id=123").isAllText("$id=123").isType(UriLexer.ID);
test.run("$id=ABC").isAllText("$id=ABC").isType(UriLexer.ID);
@@ -108,11 +99,8 @@ public class TestLexer {
@Test
public void testQueryExpressions() {
test.globalMode(Lexer.DEFAULT_MODE);
- // assertEquals("expected","actual");
test.run("$it").isText("$it").isType(UriLexer.IT);
- // TODO check and add error handling
- // test.run("$itabc").isText("$it").isType(UriLexer.IMPLICIT_VARIABLE_EXPR);
test.run("$filter=contains(").at(2).isText("contains(").isType(UriLexer.CONTAINS_WORD);
@@ -131,106 +119,6 @@ public class TestLexer {
}
- // ;------------------------------------------------------------------------------
- // ; 5. JSON format for function parameters
- // ;------------------------------------------------------------------------------
-
- @Test
- public void testQueryJSON_and_otheres() {
- // QUOTATION_MARK
- // test.run("\"").isText("\"").isType(UriLexer.QUOTATION_MARK);
- // test.run("%22").isText("%22").isType(UriLexer.QUOTATION_MARK);
-
- // Lexer rule QCHAR_UNESCAPED
- test.run("\"abc\"").isText("\"abc\"").isType(UriLexer.STRING_IN_JSON);
-
- // Lexer rule QCHAR_JSON_SPECIAL
- /*
- * test.run("\"" + cQCHAR_JSON_SPECIAL + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- *
- * // Lexer rule CHAR_IN_JSON
- * test.run("\"" + cQCHAR_UNESCAPED + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cQCHAR_JSON_SPECIAL + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- *
- * // Lexer rule ESCAPE CHAR_IN_JSON
- * test.run("\"" + cESCAPE + cQUOTATION_MARK + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + cESCAPE + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "/" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "%2F" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "b" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "f" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "n" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "r" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "t" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "u12AB" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- */
- }
-
- // ;------------------------------------------------------------------------------
- // ; 6. Names and identifiers
- // ;------------------------------------------------------------------------------
-
- @Test
- public void testNamesAndIdentifiers() {
- /*
- * test.run("Binary").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Boolean").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Byte").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Date").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("DateTimeOffset").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Decimal").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Double").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Duration").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Guid").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Int16").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Int32").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Int64").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("SByte").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Single").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Stream").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("String").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("TimeOfDay").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- *
- * test.run("Geography").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Geometry").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- *
- * String g = "Geography";
- * test.run(g ).isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Collection").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiLineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiPoint").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiPolygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Point").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Polygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- *
- * g = "Geometry";
- * test.run(g ).isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Collection").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiLineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiPoint").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiPolygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Point").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Polygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- */
- }
-
- @Test
- public void testNameClaches() {
- /*
- * test.run("Collection").isInput().isType(UriLexer.COLLECTION_CS_FIX);
- * test.run("LineString").isInput().isType(UriLexer.LINESTRING_CS_FIX);
- * test.run("MultiLineString").isInput().isType(UriLexer.MULTILINESTRING_CS_FIX);
- * test.run("MultiPoint").isInput().isType(UriLexer.MULTIPOINT_CS_FIX);
- * test.run("MultiPolygon").isInput().isType(UriLexer.MULTIPOLYGON_CS_FIX);
- * test.run("Point").isInput().isType(UriLexer.POINT_CS_FIX);
- * test.run("Polygon").isInput().isType(UriLexer.POLYGON_CS_FIX);
- * test.run("Srid").isInput().isType(UriLexer.SRID_CS);
- */
- }
// ;------------------------------------------------------------------------------
// ; 7. Literal Data Values
@@ -246,11 +134,6 @@ public class TestLexer {
test.run("binary'ABCD'").isInput().isType(UriLexer.BINARY);
test.run("BiNaRy'ABCD'").isInput().isType(UriLexer.BINARY);
- // not a binary TODO add error handling
- test.run("BiNaRy'ABCDA'")
- .at(0).isText("BiNaRy").isType(UriLexer.ODATAIDENTIFIER)
- .at(1).isText("'ABCDA'").isType(UriLexer.STRING);
-
// boolean
test.run("true").isInput().isType(UriLexer.TRUE);
test.run("false").isInput().isType(UriLexer.FALSE);
@@ -342,28 +225,7 @@ public class TestLexer {
}
- /*
- * // ;------------------------------------------------------------------------------
- * // ; 0. misc
- * // ;------------------------------------------------------------------------------
- *
- * @Test
- * public void testCriticalOrder() {
- * // Test lexer rule STRING
- * test.run("'abc'").isInput().isType(UriLexer.STRING);
- *
- * // Test lexer rule SEARCHWORD
- * test.run("abc", true).isInput().isType(UriLexer.SEARCHWORD);
- *
- * // Test lexer rule SEARCHPHRASE
- * test.run("\"abc\"", true).isInput().isType(UriLexer.SEARCHPHRASE);
- *
- * // Test lexer rule ODATAIDENTIFIER
- * test.run("abc").isInput().isType(UriLexer.ODATAIDENTIFIER);
- *
- * test.run("\"abc\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * }
- */
+
@Test
public void testDelims() {
String reserved = "/";
@@ -383,27 +245,6 @@ public class TestLexer {
// Test lexer rule PCHAR all
test.run("$format=" + cPCHAR + "/" + cPCHAR).isAllInput().isType(UriLexer.FORMAT);
- /*
- * test.run("$format=" + cPCHAR + "/" + cPCHAR + reserved)
- * .isType(UriLexer.FORMAT).at(4)
- * .isText(cPCHAR);
- */
-
- // Test lexer rule QCHAR_NO_AMP
- // String amp = "&";
- // Test lexer rule UNRESERVED
- // test.run("$id=" + cUNRESERVED).isAllInput().isType(UriLexer.ID);
- // test.run("$id=" + cUNRESERVED + amp).isType(UriLexer.ID).at(2).isText(cUNRESERVED);
- // Test lexer rule PCT_ENCODED
- // test.run("$id=" + cPCT_ENCODED).isAllInput().isType(UriLexer.ID);
- // test.run("$id=" + cPCT_ENCODED + amp).isType(UriLexer.ID).at(2).isText(cPCT_ENCODED);
- // Test lexer rule OTHER_DELIMS
- // test.run("$id=" + cOTHER_DELIMS).isAllInput().isType(UriLexer.ID);
- // test.run("$id=" + cOTHER_DELIMS + amp).isType(UriLexer.ID).at(2).isText(cOTHER_DELIMS);
- // Lexer rule QCHAR_NO_AMP rest
- // test.run("$id=:@/?$'=").isAllText("$id=:@/?$'=").isType(UriLexer.ID);
- // test.run("$id=:@/?$'=" + amp).isType(UriLexer.ID).at(2).isText(":@/?$'=");
-
}
}
[11/14] [OLINGO-169] First huge import from ODataJClient: for the
moment,
it just build (no tests yet) and dummy Edm interfaces are used instead of the
ones from commons-api
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/AbstractConfiguration.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/AbstractConfiguration.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/AbstractConfiguration.java
new file mode 100644
index 0000000..7ff6a89
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/AbstractConfiguration.java
@@ -0,0 +1,209 @@
+/*
+ * 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.client.core;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import org.apache.olingo.odata4.client.api.Configuration;
+import org.apache.olingo.odata4.client.api.http.HttpClientFactory;
+import org.apache.olingo.odata4.client.api.http.HttpUriRequestFactory;
+import org.apache.olingo.odata4.client.api.format.ODataFormat;
+import org.apache.olingo.odata4.client.api.format.ODataMediaFormat;
+import org.apache.olingo.odata4.client.api.format.ODataPubFormat;
+import org.apache.olingo.odata4.client.api.format.ODataValueFormat;
+import org.apache.olingo.odata4.client.core.http.DefaultHttpClientFactory;
+import org.apache.olingo.odata4.client.core.http.DefaultHttpUriRequestFactory;
+
+public abstract class AbstractConfiguration implements Configuration {
+
+ private static final String DEFAULT_PUB_FORMAT = "pubFormat";
+
+ private static final String DEFAULT_VALUE_FORMAT = "valueFormat";
+
+ private static final String DEFAULT_MEDIA_FORMAT = "valueFormat";
+
+ private static final String HTTP_CLIENT_FACTORY = "httpClientFactory";
+
+ private static final String HTTP_URI_REQUEST_FACTORY = "httpUriRequestFactory";
+
+ private static final String USE_XHTTP_METHOD = "useHTTPMethod";
+
+ private static final String KEY_AS_SEGMENT = "keyAsSegment";
+
+ private static final String GZIP_COMPRESSION = "gzipCompression";
+
+ private static final String CHUNKING = "chunking";
+
+ private final Map<String, Object> CONF = new HashMap<String, Object>();
+
+ private transient ExecutorService executor = Executors.newFixedThreadPool(10);
+
+ /**
+ * Gets given configuration property.
+ *
+ * @param key key value of the property to be retrieved.
+ * @param defaultValue default value to be used in case of the given key doesn't exist.
+ * @return property value if exists; default value if does not exist.
+ */
+ private Object getProperty(final String key, final Object defaultValue) {
+ return CONF.containsKey(key) ? CONF.get(key) : defaultValue;
+ }
+
+ /**
+ * Sets new configuration property.
+ *
+ * @param key configuration property key.
+ * @param value configuration property value.
+ * @return given value.
+ */
+ private Object setProperty(final String key, final Object value) {
+ return CONF.put(key, value);
+ }
+
+ @Override
+ public ODataPubFormat getDefaultPubFormat() {
+ return ODataPubFormat.valueOf(
+ getProperty(DEFAULT_PUB_FORMAT, ODataPubFormat.JSON_FULL_METADATA.name()).toString());
+ }
+
+ @Override
+ public void setDefaultPubFormat(final ODataPubFormat format) {
+ setProperty(DEFAULT_PUB_FORMAT, format.name());
+ }
+
+ @Override
+ public ODataFormat getDefaultFormat() {
+ ODataFormat format;
+
+ switch (getDefaultPubFormat()) {
+ case ATOM:
+ format = ODataFormat.XML;
+ break;
+
+ case JSON_FULL_METADATA:
+ format = ODataFormat.JSON_FULL_METADATA;
+ break;
+
+ case JSON_NO_METADATA:
+ format = ODataFormat.JSON_NO_METADATA;
+ break;
+
+ case JSON:
+ default:
+ format = ODataFormat.JSON;
+ }
+
+ return format;
+ }
+
+ @Override
+ public ODataValueFormat getDefaultValueFormat() {
+ return ODataValueFormat.valueOf(
+ getProperty(DEFAULT_VALUE_FORMAT, ODataValueFormat.TEXT.name()).toString());
+ }
+
+ @Override
+ public void setDefaultValueFormat(final ODataValueFormat format) {
+ setProperty(DEFAULT_VALUE_FORMAT, format.name());
+ }
+
+ @Override
+ public ODataMediaFormat getDefaultMediaFormat() {
+ return ODataMediaFormat.valueOf(
+ getProperty(DEFAULT_VALUE_FORMAT, ODataMediaFormat.APPLICATION_OCTET_STREAM.name()).toString());
+ }
+
+ @Override
+ public void setDefaultMediaFormat(final ODataMediaFormat format) {
+ setProperty(DEFAULT_MEDIA_FORMAT, format.name());
+ }
+
+ @Override
+ public HttpClientFactory getHttpClientFactory() {
+ return (HttpClientFactory) getProperty(HTTP_CLIENT_FACTORY, new DefaultHttpClientFactory());
+ }
+
+ @Override
+ public void setHttpClientFactory(final HttpClientFactory factory) {
+ setProperty(HTTP_CLIENT_FACTORY, factory);
+ }
+
+ @Override
+ public HttpUriRequestFactory getHttpUriRequestFactory() {
+ return (HttpUriRequestFactory) getProperty(HTTP_URI_REQUEST_FACTORY, new DefaultHttpUriRequestFactory());
+ }
+
+ @Override
+ public void setHttpUriRequestFactory(final HttpUriRequestFactory factory) {
+ setProperty(HTTP_URI_REQUEST_FACTORY, factory);
+ }
+
+ @Override
+ public boolean isUseXHTTPMethod() {
+ return (Boolean) getProperty(USE_XHTTP_METHOD, false);
+ }
+
+ @Override
+ public void setUseXHTTPMethod(final boolean value) {
+ setProperty(USE_XHTTP_METHOD, value);
+ }
+
+ @Override
+ public boolean isKeyAsSegment() {
+ return (Boolean) getProperty(KEY_AS_SEGMENT, false);
+ }
+
+ @Override
+ public void setKeyAsSegment(final boolean value) {
+ setProperty(KEY_AS_SEGMENT, value);
+ }
+
+ @Override
+ public boolean isGzipCompression() {
+ return (Boolean) getProperty(GZIP_COMPRESSION, false);
+ }
+
+ @Override
+ public void setGzipCompression(final boolean value) {
+ setProperty(GZIP_COMPRESSION, value);
+ }
+
+ @Override
+ public boolean isUseChuncked() {
+ return (Boolean) getProperty(CHUNKING, true);
+ }
+
+ @Override
+ public void setUseChuncked(final boolean value) {
+ setProperty(CHUNKING, value);
+ }
+
+ @Override
+ public ExecutorService getExecutor() {
+ return executor;
+ }
+
+ @Override
+ public void setExecutor(final ExecutorService executorService) {
+ executor = executorService;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/AbstractODataClient.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/AbstractODataClient.java
new file mode 100644
index 0000000..15a51c0
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/AbstractODataClient.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.client.core;
+
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.data.ODataGeospatialValue;
+import org.apache.olingo.odata4.client.core.data.ODataPrimitiveValue;
+
+abstract class AbstractODataClient implements ODataClient {
+
+ private static final long serialVersionUID = 7269096702397630265L;
+
+ public ODataPrimitiveValue.Builder getPrimitiveValueBuilder() {
+ return new ODataPrimitiveValue.Builder(this);
+ }
+
+ public ODataGeospatialValue.Builder getGeospatialValueBuilder() {
+ return new ODataGeospatialValue.Builder(this);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientFactory.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientFactory.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientFactory.java
new file mode 100644
index 0000000..e8276f5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientFactory.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.client.core;
+
+public final class ODataClientFactory {
+
+ public static ODataV3Client getV3() {
+ return new ODataV3Client();
+ }
+
+ public static ODataV4Client getV4() {
+ return new ODataV4Client();
+ }
+
+ private ODataClientFactory() {
+ // empty constructory for static utility class
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientImpl.java
deleted file mode 100644
index 9af91b3..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientImpl.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core;
-
-import org.apache.olingo.odata4.client.api.ODataClient;
-
-public class ODataClientImpl extends ODataClient {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataV3Client.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataV3Client.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataV3Client.java
new file mode 100644
index 0000000..08a941d
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataV3Client.java
@@ -0,0 +1,138 @@
+/*
+ * 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.client.core;
+
+import org.apache.olingo.odata4.client.core.data.impl.v3.ODataDeserializerImpl;
+import org.apache.olingo.odata4.client.core.data.impl.v3.ODataReaderImpl;
+import org.apache.olingo.odata4.client.core.data.impl.v3.ODataSerializerImpl;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+public class ODataV3Client extends AbstractODataClient {
+
+ private static final long serialVersionUID = -1655712193243609209L;
+
+ private final V3Configuration configuration = new V3Configuration();
+
+// private final V3FilterFactory filterFactory = new V3FilterFactory();
+//
+ private final ODataDeserializerImpl deserializer = new ODataDeserializerImpl(this);
+//
+
+ private final ODataSerializerImpl serializer = new ODataSerializerImpl(this);
+
+ private final ODataReaderImpl reader = new ODataReaderImpl(this);
+
+// private final ODataWriterImpl writer = new ODataWriterImpl(this);
+//
+// private final ODataBinderImpl binder = new ODataBinderImpl(this);
+//
+// private final ODataObjectFactoryImpl objectFactory = new ODataObjectFactoryImpl(this);
+//
+// private final V3RetrieveRequestFactory retrieveReqFact = new V3RetrieveRequestFactory(this);
+//
+// private final V3CUDRequestFactory cudReqFact = new V3CUDRequestFactory(this);
+//
+// private final V3StreamedRequestFactory streamedReqFact = new V3StreamedRequestFactory(this);
+//
+// private final V3InvokeRequestFactory invokeReqFact = new V3InvokeRequestFactory(this);
+//
+// private final V3BatchRequestFactory batchReqFact = new V3BatchRequestFactory(this);
+ @Override
+ public ODataServiceVersion getServiceVersion() {
+ return ODataServiceVersion.V30;
+ }
+
+// @Override
+// public ODataHeaders getVersionHeaders() {
+// final ODataHeaders odataHeaders = new ODataHeaders();
+// odataHeaders.setHeader(ODataHeaders.HeaderName.minDataServiceVersion, ODataVersion.V3.toString());
+// odataHeaders.setHeader(ODataHeaders.HeaderName.maxDataServiceVersion, ODataVersion.V3.toString());
+// odataHeaders.setHeader(ODataHeaders.HeaderName.dataServiceVersion, ODataVersion.V3.toString());
+// return odataHeaders;
+// }
+ @Override
+ public V3Configuration getConfiguration() {
+ return configuration;
+ }
+
+// @Override
+// public V3URIBuilder getURIBuilder(final String serviceRoot) {
+// return new V3URIBuilder(configuration, serviceRoot);
+// }
+//
+// @Override
+// public V3FilterFactory getFilterFactory() {
+// return filterFactory;
+// }
+//
+ @Override
+ public ODataDeserializerImpl getDeserializer() {
+ return deserializer;
+ }
+
+ @Override
+ public ODataSerializerImpl getSerializer() {
+ return serializer;
+ }
+
+ @Override
+ public ODataReaderImpl getReader() {
+ return reader;
+ }
+
+// @Override
+// public ODataWriterImpl getWriter() {
+// return writer;
+// }
+//
+// @Override
+// public ODataBinderImpl getBinder() {
+// return binder;
+// }
+//
+// @Override
+// public ODataObjectFactoryImpl getObjectFactory() {
+// return objectFactory;
+// }
+//
+// @Override
+// public V3RetrieveRequestFactory getRetrieveRequestFactory() {
+// return retrieveReqFact;
+// }
+//
+// @Override
+// public V3CUDRequestFactory getCUDRequestFactory() {
+// return cudReqFact;
+// }
+//
+// @Override
+// public V3StreamedRequestFactory getStreamedRequestFactory() {
+// return streamedReqFact;
+// }
+//
+// @Override
+// public V3InvokeRequestFactory getInvokeRequestFactory() {
+// return invokeReqFact;
+// }
+//
+// @Override
+// public V3BatchRequestFactory getBatchRequestFactory() {
+// return batchReqFact;
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataV4Client.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataV4Client.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataV4Client.java
new file mode 100644
index 0000000..55d4adf
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataV4Client.java
@@ -0,0 +1,137 @@
+/*
+ * 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.client.core;
+
+import org.apache.olingo.odata4.client.core.data.impl.v4.ODataDeserializerImpl;
+import org.apache.olingo.odata4.client.core.data.impl.v4.ODataReaderImpl;
+import org.apache.olingo.odata4.client.core.data.impl.v4.ODataSerializerImpl;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+public class ODataV4Client extends AbstractODataClient {
+
+ private static final long serialVersionUID = -6653176125573631964L;
+
+ private final V4Configuration configuration = new V4Configuration();
+
+// private final V4FilterFactory filterFactory = new V4FilterFactory();
+//
+ private final ODataDeserializerImpl deserializer = new ODataDeserializerImpl(this);
+//
+
+ private final ODataSerializerImpl serializer = new ODataSerializerImpl(this);
+
+ private final ODataReaderImpl reader = new ODataReaderImpl(this);
+
+// private final ODataWriterImpl writer = new ODataWriterImpl(this);
+//
+// private final ODataBinderImpl binder = new ODataBinderImpl(this);
+//
+// private final ODataObjectFactoryImpl objectFactory = new ODataObjectFactoryImpl(this);
+//
+// private final V4RetrieveRequestFactory retrieveReqFact = new V4RetrieveRequestFactory(this);
+//
+// private final V4CUDRequestFactory cudReqFact = new V4CUDRequestFactory(this);
+//
+// private final V4StreamedRequestFactory streamedReqFact = new V4StreamedRequestFactory(this);
+//
+// private final V4InvokeRequestFactory invokeReqFact = new V4InvokeRequestFactory(this);
+//
+// private final V4BatchRequestFactory batchReqFact = new V4BatchRequestFactory(this);
+ @Override
+ public ODataServiceVersion getServiceVersion() {
+ return ODataServiceVersion.V40;
+ }
+//
+// @Override
+// public ODataHeaders getVersionHeaders() {
+// final ODataHeaders odataHeaders = new ODataHeaders();
+// odataHeaders.setHeader(ODataHeaders.HeaderName.maxDataServiceVersion, ODataVersion.V4.toString());
+// odataHeaders.setHeader(ODataHeaders.HeaderName.dataServiceVersion, ODataVersion.V4.toString());
+// return odataHeaders;
+// }
+
+ @Override
+ public V4Configuration getConfiguration() {
+ return configuration;
+ }
+
+// @Override
+// public URIBuilder getURIBuilder(final String serviceRoot) {
+// return new V4URIBuilder(configuration, serviceRoot);
+// }
+//
+// @Override
+// public V4FilterFactory getFilterFactory() {
+// return filterFactory;
+// }
+ @Override
+ public ODataDeserializerImpl getDeserializer() {
+ return deserializer;
+ }
+
+ @Override
+ public ODataSerializerImpl getSerializer() {
+ return serializer;
+ }
+
+ @Override
+ public ODataReaderImpl getReader() {
+ return reader;
+ }
+
+// @Override
+// public ODataWriterImpl getWriter() {
+// return writer;
+// }
+//
+// @Override
+// public ODataBinderImpl getBinder() {
+// return binder;
+// }
+//
+// @Override
+// public ODataObjectFactoryImpl getObjectFactory() {
+// return objectFactory;
+// }
+//
+// @Override
+// public V4RetrieveRequestFactory getRetrieveRequestFactory() {
+// return retrieveReqFact;
+// }
+//
+// @Override
+// public V4CUDRequestFactory getCUDRequestFactory() {
+// return cudReqFact;
+// }
+//
+// @Override
+// public V4StreamedRequestFactory getStreamedRequestFactory() {
+// return streamedReqFact;
+// }
+//
+// @Override
+// public V4InvokeRequestFactory getInvokeRequestFactory() {
+// return invokeReqFact;
+// }
+//
+// @Override
+// public V4BatchRequestFactory getBatchRequestFactory() {
+// return batchReqFact;
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/V3Configuration.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/V3Configuration.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/V3Configuration.java
new file mode 100644
index 0000000..386cff7
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/V3Configuration.java
@@ -0,0 +1,29 @@
+/*
+ * 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.client.core;
+
+public class V3Configuration extends AbstractConfiguration {
+
+ private static final long serialVersionUID = -8719958537946884777L;
+
+ protected V3Configuration() {
+ super();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/V4Configuration.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/V4Configuration.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/V4Configuration.java
new file mode 100644
index 0000000..1aaf534
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/V4Configuration.java
@@ -0,0 +1,29 @@
+/*
+ * 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.client.core;
+
+public class V4Configuration extends AbstractConfiguration {
+
+ private static final long serialVersionUID = -1134213707190176857L;
+
+ protected V4Configuration() {
+ super();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/EdmSimpleType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/EdmSimpleType.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/EdmSimpleType.java
new file mode 100644
index 0000000..08e974b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/EdmSimpleType.java
@@ -0,0 +1,288 @@
+/*
+ * 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.client.core.data;
+
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.UUID;
+import org.apache.olingo.odata4.client.core.data.geospatial.Geospatial;
+import org.apache.olingo.odata4.client.core.data.geospatial.GeospatialCollection;
+import org.apache.olingo.odata4.client.core.data.geospatial.LineString;
+import org.apache.olingo.odata4.client.core.data.geospatial.MultiLineString;
+import org.apache.olingo.odata4.client.core.data.geospatial.MultiPoint;
+import org.apache.olingo.odata4.client.core.data.geospatial.MultiPolygon;
+import org.apache.olingo.odata4.client.core.data.geospatial.Point;
+import org.apache.olingo.odata4.client.core.data.geospatial.Polygon;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+/**
+ * Represent the primitive types of the Entity Data Model (EDM).
+ *
+ * @see http://dl.windowsazure.com/javadoc/com/microsoft/windowsazure/services/table/models/EdmType.html
+ * <p>
+ * For an overview of the available EDM primitive data types and names, see the <a
+ * href="http://www.odata.org/developers/protocols/overview#AbstractTypeSystem">Primitive Data Types</a> section of the
+ * <a href="http://www.odata.org/developers/protocols/overview">OData Protocol Overview</a>.
+ * </p>
+ * <p>
+ * The Abstract Type System used to define the primitive types supported by OData is defined in detail in <a
+ * href="http://msdn.microsoft.com/en-us/library/dd541474.aspx">[MC-CSDL] (section 2.2.1).</a>
+ * </p>
+ */
+public enum EdmSimpleType {
+
+ /**
+ * The absence of a value.
+ */
+ Null(Void.class),
+ /**
+ * An array of bytes.
+ */
+ Binary(byte[].class),
+ /**
+ * A Boolean value.
+ */
+ Boolean(Boolean.class),
+ /**
+ * Unsigned 8-bit integer value.
+ */
+ Byte(Integer.class),
+ /**
+ * A signed 8-bit integer value.
+ */
+ SByte(Byte.class),
+ /**
+ * A 64-bit value expressed as Coordinated Universal Time (UTC).
+ */
+ DateTime(new ODataServiceVersion[]{ODataServiceVersion.V30}, ODataTimestamp.class, "yyyy-MM-dd'T'HH:mm:ss"),
+ /**
+ * Date without a time-zone offset.
+ */
+ Date(new ODataServiceVersion[]{ODataServiceVersion.V40}, ODataTimestamp.class, "yyyy-MM-dd"),
+ /**
+ * Date and time as an Offset in minutes from GMT.
+ */
+ DateTimeOffset(ODataTimestamp.class, "yyyy-MM-dd'T'HH:mm:ss"),
+ /**
+ * The time of day with values ranging from 0:00:00.x to 23:59:59.y, where x and y depend upon the precision.
+ */
+ Time(new ODataServiceVersion[]{ODataServiceVersion.V30}, ODataDuration.class),
+ /**
+ * The time of day with values ranging from 0:00:00.x to 23:59:59.y, where x and y depend upon the precision.
+ */
+ TimeOfDay(new ODataServiceVersion[]{ODataServiceVersion.V40}, ODataDuration.class),
+ /**
+ * Signed duration in days, hours, minutes, and (sub)seconds.
+ */
+ Duration(new ODataServiceVersion[]{ODataServiceVersion.V40}, ODataDuration.class),
+ /**
+ * Numeric values with fixed precision and scale.
+ */
+ Decimal(BigDecimal.class, "#.#######################"),
+ /**
+ * A floating point number with 7 digits precision.
+ */
+ Single(Float.class, "#.#######E0"),
+ /**
+ * A 64-bit double-precision floating point value.
+ */
+ Double(Double.class, "#.#######################E0"),
+ // --- Geospatial ---
+ Geography(Geospatial.class),
+ GeographyPoint(Point.class),
+ GeographyLineString(LineString.class),
+ GeographyPolygon(Polygon.class),
+ GeographyMultiPoint(MultiPoint.class),
+ GeographyMultiLineString(MultiLineString.class),
+ GeographyMultiPolygon(MultiPolygon.class),
+ GeographyCollection(GeospatialCollection.class),
+ Geometry(Geospatial.class),
+ GeometryPoint(Point.class),
+ GeometryLineString(LineString.class),
+ GeometryPolygon(Polygon.class),
+ GeometryMultiPoint(MultiPoint.class),
+ GeometryMultiLineString(MultiLineString.class),
+ GeometryMultiPolygon(MultiPolygon.class),
+ GeometryCollection(GeospatialCollection.class),
+ /**
+ * A 128-bit globally unique identifier.
+ */
+ Guid(UUID.class),
+ /**
+ * A 16-bit integer value.
+ */
+ Int16(Short.class),
+ /**
+ * A 32-bit integer value.
+ */
+ Int32(Integer.class),
+ /**
+ * A 64-bit integer value.
+ */
+ Int64(Long.class),
+ /**
+ * A UTF-16-encoded value. String values may be up to 64 KB in size.
+ */
+ String(String.class),
+ /**
+ * Resource stream (for media entities).
+ */
+ Stream(URI.class);
+
+ private final Class<?> clazz;
+
+ private final String pattern;
+
+ private final ODataServiceVersion[] versions;
+
+ /**
+ * Constructor (all OData versions).
+ *
+ * @param clazz type.
+ */
+ EdmSimpleType(final Class<?> clazz) {
+ this(ODataServiceVersion.values(), clazz, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param versions supported OData versions.
+ * @param clazz type.
+ */
+ EdmSimpleType(final ODataServiceVersion[] versions, final Class<?> clazz) {
+ this(versions, clazz, null);
+ }
+
+ /**
+ * Constructor (all OData versions).
+ *
+ * @param clazz type.
+ * @param pattern pattern.
+ */
+ EdmSimpleType(final Class<?> clazz, final String pattern) {
+ this(ODataServiceVersion.values(), clazz, pattern);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param versions supported OData versions.
+ * @param clazz type.
+ * @param pattern pattern.
+ */
+ EdmSimpleType(final ODataServiceVersion[] versions, final Class<?> clazz, final String pattern) {
+ this.clazz = clazz;
+ this.pattern = pattern;
+ this.versions = versions.clone();
+ }
+
+ /**
+ * Gets pattern.
+ *
+ * @return pattern.
+ */
+ public String pattern() {
+ return pattern;
+ }
+
+ /**
+ * Gets corresponding java type.
+ *
+ * @return java type.
+ */
+ public Class<?> javaType() {
+ return this.clazz;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ return namespace() + "." + name();
+ }
+
+ /**
+ * Checks if is a geospatial type.
+ *
+ * @return <tt>true</tt> if is geospatial type; <tt>false</tt> otherwise.
+ */
+ public boolean isGeospatial() {
+ return name().startsWith("Geo");
+ }
+
+ /**
+ * Checks if the given type is a geospatial type.
+ *
+ * @param type type.
+ * @return <tt>true</tt> if is geospatial type; <tt>false</tt> otherwise.
+ */
+ public static boolean isGeospatial(final String type) {
+ return type != null && type.startsWith(namespace() + ".Geo");
+ }
+
+ /**
+ * Gets <tt>EdmSimpleType</tt> from string.
+ *
+ * @param value string value type.
+ * @return <tt>EdmSimpleType</tt> object.
+ */
+ public static EdmSimpleType fromValue(final String value) {
+ final String noNsValue = value.substring(4);
+ for (EdmSimpleType edmSimpleType : EdmSimpleType.values()) {
+ if (edmSimpleType.name().equals(noNsValue)) {
+ return edmSimpleType;
+ }
+ }
+ throw new IllegalArgumentException(value);
+ }
+
+ /**
+ * Gets <tt>EdmSimpleType</tt> from object instance.
+ *
+ * @param workingVersion OData version.
+ * @param obj object.
+ * @return <tt>EdmSimpleType</tt> object.
+ */
+ public static EdmSimpleType fromObject(final ODataServiceVersion workingVersion, final Object obj) {
+ for (EdmSimpleType edmSimpleType : EdmSimpleType.values()) {
+ if (edmSimpleType.javaType().equals(obj.getClass())) {
+ return edmSimpleType == DateTimeOffset || edmSimpleType == DateTime || edmSimpleType == Date
+ ? ((ODataTimestamp) obj).isOffset()
+ ? DateTimeOffset : workingVersion == ODataServiceVersion.V30 ? DateTime : Date
+ : edmSimpleType;
+ }
+ }
+ throw new IllegalArgumentException(obj.getClass().getSimpleName() + " is not a simple type");
+ }
+
+ /**
+ * Gets namespace.
+ *
+ * @return namespace.
+ */
+ public static String namespace() {
+ return "Edm";
+ }
+
+ public ODataServiceVersion[] getSupportedVersions() {
+ return versions.clone();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataCollectionValue.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataCollectionValue.java
new file mode 100644
index 0000000..4635336
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataCollectionValue.java
@@ -0,0 +1,98 @@
+/*
+ * 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.client.core.data;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * OData collection property value.
+ */
+public class ODataCollectionValue extends ODataValue implements Iterable<ODataValue> {
+
+ private static final long serialVersionUID = -3665659846001987187L;
+
+ /**
+ * Type name;
+ */
+ private final String typeName;
+
+ /**
+ * Values.
+ */
+ private final List<ODataValue> values = new ArrayList<ODataValue>();
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public ODataCollectionValue(final String typeName) {
+ this.typeName = typeName;
+ }
+
+ /**
+ * Adds a value to the collection.
+ *
+ * @param value value to be added.
+ */
+ public void add(final ODataValue value) {
+ if (value.isPrimitive() || value.isComplex()) {
+ values.add(value);
+ }
+ }
+
+ /**
+ * Value iterator.
+ *
+ * @return value iterator.
+ */
+ @Override
+ public Iterator<ODataValue> iterator() {
+ return values.iterator();
+ }
+
+ /**
+ * Gets value type name.
+ *
+ * @return value type name.
+ */
+ public String getTypeName() {
+ return typeName;
+ }
+
+ /**
+ * Gets collection size.
+ *
+ * @return collection size.
+ */
+ public int size() {
+ return values.size();
+ }
+
+ /**
+ * Checks if collection is empty.
+ *
+ * @return 'TRUE' if empty; 'FALSE' otherwise.
+ */
+ public boolean isEmpty() {
+ return values.isEmpty();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataComplexValue.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataComplexValue.java
new file mode 100644
index 0000000..b146e06
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataComplexValue.java
@@ -0,0 +1,97 @@
+/*
+ * 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.client.core.data;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * OData complex property value.
+ */
+public class ODataComplexValue extends ODataValue implements Iterable<ODataProperty> {
+
+ private static final long serialVersionUID = -1878555027714020431L;
+
+ /**
+ * Type name.
+ */
+ private final String typeName;
+
+ /**
+ * Complex type fields.
+ */
+ private final Map<String, ODataProperty> fields = new LinkedHashMap<String, ODataProperty>();
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public ODataComplexValue(final String typeName) {
+ this.typeName = typeName;
+ }
+
+ /**
+ * Adds field to the complex type.
+ *
+ * @param field field to be added.
+ */
+ public void add(final ODataProperty field) {
+ fields.put(field.getName(), field);
+ }
+
+ /**
+ * Gets field.
+ *
+ * @param name name of the field to be retrieved.
+ * @return requested field.
+ */
+ public ODataProperty get(final String name) {
+ return fields.get(name);
+ }
+
+ /**
+ * Complex property fields iterator.
+ *
+ * @return fields iterator.
+ */
+ @Override
+ public Iterator<ODataProperty> iterator() {
+ return fields.values().iterator();
+ }
+
+ /**
+ * Gest value type name.
+ *
+ * @return value type name.
+ */
+ public String getTypeName() {
+ return typeName;
+ }
+
+ /**
+ * Gets number of fields.
+ *
+ * @return number of fields.
+ */
+ public int size() {
+ return fields.size();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataDuration.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataDuration.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataDuration.java
new file mode 100644
index 0000000..1724f75
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataDuration.java
@@ -0,0 +1,80 @@
+/*
+ * 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.client.core.data;
+
+import java.io.Serializable;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+/**
+ * Helper class for handling time (as duration) primitive values.
+ *
+ * @see com.msopentech.odatajclient.engine.data.metadata.edm.EdmSimpleType#TIME
+ * @see Duration
+ */
+public final class ODataDuration implements Serializable {
+
+ private static final long serialVersionUID = 778404231943967899L;
+
+ private final Duration duration;
+
+ public ODataDuration(final String input) {
+ try {
+ final DatatypeFactory dtFactory = DatatypeFactory.newInstance();
+ this.duration = dtFactory.newDuration(input);
+ } catch (DatatypeConfigurationException e) {
+ throw new IllegalArgumentException("Could not parse '" + input + "' as Duration", e);
+ }
+ }
+
+ public ODataDuration(final Duration duration) {
+ this.duration = duration;
+ }
+
+ public Duration getDuration() {
+ return duration;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ return this.duration.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataGeospatialValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataGeospatialValue.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataGeospatialValue.java
new file mode 100644
index 0000000..40a664e
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataGeospatialValue.java
@@ -0,0 +1,488 @@
+/**
+ * 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.client.core.data;
+
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+import org.apache.olingo.odata4.client.api.Constants;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.data.EdmSimpleType;
+import org.apache.olingo.odata4.client.core.data.geospatial.Geospatial;
+import org.apache.olingo.odata4.client.core.data.geospatial.GeospatialCollection;
+import org.apache.olingo.odata4.client.core.data.geospatial.LineString;
+import org.apache.olingo.odata4.client.core.data.geospatial.MultiLineString;
+import org.apache.olingo.odata4.client.core.data.geospatial.MultiPoint;
+import org.apache.olingo.odata4.client.core.data.geospatial.MultiPolygon;
+import org.apache.olingo.odata4.client.core.data.geospatial.Point;
+import org.apache.olingo.odata4.client.core.data.geospatial.Polygon;
+import org.apache.olingo.odata4.client.core.utils.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class ODataGeospatialValue extends ODataPrimitiveValue {
+
+ private static final long serialVersionUID = -3984105137562291082L;
+
+ /**
+ * Geospatial value builder.
+ */
+ public static class Builder extends AbstractBuilder {
+
+ private final ODataGeospatialValue ogv;
+
+ /**
+ * Constructor.
+ */
+ public Builder(final ODataClient client) {
+ super(client);
+ this.ogv = new ODataGeospatialValue(client);
+ }
+
+ /**
+ * Sets the given value provided as a DOM tree.
+ *
+ * @param tree value.
+ * @return the current builder.
+ */
+ public Builder setTree(final Element tree) {
+ this.ogv.tree = tree;
+ return this;
+ }
+
+ /**
+ * Sets the actual object value.
+ *
+ * @param value value.
+ * @return the current builder.
+ */
+ public <T extends Geospatial> Builder setValue(final T value) {
+ this.ogv.value = value;
+ return this;
+ }
+
+ /**
+ * Sets actual value type.
+ *
+ * @param type type.
+ * @return the current builder.
+ */
+ public Builder setType(final EdmSimpleType type) {
+ isSupported(type);
+
+ if (!type.isGeospatial()) {
+ throw new IllegalArgumentException(
+ "Use " + ODataPrimitiveValue.class.getSimpleName() + " for non-geospatial types");
+ }
+
+ if (type == EdmSimpleType.Geography || type == EdmSimpleType.Geometry) {
+ throw new IllegalArgumentException(
+ type + "is not an instantiable type. "
+ + "An entity can declare a property to be of type Geometry. "
+ + "An instance of an entity MUST NOT have a value of type Geometry. "
+ + "Each value MUST be of some subtype.");
+ }
+ this.ogv.type = type;
+ return this;
+ }
+
+ /**
+ * Builds the geospatial value.
+ *
+ * @return <tt>ODataGeospatialValue</tt> object.
+ */
+ public ODataGeospatialValue build() {
+ if (this.ogv.tree == null && this.ogv.value == null) {
+ throw new IllegalArgumentException("Must provide either tree or value");
+ }
+ if (this.ogv.tree != null && this.ogv.value != null) {
+ throw new IllegalArgumentException("Cannot provide both tree and value");
+ }
+
+ if (this.ogv.type == null) {
+ throw new IllegalArgumentException("Must provide geospatial type");
+ }
+
+ if (this.ogv.tree != null) {
+ this.ogv.value = this.ogv.parseTree(this.ogv.tree, this.ogv.type);
+ }
+ if (this.ogv.value != null) {
+ this.ogv.tree = this.ogv.parseGeospatial((Geospatial) this.ogv.value);
+ }
+
+ return this.ogv;
+ }
+ }
+
+ /**
+ * DOM tree.
+ */
+ private Element tree;
+
+ /**
+ * Protected constructor, need to use the builder to instantiate this class.
+ *
+ * @see Builder
+ */
+ protected ODataGeospatialValue(final ODataClient client) {
+ super(client);
+ }
+
+ private Geospatial.Dimension getDimension() {
+ Geospatial.Dimension dimension;
+
+ switch (this.type) {
+ case Geography:
+ case GeographyCollection:
+ case GeographyLineString:
+ case GeographyMultiLineString:
+ case GeographyPoint:
+ case GeographyMultiPoint:
+ case GeographyPolygon:
+ case GeographyMultiPolygon:
+ dimension = Geospatial.Dimension.GEOGRAPHY;
+ break;
+
+ default:
+ dimension = Geospatial.Dimension.GEOMETRY;
+ }
+
+ return dimension;
+ }
+
+ private List<Point> parsePoints(final NodeList posList) {
+ final List<Point> result = new ArrayList<Point>();
+ for (int i = 0; i < posList.getLength(); i++) {
+ final String[] pointInfo = posList.item(i).getTextContent().split(" ");
+ final Point point = new Point(getDimension());
+ point.setX(Double.valueOf(pointInfo[0]));
+ point.setY(Double.valueOf(pointInfo[1]));
+
+ result.add(point);
+ }
+ return result;
+ }
+
+ private LineString parseLineString(final Element element) {
+ return new LineString(getDimension(),
+ parsePoints(element.getElementsByTagName(Constants.ELEM_POS)));
+ }
+
+ private Polygon parsePolygon(final Element element) {
+ List<Point> extPoints = null;
+ final Element exterior =
+ (Element) element.getElementsByTagName(Constants.ELEM_POLYGON_EXTERIOR).item(0);
+ if (exterior != null) {
+ extPoints = parsePoints(
+ ((Element) exterior.getElementsByTagName(Constants.ELEM_POLYGON_LINEARRING).item(0)).
+ getElementsByTagName(Constants.ELEM_POS));
+ }
+ List<Point> intPoints = null;
+ final Element interior =
+ (Element) element.getElementsByTagName(Constants.ELEM_POLYGON_INTERIOR).item(0);
+ if (interior != null) {
+ intPoints = parsePoints(
+ ((Element) interior.getElementsByTagName(Constants.ELEM_POLYGON_LINEARRING).item(0)).
+ getElementsByTagName(Constants.ELEM_POS));
+ }
+
+ return new Polygon(getDimension(), intPoints, extPoints);
+ }
+
+ /**
+ * Parses given tree as geospatial value.
+ */
+ private Geospatial parseTree(final Element tree, final EdmSimpleType type) {
+ Geospatial value;
+
+ switch (type) {
+ case GeographyPoint:
+ case GeometryPoint:
+ value = parsePoints(tree.getElementsByTagName(Constants.ELEM_POS)).get(0);
+ break;
+
+ case GeographyMultiPoint:
+ case GeometryMultiPoint:
+ final Element pMembs =
+ (Element) tree.getElementsByTagName(Constants.ELEM_POINTMEMBERS).item(0);
+ final List<Point> points = pMembs == null
+ ? Collections.<Point>emptyList()
+ : parsePoints(pMembs.getElementsByTagName(Constants.ELEM_POS));
+ value = new MultiPoint(getDimension(), points);
+ break;
+
+ case GeographyLineString:
+ case GeometryLineString:
+ value = parseLineString(tree);
+ break;
+
+ case GeographyMultiLineString:
+ case GeometryMultiLineString:
+ final Element mlMembs =
+ (Element) tree.getElementsByTagName(Constants.ELEM_LINESTRINGMEMBERS).item(0);
+ final List<LineString> lineStrings;
+ if (mlMembs == null) {
+ lineStrings = Collections.<LineString>emptyList();
+ } else {
+ lineStrings = new ArrayList<LineString>();
+ final NodeList lineStringNodes = mlMembs.getElementsByTagName(Constants.ELEM_LINESTRING);
+ for (int i = 0; i < lineStringNodes.getLength(); i++) {
+ lineStrings.add(parseLineString((Element) lineStringNodes.item(i)));
+ }
+ }
+ value = new MultiLineString(getDimension(), lineStrings);
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ value = parsePolygon(tree);
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ final Element mpMembs =
+ (Element) tree.getElementsByTagName(Constants.ELEM_SURFACEMEMBERS).item(0);
+ final List<Polygon> polygons;
+ if (mpMembs == null) {
+ polygons = Collections.<Polygon>emptyList();
+ } else {
+ polygons = new ArrayList<Polygon>();
+ final NodeList polygonNodes = mpMembs.getElementsByTagName(Constants.ELEM_POLYGON);
+ for (int i = 0; i < polygonNodes.getLength(); i++) {
+ polygons.add(parsePolygon((Element) polygonNodes.item(i)));
+ }
+ }
+ value = new MultiPolygon(getDimension(), polygons);
+ break;
+
+ case GeographyCollection:
+ case GeometryCollection:
+ final Element cMembs =
+ (Element) tree.getElementsByTagName(Constants.ELEM_GEOMEMBERS).item(0);
+ final List<Geospatial> geospatials;
+ if (cMembs == null) {
+ geospatials = Collections.<Geospatial>emptyList();
+ } else {
+ geospatials = new ArrayList<Geospatial>();
+ for (Node geom : XMLUtils.getChildNodes(cMembs, Node.ELEMENT_NODE)) {
+ geospatials.add(
+ parseTree((Element) geom, XMLUtils.simpleTypeForNode(getDimension(), geom)));
+ }
+ }
+ value = new GeospatialCollection(getDimension(), geospatials);
+ break;
+
+ default:
+ value = null;
+ }
+
+ return value;
+ }
+
+ private void parsePoints(final Element parent, final Iterator<Point> itor, final boolean wrap) {
+ while (itor.hasNext()) {
+ final Point point = itor.next();
+
+ final Element pos = parent.getOwnerDocument().
+ createElementNS(Constants.NS_GML, Constants.ELEM_POS);
+ pos.appendChild(parent.getOwnerDocument().createTextNode(
+ Double.toString(point.getX()) + " " + point.getY()));
+
+ final Element appendable;
+ if (wrap) {
+ final Element epoint = parent.getOwnerDocument().
+ createElementNS(Constants.NS_GML, Constants.ELEM_POINT);
+ parent.appendChild(epoint);
+ appendable = epoint;
+ } else {
+ appendable = parent;
+ }
+ appendable.appendChild(pos);
+ }
+ }
+
+ private void parseLineStrings(final Element parent, final Iterator<LineString> itor, final boolean wrap) {
+ while (itor.hasNext()) {
+ final LineString lineString = itor.next();
+
+ final Element appendable;
+ if (wrap) {
+ final Element eLineString = parent.getOwnerDocument().
+ createElementNS(Constants.NS_GML, Constants.ELEM_LINESTRING);
+ parent.appendChild(eLineString);
+ appendable = eLineString;
+ } else {
+ appendable = parent;
+ }
+ parsePoints(appendable, lineString.iterator(), false);
+ }
+ }
+
+ private void parsePolygons(final Element parent, final Iterator<Polygon> itor, final boolean wrap) {
+ while (itor.hasNext()) {
+ final Polygon polygon = itor.next();
+
+ final Element appendable;
+ if (wrap) {
+ final Element ePolygon = parent.getOwnerDocument().createElementNS(
+ Constants.NS_GML, Constants.ELEM_POLYGON);
+ parent.appendChild(ePolygon);
+ appendable = ePolygon;
+ } else {
+ appendable = parent;
+ }
+
+ if (!polygon.getExterior().isEmpty()) {
+ final Element exterior = parent.getOwnerDocument().createElementNS(
+ Constants.NS_GML, Constants.ELEM_POLYGON_EXTERIOR);
+ appendable.appendChild(exterior);
+ final Element linearRing = parent.getOwnerDocument().createElementNS(
+ Constants.NS_GML, Constants.ELEM_POLYGON_LINEARRING);
+ exterior.appendChild(linearRing);
+
+ parsePoints(linearRing, polygon.getExterior().iterator(), false);
+ }
+ if (!polygon.getInterior().isEmpty()) {
+ final Element interior = parent.getOwnerDocument().createElementNS(
+ Constants.NS_GML, Constants.ELEM_POLYGON_INTERIOR);
+ appendable.appendChild(interior);
+ final Element linearRing = parent.getOwnerDocument().createElementNS(
+ Constants.NS_GML, Constants.ELEM_POLYGON_LINEARRING);
+ interior.appendChild(linearRing);
+
+ parsePoints(linearRing, polygon.getInterior().iterator(), false);
+ }
+ }
+ }
+
+ private Element parseGeospatial(final Geospatial value) {
+ final DocumentBuilder builder;
+ try {
+ builder = XMLUtils.DOC_BUILDER_FACTORY.newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ throw new IllegalStateException("Failure initializing Geospatial DOM tree", e);
+ }
+ final Document doc = builder.newDocument();
+
+ final Element tree;
+
+ switch (value.getEdmSimpleType()) {
+ case GeographyPoint:
+ case GeometryPoint:
+ tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_POINT);
+
+ parsePoints(tree, Collections.singleton((Point) value).iterator(), false);
+ break;
+
+ case GeometryMultiPoint:
+ case GeographyMultiPoint:
+ tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_MULTIPOINT);
+
+ final Element pMembs = doc.createElementNS(Constants.NS_GML, Constants.ELEM_POINTMEMBERS);
+ tree.appendChild(pMembs);
+
+ parsePoints(pMembs, ((MultiPoint) value).iterator(), true);
+ break;
+
+ case GeometryLineString:
+ case GeographyLineString:
+ tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_LINESTRING);
+
+ parseLineStrings(tree, Collections.singleton((LineString) value).iterator(), false);
+ break;
+
+ case GeometryMultiLineString:
+ case GeographyMultiLineString:
+ tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_MULTILINESTRING);
+
+ final Element mlMembs =
+ doc.createElementNS(Constants.NS_GML, Constants.ELEM_LINESTRINGMEMBERS);
+ tree.appendChild(mlMembs);
+
+ parseLineStrings(mlMembs, ((MultiLineString) value).iterator(), true);
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_POLYGON);
+ parsePolygons(tree, Collections.singleton(((Polygon) value)).iterator(), false);
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_MULTIPOLYGON);
+
+ final Element mpMembs =
+ doc.createElementNS(Constants.NS_GML, Constants.ELEM_SURFACEMEMBERS);
+ tree.appendChild(mpMembs);
+
+ parsePolygons(mpMembs, ((MultiPolygon) value).iterator(), true);
+ break;
+
+ case GeographyCollection:
+ case GeometryCollection:
+ tree = doc.createElementNS(Constants.NS_GML, Constants.ELEM_GEOCOLLECTION);
+
+ final Element gMembs =
+ doc.createElementNS(Constants.NS_GML, Constants.ELEM_GEOMEMBERS);
+ tree.appendChild(gMembs);
+
+ final Iterator<Geospatial> itor = ((GeospatialCollection) value).iterator();
+ while (itor.hasNext()) {
+ final Geospatial geospatial = itor.next();
+ gMembs.appendChild(doc.importNode(parseGeospatial(geospatial), true));
+ }
+ break;
+
+ default:
+ tree = null;
+ }
+
+ return tree;
+ }
+
+ public Element toTree() {
+ return this.tree;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final ODataGeospatialValue other = (ODataGeospatialValue) obj;
+ return this.tree.isEqualNode(other.tree);
+ }
+
+ @Override
+ public String toString() {
+ final StringWriter writer = new StringWriter();
+ client.getSerializer().dom(this.tree, writer);
+ return writer.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataInvokeResult.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataInvokeResult.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataInvokeResult.java
new file mode 100644
index 0000000..0a759b3
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataInvokeResult.java
@@ -0,0 +1,30 @@
+/*
+ * 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.client.core.data;
+
+/**
+ * Marker interface for any OData domain object that can be returned by an operation invocation.
+ *
+ * @see ODataEntitySet
+ * @see ODataEntity
+ * @see ODataProperty
+ * @see ODataNoContent
+ */
+public interface ODataInvokeResult {
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataPrimitiveValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataPrimitiveValue.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataPrimitiveValue.java
new file mode 100644
index 0000000..b56c729
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataPrimitiveValue.java
@@ -0,0 +1,376 @@
+/*
+ * 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.client.core.data;
+
+import java.math.BigDecimal;
+import java.net.URI;
+import java.sql.Timestamp;
+import java.text.DecimalFormat;
+import java.util.Date;
+import java.util.UUID;
+import javax.xml.datatype.Duration;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.data.EdmSimpleType;
+import org.apache.olingo.odata4.client.core.data.ODataDuration;
+import org.apache.olingo.odata4.client.core.data.ODataTimestamp;
+import org.apache.olingo.odata4.client.core.data.ODataValue;
+
+/**
+ * OData primitive property value.
+ */
+public class ODataPrimitiveValue extends ODataValue {
+
+ private static final long serialVersionUID = 2841837627899878223L;
+
+ protected abstract static class AbstractBuilder {
+
+ private final ODataClient client;
+
+ /**
+ * Constructor.
+ */
+ public AbstractBuilder(final ODataClient client) {
+ this.client = client;
+ }
+
+ public AbstractBuilder isSupported(final EdmSimpleType type) {
+ if (type != null && !ArrayUtils.contains(type.getSupportedVersions(), client.getServiceVersion())) {
+ throw new IllegalArgumentException(String.format(
+ "Type %s not supported by the current OData working version", type.toString()));
+ }
+
+ return this;
+ }
+ }
+
+ /**
+ * Primitive value builder.
+ */
+ public static class Builder extends AbstractBuilder {
+
+ private final ODataPrimitiveValue opv;
+
+ /**
+ * Constructor.
+ */
+ public Builder(final ODataClient client) {
+ super(client);
+ this.opv = new ODataPrimitiveValue(client);
+ }
+
+ /**
+ * Sets the given value provided as a text.
+ *
+ * @param text value.
+ * @return the current builder.
+ */
+ public Builder setText(final String text) {
+ this.opv.text = text;
+ return this;
+ }
+
+ /**
+ * Sets the actual object value.
+ *
+ * @param value value.
+ * @return the current builder.
+ */
+ public Builder setValue(final Object value) {
+ this.opv.value = value;
+ return this;
+ }
+
+ /**
+ * Sets actual value type.
+ *
+ * @param type type.
+ * @return the current builder.
+ */
+ public Builder setType(final EdmSimpleType type) {
+ isSupported(type);
+
+ if (type == EdmSimpleType.Stream) {
+ throw new IllegalArgumentException(String.format(
+ "Cannot build a primitive value for %s", EdmSimpleType.Stream.toString()));
+ }
+
+ this.opv.type = type;
+ return this;
+ }
+
+ /**
+ * Builds the primitive value.
+ *
+ * @return <code>ODataPrimitiveValue</code> object.
+ */
+ public ODataPrimitiveValue build() {
+ if (this.opv.text == null && this.opv.value == null) {
+ throw new IllegalArgumentException("Must provide either text or value");
+ }
+ if (this.opv.text != null && this.opv.value != null) {
+ throw new IllegalArgumentException("Cannot provide both text and value");
+ }
+
+ if (this.opv.type == null) {
+ this.opv.type = EdmSimpleType.String;
+ }
+
+ if (this.opv.type.isGeospatial()) {
+ throw new IllegalArgumentException(
+ "Use " + ODataGeospatialValue.class.getSimpleName() + " for geospatial types");
+ }
+
+ if (this.opv.value instanceof Timestamp) {
+ this.opv.value = ODataTimestamp.getInstance(this.opv.type, (Timestamp) this.opv.value);
+ } else if (this.opv.value instanceof Date) {
+ this.opv.value = ODataTimestamp.getInstance(this.opv.type,
+ new Timestamp(((Date) this.opv.value).getTime()));
+ }
+ if (this.opv.value instanceof Duration) {
+ this.opv.value = new ODataDuration((Duration) this.opv.value);
+ }
+
+ if (this.opv.value != null && !this.opv.type.javaType().isAssignableFrom(this.opv.value.getClass())) {
+ throw new IllegalArgumentException("Provided value is not compatible with " + this.opv.type.toString());
+ }
+
+ if (this.opv.text != null) {
+ this.opv.parseText();
+ }
+ if (this.opv.value != null) {
+ this.opv.formatValue();
+ }
+
+ return this.opv;
+ }
+ }
+
+ protected ODataClient client;
+
+ /**
+ * Text value.
+ */
+ private String text;
+
+ /**
+ * Actual value.
+ */
+ protected Object value;
+
+ /**
+ * Value type.
+ */
+ protected EdmSimpleType type;
+
+ /**
+ * Protected constructor, need to use the builder to instantiate this class.
+ *
+ * @see Builder
+ */
+ protected ODataPrimitiveValue(final ODataClient client) {
+ super();
+ this.client = client;
+ }
+
+ /**
+ * Parses given text as object value.
+ */
+ private void parseText() {
+ switch (this.type) {
+ case Null:
+ this.value = null;
+ break;
+
+ case Binary:
+ this.value = Base64.decodeBase64(this.toString());
+ break;
+
+ case SByte:
+ this.value = Byte.parseByte(this.toString());
+ break;
+
+ case Boolean:
+ this.value = Boolean.parseBoolean(this.toString());
+ break;
+
+ case Date:
+ case DateTime:
+ case DateTimeOffset:
+ this.value = ODataTimestamp.parse(this.type, this.toString());
+ break;
+
+ case Time:
+ case TimeOfDay:
+ this.value = new ODataDuration(this.toString());
+ break;
+
+ case Decimal:
+ this.value = new BigDecimal(this.toString());
+ break;
+
+ case Single:
+ this.value = Float.parseFloat(this.toString());
+ break;
+
+ case Double:
+ this.value = Double.parseDouble(this.toString());
+ break;
+
+ case Guid:
+ this.value = UUID.fromString(this.toString());
+ break;
+
+ case Int16:
+ this.value = Short.parseShort(this.toString());
+ break;
+
+ case Byte:
+ case Int32:
+ this.value = Integer.parseInt(this.toString());
+ break;
+
+ case Int64:
+ this.value = Long.parseLong(this.toString());
+ break;
+
+ case Stream:
+ this.value = URI.create(this.toString());
+ break;
+
+ case String:
+ this.value = this.toString();
+ break;
+
+ default:
+ }
+ }
+
+ /**
+ * Format given value as text.
+ */
+ private void formatValue() {
+ switch (this.type) {
+ case Null:
+ this.text = StringUtils.EMPTY;
+ break;
+
+ case Binary:
+ this.text = Base64.encodeBase64String(this.<byte[]>toCastValue());
+ break;
+
+ case SByte:
+ this.text = this.<Byte>toCastValue().toString();
+ break;
+
+ case Boolean:
+ this.text = this.<Boolean>toCastValue().toString();
+ break;
+
+ case Date:
+ case DateTime:
+ case DateTimeOffset:
+ this.text = this.<ODataTimestamp>toCastValue().toString();
+ break;
+
+ case Time:
+ case TimeOfDay:
+ this.text = this.<ODataDuration>toCastValue().toString();
+ break;
+
+ case Decimal:
+ this.text = new DecimalFormat(this.type.pattern()).format(this.<BigDecimal>toCastValue());
+ break;
+
+ case Single:
+ this.text = new DecimalFormat(this.type.pattern()).format(this.<Float>toCastValue());
+ break;
+
+ case Double:
+ this.text = new DecimalFormat(this.type.pattern()).format(this.<Double>toCastValue());
+ break;
+
+ case Guid:
+ this.text = this.<UUID>toCastValue().toString();
+ break;
+
+ case Int16:
+ this.text = this.<Short>toCastValue().toString();
+ break;
+
+ case Byte:
+ case Int32:
+ this.text = this.<Integer>toCastValue().toString();
+ break;
+
+ case Int64:
+ this.text = this.<Long>toCastValue().toString();
+ break;
+
+ case Stream:
+ this.text = this.<URI>toCastValue().toASCIIString();
+ break;
+
+ case String:
+ this.text = this.<String>toCastValue();
+ break;
+
+ default:
+ }
+ }
+
+ /**
+ * Gets type name.
+ *
+ * @return type name.
+ */
+ public String getTypeName() {
+ return type.toString();
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ return this.text;
+ }
+
+ /**
+ * Gets actual primitive value.
+ *
+ * @return
+ */
+ public Object toValue() {
+ return this.value;
+ }
+
+ /**
+ * Casts primitive value.
+ *
+ * @param <T> cast.
+ * @return casted value.
+ */
+ @SuppressWarnings("unchecked")
+ public <T> T toCastValue() {
+ return (T) type.javaType().cast(toValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataProperty.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataProperty.java
new file mode 100644
index 0000000..8069860
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataProperty.java
@@ -0,0 +1,192 @@
+/*
+ * 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.client.core.data;
+
+import java.io.Serializable;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * OData entity property.
+ */
+public class ODataProperty implements Serializable, ODataInvokeResult {
+
+ /**
+ * Property type.
+ */
+ public enum PropertyType {
+
+ /**
+ * Primitive.
+ */
+ PRIMITIVE,
+ /**
+ * Collection
+ */
+ COLLECTION,
+ /**
+ * Complex.
+ */
+ COMPLEX,
+ /**
+ * Empty type (possibly, no type information could be retrieved).
+ */
+ EMPTY
+
+ }
+
+ private static final long serialVersionUID = 926939448778950450L;
+
+ /**
+ * Property name.
+ */
+ private final String name;
+
+ /**
+ * Property value.
+ */
+ private ODataValue value;
+
+ /**
+ * Constructor.
+ *
+ * @param name property name.
+ * @param value property value.
+ */
+ ODataProperty(final String name, final ODataValue value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Returns property name.
+ *
+ * @return property name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns property value.
+ *
+ * @return property value.
+ */
+ public ODataValue getValue() {
+ return value;
+ }
+
+ /**
+ * Updates property value.
+ *
+ * @param value property value that replaces current.
+ */
+ public void setValue(final ODataValue value) {
+ this.value = value;
+ }
+
+ /**
+ * Checks if has null value.
+ *
+ * @return 'TRUE' if has null value; 'FALSE' otherwise.
+ */
+ public boolean hasNullValue() {
+ return this.value == null;
+ }
+
+ /**
+ * Checks if has primitive value.
+ *
+ * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
+ */
+ public boolean hasPrimitiveValue() {
+ return !hasNullValue() && this.value.isPrimitive();
+ }
+
+ /**
+ * Gets primitive value.
+ *
+ * @return primitive value if exists; null otherwise.
+ */
+ public ODataPrimitiveValue getPrimitiveValue() {
+ return hasPrimitiveValue() ? this.value.asPrimitive() : null;
+ }
+
+ /**
+ * Checks if has complex value.
+ *
+ * @return 'TRUE' if has complex value; 'FALSE' otherwise.
+ */
+ public boolean hasComplexValue() {
+ return !hasNullValue() && this.value.isComplex();
+ }
+
+ /**
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ public ODataComplexValue getComplexValue() {
+ return hasComplexValue() ? this.value.asComplex() : null;
+ }
+
+ /**
+ * Checks if has collection value.
+ *
+ * @return 'TRUE' if has collection value; 'FALSE' otherwise.
+ */
+ public boolean hasCollectionValue() {
+ return !hasNullValue() && this.value.isCollection();
+ }
+
+ /**
+ * Gets collection value.
+ *
+ * @return collection value if exists; null otherwise.
+ */
+ public ODataCollectionValue getCollectionValue() {
+ return hasCollectionValue() ? this.value.asCollection() : null;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataTimestamp.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataTimestamp.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataTimestamp.java
new file mode 100644
index 0000000..3734408
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataTimestamp.java
@@ -0,0 +1,141 @@
+/*
+ * 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.client.core.data;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+/**
+ * Helper class for handling datetime and datetime-offset primitive values.
+ *
+ * @see com.msopentech.odatajclient.engine.data.metadata.edm.EdmSimpleType#DATE_TIME
+ * @see com.msopentech.odatajclient.engine.data.metadata.edm.EdmSimpleType#DATE_TIME_OFFSET
+ */
+public final class ODataTimestamp implements Serializable {
+
+ private static final long serialVersionUID = 4053990618660356004L;
+
+ private final SimpleDateFormat sdf;
+
+ private final Timestamp timestamp;
+
+ private String timezone;
+
+ private final boolean offset;
+
+ public static ODataTimestamp getInstance(final EdmSimpleType type, final Timestamp timestamp) {
+ return new ODataTimestamp(new SimpleDateFormat(type.pattern()),
+ new Date(timestamp.getTime()), timestamp.getNanos(), type == EdmSimpleType.DateTimeOffset);
+ }
+
+ public static ODataTimestamp parse(final EdmSimpleType type, final String input) {
+ final ODataTimestamp instance;
+
+ final String[] dateParts = input.split("\\.");
+ final SimpleDateFormat sdf = new SimpleDateFormat(type.pattern());
+ final boolean isOffset = type == EdmSimpleType.DateTimeOffset;
+
+ try {
+ final Date date = sdf.parse(dateParts[0]);
+ if (dateParts.length > 1) {
+ int idx = dateParts[1].indexOf('+');
+ if (idx == -1) {
+ idx = dateParts[1].indexOf('-');
+ }
+ if (idx == -1) {
+ instance = new ODataTimestamp(sdf, date, Integer.parseInt(dateParts[1]), isOffset);
+ } else {
+ instance = new ODataTimestamp(sdf, date,
+ Integer.parseInt(dateParts[1].substring(0, idx)), dateParts[1].substring(idx), isOffset);
+ }
+ } else {
+ instance = new ODataTimestamp(sdf, date, isOffset);
+ }
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Cannot parse " + type.pattern(), e);
+ }
+
+ return instance;
+ }
+
+ private ODataTimestamp(final SimpleDateFormat sdf, final Date date, final boolean offset) {
+ this.sdf = sdf;
+ this.timestamp = new Timestamp(date.getTime());
+ this.offset = offset;
+ }
+
+ private ODataTimestamp(final SimpleDateFormat sdf, final Date date, final int nanos, final boolean offset) {
+ this(sdf, date, offset);
+ this.timestamp.setNanos(nanos);
+ }
+
+ private ODataTimestamp(
+ final SimpleDateFormat sdf, final Date date, final int nanos, final String timezone, final boolean offset) {
+ this(sdf, date, nanos, offset);
+ this.timezone = timezone;
+ }
+
+ public Timestamp getTimestamp() {
+ return timestamp;
+ }
+
+ public String getTimezone() {
+ return timezone;
+ }
+
+ public boolean isOffset() {
+ return offset;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj, "sdf");
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this, "sdf");
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ final StringBuilder formatted = new StringBuilder().append(sdf.format(timestamp));
+ if (timestamp.getNanos() > 0) {
+ formatted.append('.').append(String.valueOf(timestamp.getNanos()));
+ }
+ if (StringUtils.isNotBlank(timezone)) {
+ formatted.append(timezone);
+ }
+ return formatted.toString();
+ }
+}
[10/14] [OLINGO-169] First huge import from ODataJClient: for the
moment,
it just build (no tests yet) and dummy Edm interfaces are used instead of the
ones from commons-api
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataValue.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataValue.java
new file mode 100644
index 0000000..a6e2201
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/ODataValue.java
@@ -0,0 +1,111 @@
+/*
+ * 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.client.core.data;
+
+import java.io.Serializable;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * Abstract representation of an OData entity property value.
+ */
+public abstract class ODataValue implements Serializable {
+
+ private static final long serialVersionUID = 7445422004232581877L;
+
+ /**
+ * Check is is a primitive value.
+ *
+ * @return 'TRUE' if primitive; 'FALSE' otherwise.
+ */
+ public boolean isPrimitive() {
+ return (this instanceof ODataPrimitiveValue);
+ }
+
+ /**
+ * Casts to primitive value.
+ *
+ * @return primitive value.
+ */
+ public ODataPrimitiveValue asPrimitive() {
+ return isPrimitive() ? (ODataPrimitiveValue) this : null;
+ }
+
+ /**
+ * Check is is a complex value.
+ *
+ * @return 'TRUE' if complex; 'FALSE' otherwise.
+ */
+ public boolean isComplex() {
+ return (this instanceof ODataComplexValue);
+ }
+
+ /**
+ * Casts to complex value.
+ *
+ * @return complex value.
+ */
+ public ODataComplexValue asComplex() {
+ return isComplex() ? (ODataComplexValue) this : null;
+ }
+
+ /**
+ * Check is is a collection value.
+ *
+ * @return 'TRUE' if collection; 'FALSE' otherwise.
+ */
+ public boolean isCollection() {
+ return (this instanceof ODataCollectionValue);
+ }
+
+ /**
+ * Casts to collection value.
+ *
+ * @return collection value.
+ */
+ public ODataCollectionValue asCollection() {
+ return isCollection() ? (ODataCollectionValue) this : null;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/ComposedGeospatial.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/ComposedGeospatial.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/ComposedGeospatial.java
new file mode 100644
index 0000000..78886d2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/ComposedGeospatial.java
@@ -0,0 +1,75 @@
+/*
+ * 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.client.core.data.geospatial;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Abstract base class for all Geometries that are composed out of other geospatial elements.
+ */
+public abstract class ComposedGeospatial<T extends Geospatial> extends Geospatial implements Iterable<T> {
+
+ private static final long serialVersionUID = 8796254901098541307L;
+
+ protected final List<T> geospatials;
+
+ /**
+ * Constructor.
+ *
+ * @param dimension dimension.
+ * @param type type.
+ * @param geospatials geospatials info.
+ */
+ protected ComposedGeospatial(final Dimension dimension, final Type type, final List<T> geospatials) {
+ super(dimension, type);
+ this.geospatials = new ArrayList<T>();
+ if (geospatials != null) {
+ this.geospatials.addAll(geospatials);
+ }
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public Iterator<T> iterator() {
+ return this.geospatials.iterator();
+ }
+
+ /**
+ * Checks if is empty.
+ *
+ * @return 'TRUE' if is empty; 'FALSE' otherwise.
+ */
+ public boolean isEmpty() {
+ return geospatials.isEmpty();
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public void setSrid(final Integer srid) {
+ for (Geospatial geospatial : this.geospatials) {
+ geospatial.setSrid(srid);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Geospatial.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Geospatial.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Geospatial.java
new file mode 100644
index 0000000..a5afae5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Geospatial.java
@@ -0,0 +1,156 @@
+/*
+ * 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.client.core.data.geospatial;
+
+import java.io.Serializable;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.odata4.client.core.data.EdmSimpleType;
+
+/**
+ * Base class for all geospatial info.
+ */
+public abstract class Geospatial implements Serializable {
+
+ public enum Dimension {
+
+ GEOMETRY,
+ GEOGRAPHY;
+
+ }
+
+ public enum Type {
+
+ /**
+ * The OGIS geometry type number for points.
+ */
+ POINT,
+ /**
+ * The OGIS geometry type number for lines.
+ */
+ LINESTRING,
+ /**
+ * The OGIS geometry type number for polygons.
+ */
+ POLYGON,
+ /**
+ * The OGIS geometry type number for aggregate points.
+ */
+ MULTIPOINT,
+ /**
+ * The OGIS geometry type number for aggregate lines.
+ */
+ MULTILINESTRING,
+ /**
+ * The OGIS geometry type number for aggregate polygons.
+ */
+ MULTIPOLYGON,
+ /**
+ * The OGIS geometry type number for feature collections.
+ */
+ GEOSPATIALCOLLECTION;
+
+ }
+
+ protected final Dimension dimension;
+
+ protected final Type type;
+
+ /**
+ * Null value means it is expected to vary per instance.
+ */
+ protected Integer srid;
+
+ /**
+ * Constructor.
+ *
+ * @param dimension dimension.
+ * @param type type.
+ */
+ protected Geospatial(final Dimension dimension, final Type type) {
+ this.dimension = dimension;
+ this.type = type;
+ }
+
+ /**
+ * Gets dimension.
+ *
+ * @return dimension.
+ * @see Dimension
+ */
+ public Dimension getDimension() {
+ return dimension;
+ }
+
+ /**
+ * Gets type.
+ *
+ * @return type.
+ * @see Type
+ */
+ public Type getType() {
+ return type;
+ }
+
+ /**
+ * Gets s-rid.
+ *
+ * @return s-rid.
+ */
+ public Integer getSrid() {
+ return srid;
+ }
+
+ /**
+ * Sets s-rid.
+ *
+ * @param srid s-rid.
+ */
+ public void setSrid(final Integer srid) {
+ this.srid = srid;
+ }
+
+ public abstract EdmSimpleType getEdmSimpleType();
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/GeospatialCollection.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/GeospatialCollection.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/GeospatialCollection.java
new file mode 100644
index 0000000..4977953
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/GeospatialCollection.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.data.geospatial;
+
+import java.util.List;
+import org.apache.olingo.odata4.client.core.data.EdmSimpleType;
+
+/**
+ * Wrapper for a collection of geospatials info.
+ */
+public class GeospatialCollection extends ComposedGeospatial<Geospatial> {
+
+ private static final long serialVersionUID = -9181547636133878977L;
+
+ /**
+ * Constructor.
+ *
+ * @param dimension dimension.
+ * @param geospatials geospatials info.
+ */
+ public GeospatialCollection(final Dimension dimension, final List<Geospatial> geospatials) {
+ super(dimension, Type.GEOSPATIALCOLLECTION, geospatials);
+ }
+
+ @Override
+ public EdmSimpleType getEdmSimpleType() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyCollection
+ : EdmSimpleType.GeometryCollection;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/LineString.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/LineString.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/LineString.java
new file mode 100644
index 0000000..09c9638
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/LineString.java
@@ -0,0 +1,38 @@
+/*
+ * 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.client.core.data.geospatial;
+
+import java.util.List;
+import org.apache.olingo.odata4.client.core.data.EdmSimpleType;
+
+public class LineString extends ComposedGeospatial<Point> {
+
+ private static final long serialVersionUID = 3207958185407535907L;
+
+ public LineString(final Dimension dimension, final List<Point> points) {
+ super(dimension, Type.LINESTRING, points);
+ }
+
+ @Override
+ public EdmSimpleType getEdmSimpleType() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyLineString
+ : EdmSimpleType.GeometryLineString;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiLineString.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiLineString.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiLineString.java
new file mode 100644
index 0000000..a506dd8
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiLineString.java
@@ -0,0 +1,38 @@
+/*
+ * 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.client.core.data.geospatial;
+
+import java.util.List;
+import org.apache.olingo.odata4.client.core.data.EdmSimpleType;
+
+public class MultiLineString extends ComposedGeospatial<LineString> {
+
+ private static final long serialVersionUID = -5042414471218124125L;
+
+ public MultiLineString(final Dimension dimension, final List<LineString> lineStrings) {
+ super(dimension, Type.MULTILINESTRING, lineStrings);
+ }
+
+ @Override
+ public EdmSimpleType getEdmSimpleType() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyMultiLineString
+ : EdmSimpleType.GeometryMultiLineString;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiPoint.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiPoint.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiPoint.java
new file mode 100644
index 0000000..408c590
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiPoint.java
@@ -0,0 +1,38 @@
+/*
+ * 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.client.core.data.geospatial;
+
+import java.util.List;
+import org.apache.olingo.odata4.client.core.data.EdmSimpleType;
+
+public class MultiPoint extends ComposedGeospatial<Point> {
+
+ private static final long serialVersionUID = 4951011255142116129L;
+
+ public MultiPoint(final Dimension dimension, final List<Point> points) {
+ super(dimension, Type.MULTIPOINT, points);
+ }
+
+ @Override
+ public EdmSimpleType getEdmSimpleType() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyMultiPoint
+ : EdmSimpleType.GeometryMultiPoint;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiPolygon.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiPolygon.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiPolygon.java
new file mode 100644
index 0000000..4ce9dcb
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/MultiPolygon.java
@@ -0,0 +1,38 @@
+/*
+ * 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.client.core.data.geospatial;
+
+import java.util.List;
+import org.apache.olingo.odata4.client.core.data.EdmSimpleType;
+
+public class MultiPolygon extends ComposedGeospatial<Polygon> {
+
+ private static final long serialVersionUID = -160184788048512883L;
+
+ public MultiPolygon(final Dimension dimension, final List<Polygon> polygons) {
+ super(dimension, Type.MULTIPOLYGON, polygons);
+ }
+
+ @Override
+ public EdmSimpleType getEdmSimpleType() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyMultiPolygon
+ : EdmSimpleType.GeometryMultiPolygon;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Point.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Point.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Point.java
new file mode 100644
index 0000000..0168ae5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Point.java
@@ -0,0 +1,77 @@
+/*
+ * 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.client.core.data.geospatial;
+
+import org.apache.olingo.odata4.client.core.data.EdmSimpleType;
+
+public class Point extends Geospatial {
+
+ private static final long serialVersionUID = 4917380107331557828L;
+
+ /**
+ * The X coordinate of the point. In most long/lat systems, this is the longitude.
+ */
+ private double x;
+
+ /**
+ * The Y coordinate of the point. In most long/lat systems, this is the latitude.
+ */
+ private double y;
+
+ /**
+ * The Z coordinate of the point. In most long/lat systems, this is a radius from the center of the earth, or the
+ * height / elevation over the ground.
+ */
+ private double z;
+
+ public Point(final Dimension dimension) {
+ super(dimension, Type.POINT);
+ }
+
+ public double getX() {
+ return x;
+ }
+
+ public void setX(double x) {
+ this.x = x;
+ }
+
+ public double getY() {
+ return y;
+ }
+
+ public void setY(double y) {
+ this.y = y;
+ }
+
+ public double getZ() {
+ return z;
+ }
+
+ public void setZ(double z) {
+ this.z = z;
+ }
+
+ @Override
+ public EdmSimpleType getEdmSimpleType() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyPoint
+ : EdmSimpleType.GeometryPoint;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Polygon.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Polygon.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Polygon.java
new file mode 100644
index 0000000..f45d6a8
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/geospatial/Polygon.java
@@ -0,0 +1,72 @@
+/*
+ * 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.client.core.data.geospatial;
+
+import java.util.List;
+import org.apache.olingo.odata4.client.core.data.EdmSimpleType;
+
+/**
+ * Polygon.
+ */
+public class Polygon extends Geospatial {
+
+ private static final long serialVersionUID = 7797602503445391678L;
+
+ final ComposedGeospatial<Point> interior;
+
+ final ComposedGeospatial<Point> exterior;
+
+ /**
+ * Constructor.
+ *
+ * @param dimension dimension.
+ * @param interior interior points.
+ * @param exterior exterior points.
+ */
+ public Polygon(final Dimension dimension, final List<Point> interior, final List<Point> exterior) {
+ super(dimension, Type.POLYGON);
+ this.interior = new MultiPoint(dimension, interior);
+ this.exterior = new MultiPoint(dimension, exterior);
+ }
+
+ /**
+ * Gest interior points.
+ *
+ * @return interior points.
+ */
+ public ComposedGeospatial<Point> getInterior() {
+ return interior;
+ }
+
+ /**
+ * Gets exterior points.
+ *
+ * @return exterior points.I
+ */
+ public ComposedGeospatial<Point> getExterior() {
+ return exterior;
+ }
+
+ @Override
+ public EdmSimpleType getEdmSimpleType() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyPolygon
+ : EdmSimpleType.GeometryPolygon;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractEdmDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractEdmDeserializer.java
new file mode 100644
index 0000000..ac7d6cc
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractEdmDeserializer.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.client.core.data.impl;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.edm.v4.ReturnTypeImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.annotation.ConstExprConstruct;
+
+public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
+
+ protected ODataClient client;
+
+ protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
+ return ConstExprConstruct.Type.fromString(jp.getCurrentName()) != null;
+ }
+
+ protected ConstExprConstruct parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
+ final ConstExprConstruct constExpr = new ConstExprConstruct();
+ constExpr.setType(ConstExprConstruct.Type.fromString(jp.getCurrentName()));
+ constExpr.setValue(jp.nextTextValue());
+ return constExpr;
+ }
+
+ protected ReturnTypeImpl parseReturnType(final JsonParser jp, final String elementName) throws IOException {
+ ReturnTypeImpl returnType;
+ if (elementName.equals(((FromXmlParser) jp).getStaxReader().getLocalName())) {
+ returnType = new ReturnTypeImpl();
+ returnType.setType(jp.nextTextValue());
+ } else {
+ jp.nextToken();
+ returnType = jp.getCodec().readValue(jp, ReturnTypeImpl.class);
+ }
+ return returnType;
+ }
+
+ protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt)
+ throws IOException, JsonProcessingException;
+
+ @Override
+ public T deserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ client = (ODataClient) ctxt.findInjectableValue(ODataClient.class.getName(), null, null);
+ return doDeserialize(jp, ctxt);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractJacksonTool.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractJacksonTool.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractJacksonTool.java
new file mode 100644
index 0000000..b524ba9
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractJacksonTool.java
@@ -0,0 +1,83 @@
+/*
+ * 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.client.core.data.impl;
+
+import com.fasterxml.aalto.stax.InputFactoryImpl;
+import com.fasterxml.aalto.stax.OutputFactoryImpl;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.InjectableValues;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.deser.DeserializationProblemHandler;
+import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
+import com.fasterxml.jackson.dataformat.xml.XmlFactory;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+abstract class AbstractJacksonTool {
+
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractJacksonTool.class);
+
+ protected final ODataClient client;
+
+ protected AbstractJacksonTool(final ODataClient client) {
+ this.client = client;
+ }
+
+ protected ObjectMapper getObjectMapper() {
+ final ObjectMapper mapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
+
+ mapper.setInjectableValues(new InjectableValues.Std().addValue(ODataClient.class, client));
+
+ mapper.setSerializerProvider(new InjectableSerializerProvider(mapper.getSerializerProvider(),
+ mapper.getSerializationConfig().withAttribute(ODataClient.class, client),
+ mapper.getSerializerFactory()));
+
+ return mapper;
+ }
+
+ protected XmlMapper getXmlMapper() {
+ final XmlMapper xmlMapper = new XmlMapper(
+ new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());
+
+ xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(ODataClient.class, client));
+
+ xmlMapper.addHandler(new DeserializationProblemHandler() {
+
+ @Override
+ public boolean handleUnknownProperty(final DeserializationContext ctxt, final JsonParser jp,
+ final JsonDeserializer<?> deserializer, final Object beanOrClass, final String propertyName)
+ throws IOException, JsonProcessingException {
+
+ // skip any unknown property
+ LOG.warn("Skipping unknown property {}", propertyName);
+ ctxt.getParser().skipChildren();
+ return true;
+ }
+ });
+ return xmlMapper;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataDeserializer.java
new file mode 100644
index 0000000..2cfc974
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataDeserializer.java
@@ -0,0 +1,177 @@
+/*
+ * 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.client.core.data.impl;
+
+import java.io.InputStream;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.api.data.ODataDeserializer;
+import org.apache.olingo.odata4.client.core.utils.XMLUtils;
+import org.w3c.dom.Element;
+
+public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements ODataDeserializer {
+
+ private static final long serialVersionUID = -4244158979195609909L;
+
+// private final AtomDeserializer atomDeserializer;
+ public AbstractODataDeserializer(final ODataClient client) {
+ super(client);
+// this.atomDeserializer = new AtomDeserializer(client);
+ }
+
+// @Override
+// @SuppressWarnings("unchecked")
+// public <T extends Feed> T toFeed(final InputStream input, final Class<T> reference) {
+// T entry;
+//
+// if (AtomFeed.class.equals(reference)) {
+// entry = (T) toAtomFeed(input);
+// } else {
+// entry = (T) toJSONFeed(input);
+// }
+//
+// return entry;
+// }
+//
+// @Override
+// @SuppressWarnings("unchecked")
+// public <T extends Entry> T toEntry(final InputStream input, final Class<T> reference) {
+// T entry;
+//
+// if (AtomEntry.class.equals(reference)) {
+// entry = (T) toAtomEntry(input);
+//
+// } else {
+// entry = (T) toJSONEntry(input);
+// }
+//
+// return entry;
+// }
+//
+// @Override
+// public Element toPropertyDOM(final InputStream input, final ODataFormat format) {
+// return format == ODataFormat.XML
+// ? toPropertyDOMFromXML(input)
+// : toPropertyDOMFromJSON(input);
+// }
+//
+// @Override
+// public LinkCollection toLinkCollection(final InputStream input, final ODataFormat format) {
+// return format == ODataFormat.XML
+// ? toLinkCollectionFromXML(input)
+// : toLinkCollectionFromJSON(input);
+// }
+//
+// @Override
+// public ODataError toODataError(final InputStream input, final boolean isXML) {
+// return isXML
+// ? toODataErrorFromXML(input)
+// : toODataErrorFromJSON(input);
+// }
+//
+ @Override
+ public Element toDOM(final InputStream input) {
+ return XMLUtils.PARSER.deserialize(input);
+ }
+//
+// /*
+// * ------------------ Protected methods ------------------
+// */
+// protected AtomFeed toAtomFeed(final InputStream input) {
+// try {
+// return atomDeserializer.feed(toDOM(input));
+// } catch (Exception e) {
+// throw new IllegalArgumentException("While deserializing Atom feed", e);
+// }
+// }
+//
+// protected AtomEntry toAtomEntry(final InputStream input) {
+// try {
+// return atomDeserializer.entry(toDOM(input));
+// } catch (Exception e) {
+// throw new IllegalArgumentException("While deserializing Atom entry", e);
+// }
+// }
+//
+// protected JSONFeed toJSONFeed(final InputStream input) {
+// try {
+// return getObjectMapper().readValue(input, JSONFeed.class);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("While deserializing JSON feed", e);
+// }
+// }
+//
+// protected abstract AbstractJSONEntry toJSONEntry(final InputStream input);
+//
+// protected Element toPropertyDOMFromXML(final InputStream input) {
+// return toDOM(input);
+// }
+//
+// protected Element toPropertyDOMFromJSON(final InputStream input) {
+// try {
+// return getObjectMapper().readValue(input, JSONProperty.class).getContent();
+// } catch (IOException e) {
+// throw new IllegalArgumentException("While deserializing JSON property", e);
+// }
+// }
+//
+// protected XMLLinkCollection toLinkCollectionFromXML(final InputStream input) {
+// final Element root = toDOM(input);
+//
+// final NodeList uris = root.getOwnerDocument().getElementsByTagName(ODataConstants.ELEM_URI);
+//
+// final List<URI> links = new ArrayList<URI>();
+// for (int i = 0; i < uris.getLength(); i++) {
+// links.add(URI.create(uris.item(i).getTextContent()));
+// }
+//
+// final NodeList next = root.getElementsByTagName(ODataConstants.NEXT_LINK_REL);
+// final XMLLinkCollection linkCollection = next.getLength() > 0
+// ? new XMLLinkCollection(URI.create(next.item(0).getTextContent()))
+// : new XMLLinkCollection();
+// linkCollection.setLinks(links);
+//
+// return linkCollection;
+// }
+//
+// protected JSONLinkCollection toLinkCollectionFromJSON(final InputStream input) {
+// try {
+// return getObjectMapper().readValue(input, JSONLinkCollection.class);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("While deserializing JSON $links", e);
+// }
+// }
+//
+// protected XMLODataError toODataErrorFromXML(final InputStream input) {
+// try {
+// final XmlMapper xmlMapper = new XmlMapper(
+// new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());
+// return xmlMapper.readValue(input, XMLODataError.class);
+// } catch (Exception e) {
+// throw new IllegalArgumentException("While deserializing XML error", e);
+// }
+// }
+//
+// protected JSONODataError toODataErrorFromJSON(final InputStream input) {
+// try {
+// return getObjectMapper().readValue(input, JSONODataErrorBundle.class).getError();
+// } catch (IOException e) {
+// throw new IllegalArgumentException("While deserializing JSON error", e);
+// }
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataReader.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataReader.java
new file mode 100644
index 0000000..0e45ca5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataReader.java
@@ -0,0 +1,138 @@
+/*
+ * 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.client.core.data.impl;
+
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.api.data.ODataReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractODataReader implements ODataReader {
+
+ private static final long serialVersionUID = -1988865870981207079L;
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractODataReader.class);
+
+ protected final ODataClient client;
+
+ protected AbstractODataReader(final ODataClient client) {
+ this.client = client;
+ }
+
+// @Override
+// public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
+// return client.getBinder().getODataEntitySet(
+// client.getDeserializer().toFeed(input, ResourceFactory.feedClassForFormat(format)));
+// }
+//
+// @Override
+// public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
+// return client.getBinder().getODataEntity(
+// client.getDeserializer().toEntry(input, ResourceFactory.entryClassForFormat(format)));
+// }
+//
+// @Override
+// public ODataProperty readProperty(final InputStream input, final ODataFormat format) {
+// final Element property = client.getDeserializer().toPropertyDOM(input, format);
+//
+// // The ODataProperty object is used either for actual entity properties and for invoke result
+// // (when return type is neither an entity nor a collection of entities).
+// // Such formats are mostly the same except for collections: an entity property looks like
+// // <aproperty m:type="Collection(AType)">
+// // <element>....</element>
+// // </aproperty>
+// //
+// // while an invoke result with returnType="Collection(AnotherType)" looks like
+// // <functionImportName>
+// // <element m:type="AnotherType">...</element>
+// // <functionImportName>
+// //
+// // The code below is meant for "normalizing" the latter into
+// // <functionImportName m:type="Collection(AnotherType)">
+// // <element m:type="AnotherType">...</element>
+// // <functionImportName>
+// final String type = property.getAttribute(ODataConstants.ATTR_M_TYPE);
+// final NodeList elements = property.getElementsByTagName(ODataConstants.ELEM_ELEMENT);
+// if (StringUtils.isBlank(type) && elements != null && elements.getLength() > 0) {
+// final Node elementType = elements.item(0).getAttributes().getNamedItem(ODataConstants.ATTR_M_TYPE);
+// if (elementType != null) {
+// property.setAttribute(ODataConstants.ATTR_M_TYPE, "Collection(" + elementType.getTextContent() + ")");
+// }
+// }
+//
+// return client.getBinder().getProperty(property);
+// }
+//
+// @Override
+// public ODataLinkCollection readLinks(final InputStream input, final ODataFormat format) {
+// return client.getBinder().getLinkCollection(
+// client.getDeserializer().toLinkCollection(input, format));
+// }
+//
+// @Override
+// public ODataError readError(final InputStream inputStream, final boolean isXML) {
+// return client.getDeserializer().toODataError(inputStream, isXML);
+// }
+//
+// @Override
+// @SuppressWarnings("unchecked")
+// public <T> T read(final InputStream src, final String format, final Class<T> reference) {
+// Object res;
+//
+// try {
+// if (ODataEntitySetIterator.class.isAssignableFrom(reference)) {
+// res = new ODataEntitySetIterator(client, src, ODataPubFormat.fromString(format));
+// } else if (ODataEntitySet.class.isAssignableFrom(reference)) {
+// res = readEntitySet(src, ODataPubFormat.fromString(format));
+// } else if (ODataEntity.class.isAssignableFrom(reference)) {
+// res = readEntity(src, ODataPubFormat.fromString(format));
+// } else if (ODataProperty.class.isAssignableFrom(reference)) {
+// res = readProperty(src, ODataFormat.fromString(format));
+// } else if (ODataLinkCollection.class.isAssignableFrom(reference)) {
+// res = readLinks(src, ODataFormat.fromString(format));
+// } else if (ODataValue.class.isAssignableFrom(reference)) {
+// res = client.getPrimitiveValueBuilder().
+// setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT
+// ? EdmSimpleType.String : EdmSimpleType.Stream).
+// setText(IOUtils.toString(src)).
+// build();
+// } else if (AbstractEdmMetadata.class.isAssignableFrom(reference)) {
+// res = readMetadata(src);
+// } else if (ODataServiceDocument.class.isAssignableFrom(reference)) {
+// res = readServiceDocument(src, ODataFormat.fromString(format));
+// } else if (ODataError.class.isAssignableFrom(reference)) {
+// res = readError(src, !format.toString().contains("json"));
+// } else {
+// throw new IllegalArgumentException("Invalid reference type " + reference);
+// }
+// } catch (Exception e) {
+// LOG.warn("Cast error", e);
+// res = null;
+// } finally {
+// if (!ODataEntitySetIterator.class.isAssignableFrom(reference)) {
+// IOUtils.closeQuietly(src);
+// }
+// }
+//
+// return (T) res;
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataSerializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataSerializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataSerializer.java
new file mode 100644
index 0000000..2dc3c57
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/AbstractODataSerializer.java
@@ -0,0 +1,160 @@
+/*
+ * 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.client.core.data.impl;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.api.data.ODataSerializer;
+import org.apache.olingo.odata4.client.core.utils.XMLUtils;
+import org.w3c.dom.Node;
+
+public abstract class AbstractODataSerializer extends AbstractJacksonTool implements ODataSerializer {
+
+ private static final long serialVersionUID = -357777648541325363L;
+
+// private final AtomSerializer atomSerializer;
+ public AbstractODataSerializer(final ODataClient client) {
+ super(client);
+// this.atomSerializer = new AtomSerializer(client);
+ }
+
+// @Override
+// public <T extends Feed> void feed(final T obj, final OutputStream out) {
+// feed(obj, new OutputStreamWriter(out));
+// }
+//
+// @Override
+// public <T extends Feed> void feed(final T obj, final Writer writer) {
+// if (obj instanceof AtomFeed) {
+// atom((AtomFeed) obj, writer);
+// } else {
+// json((JSONFeed) obj, writer);
+// }
+// }
+//
+// @Override
+// public <T extends Entry> void entry(final T obj, final OutputStream out) {
+// entry(obj, new OutputStreamWriter(out));
+// }
+//
+// @Override
+// public <T extends Entry> void entry(final T obj, final Writer writer) {
+// if (obj instanceof AtomEntry) {
+// atom((AtomEntry) obj, writer);
+// } else {
+// json((JSONEntry) obj, writer);
+// }
+// }
+//
+// @Override
+// public void property(final Element element, final ODataFormat format, final OutputStream out) {
+// property(element, format, new OutputStreamWriter(out));
+// }
+//
+// @Override
+// public void property(final Element element, final ODataFormat format, final Writer writer) {
+// if (format == ODataFormat.XML) {
+// dom(element, writer);
+// } else {
+// json(element, writer);
+// }
+// }
+//
+// @Override
+// public void link(final ODataLink link, final ODataFormat format, final OutputStream out) {
+// link(link, format, new OutputStreamWriter(out));
+// }
+//
+// @Override
+// public void link(final ODataLink link, final ODataFormat format, final Writer writer) {
+// if (format == ODataFormat.XML) {
+// xmlLink(link, writer);
+// } else {
+// jsonLink(link, writer);
+// }
+// }
+//
+ @Override
+ public void dom(final Node content, final OutputStream out) {
+ dom(content, new OutputStreamWriter(out));
+ }
+
+ @Override
+ public void dom(final Node content, final Writer writer) {
+ XMLUtils.PARSER.serialize(content, writer);
+ }
+//
+// /*
+// * ------------------ Protected methods ------------------
+// */
+// protected <T extends AbstractPayloadObject> void atom(final T obj, final Writer writer) {
+// try {
+// dom(atomSerializer.serialize(obj), writer);
+// } catch (Exception e) {
+// throw new IllegalArgumentException("While serializing Atom object", e);
+// }
+// }
+//
+// protected <T extends AbstractPayloadObject> void json(final T obj, final Writer writer) {
+// try {
+// getObjectMapper().writeValue(writer, obj);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("While serializing JSON object", e);
+// }
+// }
+//
+// protected void json(final Element element, final Writer writer) {
+// try {
+// final JSONProperty property = new JSONProperty();
+// property.setContent(element);
+// getObjectMapper().writeValue(writer, property);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("While serializing JSON property", e);
+// }
+// }
+//
+// protected void xmlLink(final ODataLink link, final Writer writer) {
+// try {
+// final DocumentBuilder builder = XMLUtils.DOC_BUILDER_FACTORY.newDocumentBuilder();
+// final Document doc = builder.newDocument();
+// final Element uri = doc.createElementNS(
+// client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_DATASERVICES),
+// ODataConstants.ELEM_URI);
+// uri.appendChild(doc.createTextNode(link.getLink().toASCIIString()));
+//
+// dom(uri, writer);
+// } catch (Exception e) {
+// throw new IllegalArgumentException("While serializing XML link", e);
+// }
+// }
+//
+// protected void jsonLink(final ODataLink link, final Writer writer) {
+// final ObjectMapper mapper = getObjectMapper();
+// final ObjectNode uri = mapper.createObjectNode();
+// uri.put(ODataConstants.JSON_URL, link.getLink().toASCIIString());
+//
+// try {
+// mapper.writeValue(writer, uri);
+// } catch (Exception e) {
+// throw new IllegalArgumentException("While serializing JSON link", e);
+// }
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/ComplexTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/ComplexTypeDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/ComplexTypeDeserializer.java
new file mode 100644
index 0000000..46f5bfa
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/ComplexTypeDeserializer.java
@@ -0,0 +1,81 @@
+/*
+ * 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.client.core.data.impl;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.odata4.client.core.edm.AbstractComplexType;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+public class ComplexTypeDeserializer extends AbstractEdmDeserializer<AbstractComplexType> {
+
+ @Override
+ protected AbstractComplexType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AbstractComplexType complexType = ODataServiceVersion.V30 == client.getServiceVersion()
+ ? new org.apache.olingo.odata4.client.core.edm.v3.ComplexTypeImpl()
+ : new org.apache.olingo.odata4.client.core.edm.v4.ComplexTypeImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ complexType.setName(jp.nextTextValue());
+ } else if ("Abstract".equals(jp.getCurrentName())) {
+ ((org.apache.olingo.odata4.client.core.edm.v4.ComplexTypeImpl) complexType).
+ setAbstractEntityType(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("BaseType".equals(jp.getCurrentName())) {
+ ((org.apache.olingo.odata4.client.core.edm.v4.ComplexTypeImpl) complexType).
+ setBaseType(jp.nextTextValue());
+ } else if ("OpenType".equals(jp.getCurrentName())) {
+ ((org.apache.olingo.odata4.client.core.edm.v4.ComplexTypeImpl) complexType).
+ setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Property".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (complexType instanceof org.apache.olingo.odata4.client.core.edm.v3.ComplexTypeImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.ComplexTypeImpl) complexType).
+ getProperties().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.PropertyImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.ComplexTypeImpl) complexType).
+ getProperties().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.PropertyImpl.class));
+ }
+ } else if ("NavigationProperty".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.ComplexTypeImpl) complexType).
+ getNavigationProperties().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.NavigationPropertyImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.ComplexTypeImpl) complexType).
+ setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return complexType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityContainerDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityContainerDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityContainerDeserializer.java
new file mode 100644
index 0000000..1fa365e
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityContainerDeserializer.java
@@ -0,0 +1,100 @@
+/*
+ * 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.client.core.data.impl;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.odata4.client.core.edm.AbstractEntityContainer;
+import org.apache.olingo.odata4.client.core.edm.v3.AssociationSetImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.ActionImportImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.SingletonImpl;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+@SuppressWarnings("rawtypes")
+public class EntityContainerDeserializer extends AbstractEdmDeserializer<AbstractEntityContainer> {
+
+ @Override
+ protected AbstractEntityContainer doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AbstractEntityContainer entityContainer = ODataServiceVersion.V30 == client.getServiceVersion()
+ ? new org.apache.olingo.odata4.client.core.edm.v3.EntityContainerImpl()
+ : new org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ entityContainer.setName(jp.nextTextValue());
+ } else if ("Extends".equals(jp.getCurrentName())) {
+ entityContainer.setExtends(jp.nextTextValue());
+ } else if ("LazyLoadingEnabled".equals(jp.getCurrentName())) {
+ entityContainer.setLazyLoadingEnabled(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("IsDefaultEntityContainer".equals(jp.getCurrentName())) {
+ entityContainer.setDefaultEntityContainer(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("EntitySet".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (entityContainer instanceof org.apache.olingo.odata4.client.core.edm.v3.EntityContainerImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.EntityContainerImpl) entityContainer).
+ getEntitySets().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.EntitySetImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl) entityContainer).
+ getEntitySets().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.EntitySetImpl.class));
+ }
+ } else if ("AssociationSet".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v3.EntityContainerImpl) entityContainer).
+ getAssociationSets().add(jp.getCodec().readValue(jp, AssociationSetImpl.class));
+ } else if ("Singleton".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl) entityContainer).
+ getSingletons().add(jp.getCodec().readValue(jp, SingletonImpl.class));
+ } else if ("ActionImport".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl) entityContainer).
+ getActionImports().add(jp.getCodec().readValue(jp, ActionImportImpl.class));
+ } else if ("FunctionImport".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (entityContainer instanceof org.apache.olingo.odata4.client.core.edm.v3.EntityContainerImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.EntityContainerImpl) entityContainer).
+ getFunctionImports().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.FunctionImportImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl) entityContainer).
+ getFunctionImports().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.FunctionImportImpl.class));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl) entityContainer).
+ setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return entityContainer;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityKeyDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityKeyDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityKeyDeserializer.java
new file mode 100644
index 0000000..7610817
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityKeyDeserializer.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.client.core.data.impl;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.edm.EntityKeyImpl;
+import org.apache.olingo.odata4.client.core.edm.PropertyRefImpl;
+
+public class EntityKeyDeserializer extends AbstractEdmDeserializer<EntityKeyImpl> {
+
+ @Override
+ protected EntityKeyImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final EntityKeyImpl entityKey = new EntityKeyImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+
+ if (token == JsonToken.FIELD_NAME && "PropertyRef".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entityKey.getPropertyRefs().add(jp.getCodec().readValue(jp, PropertyRefImpl.class));
+ }
+ }
+
+ return entityKey;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntitySetDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntitySetDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntitySetDeserializer.java
new file mode 100644
index 0000000..4b9e66b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntitySetDeserializer.java
@@ -0,0 +1,68 @@
+/*
+ * 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.client.core.data.impl;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.odata4.client.core.edm.AbstractEntitySet;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.NavigationPropertyBindingImpl;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+public class EntitySetDeserializer extends AbstractEdmDeserializer<AbstractEntitySet> {
+
+ @Override
+ protected AbstractEntitySet doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AbstractEntitySet entitySet = ODataServiceVersion.V30 == client.getServiceVersion()
+ ? new org.apache.olingo.odata4.client.core.edm.v3.EntitySetImpl()
+ : new org.apache.olingo.odata4.client.core.edm.v4.EntitySetImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ entitySet.setName(jp.nextTextValue());
+ } else if ("EntityType".equals(jp.getCurrentName())) {
+ entitySet.setEntityType(jp.nextTextValue());
+ } else if ("IncludeInServiceDocument".equals(jp.getCurrentName())) {
+ ((org.apache.olingo.odata4.client.core.edm.v4.EntitySetImpl) entitySet).
+ setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.EntitySetImpl) entitySet).
+ getNavigationPropertyBindings().add(
+ jp.getCodec().readValue(jp, NavigationPropertyBindingImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.EntitySetImpl) entitySet).
+ setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return entitySet;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityTypeDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityTypeDeserializer.java
new file mode 100644
index 0000000..c6fa3a4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EntityTypeDeserializer.java
@@ -0,0 +1,90 @@
+/*
+ * 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.client.core.data.impl;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.odata4.client.core.edm.AbstractEntityType;
+import org.apache.olingo.odata4.client.core.edm.EntityKeyImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+public class EntityTypeDeserializer extends AbstractEdmDeserializer<AbstractEntityType> {
+
+ @Override
+ protected AbstractEntityType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AbstractEntityType entityType = ODataServiceVersion.V30 == client.getServiceVersion()
+ ? new org.apache.olingo.odata4.client.core.edm.v3.EntityTypeImpl()
+ : new org.apache.olingo.odata4.client.core.edm.v4.EntityTypeImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ entityType.setName(jp.nextTextValue());
+ } else if ("Abstract".equals(jp.getCurrentName())) {
+ entityType.setAbstractEntityType(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("BaseType".equals(jp.getCurrentName())) {
+ entityType.setBaseType(jp.nextTextValue());
+ } else if ("OpenType".equals(jp.getCurrentName())) {
+ entityType.setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("HasStream".equals(jp.getCurrentName())) {
+ entityType.setHasStream(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Key".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entityType.setKey(jp.getCodec().readValue(jp, EntityKeyImpl.class));
+ } else if ("Property".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (entityType instanceof org.apache.olingo.odata4.client.core.edm.v3.EntityTypeImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.EntityTypeImpl) entityType).
+ getProperties().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.PropertyImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.EntityTypeImpl) entityType).
+ getProperties().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.PropertyImpl.class));
+ }
+ } else if ("NavigationProperty".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (entityType instanceof org.apache.olingo.odata4.client.core.edm.v3.EntityTypeImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.EntityTypeImpl) entityType).
+ getNavigationProperties().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.NavigationPropertyImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.EntityTypeImpl) entityType).
+ getNavigationProperties().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.NavigationPropertyImpl.class));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.EntityTypeImpl) entityType).
+ setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return entityType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EnumTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EnumTypeDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EnumTypeDeserializer.java
new file mode 100644
index 0000000..9d3a563
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/EnumTypeDeserializer.java
@@ -0,0 +1,71 @@
+/*
+ * 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.client.core.data.impl;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.odata4.client.core.edm.AbstractEnumType;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+public class EnumTypeDeserializer extends AbstractEdmDeserializer<AbstractEnumType> {
+
+ @Override
+ protected AbstractEnumType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AbstractEnumType enumType = ODataServiceVersion.V30 == client.getServiceVersion()
+ ? new org.apache.olingo.odata4.client.core.edm.v3.EnumTypeImpl()
+ : new org.apache.olingo.odata4.client.core.edm.v4.EnumTypeImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ enumType.setName(jp.nextTextValue());
+ } else if ("UnderlyingType".equals(jp.getCurrentName())) {
+ enumType.setUnderlyingType(jp.nextTextValue());
+ } else if ("IsFlags".equals(jp.getCurrentName())) {
+ enumType.setFlags(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Member".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (enumType instanceof org.apache.olingo.odata4.client.core.edm.v3.EnumTypeImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.EnumTypeImpl) enumType).
+ getMembers().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.MemberImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.EnumTypeImpl) enumType).
+ getMembers().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.MemberImpl.class));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.EnumTypeImpl) enumType).
+ setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return enumType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/InjectableSerializerProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/InjectableSerializerProvider.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/InjectableSerializerProvider.java
new file mode 100644
index 0000000..e5e8b93
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/InjectableSerializerProvider.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.client.core.data.impl;
+
+import com.fasterxml.jackson.databind.SerializationConfig;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
+import com.fasterxml.jackson.databind.ser.SerializerFactory;
+
+class InjectableSerializerProvider extends DefaultSerializerProvider {
+
+ private static final long serialVersionUID = 3432260063063739646L;
+
+ public InjectableSerializerProvider(
+ final SerializerProvider src, final SerializationConfig config, final SerializerFactory factory) {
+
+ super(src, config, factory);
+ }
+
+ @Override
+ public InjectableSerializerProvider createInstance(
+ final SerializationConfig config, final SerializerFactory factory) {
+
+ return this;
+ }
+
+}
[09/14] [OLINGO-169] First huge import from ODataJClient: for the
moment,
it just build (no tests yet) and dummy Edm interfaces are used instead of the
ones from commons-api
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/SchemaDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/SchemaDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/SchemaDeserializer.java
new file mode 100644
index 0000000..cd622ce
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/SchemaDeserializer.java
@@ -0,0 +1,147 @@
+/*
+ * 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.client.core.data.impl;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.edm.AbstractSchema;
+import org.apache.olingo.odata4.client.core.edm.v3.AssociationImpl;
+import org.apache.olingo.odata4.client.core.edm.v3.UsingImpl;
+import org.apache.olingo.odata4.client.core.edm.v3.ValueTermImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.ActionImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.FunctionImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.TypeDefinitionImpl;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+@SuppressWarnings("rawtypes")
+public class SchemaDeserializer extends AbstractEdmDeserializer<AbstractSchema> {
+
+ @Override
+ protected AbstractSchema doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AbstractSchema schema = ODataServiceVersion.V30 == client.getServiceVersion()
+ ? new org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl()
+ : new org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Namespace".equals(jp.getCurrentName())) {
+ schema.setNamespace(jp.nextTextValue());
+ } else if ("Alias".equals(jp.getCurrentName())) {
+ schema.setAlias(jp.nextTextValue());
+ } else if ("Using".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getUsings().add(jp.getCodec().readValue(jp, UsingImpl.class));
+ } else if ("Association".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getAssociations().add(jp.getCodec().readValue(jp, AssociationImpl.class));
+ } else if ("ComplexType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getComplexTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.ComplexTypeImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).
+ getComplexTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.ComplexTypeImpl.class));
+ }
+ } else if ("EntityType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getEntityTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.EntityTypeImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).
+ getEntityTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.EntityTypeImpl.class));
+ }
+ } else if ("EnumType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getEnumTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.EnumTypeImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).
+ getEnumTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.EnumTypeImpl.class));
+ }
+ } else if ("ValueTerm".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getValueTerms().add(jp.getCodec().readValue(jp, ValueTermImpl.class));
+ } else if ("EntityContainer".equals(jp.getCurrentName())) {
+ jp.nextToken();
+
+ if (schema instanceof org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getEntityContainers().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.EntityContainerImpl.class));
+ } else {
+ org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl entityContainer
+ = jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl.class);
+ entityContainer.setDefaultEntityContainer(true);
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).
+ setEntityContainer(entityContainer);
+ }
+ } else if ("Annotations".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).getAnnotationsList().
+ add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.AnnotationsImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).getAnnotationsList().
+ add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.AnnotationsImpl.class));
+ }
+ } else if ("Action".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).getActions().
+ add(jp.getCodec().readValue(jp, ActionImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).getAnnotations().
+ add(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ } else if ("Function".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).getFunctions().
+ add(jp.getCodec().readValue(jp, FunctionImpl.class));
+ } else if ("TypeDefinition".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).
+ getTypeDefinitions().add(jp.getCodec().readValue(jp, TypeDefinitionImpl.class));
+ }
+ }
+ }
+
+ return schema;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataDeserializerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataDeserializerImpl.java
new file mode 100644
index 0000000..962f4b7
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataDeserializerImpl.java
@@ -0,0 +1,63 @@
+/**
+ * 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.client.core.data.impl.v3;
+
+import java.io.InputStream;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v3.EdmxImpl;
+
+public class ODataDeserializerImpl extends AbstractODataDeserializer {
+
+ private static final long serialVersionUID = -8221085862548914611L;
+
+ public ODataDeserializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public EdmxImpl toMetadata(final InputStream input) {
+ try {
+ return getXmlMapper().readValue(input, EdmxImpl.class);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Could not parse as Edmx document", e);
+ }
+ }
+
+// @Override
+// public AbstractServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
+// try {
+// return format == ODataFormat.XML
+// ? getXmlMapper().readValue(input, XMLServiceDocument.class)
+// : getObjectMapper().readValue(input, JSONServiceDocument.class);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("Could not parse Service Document", e);
+// }
+// }
+//
+// @Override
+// protected JSONEntry toJSONEntry(final InputStream input) {
+// try {
+// return getObjectMapper().readValue(input, JSONEntry.class);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("While deserializing JSON entry", e);
+// }
+// }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataReaderImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataReaderImpl.java
new file mode 100644
index 0000000..28898de
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataReaderImpl.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.client.core.data.impl.v3;
+
+import java.io.InputStream;
+import org.apache.olingo.odata4.client.core.ODataV3Client;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataReader;
+import org.apache.olingo.odata4.client.core.edm.v3.EdmMetadataImpl;
+
+public class ODataReaderImpl extends AbstractODataReader {
+
+ private static final long serialVersionUID = -2481293269536406956L;
+
+ public ODataReaderImpl(final ODataV3Client client) {
+ super(client);
+ }
+
+ @Override
+ public EdmMetadataImpl readMetadata(final InputStream input) {
+ return new EdmMetadataImpl(client, input);
+ }
+
+// @Override
+// public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
+// return ((ODataV3Client) client).getBinder().getODataServiceDocument(
+// ((ODataV3Client) client).getDeserializer().toServiceDocument(input, format));
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataSerializerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataSerializerImpl.java
new file mode 100644
index 0000000..d13bca5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataSerializerImpl.java
@@ -0,0 +1,32 @@
+/*
+ * 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.client.core.data.impl.v3;
+
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataSerializer;
+
+public class ODataSerializerImpl extends AbstractODataSerializer {
+
+ private static final long serialVersionUID = -8861908250297989806L;
+
+ public ODataSerializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataDeserializerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataDeserializerImpl.java
new file mode 100644
index 0000000..1b12016
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataDeserializerImpl.java
@@ -0,0 +1,63 @@
+/*
+ * 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.client.core.data.impl.v4;
+
+import java.io.InputStream;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v4.EdmxImpl;
+
+public class ODataDeserializerImpl extends AbstractODataDeserializer {
+
+ private static final long serialVersionUID = 8593081342440470415L;
+
+ public ODataDeserializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public EdmxImpl toMetadata(final InputStream input) {
+ try {
+ return getXmlMapper().readValue(input, EdmxImpl.class);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Could not parse as Edmx document", e);
+ }
+ }
+
+// @Override
+// public AbstractServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
+// try {
+// return format == ODataFormat.XML
+// ? getXmlMapper().readValue(input, XMLServiceDocument.class)
+// : null;
+//// : getObjectMapper().readValue(input, JSONServiceDocument.class);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("Could not parse Service Document", e);
+// }
+// }
+//
+// @Override
+// protected JSONEntry toJSONEntry(final InputStream input) {
+// try {
+// return getObjectMapper().readValue(input, JSONEntry.class);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("While deserializing JSON entry", e);
+// }
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataReaderImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataReaderImpl.java
new file mode 100644
index 0000000..10904ea
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataReaderImpl.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.client.core.data.impl.v4;
+
+import java.io.InputStream;
+import org.apache.olingo.odata4.client.core.ODataV4Client;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataReader;
+import org.apache.olingo.odata4.client.core.edm.v4.EdmMetadataImpl;
+
+public class ODataReaderImpl extends AbstractODataReader {
+
+ private static final long serialVersionUID = -2481293269536406956L;
+
+ public ODataReaderImpl(final ODataV4Client client) {
+ super(client);
+ }
+
+ @Override
+ public EdmMetadataImpl readMetadata(final InputStream input) {
+ return new EdmMetadataImpl(client, input);
+ }
+
+// @Override
+// public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
+// return ((ODataV4Client) client).getBinder().getODataServiceDocument(
+// ((ODataV4Client) client).getDeserializer().toServiceDocument(input, format));
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataSerializerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataSerializerImpl.java
new file mode 100644
index 0000000..a56afc1
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataSerializerImpl.java
@@ -0,0 +1,32 @@
+/*
+ * 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.client.core.data.impl.v4;
+
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataSerializer;
+
+public class ODataSerializerImpl extends AbstractODataSerializer {
+
+ private static final long serialVersionUID = 7587265188399685309L;
+
+ public ODataSerializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
index 90733b2..30f048d 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
@@ -34,9 +34,13 @@ import org.apache.olingo.odata4.client.api.deserializer.Value;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class PropertyCollectionBuilder extends PropertyCollection {
+ private static final Logger LOG = LoggerFactory.getLogger(PropertyCollectionBuilder.class);
+
private JsonParser parser;
private EntitySetImpl enclosingEntitySet;
@@ -95,10 +99,9 @@ public class PropertyCollectionBuilder extends PropertyCollection {
return true;
}
} catch (JsonParseException e) {
- // TODO: SLF4J Logging!
- e.printStackTrace();
+ LOG.error("While parsing", e);
} catch (IOException e) {
- e.printStackTrace();
+ LOG.error("While parsing", e);
}
return false;
@@ -193,7 +196,7 @@ public class PropertyCollectionBuilder extends PropertyCollection {
case VALUE_STRING:
enclosingEntitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
break;
-
+
default:
break;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractAnnotations.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractAnnotations.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractAnnotations.java
new file mode 100644
index 0000000..5d1d7a4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractAnnotations.java
@@ -0,0 +1,49 @@
+/*
+ * 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.client.core.edm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v3.Annotations;
+
+public abstract class AbstractAnnotations extends AbstractEdmItem implements Annotations {
+
+ private static final long serialVersionUID = 4926640428016042620L;
+
+ @JsonProperty(value = "Target", required = true)
+ private String target;
+
+ @JsonProperty("Qualifier")
+ private String qualifier;
+
+ public String getTarget() {
+ return target;
+ }
+
+ public void setTarget(final String target) {
+ this.target = target;
+ }
+
+ public String getQualifier() {
+ return qualifier;
+ }
+
+ public void setQualifier(final String qualifier) {
+ this.qualifier = qualifier;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractComplexType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractComplexType.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractComplexType.java
new file mode 100644
index 0000000..ebda229
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractComplexType.java
@@ -0,0 +1,41 @@
+/*
+ * 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.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.odata4.client.api.edm.ComplexType;
+import org.apache.olingo.odata4.client.core.data.impl.ComplexTypeDeserializer;
+
+@JsonDeserialize(using = ComplexTypeDeserializer.class)
+public abstract class AbstractComplexType extends AbstractEdmItem implements ComplexType {
+
+ private static final long serialVersionUID = -4765071294433482957L;
+
+ private String name;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(final String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.java
new file mode 100644
index 0000000..feda3a5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.List;
+
+@JsonDeserialize(using = DataServicesDeserializer.class)
+public abstract class AbstractDataServices<S extends AbstractSchema<EC, E, C, FI>, EC extends AbstractEntityContainer<
+ FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport>
+ extends AbstractEdmItem {
+
+ private static final long serialVersionUID = -9126377222393876166L;
+
+ private String dataServiceVersion;
+
+ private String maxDataServiceVersion;
+
+ public String getDataServiceVersion() {
+ return dataServiceVersion;
+ }
+
+ public void setDataServiceVersion(final String dataServiceVersion) {
+ this.dataServiceVersion = dataServiceVersion;
+ }
+
+ public String getMaxDataServiceVersion() {
+ return maxDataServiceVersion;
+ }
+
+ public void setMaxDataServiceVersion(final String maxDataServiceVersion) {
+ this.maxDataServiceVersion = maxDataServiceVersion;
+ }
+
+ public abstract List<S> getSchemas();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmItem.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmItem.java
new file mode 100644
index 0000000..da6dca9
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmItem.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.client.core.edm;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public abstract class AbstractEdmItem {
+
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.java
new file mode 100644
index 0000000..cf94a7b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.java
@@ -0,0 +1,106 @@
+/*
+ * 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.client.core.edm;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.api.edm.EdmMetadata;
+
+/**
+ * Entry point for access information about EDM metadata.
+ */
+public abstract class AbstractEdmMetadata<
+ EDMX extends AbstractEdmx<DS, S, EC, E, C, FI>, DS extends AbstractDataServices<
+ S, EC, E, C, FI>, S extends AbstractSchema<EC, E, C, FI>, EC extends AbstractEntityContainer<
+ FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport>
+ extends AbstractEdmItem implements EdmMetadata {
+
+ private static final long serialVersionUID = -1214173426671503187L;
+
+ protected final EDMX edmx;
+
+ protected final Map<String, S> schemaByNsOrAlias;
+
+ /**
+ * Constructor.
+ *
+ * @param client OData client
+ * @param inputStream source stream.
+ */
+ @SuppressWarnings("unchecked")
+ public AbstractEdmMetadata(final ODataClient client, final InputStream inputStream) {
+ edmx = (EDMX) client.getDeserializer().toMetadata(inputStream);
+
+ this.schemaByNsOrAlias = new HashMap<String, S>();
+ for (S schema : edmx.getDataServices().getSchemas()) {
+ this.schemaByNsOrAlias.put(schema.getNamespace(), schema);
+ if (StringUtils.isNotBlank(schema.getAlias())) {
+ this.schemaByNsOrAlias.put(schema.getAlias(), schema);
+ }
+ }
+ }
+
+ /**
+ * Checks whether the given key is a valid namespace or alias in the EdM metadata document.
+ *
+ * @param key namespace or alias
+ * @return true if key is valid namespace or alias
+ */
+ @Override
+ public boolean isNsOrAlias(final String key) {
+ return this.schemaByNsOrAlias.keySet().contains(key);
+ }
+
+ /**
+ * Returns the Schema at the specified position in the EdM metadata document.
+ *
+ * @param index index of the Schema to return
+ * @return the Schema at the specified position in the EdM metadata document
+ */
+ @Override
+ public S getSchema(final int index) {
+ return this.edmx.getDataServices().getSchemas().get(index);
+ }
+
+ /**
+ * Returns the Schema with the specified key (namespace or alias) in the EdM metadata document.
+ *
+ * @param key namespace or alias
+ * @return the Schema with the specified key in the EdM metadata document
+ */
+ @Override
+ public S getSchema(final String key) {
+ return this.schemaByNsOrAlias.get(key);
+ }
+
+ /**
+ * Returns all Schema objects defined in the EdM metadata document.
+ *
+ * @return all Schema objects defined in the EdM metadata document
+ */
+ @Override
+ public List<S> getSchemas() {
+ return this.edmx.getDataServices().getSchemas();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.java
new file mode 100644
index 0000000..3a379f2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.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.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.odata4.client.api.edm.Edmx;
+
+@JsonDeserialize(using = EdmxDeserializer.class)
+public abstract class AbstractEdmx<DS extends AbstractDataServices<S, EC, E, C, FI>, S extends AbstractSchema<
+ EC, E, C, FI>, EC extends AbstractEntityContainer<
+ FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport>
+ extends AbstractEdmItem implements Edmx {
+
+ private static final long serialVersionUID = -5480835122183091469L;
+
+ private String version;
+
+ private DS dataServices;
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(final String version) {
+ this.version = version;
+ }
+
+ public DS getDataServices() {
+ return dataServices;
+ }
+
+ public void setDataServices(final DS dataServices) {
+ this.dataServices = dataServices;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java
new file mode 100644
index 0000000..588e0ea
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java
@@ -0,0 +1,107 @@
+/*
+ * 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.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.EntityContainer;
+import org.apache.olingo.odata4.client.core.data.impl.EntityContainerDeserializer;
+
+@JsonDeserialize(using = EntityContainerDeserializer.class)
+public abstract class AbstractEntityContainer<FI extends AbstractFunctionImport>
+ extends AbstractEdmItem implements EntityContainer {
+
+ private static final long serialVersionUID = 4121974387552855032L;
+
+ private String name;
+
+ private String _extends;
+
+ private boolean lazyLoadingEnabled;
+
+ private boolean defaultEntityContainer;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getExtends() {
+ return _extends;
+ }
+
+ public void setExtends(final String _extends) {
+ this._extends = _extends;
+ }
+
+ public boolean isLazyLoadingEnabled() {
+ return lazyLoadingEnabled;
+ }
+
+ public void setLazyLoadingEnabled(final boolean lazyLoadingEnabled) {
+ this.lazyLoadingEnabled = lazyLoadingEnabled;
+ }
+
+ public boolean isDefaultEntityContainer() {
+ return defaultEntityContainer;
+ }
+
+ public void setDefaultEntityContainer(final boolean defaultEntityContainer) {
+ this.defaultEntityContainer = defaultEntityContainer;
+ }
+
+ public abstract List<? extends AbstractEntitySet> getEntitySets();
+
+ public abstract AbstractEntitySet getEntitySet(String name);
+
+ /**
+ * Gets the first function import with given name.
+ *
+ * @param name name.
+ * @return function import.
+ */
+ public FI getFunctionImport(final String name) {
+ final List<FI> funcImps = getFunctionImports(name);
+ return funcImps.isEmpty()
+ ? null
+ : funcImps.get(0);
+ }
+
+ /**
+ * Gets all function imports with given name.
+ *
+ * @param name name.
+ * @return function imports.
+ */
+ public List<FI> getFunctionImports(final String name) {
+ final List<FI> result = new ArrayList<FI>();
+ for (FI functionImport : getFunctionImports()) {
+ if (name.equals(functionImport.getName())) {
+ result.add(functionImport);
+ }
+ }
+ return result;
+ }
+
+ public abstract List<FI> getFunctionImports();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java
new file mode 100644
index 0000000..bf01649
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java
@@ -0,0 +1,49 @@
+/*
+ * 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.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.odata4.client.api.edm.EntitySet;
+import org.apache.olingo.odata4.client.core.data.impl.EntitySetDeserializer;
+
+@JsonDeserialize(using = EntitySetDeserializer.class)
+public abstract class AbstractEntitySet extends AbstractEdmItem implements EntitySet {
+
+ private static final long serialVersionUID = -6577263439520376420L;
+
+ private String name;
+
+ private String entityType;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getEntityType() {
+ return entityType;
+ }
+
+ public void setEntityType(final String entityType) {
+ this.entityType = entityType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java
new file mode 100644
index 0000000..3db1dd2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java
@@ -0,0 +1,85 @@
+/*
+ * 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.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.EntityType;
+import org.apache.olingo.odata4.client.core.data.impl.EntityTypeDeserializer;
+
+@JsonDeserialize(using = EntityTypeDeserializer.class)
+public abstract class AbstractEntityType extends AbstractComplexType implements EntityType {
+
+ private static final long serialVersionUID = -1579462552966168139L;
+
+ private boolean abstractEntityType = false;
+
+ private String baseType;
+
+ private boolean openType = false;
+
+ private boolean hasStream = false;
+
+ private EntityKeyImpl key;
+
+ public boolean isAbstractEntityType() {
+ return abstractEntityType;
+ }
+
+ public void setAbstractEntityType(final boolean abstractEntityType) {
+ this.abstractEntityType = abstractEntityType;
+ }
+
+ public String getBaseType() {
+ return baseType;
+ }
+
+ public void setBaseType(final String baseType) {
+ this.baseType = baseType;
+ }
+
+ public boolean isOpenType() {
+ return openType;
+ }
+
+ public void setOpenType(final boolean openType) {
+ this.openType = openType;
+ }
+
+ public EntityKeyImpl getKey() {
+ return key;
+ }
+
+ public void setKey(final EntityKeyImpl key) {
+ this.key = key;
+ }
+
+ public boolean isHasStream() {
+ return hasStream;
+ }
+
+ public void setHasStream(final boolean hasStream) {
+ this.hasStream = hasStream;
+ }
+
+ public abstract List<? extends AbstractNavigationProperty> getNavigationProperties();
+
+ public abstract AbstractNavigationProperty getNavigationProperty(String name);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java
new file mode 100644
index 0000000..50075f8
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java
@@ -0,0 +1,65 @@
+/*
+ * 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.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.odata4.client.api.edm.EnumType;
+import org.apache.olingo.odata4.client.core.data.impl.EnumTypeDeserializer;
+
+@JsonDeserialize(using = EnumTypeDeserializer.class)
+public abstract class AbstractEnumType extends AbstractEdmItem implements EnumType {
+
+ private static final long serialVersionUID = 2688487586103418210L;
+
+ private String name;
+
+ private String underlyingType;
+
+ private boolean flags;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getUnderlyingType() {
+ return underlyingType;
+ }
+
+ @Override
+ public void setUnderlyingType(final String underlyingType) {
+ this.underlyingType = underlyingType;
+ }
+
+ @Override
+ public boolean isFlags() {
+ return flags;
+ }
+
+ @Override
+ public void setFlags(final boolean flags) {
+ this.flags = flags;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java
new file mode 100644
index 0000000..fc6e9e4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java
@@ -0,0 +1,30 @@
+/*
+ * 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.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.FunctionImport;
+
+public abstract class AbstractFunctionImport extends AbstractEdmItem implements FunctionImport {
+
+ private static final long serialVersionUID = 4154308065211315663L;
+
+ public abstract String getName();
+
+ public abstract String getEntitySet();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractMember.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractMember.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractMember.java
new file mode 100644
index 0000000..7f53394
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractMember.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.client.core.edm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.Member;
+
+public abstract class AbstractMember extends AbstractEdmItem implements Member {
+
+ private static final long serialVersionUID = -1852481655317148552L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ @JsonProperty("Value")
+ private Integer value;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public Integer getValue() {
+ return value;
+ }
+
+ public void setValue(final Integer value) {
+ this.value = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractNavigationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractNavigationProperty.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractNavigationProperty.java
new file mode 100644
index 0000000..b02bbda
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractNavigationProperty.java
@@ -0,0 +1,38 @@
+/*
+ * 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.client.core.edm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.NavigationProperty;
+
+public class AbstractNavigationProperty extends AbstractEdmItem implements NavigationProperty {
+
+ private static final long serialVersionUID = 3112463683071069594L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractParameter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractParameter.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractParameter.java
new file mode 100644
index 0000000..7be7977
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractParameter.java
@@ -0,0 +1,94 @@
+/*
+ * 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.client.core.edm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.math.BigInteger;
+import org.apache.olingo.odata4.client.api.edm.Parameter;
+
+public abstract class AbstractParameter extends AbstractEdmItem implements Parameter {
+
+ private static final long serialVersionUID = -4305016554930334342L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ @JsonProperty(value = "Type", required = true)
+ private String type;
+
+ @JsonProperty(value = "Nullable")
+ private boolean nullable = true;
+
+ @JsonProperty("MaxLength")
+ private String maxLength;
+
+ @JsonProperty("Precision")
+ private BigInteger precision;
+
+ @JsonProperty("Scale")
+ private BigInteger scale;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public boolean isNullable() {
+ return nullable;
+ }
+
+ public void setNullable(final boolean nullable) {
+ this.nullable = nullable;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractProperty.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractProperty.java
new file mode 100644
index 0000000..473d265
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractProperty.java
@@ -0,0 +1,240 @@
+/*
+ * 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.client.core.edm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.math.BigInteger;
+import org.apache.olingo.odata4.client.api.edm.Property;
+import org.apache.olingo.odata4.commons.api.edm.constants.ConcurrencyMode;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmContentKind;
+import org.apache.olingo.odata4.commons.api.edm.constants.StoreGeneratedPattern;
+
+public abstract class AbstractProperty extends AbstractEdmItem implements Property {
+
+ private static final long serialVersionUID = -6004492361142315153L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ @JsonProperty(value = "Type", required = true)
+ private String type;
+
+ @JsonProperty(value = "Nullable")
+ private boolean nullable = true;
+
+ @JsonProperty(value = "DefaultValue")
+ private String defaultValue;
+
+ @JsonProperty(value = "MaxLength")
+ private String maxLength;
+
+ @JsonProperty(value = "FixedLength")
+ private boolean fixedLength;
+
+ @JsonProperty(value = "Precision")
+ private BigInteger precision;
+
+ @JsonProperty(value = "Scale")
+ private BigInteger scale;
+
+ @JsonProperty(value = "Unicode")
+ private boolean unicode = true;
+
+ @JsonProperty(value = "Collation")
+ private String collation;
+
+ @JsonProperty(value = "SRID")
+ private String srid;
+
+ @JsonProperty(value = "ConcurrencyMode")
+ private ConcurrencyMode concurrencyMode;
+
+ @JsonProperty("FC_SourcePath")
+ private String fcSourcePath;
+
+ @JsonProperty("FC_TargetPath")
+ private String fcTargetPath;
+
+ @JsonProperty("FC_ContentKind")
+ private EdmContentKind fcContentKind = EdmContentKind.text;
+
+ @JsonProperty("FC_NsPrefix")
+ private String fcNSPrefix;
+
+ @JsonProperty("FC_NsUri")
+ private String fcNSURI;
+
+ @JsonProperty("FC_KeepInContent")
+ private boolean fcKeepInContent = true;
+
+ @JsonProperty("StoreGeneratedPattern")
+ private StoreGeneratedPattern storeGeneratedPattern = StoreGeneratedPattern.None;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public boolean isNullable() {
+ return nullable;
+ }
+
+ public void setNullable(final boolean nullable) {
+ this.nullable = nullable;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(final String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public boolean isFixedLength() {
+ return fixedLength;
+ }
+
+ public void setFixedLength(final boolean fixedLength) {
+ this.fixedLength = fixedLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+
+ public boolean isUnicode() {
+ return unicode;
+ }
+
+ public void setUnicode(final boolean unicode) {
+ this.unicode = unicode;
+ }
+
+ public String getCollation() {
+ return collation;
+ }
+
+ public void setCollation(final String collation) {
+ this.collation = collation;
+ }
+
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+ public ConcurrencyMode getConcurrencyMode() {
+ return concurrencyMode;
+ }
+
+ public void setConcurrencyMode(final ConcurrencyMode concurrencyMode) {
+ this.concurrencyMode = concurrencyMode;
+ }
+
+ public String getFcSourcePath() {
+ return fcSourcePath;
+ }
+
+ public void setFcSourcePath(final String fcSourcePath) {
+ this.fcSourcePath = fcSourcePath;
+ }
+
+ public String getFcTargetPath() {
+ return fcTargetPath;
+ }
+
+ public void setFcTargetPath(final String fcTargetPath) {
+ this.fcTargetPath = fcTargetPath;
+ }
+
+ public EdmContentKind getFcContentKind() {
+ return fcContentKind;
+ }
+
+ public void setFcContentKind(final EdmContentKind fcContentKind) {
+ this.fcContentKind = fcContentKind;
+ }
+
+ public String getFcNSPrefix() {
+ return fcNSPrefix;
+ }
+
+ public void setFcNSPrefix(final String fcNSPrefix) {
+ this.fcNSPrefix = fcNSPrefix;
+ }
+
+ public String getFcNSURI() {
+ return fcNSURI;
+ }
+
+ public void setFcNSURI(final String fcNSURI) {
+ this.fcNSURI = fcNSURI;
+ }
+
+ public boolean isFcKeepInContent() {
+ return fcKeepInContent;
+ }
+
+ public void setFcKeepInContent(final boolean fcKeepInContent) {
+ this.fcKeepInContent = fcKeepInContent;
+ }
+
+ public StoreGeneratedPattern getStoreGeneratedPattern() {
+ return storeGeneratedPattern;
+ }
+
+ public void setStoreGeneratedPattern(final StoreGeneratedPattern storeGeneratedPattern) {
+ this.storeGeneratedPattern = storeGeneratedPattern;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java
new file mode 100644
index 0000000..d297ae9
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java
@@ -0,0 +1,128 @@
+/*
+ * 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.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.Schema;
+import org.apache.olingo.odata4.client.core.data.impl.SchemaDeserializer;
+
+@JsonDeserialize(using = SchemaDeserializer.class)
+public abstract class AbstractSchema<EC extends AbstractEntityContainer<
+ FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport>
+ extends AbstractEdmItem implements Schema {
+
+ private static final long serialVersionUID = -1356392748971378455L;
+
+ private String namespace;
+
+ private String alias;
+
+ @Override
+ public String getNamespace() {
+ return namespace;
+ }
+
+ @Override
+ public void setNamespace(final String namespace) {
+ this.namespace = namespace;
+ }
+
+ @Override
+ public String getAlias() {
+ return alias;
+ }
+
+ @Override
+ public void setAlias(final String alias) {
+ this.alias = alias;
+ }
+
+ @Override
+ public abstract List<E> getEntityTypes();
+
+ @Override
+ public abstract List<? extends AbstractEnumType> getEnumTypes();
+
+ @Override
+ public abstract AbstractEnumType getEnumType(String name);
+
+ @Override
+ public abstract List<? extends AbstractAnnotations> getAnnotationsList();
+
+ @Override
+ public abstract AbstractAnnotations getAnnotationsList(String target);
+
+ @Override
+ public abstract List<C> getComplexTypes();
+
+ @Override
+ public abstract List<EC> getEntityContainers();
+
+ /**
+ * Gets default entity container.
+ *
+ * @return default entity container.
+ */
+ @Override
+ public abstract EC getDefaultEntityContainer();
+
+ /**
+ * Gets entity container with the given name.
+ *
+ * @param name name.
+ * @return entity container.
+ */
+ @Override
+ public abstract EC getEntityContainer(String name);
+
+ /**
+ * Gets entity type with the given name.
+ *
+ * @param name name.
+ * @return entity type.
+ */
+ @Override
+ public E getEntityType(final String name) {
+ E result = null;
+ for (E type : getEntityTypes()) {
+ if (name.equals(type.getName())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Gets complex type with the given name.
+ *
+ * @param name name.
+ * @return complex type.
+ */
+ @Override
+ public C getComplexType(final String name) {
+ C result = null;
+ for (C type : getComplexTypes()) {
+ if (name.equals(type.getName())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/DataServicesDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/DataServicesDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/DataServicesDeserializer.java
new file mode 100644
index 0000000..3b87d06
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/DataServicesDeserializer.java
@@ -0,0 +1,64 @@
+/*
+ * 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.client.core.edm;
+
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+public class DataServicesDeserializer extends AbstractEdmDeserializer<AbstractDataServices> {
+
+ @Override
+ protected AbstractDataServices doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AbstractDataServices dataServices = ODataServiceVersion.V30 == client.getServiceVersion()
+ ? new org.apache.olingo.odata4.client.core.edm.v3.DataServicesImpl()
+ : new org.apache.olingo.odata4.client.core.edm.v4.DataServicesImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("DataServiceVersion".equals(jp.getCurrentName())) {
+ dataServices.setDataServiceVersion(jp.nextTextValue());
+ } else if ("MaxDataServiceVersion".equals(jp.getCurrentName())) {
+ dataServices.setMaxDataServiceVersion(jp.nextTextValue());
+ } else if ("Schema".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (dataServices instanceof org.apache.olingo.odata4.client.core.edm.v3.DataServicesImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.DataServicesImpl) dataServices).
+ getSchemas().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl.class));
+
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.DataServicesImpl) dataServices).
+ getSchemas().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl.class));
+ }
+ }
+ }
+ }
+
+ return dataServices;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmxDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmxDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmxDeserializer.java
new file mode 100644
index 0000000..db6607c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmxDeserializer.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.edm.v4.ReferenceImpl;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+@SuppressWarnings("rawtypes")
+public class EdmxDeserializer extends AbstractEdmDeserializer<AbstractEdmx> {
+
+ @Override
+ protected AbstractEdmx doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AbstractEdmx edmx = ODataServiceVersion.V30 == client.getServiceVersion()
+ ? new org.apache.olingo.odata4.client.core.edm.v3.EdmxImpl()
+ : new org.apache.olingo.odata4.client.core.edm.v4.EdmxImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Version".equals(jp.getCurrentName())) {
+ edmx.setVersion(jp.nextTextValue());
+ } else if ("DataServices".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (edmx instanceof org.apache.olingo.odata4.client.core.edm.v3.EdmxImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.EdmxImpl) edmx).
+ setDataServices(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.DataServicesImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.EdmxImpl) edmx).
+ setDataServices(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.DataServicesImpl.class));
+ }
+ } else if ("Reference".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.EdmxImpl) edmx).getReferences().
+ add(jp.getCodec().readValue(jp, ReferenceImpl.class));
+ }
+ }
+ }
+
+ return edmx;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntityKeyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntityKeyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntityKeyImpl.java
new file mode 100644
index 0000000..3baadf3
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntityKeyImpl.java
@@ -0,0 +1,41 @@
+/*
+ * 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.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.EntityKey;
+import org.apache.olingo.odata4.client.core.data.impl.EntityKeyDeserializer;
+
+@JsonDeserialize(using = EntityKeyDeserializer.class)
+public class EntityKeyImpl extends AbstractEdmItem implements EntityKey {
+
+ private static final long serialVersionUID = 2586047015894794685L;
+
+ private List<PropertyRefImpl> propertyRefs = new ArrayList<PropertyRefImpl>();
+
+ public List<PropertyRefImpl> getPropertyRefs() {
+ return propertyRefs;
+ }
+
+ public void setPropertyRefs(final List<PropertyRefImpl> propertyRefs) {
+ this.propertyRefs = propertyRefs;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntitySetImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntitySetImpl.java
new file mode 100644
index 0000000..e65e3d2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntitySetImpl.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.client.core.edm;
+
+public class EntitySetImpl extends AbstractEntitySet {
+
+ private static final long serialVersionUID = 5570833733884884012L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java
new file mode 100644
index 0000000..f3ba343
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java
@@ -0,0 +1,40 @@
+/*
+ * 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.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.v4.OnDeleteAction;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.OnDelete;
+
+public class OnDeleteImpl extends AbstractEdmItem implements OnDelete {
+
+ private static final long serialVersionUID = -5321523424474336347L;
+
+ @JsonProperty(value = "Action", required = true)
+ private OnDeleteAction action = OnDeleteAction.None;
+
+ public OnDeleteAction getAction() {
+ return action;
+ }
+
+ public void setAction(final OnDeleteAction action) {
+ this.action = action;
+ }
+
+}
[07/14] [OLINGO-169] First huge import from ODataJClient: for the
moment,
it just build (no tests yet) and dummy Edm interfaces are used instead of the
ones from commons-api
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AbstractAnnotatedEdmItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AbstractAnnotatedEdmItem.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AbstractAnnotatedEdmItem.java
new file mode 100644
index 0000000..365cdeb
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AbstractAnnotatedEdmItem.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.client.core.edm.v4;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public abstract class AbstractAnnotatedEdmItem extends AbstractEdmItem implements AnnotatedEdmItem {
+
+ private static final long serialVersionUID = -8859729466090997718L;
+
+ @JsonProperty("Annotation")
+ private Annotation annotation;
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionDeserializer.java
new file mode 100644
index 0000000..d106aba
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionDeserializer.java
@@ -0,0 +1,60 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class ActionDeserializer extends AbstractEdmDeserializer<ActionImpl> {
+
+ @Override
+ protected ActionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final ActionImpl action = new ActionImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ action.setName(jp.nextTextValue());
+ } else if ("IsBound".equals(jp.getCurrentName())) {
+ action.setBound(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("EntitySetPath".equals(jp.getCurrentName())) {
+ action.setEntitySetPath(jp.nextTextValue());
+ } else if ("Parameter".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ action.getParameters().add(jp.getCodec().readValue(jp, ParameterImpl.class));
+ } else if ("ReturnType".equals(jp.getCurrentName())) {
+ action.setReturnType(parseReturnType(jp, "Action"));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ action.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return action;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionImpl.java
new file mode 100644
index 0000000..0bfe85c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionImpl.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.client.core.edm.v4;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v4.Action;
+
+@JsonDeserialize(using = ActionDeserializer.class)
+public class ActionImpl extends AbstractAnnotatedEdmItem implements Action {
+
+ private static final long serialVersionUID = -99977447455438193L;
+
+ private String name;
+
+ private boolean bound = false;
+
+ private String entitySetPath;
+
+ private final List<ParameterImpl> parameters = new ArrayList<ParameterImpl>();
+
+ private ReturnTypeImpl returnType;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public boolean isBound() {
+ return bound;
+ }
+
+ public void setBound(final boolean bound) {
+ this.bound = bound;
+ }
+
+ public String getEntitySetPath() {
+ return entitySetPath;
+ }
+
+ public void setEntitySetPath(final String entitySetPath) {
+ this.entitySetPath = entitySetPath;
+ }
+
+ public List<ParameterImpl> getParameters() {
+ return parameters;
+ }
+
+ public ParameterImpl getParameter(final String name) {
+ ParameterImpl result = null;
+ for (ParameterImpl parameter : getParameters()) {
+ if (name.equals(parameter.getName())) {
+ result = parameter;
+ }
+ }
+ return result;
+ }
+
+ public ReturnTypeImpl getReturnType() {
+ return returnType;
+ }
+
+ public void setReturnType(final ReturnTypeImpl returnType) {
+ this.returnType = returnType;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionImportImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionImportImpl.java
new file mode 100644
index 0000000..3d4f496
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ActionImportImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class ActionImportImpl extends AbstractAnnotatedEdmItem {
+
+ private static final long serialVersionUID = -866422101558426421L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ @JsonProperty(value = "Action", required = true)
+ private String action;
+
+ @JsonProperty(value = "EntitySet")
+ private String entitySet;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(final String action) {
+ this.action = action;
+ }
+
+ public String getEntitySet() {
+ return entitySet;
+ }
+
+ public void setEntitySet(final String entitySet) {
+ this.entitySet = entitySet;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotatedEdmItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotatedEdmItem.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotatedEdmItem.java
new file mode 100644
index 0000000..c0b64b7
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotatedEdmItem.java
@@ -0,0 +1,28 @@
+/*
+ * 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.client.core.edm.v4;
+
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+
+public interface AnnotatedEdmItem {
+
+ Annotation getAnnotation();
+
+ void setAnnotation(Annotation annotation);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationDeserializer.java
new file mode 100644
index 0000000..a5399ab
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationDeserializer.java
@@ -0,0 +1,57 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v4.annotation.DynExprConstruct;
+
+public class AnnotationDeserializer extends AbstractEdmDeserializer<AnnotationImpl> {
+
+ @Override
+ protected AnnotationImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AnnotationImpl annotation = new AnnotationImpl();
+
+ for (; jp.getCurrentToken() != null && jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Term".equals(jp.getCurrentName())) {
+ annotation.setTerm(jp.nextTextValue());
+ } else if ("Qualifier".equals(jp.getCurrentName())) {
+ annotation.setQualifier(jp.nextTextValue());
+ } else if (isAnnotationConstExprConstruct(jp)) {
+ // Constant Expressions
+ annotation.setConstExpr(parseAnnotationConstExprConstruct(jp));
+ } else {
+ // Dynamic Expressions
+ annotation.setDynExpr(jp.getCodec().readValue(jp, DynExprConstruct.class));
+ }
+ }
+ }
+
+ return annotation;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationImpl.java
new file mode 100644
index 0000000..21d94f5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationImpl.java
@@ -0,0 +1,72 @@
+/**
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+import org.apache.olingo.odata4.client.core.edm.v4.annotation.ConstExprConstruct;
+import org.apache.olingo.odata4.client.core.edm.v4.annotation.DynExprConstruct;
+
+@JsonDeserialize(using = AnnotationDeserializer.class)
+public class AnnotationImpl extends AbstractEdmItem implements Annotation {
+
+ private static final long serialVersionUID = -5600031479702563436L;
+
+ private String term;
+
+ private String qualifier;
+
+ private ConstExprConstruct constExpr;
+
+ private DynExprConstruct dynExpr;
+
+ public String getTerm() {
+ return term;
+ }
+
+ public void setTerm(final String term) {
+ this.term = term;
+ }
+
+ public String getQualifier() {
+ return qualifier;
+ }
+
+ public void setQualifier(final String qualifier) {
+ this.qualifier = qualifier;
+ }
+
+ public ConstExprConstruct getConstExpr() {
+ return constExpr;
+ }
+
+ public void setConstExpr(final ConstExprConstruct constExpr) {
+ this.constExpr = constExpr;
+ }
+
+ public DynExprConstruct getDynExpr() {
+ return dynExpr;
+ }
+
+ public void setDynExpr(final DynExprConstruct dynExpr) {
+ this.dynExpr = dynExpr;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationsDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationsDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationsDeserializer.java
new file mode 100644
index 0000000..49dc359
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationsDeserializer.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.client.core.edm.v4;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class AnnotationsDeserializer extends AbstractEdmDeserializer<AnnotationsImpl> {
+
+ @Override
+ protected AnnotationsImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AnnotationsImpl annotations = new AnnotationsImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Target".equals(jp.getCurrentName())) {
+ annotations.setTarget(jp.nextTextValue());
+ } else if ("Qualifier".equals(jp.getCurrentName())) {
+ annotations.setQualifier(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ annotations.getAnnotations().add(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return annotations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationsImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationsImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationsImpl.java
new file mode 100644
index 0000000..186b5d4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/AnnotationsImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v4;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotations;
+import org.apache.olingo.odata4.client.core.edm.AbstractAnnotations;
+
+@JsonDeserialize(using = AnnotationsDeserializer.class)
+public class AnnotationsImpl extends AbstractAnnotations implements Annotations {
+
+ private static final long serialVersionUID = 3877353656301805410L;
+
+ private final List<AnnotationImpl> annotations = new ArrayList<AnnotationImpl>();
+
+ public List<AnnotationImpl> getAnnotations() {
+ return annotations;
+ }
+
+ public AnnotationImpl getAnnotation(final String term) {
+ AnnotationImpl result = null;
+ for (AnnotationImpl annotation : getAnnotations()) {
+ if (term.equals(annotation.getTerm())) {
+ result = annotation;
+ }
+ }
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ComplexTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ComplexTypeImpl.java
new file mode 100644
index 0000000..2066c80
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ComplexTypeImpl.java
@@ -0,0 +1,107 @@
+/*
+ * 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.client.core.edm.v4;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.Property;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractComplexType;
+
+public class ComplexTypeImpl extends AbstractComplexType implements AnnotatedEdmItem {
+
+ private static final long serialVersionUID = -1251230308269425962L;
+
+ private boolean abstractEntityType = false;
+
+ private String baseType;
+
+ private boolean openType = false;
+
+ private final List<Property> properties = new ArrayList<Property>();
+
+ private final List<NavigationPropertyImpl> navigationProperties = new ArrayList<NavigationPropertyImpl>();
+
+ private Annotation annotation;
+
+ public boolean isAbstractEntityType() {
+ return abstractEntityType;
+ }
+
+ public void setAbstractEntityType(final boolean abstractEntityType) {
+ this.abstractEntityType = abstractEntityType;
+ }
+
+ public String getBaseType() {
+ return baseType;
+ }
+
+ public void setBaseType(final String baseType) {
+ this.baseType = baseType;
+ }
+
+ public boolean isOpenType() {
+ return openType;
+ }
+
+ public void setOpenType(final boolean openType) {
+ this.openType = openType;
+ }
+
+ @Override
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public Property getProperty(final String name) {
+ Property result = null;
+ for (Property property : getProperties()) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ return result;
+ }
+
+ public List<NavigationPropertyImpl> getNavigationProperties() {
+ return navigationProperties;
+ }
+
+ public NavigationPropertyImpl getNavigationProperty(final String name) {
+ NavigationPropertyImpl result = null;
+ for (NavigationPropertyImpl property : getNavigationProperties()) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/DataServicesImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/DataServicesImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/DataServicesImpl.java
new file mode 100644
index 0000000..33423a1
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/DataServicesImpl.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.client.core.edm.v4;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.core.edm.AbstractDataServices;
+
+public class DataServicesImpl extends AbstractDataServices<
+ SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl> {
+
+ private static final long serialVersionUID = -7954360771258897632L;
+
+ private final List<SchemaImpl> schemas = new ArrayList<SchemaImpl>();
+
+ @Override
+ public List<SchemaImpl> getSchemas() {
+ return schemas;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java
new file mode 100644
index 0000000..b8fc847
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java
@@ -0,0 +1,39 @@
+/*
+ * 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.client.core.edm.v4;
+
+import java.io.InputStream;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmMetadata;
+
+public class EdmMetadataImpl extends AbstractEdmMetadata<
+ EdmxImpl, DataServicesImpl, SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl,
+ FunctionImportImpl> {
+
+ private static final long serialVersionUID = -7765327879691528010L;
+
+ public EdmMetadataImpl(final ODataClient client, final InputStream inputStream) {
+ super(client, inputStream);
+ }
+
+ public List<ReferenceImpl> getReferences() {
+ return this.edmx.getReferences();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmxImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmxImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmxImpl.java
new file mode 100644
index 0000000..2663b78
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmxImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v4;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmx;
+
+public class EdmxImpl extends AbstractEdmx<
+ DataServicesImpl, SchemaImpl, EntityContainerImpl, EntityTypeImpl, ComplexTypeImpl, FunctionImportImpl> {
+
+ private static final long serialVersionUID = -8031883176876401375L;
+
+ private final List<ReferenceImpl> references = new ArrayList<ReferenceImpl>();
+
+ public List<ReferenceImpl> getReferences() {
+ return references;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityContainerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityContainerImpl.java
new file mode 100644
index 0000000..7eb6ea8
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityContainerImpl.java
@@ -0,0 +1,128 @@
+/*
+ * 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.client.core.edm.v4;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractEntityContainer;
+
+public class EntityContainerImpl extends AbstractEntityContainer<FunctionImportImpl> implements AnnotatedEdmItem {
+
+ private static final long serialVersionUID = 2526002525927260320L;
+
+ private final List<EntitySetImpl> entitySets = new ArrayList<EntitySetImpl>();
+
+ private final List<SingletonImpl> singletons = new ArrayList<SingletonImpl>();
+
+ private final List<ActionImportImpl> actionImports = new ArrayList<ActionImportImpl>();
+
+ private final List<FunctionImportImpl> functionImports = new ArrayList<FunctionImportImpl>();
+
+ private Annotation annotation;
+
+ @Override
+ public void setDefaultEntityContainer(final boolean defaultEntityContainer) {
+ // no action: a single entity container MUST be available as per OData 4.0
+ }
+
+ @Override
+ public boolean isDefaultEntityContainer() {
+ return true;
+ }
+
+ @Override
+ public List<EntitySetImpl> getEntitySets() {
+ return entitySets;
+ }
+
+ @Override
+ public EntitySetImpl getEntitySet(final String name) {
+ EntitySetImpl result = null;
+ for (EntitySetImpl entitySet : getEntitySets()) {
+ if (name.equals(entitySet.getName())) {
+ result = entitySet;
+ }
+ }
+ return result;
+ }
+
+ public List<SingletonImpl> getSingletons() {
+ return singletons;
+ }
+
+ public SingletonImpl getSingleton(final String name) {
+ SingletonImpl result = null;
+ for (SingletonImpl singleton : getSingletons()) {
+ if (name.equals(singleton.getName())) {
+ result = singleton;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Gets the first action import with given name.
+ *
+ * @param name name.
+ * @return action import.
+ */
+ public ActionImportImpl getActionImport(final String name) {
+ final List<ActionImportImpl> actImps = getActionImports(name);
+ return actImps.isEmpty()
+ ? null
+ : actImps.get(0);
+ }
+
+ /**
+ * Gets all action imports with given name.
+ *
+ * @param name name.
+ * @return action imports.
+ */
+ public List<ActionImportImpl> getActionImports(final String name) {
+ final List<ActionImportImpl> result = new ArrayList<ActionImportImpl>();
+ for (ActionImportImpl actionImport : getActionImports()) {
+ if (name.equals(actionImport.getName())) {
+ result.add(actionImport);
+ }
+ }
+ return result;
+ }
+
+ public List<ActionImportImpl> getActionImports() {
+ return actionImports;
+ }
+
+ @Override
+ public List<FunctionImportImpl> getFunctionImports() {
+ return functionImports;
+ }
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntitySetImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntitySetImpl.java
new file mode 100644
index 0000000..33bbe0b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntitySetImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.client.core.edm.v4;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.NavigationPropertyBinding;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractEntitySet;
+
+public class EntitySetImpl extends AbstractEntitySet implements AnnotatedEdmItem {
+
+ private static final long serialVersionUID = 5570833733884884012L;
+
+ private boolean includeInServiceDocument = true;
+
+ private Annotation annotation;
+
+ private final List<NavigationPropertyBinding> navigationPropertyBindings
+ = new ArrayList<NavigationPropertyBinding>();
+
+ public boolean isIncludeInServiceDocument() {
+ return includeInServiceDocument;
+ }
+
+ public void setIncludeInServiceDocument(final boolean includeInServiceDocument) {
+ this.includeInServiceDocument = includeInServiceDocument;
+ }
+
+ public List<NavigationPropertyBinding> getNavigationPropertyBindings() {
+ return navigationPropertyBindings;
+ }
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityTypeImpl.java
new file mode 100644
index 0000000..125f63d
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EntityTypeImpl.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v4;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractEntityType;
+
+public class EntityTypeImpl extends AbstractEntityType implements AnnotatedEdmItem {
+
+ private static final long serialVersionUID = 8727765036150269547L;
+
+ private final List<PropertyImpl> properties = new ArrayList<PropertyImpl>();
+
+ private final List<NavigationPropertyImpl> navigationProperties = new ArrayList<NavigationPropertyImpl>();
+
+ private Annotation annotation;
+
+ @Override
+ public List<PropertyImpl> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public PropertyImpl getProperty(final String name) {
+ PropertyImpl result = null;
+ for (PropertyImpl property : getProperties()) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public List<NavigationPropertyImpl> getNavigationProperties() {
+ return navigationProperties;
+ }
+
+ @Override
+ public NavigationPropertyImpl getNavigationProperty(final String name) {
+ NavigationPropertyImpl result = null;
+ for (NavigationPropertyImpl property : getNavigationProperties()) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EnumTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EnumTypeImpl.java
new file mode 100644
index 0000000..8df0239
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EnumTypeImpl.java
@@ -0,0 +1,71 @@
+/*
+ * 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.client.core.edm.v4;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractEnumType;
+
+public class EnumTypeImpl extends AbstractEnumType implements AnnotatedEdmItem {
+
+ private static final long serialVersionUID = -3329664331877556957L;
+
+ private Annotation annotation;
+
+ private final List<MemberImpl> members = new ArrayList<MemberImpl>();
+
+ @Override
+ public List<MemberImpl> getMembers() {
+ return members;
+ }
+
+ @Override
+ public MemberImpl getMember(final String name) {
+ MemberImpl result = null;
+ for (MemberImpl member : getMembers()) {
+ if (name.equals(member.getName())) {
+ result = member;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public MemberImpl getMember(final Integer value) {
+ MemberImpl result = null;
+ for (MemberImpl member : getMembers()) {
+ if (value.equals(member.getValue())) {
+ result = member;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionDeserializer.java
new file mode 100644
index 0000000..eb942f7
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionDeserializer.java
@@ -0,0 +1,62 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class FunctionDeserializer extends AbstractEdmDeserializer<FunctionImpl> {
+
+ @Override
+ protected FunctionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final FunctionImpl function = new FunctionImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ function.setName(jp.nextTextValue());
+ } else if ("IsBound".equals(jp.getCurrentName())) {
+ function.setBound(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("IsComposable".equals(jp.getCurrentName())) {
+ function.setComposable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("EntitySetPath".equals(jp.getCurrentName())) {
+ function.setEntitySetPath(jp.nextTextValue());
+ } else if ("Parameter".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ function.getParameters().add(jp.getCodec().readValue(jp, ParameterImpl.class));
+ } else if ("ReturnType".equals(jp.getCurrentName())) {
+ function.setReturnType(parseReturnType(jp, "Function"));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ function.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return function;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImpl.java
new file mode 100644
index 0000000..5e22a7a
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImpl.java
@@ -0,0 +1,38 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = FunctionDeserializer.class)
+public class FunctionImpl extends ActionImpl {
+
+ private static final long serialVersionUID = -5888231162358116515L;
+
+ private boolean composable = false;
+
+ public boolean isComposable() {
+ return composable;
+ }
+
+ public void setComposable(final boolean composable) {
+ this.composable = composable;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImportImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImportImpl.java
new file mode 100644
index 0000000..bf9ad53
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/FunctionImportImpl.java
@@ -0,0 +1,88 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractFunctionImport;
+
+public class FunctionImportImpl extends AbstractFunctionImport implements AnnotatedEdmItem {
+
+ private static final long serialVersionUID = 3023813358471000019L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ @JsonProperty(value = "Function", required = true)
+ private String function;
+
+ @JsonProperty(value = "EntitySet")
+ private String entitySet;
+
+ @JsonProperty(value = "IncludeInServiceDocument")
+ private boolean includeInServiceDocument = false;
+
+ @JsonProperty(value = "Annotation")
+ private Annotation annotation;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getFunction() {
+ return function;
+ }
+
+ public void setFunction(final String function) {
+ this.function = function;
+ }
+
+ @Override
+ public String getEntitySet() {
+ return entitySet;
+ }
+
+ public void setEntitySet(final String entitySet) {
+ this.entitySet = entitySet;
+ }
+
+ public boolean isIncludeInServiceDocument() {
+ return includeInServiceDocument;
+ }
+
+ public void setIncludeInServiceDocument(final boolean includeInServiceDocument) {
+ this.includeInServiceDocument = includeInServiceDocument;
+ }
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/IncludeAnnotationsImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/IncludeAnnotationsImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/IncludeAnnotationsImpl.java
new file mode 100644
index 0000000..29a930c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/IncludeAnnotationsImpl.java
@@ -0,0 +1,62 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v4.IncludeAnnotations;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class IncludeAnnotationsImpl extends AbstractEdmItem implements IncludeAnnotations {
+
+ private static final long serialVersionUID = -5600031479702563436L;
+
+ @JsonProperty(value = "TermNamespace", required = true)
+ private String termNamespace;
+
+ @JsonProperty(value = "Qualifier")
+ private String qualifier;
+
+ @JsonProperty(value = "TargetNamespace")
+ private String targeyNamespace;
+
+ public String getTermNamespace() {
+ return termNamespace;
+ }
+
+ public void setTermNamespace(final String termNamespace) {
+ this.termNamespace = termNamespace;
+ }
+
+ public String getQualifier() {
+ return qualifier;
+ }
+
+ public void setQualifier(final String qualifier) {
+ this.qualifier = qualifier;
+ }
+
+ public String getTargeyNamespace() {
+ return targeyNamespace;
+ }
+
+ public void setTargeyNamespace(final String targeyNamespace) {
+ this.targeyNamespace = targeyNamespace;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/IncludeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/IncludeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/IncludeImpl.java
new file mode 100644
index 0000000..8bda525
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/IncludeImpl.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.client.core.edm.v4;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v4.Include;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class IncludeImpl extends AbstractEdmItem implements Include {
+
+ private static final long serialVersionUID = -5600031479702563436L;
+
+ @JsonProperty(value = "Namespace", required = true)
+ private String namespace;
+
+ @JsonProperty(value = "Alias")
+ private String alias;
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(final String namespace) {
+ this.namespace = namespace;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(final String alias) {
+ this.alias = alias;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/MemberImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/MemberImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/MemberImpl.java
new file mode 100644
index 0000000..15e8533
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/MemberImpl.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.client.core.edm.v4;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.Member;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractMember;
+
+public class MemberImpl extends AbstractMember implements Member, AnnotatedEdmItem {
+
+ private static final long serialVersionUID = -344920557183058824L;
+
+ @JsonProperty("Annotation")
+ private Annotation annotation;
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyBindingImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyBindingImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyBindingImpl.java
new file mode 100644
index 0000000..c39340b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyBindingImpl.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.client.core.edm.v4;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.NavigationPropertyBinding;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class NavigationPropertyBindingImpl extends AbstractEdmItem implements NavigationPropertyBinding {
+
+ private static final long serialVersionUID = -6026065326479176817L;
+
+ @JsonProperty(value = "Path", required = true)
+ private String path;
+
+ @JsonProperty(value = "Target", required = true)
+ private String target;
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(final String path) {
+ this.path = path;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ public void setTarget(final String target) {
+ this.target = target;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyDeserializer.java
new file mode 100644
index 0000000..ed5767c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyDeserializer.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v4;
+
+import org.apache.olingo.odata4.client.core.edm.OnDeleteImpl;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class NavigationPropertyDeserializer extends AbstractEdmDeserializer<NavigationPropertyImpl> {
+
+ @Override
+ protected NavigationPropertyImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final NavigationPropertyImpl property = new NavigationPropertyImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ property.setName(jp.nextTextValue());
+ } else if ("Type".equals(jp.getCurrentName())) {
+ property.setType(jp.nextTextValue());
+ } else if ("Nullable".equals(jp.getCurrentName())) {
+ property.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Partner".equals(jp.getCurrentName())) {
+ property.setPartner(jp.nextTextValue());
+ } else if ("ContainsTarget".equals(jp.getCurrentName())) {
+ property.setContainsTarget(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("ReferentialConstraint".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ property.getReferentialConstraints().add(jp.getCodec().readValue(jp, ReferentialConstraintImpl.class));
+ } else if ("OnDelete".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ property.setOnDelete(jp.getCodec().readValue(jp, OnDeleteImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ property.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return property;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyImpl.java
new file mode 100644
index 0000000..c84a659
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/NavigationPropertyImpl.java
@@ -0,0 +1,102 @@
+/*
+ * 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.client.core.edm.v4;
+
+import org.apache.olingo.odata4.client.core.edm.OnDeleteImpl;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.api.edm.v4.ReferentialConstraint;
+import org.apache.olingo.odata4.client.core.edm.AbstractNavigationProperty;
+
+@JsonDeserialize(using = NavigationPropertyDeserializer.class)
+public class NavigationPropertyImpl extends AbstractNavigationProperty implements AnnotatedEdmItem {
+
+ private static final long serialVersionUID = -2889417442815563307L;
+
+ private String type;
+
+ private boolean nullable = true;
+
+ private String partner;
+
+ private boolean containsTarget = false;
+
+ private final List<ReferentialConstraint> referentialConstraints = new ArrayList<ReferentialConstraint>();
+
+ private OnDeleteImpl onDelete;
+
+ private Annotation annotation;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public boolean isNullable() {
+ return nullable;
+ }
+
+ public void setNullable(final boolean nullable) {
+ this.nullable = nullable;
+ }
+
+ public String getPartner() {
+ return partner;
+ }
+
+ public void setPartner(final String partner) {
+ this.partner = partner;
+ }
+
+ public boolean isContainsTarget() {
+ return containsTarget;
+ }
+
+ public void setContainsTarget(final boolean containsTarget) {
+ this.containsTarget = containsTarget;
+ }
+
+ public List<ReferentialConstraint> getReferentialConstraints() {
+ return referentialConstraints;
+ }
+
+ public OnDeleteImpl getOnDelete() {
+ return onDelete;
+ }
+
+ public void setOnDelete(final OnDeleteImpl onDelete) {
+ this.onDelete = onDelete;
+ }
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ParameterImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ParameterImpl.java
new file mode 100644
index 0000000..cda9315
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ParameterImpl.java
@@ -0,0 +1,39 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.core.edm.AbstractParameter;
+
+public class ParameterImpl extends AbstractParameter {
+
+ private static final long serialVersionUID = -1067642515116697747L;
+
+ @JsonProperty(value = "SRID")
+ private String srid;
+
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/PropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/PropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/PropertyImpl.java
new file mode 100644
index 0000000..00c4567
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/PropertyImpl.java
@@ -0,0 +1,41 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.core.edm.AbstractProperty;
+
+public class PropertyImpl extends AbstractProperty implements AnnotatedEdmItem {
+
+ private static final long serialVersionUID = -5541908235094985412L;
+
+ @JsonProperty("Annotation")
+ private Annotation annotation;
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferenceDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferenceDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferenceDeserializer.java
new file mode 100644
index 0000000..2fd0ef9
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferenceDeserializer.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v4;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import java.net.URI;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class ReferenceDeserializer extends AbstractEdmDeserializer<ReferenceImpl> {
+
+ @Override
+ protected ReferenceImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final ReferenceImpl reference = new ReferenceImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Uri".equals(jp.getCurrentName())) {
+ reference.setUri(URI.create(jp.nextTextValue()));
+ } else if ("Include".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ reference.getIncludes().add(jp.getCodec().readValue(jp, IncludeImpl.class));
+ } else if ("IncludeAnnotations".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ reference.getIncludeAnnotations().add(jp.getCodec().readValue(jp, IncludeAnnotationsImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ reference.getAnnotations().add(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ }
+ }
+ }
+
+ return reference;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferenceImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferenceImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferenceImpl.java
new file mode 100644
index 0000000..369ce8f
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferenceImpl.java
@@ -0,0 +1,62 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.v4.Annotation;
+import org.apache.olingo.odata4.client.api.edm.v4.Reference;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+@JsonDeserialize(using = ReferenceDeserializer.class)
+public class ReferenceImpl extends AbstractEdmItem implements Reference {
+
+ private static final long serialVersionUID = -5600031479702563436L;
+
+ private URI uri;
+
+ private final List<IncludeImpl> includes = new ArrayList<IncludeImpl>();
+
+ private final List<IncludeAnnotationsImpl> includeAnnotations = new ArrayList<IncludeAnnotationsImpl>();
+
+ private final List<Annotation> annotations = new ArrayList<Annotation>();
+
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setUri(final URI uri) {
+ this.uri = uri;
+ }
+
+ public List<IncludeImpl> getIncludes() {
+ return includes;
+ }
+
+ public List<IncludeAnnotationsImpl> getIncludeAnnotations() {
+ return includeAnnotations;
+ }
+
+ public List<Annotation> getAnnotations() {
+ return annotations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferentialConstraintImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferentialConstraintImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferentialConstraintImpl.java
new file mode 100644
index 0000000..7234e5d
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReferentialConstraintImpl.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.client.core.edm.v4;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v4.ReferentialConstraint;
+
+public class ReferentialConstraintImpl extends AbstractAnnotatedEdmItem implements ReferentialConstraint {
+
+ private static final long serialVersionUID = -9182114558289778632L;
+
+ @JsonProperty(value = "Property", required = true)
+ private String property;
+
+ @JsonProperty(value = "ReferencedProperty", required = true)
+ private String referencedProperty;
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(final String property) {
+ this.property = property;
+ }
+
+ public String getReferencedProperty() {
+ return referencedProperty;
+ }
+
+ public void setReferencedProperty(final String referencedProperty) {
+ this.referencedProperty = referencedProperty;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReturnTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReturnTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReturnTypeImpl.java
new file mode 100644
index 0000000..9e9751e
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/ReturnTypeImpl.java
@@ -0,0 +1,96 @@
+/*
+ * 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.client.core.edm.v4;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.math.BigInteger;
+import org.apache.olingo.odata4.client.api.edm.v4.ReturnType;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmItem;
+
+public class ReturnTypeImpl extends AbstractEdmItem implements ReturnType {
+
+ private static final long serialVersionUID = -5888231162358116515L;
+
+ @JsonProperty(value = "Type")
+ private String type;
+
+ @JsonProperty(value = "Nullable")
+ private boolean nullable = true;
+
+ @JsonProperty(value = "MaxLength")
+ private String maxLength;
+
+ @JsonProperty(value = "Precision")
+ private BigInteger precision;
+
+ @JsonProperty(value = "Scale")
+ private BigInteger scale;
+
+ @JsonProperty(value = "SRID")
+ private String srid;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public boolean isNullable() {
+ return nullable;
+ }
+
+ public void setNullable(final boolean nullable) {
+ this.nullable = nullable;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+}
[14/14] git commit: Merge from origin/master
Posted by il...@apache.org.
Merge from origin/master
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/7f76d8a7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/7f76d8a7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/7f76d8a7
Branch: refs/heads/olingo169
Commit: 7f76d8a7bcdf732dfe060f088c6f39b44a4f91d1
Parents: 4f927e7 217fe95
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Feb 21 17:27:52 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Feb 21 17:27:52 2014 +0100
----------------------------------------------------------------------
.../api/uri/queryoption/FormatOption.java | 2 +-
.../uri/queryoption/SupportedQueryOptions.java | 2 +-
.../odata4/server/core/uri/antlr/UriParser.g4 | 8 +-
.../odata4/server/core/uri/UriInfoImpl.java | 2 +-
.../odata4/server/core/uri/parser/Parser.java | 18 -
.../server/core/uri/parser/UriDecoder.java | 12 +-
.../core/uri/parser/UriParseTreeVisitor.java | 82 +-
.../core/uri/parser/UriParserException.java | 1 -
.../uri/parser/UriParserSemanticException.java | 4 -
.../core/uri/queryoption/CountOptionImpl.java | 2 +-
.../core/uri/queryoption/ExpandItemImpl.java | 2 +-
.../core/uri/queryoption/SearchOptionImpl.java | 3 +-
.../odata4/server/core/uri/RawUriTest.java | 21 +-
.../server/core/uri/UriParameterImplTest.java | 502 -------
.../server/core/uri/UriResourceImplTest.java | 505 +++++++
.../core/uri/antlr/TestFullResourcePath.java | 148 +-
.../odata4/server/core/uri/antlr/TestLexer.java | 167 +--
.../server/core/uri/antlr/TestParser.java | 1359 ------------------
.../core/uri/antlr/TestUriParserImpl.java | 76 +-
.../core/uri/queryoption/QueryOptionTest.java | 2 +-
.../core/uri/testutil/ParserValidator.java | 81 --
.../core/uri/testutil/ResourceValidator.java | 17 +-
22 files changed, 682 insertions(+), 2334 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FormatOption.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SupportedQueryOptions.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
index 8f54672,db42556..1e5759e
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
@@@ -12,13 -12,12 +12,12 @@@
* 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- ******************************************************************************/
+ */
package org.apache.olingo.odata4.server.core.uri.parser;
- //TODO Check name of this exception when implementing proper error handling
public class UriParserException extends Exception {
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
index 29c6653,2f8f1d6..c9eb30d
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
@@@ -12,18 -12,14 +12,14 @@@
* 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- ******************************************************************************/
+ */
package org.apache.olingo.odata4.server.core.uri.parser;
- //TODO Check name of this exception when implementing proper error handling
public class UriParserSemanticException extends UriParserException {
- /**
- *
- */
private static final long serialVersionUID = 1L;
public UriParserSemanticException(final String message, final Throwable cause) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriResourceImplTest.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriResourceImplTest.java
index 0000000,c55488f..33fcd55
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriResourceImplTest.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriResourceImplTest.java
@@@ -1,0 -1,505 +1,505 @@@
-/*******************************************************************************
++/*
+ * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
++ * 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
- *
++ * 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
++ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
- ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+
+ import static org.junit.Assert.assertEquals;
+ import static org.junit.Assert.assertNotNull;
+
+ import java.util.ArrayList;
+ import java.util.Arrays;
+ 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.EdmEntityType;
+ 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.EdmNavigationProperty;
+ import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.core.edm.provider.EdmComplexTypeImpl;
+ import org.apache.olingo.odata4.server.core.edm.provider.EdmEntitySetImpl;
+ import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl;
+ import org.apache.olingo.odata4.server.core.edm.provider.EdmSingletonImpl;
+ import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
+ import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
+ import org.junit.Test;
+
+ public class UriResourceImplTest {
+ Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
+
+ @Test
+ public void testUriParameterImpl() {
+ UriParameterImpl impl = new UriParameterImpl();
+ ExpressionImpl expression = new LiteralImpl().setText("Expression");
+
+ impl.setText("Text");
+ impl.setName("A");
+ impl.setAlias("@A");
+ impl.setExpression(expression);
+
+ assertEquals("Text", impl.getText());
+ assertEquals("A", impl.getName());
+ assertEquals("@A", impl.getAlias());
- assertEquals(expression, impl.getExression());
++ assertEquals(expression, impl.getExpression());
+ }
+
+ @Test
+ public void testUriResourceActionImpl() {
+ UriResourceActionImpl impl = new UriResourceActionImpl();
+ assertEquals(UriResourceKind.action, impl.getKind());
+ assertEquals("", impl.toString());
+
+ // action
+ EdmAction action = edm.getAction(EdmTechProvider.nameUARTETParam, null, null);
+ impl.setAction(action);
+ assertEquals(action, impl.getAction());
+ assertEquals(EdmTechProvider.nameUARTETParam.getName(), impl.toString());
+
+ // action import
+ impl = new UriResourceActionImpl();
+ EdmActionImport actionImport = edm.getEntityContainer(null).getActionImport("AIRTPrimParam");
+ impl.setActionImport(actionImport);
+ assertEquals(actionImport, impl.getActionImport());
+ assertEquals(actionImport.getAction(), impl.getAction());
+ assertEquals(false, impl.isCollection());
+ assertEquals("AIRTPrimParam", impl.toString());
+ assertEquals(actionImport.getAction().getReturnType().getType(), impl.getType());
+ }
+
+ @Test
+ public void testUriResourceLambdaAllImpl() {
+ UriResourceLambdaAllImpl impl = new UriResourceLambdaAllImpl();
+ assertEquals(UriResourceKind.lambdaAll, impl.getKind());
+
+ ExpressionImpl expression = new LiteralImpl().setText("Expression");
+ impl.setExpression(expression);
+ impl.setLamdaVariable("A");
+
+ assertEquals(false, impl.isCollection());
+ assertEquals(expression, impl.getExpression());
+ assertEquals("A", impl.getLamdaVariable());
+ assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
+ assertEquals("all", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceLambdaAnyImpl() {
+ UriResourceLambdaAnyImpl impl = new UriResourceLambdaAnyImpl();
+ assertEquals(UriResourceKind.lambdaAny, impl.getKind());
+
+ ExpressionImpl expression = new LiteralImpl().setText("Expression");
+ impl.setExpression(expression);
+ impl.setLamdaVariable("A");
+
+ assertEquals(false, impl.isCollection());
+ assertEquals(expression, impl.getExpression());
+ assertEquals("A", impl.getLamdaVariable());
+ assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
+ assertEquals("any", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceComplexPropertyImpl() {
+ UriResourceComplexPropertyImpl impl = new UriResourceComplexPropertyImpl();
+ assertEquals(UriResourceKind.complexProperty, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+ EdmProperty property = (EdmProperty) entityType.getProperty("PropertyComplex");
+ impl.setProperty(property);
+
+ assertEquals(property, impl.getProperty());
+ assertEquals(property.getName(), impl.toString());
+ assertEquals(false, impl.isCollection());
+ assertEquals(property.getType(), impl.getType());
+ assertEquals(property.getType(), impl.getComplexType());
+ impl.getComplexType();
+
+ EdmComplexTypeImpl complexTypeImplType =
+ (EdmComplexTypeImpl) edm.getComplexType(EdmTechProvider.nameCTBasePrimCompNav);
+
+ impl.setTypeFilter(complexTypeImplType);
+ assertEquals(complexTypeImplType, impl.getTypeFilter());
+ assertEquals(complexTypeImplType, impl.getComplexTypeFilter());
+ impl.getComplexTypeFilter();
+
+ }
+
+ @Test
+ public void testUriResourcePrimitivePropertyImpl() {
+ UriResourcePrimitivePropertyImpl impl = new UriResourcePrimitivePropertyImpl();
+ assertEquals(UriResourceKind.primitiveProperty, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+ EdmProperty property = (EdmProperty) entityType.getProperty("PropertyInt16");
+ impl.setProperty(property);
+
+ assertEquals(property, impl.getProperty());
+ assertEquals(property.getName(), impl.toString());
+ assertEquals(false, impl.isCollection());
+ assertEquals(property.getType(), impl.getType());
+ }
+
+ @Test
+ public void testUriResourceCountImpl() {
+ UriResourceCountImpl impl = new UriResourceCountImpl();
+ assertEquals(UriResourceKind.count, impl.getKind());
+ assertEquals("$count", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceEntitySetImpl() {
+ UriResourceEntitySetImpl impl = new UriResourceEntitySetImpl();
+ assertEquals(UriResourceKind.entitySet, impl.getKind());
+
+ EdmEntitySetImpl entitySet = (EdmEntitySetImpl) edm.getEntityContainer(null).getEntitySet("ESAllPrim");
+ impl.setEntitSet(entitySet);
+
+ assertEquals("ESAllPrim", impl.toString());
+ assertEquals(entitySet, impl.getEntitySet());
+
+ assertEquals(entitySet.getEntityType(), impl.getType());
+ assertEquals(entitySet.getEntityType(), impl.getEntityType());
+ impl.getEntityType();
+
+ // is Collection
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceFunctionImpl() {
+ UriResourceFunctionImpl impl = new UriResourceFunctionImpl();
+ assertEquals(UriResourceKind.function, impl.getKind());
+ assertEquals("", impl.toString());
+
+ // function
+ EdmFunction function = (EdmFunction) edm.getEntityContainer(null).getFunctionImport("FINRTInt16")
+ .getFunction(new ArrayList<String>());
+ assertNotNull(function);
+ impl.setFunction(function);
+
+
+ assertEquals(function, impl.getFunction());
+ assertEquals("UFNRTInt16", impl.toString());
+ assertEquals(function.getReturnType().getType(), impl.getType());
+ assertEquals(false,impl.isParameterListFilled());
+
+ // function import
+ impl = new UriResourceFunctionImpl();
+ EdmFunctionImport functionImport = edm.getEntityContainer(null).getFunctionImport("FINRTInt16");
+ impl.setFunctionImport(functionImport, new ArrayList<UriParameterImpl>());
+ assertEquals(functionImport, impl.getFunctionImport());
+ assertEquals("FINRTInt16", impl.toString());
+
+ // function collection
+ impl = new UriResourceFunctionImpl();
+ functionImport = edm.getEntityContainer(null).getFunctionImport("FICRTESTwoKeyNavParam");
+ assertNotNull(function);
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ impl.setFunctionImport(functionImport, Arrays.asList(parameter));
+ assertEquals("FICRTESTwoKeyNavParam", impl.toString());
+
+ impl.setFunction(functionImport.getFunction(Arrays.asList("ParameterInt16")));
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
+ assertEquals(false, impl.isCollection());
+
+ assertEquals(parameter, impl.getParameters().get(0));
+ assertEquals(true,impl.isParameterListFilled());
+ }
+
+ @Test
+ public void testUriResourceImplKeyPred() {
+ class Mock extends UriResourceWithKeysImpl {
+ EdmType type;
+
+ public Mock() {
+ super(UriResourceKind.action);
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ public Mock setType(final EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "mock";
+ }
+ }
+
+ Mock impl = new Mock();
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ EdmEntityType entityTypeBaseEntry = edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ impl.setType(entityType);
+ assertEquals(entityType, impl.getType());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock", impl.toString(true));
+
+ // set both
+ impl.setCollectionTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
+ impl.setEntryTypeFilter(entityTypeBaseEntry);
+ assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav/()com.sap.odata.test1.ETTwoBaseTwoKeyNav",
+ impl.toString(true));
+
+ // set entry
+ impl = new Mock();
+ impl.setType(entityType);
+ impl.setEntryTypeFilter(entityTypeBaseEntry);
+ assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETTwoBaseTwoKeyNav", impl.toString(true));
+
+ // set collection
+ impl = new Mock();
+ impl.setType(entityType);
+ impl.setCollectionTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
+
+ impl = new Mock();
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ impl.setKeyPredicates(keyPredicates);
+ assertNotNull(null, impl.getKeyPredicates());
+
+ }
+
+ @Test
+ public void testUriResourceImplTyped() {
+ class Mock extends UriResourceTypedImpl {
+ EdmType type;
+
+ public Mock() {
+ super(UriResourceKind.action);
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ public Mock setType(final EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return "mock";
+ }
+
+ }
+
+ Mock impl = new Mock();
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ impl.setType(entityType);
+ assertEquals("mock", impl.toString());
+ assertEquals("mock", impl.toString(true));
+ assertEquals("mock", impl.toString(false));
+
+ impl.setTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getTypeFilter());
+ assertEquals("mock", impl.toString());
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
+ assertEquals("mock", impl.toString(false));
+ //
+ }
+
+ @Test
+ public void testUriResourceItImpl() {
+ UriResourceItImpl impl = new UriResourceItImpl();
+ assertEquals(UriResourceKind.it, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ assertEquals("$it", impl.toString());
+
+ impl.setType(entityType);
+ assertEquals(entityType, impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceNavigationPropertyImpl() {
+ UriResourceNavigationPropertyImpl impl = new UriResourceNavigationPropertyImpl();
+ assertEquals(UriResourceKind.navigationProperty, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ EdmNavigationProperty property = (EdmNavigationProperty) entityType.getProperty("NavPropertyETKeyNavMany");
+ assertNotNull(property);
+
+ impl.setNavigationProperty(property);
+ assertEquals(property, impl.getProperty());
+
+ assertEquals("NavPropertyETKeyNavMany", impl.toString());
+ assertEquals(property.getType(), impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceRefImpl() {
+ UriResourceRefImpl impl = new UriResourceRefImpl();
+ assertEquals(UriResourceKind.ref, impl.getKind());
+ assertEquals("$ref", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceRootImpl() {
+ UriResourceRootImpl impl = new UriResourceRootImpl();
+ assertEquals(UriResourceKind.root, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ assertEquals("$root", impl.toString());
+
+ impl.setType(entityType);
+ assertEquals(entityType, impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceSingletonImpl() {
+ UriResourceSingletonImpl impl = new UriResourceSingletonImpl();
+ assertEquals(UriResourceKind.singleton, impl.getKind());
+
+ EdmSingletonImpl singleton = (EdmSingletonImpl) edm.getEntityContainer(null).getSingleton("SINav");
+ EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ impl.setSingleton(singleton);
+
+ assertEquals("SINav", impl.toString());
+ assertEquals(singleton, impl.getSingleton());
+
+ assertEquals(singleton.getEntityType(), impl.getType());
+ assertEquals(singleton.getEntityType(), impl.getEntityType());
+ impl.getEntityType();
+
+ impl.setTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getEntityTypeFilter());
+
+ // is Collection
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceValueImpl() {
+ UriResourceValueImpl impl = new UriResourceValueImpl();
+ assertEquals(UriResourceKind.value, impl.getKind());
+ assertEquals("$value", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceLambdaVarImpl() {
+ UriResourceLambdaVarImpl impl = new UriResourceLambdaVarImpl();
+ assertEquals(UriResourceKind.lambdaVariable, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ impl.setType(entityType);
+ impl.setVariableText("A");
+
+ assertEquals("A", impl.toString());
+ assertEquals(entityType, impl.getType());
+ assertEquals("A", impl.getVariableText());
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ }
+
+
+ @Test
+ public void testUriResourceStartingTypeFilterImpl() {
+ UriResourceStartingTypeFilterImpl impl = new UriResourceStartingTypeFilterImpl();
+ assertEquals(UriResourceKind.startingTypeFilter, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+
+ impl.setType(entityType);
+ assertEquals("com.sap.odata.test1.ETTwoKeyNav", impl.toString());
+ assertEquals(entityType, impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
index 5f723a2,1d4ee7b..0898938
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
@@@ -12,15 -12,12 +12,12 @@@
* 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- ******************************************************************************/
+ */
package org.apache.olingo.odata4.server.core.uri.antlr;
- import static org.junit.Assert.assertEquals;
- import static org.junit.Assert.fail;
-
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Arrays;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7f76d8a7/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
----------------------------------------------------------------------
[04/14] git commit: [OLINGO-63] Uri Parser: add unit tests for errors
Posted by il...@apache.org.
[OLINGO-63] Uri Parser: add unit tests for errors
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/217fe957
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/217fe957
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/217fe957
Branch: refs/heads/olingo169
Commit: 217fe9579b0f61159847b983a6d0f6b4b545b70a
Parents: 32467b8
Author: Sven Kobler <sv...@sap.com>
Authored: Fri Feb 21 13:38:30 2014 +0100
Committer: Sven Kobler <sv...@sap.com>
Committed: Fri Feb 21 13:38:30 2014 +0100
----------------------------------------------------------------------
.../api/uri/queryoption/FormatOption.java | 2 +-
.../uri/queryoption/SupportedQueryOptions.java | 2 +-
.../odata4/server/core/uri/antlr/UriParser.g4 | 8 +-
.../odata4/server/core/uri/UriInfoImpl.java | 2 +-
.../odata4/server/core/uri/parser/Parser.java | 18 -
.../server/core/uri/parser/UriDecoder.java | 12 +-
.../core/uri/parser/UriParseTreeVisitor.java | 82 +-
.../core/uri/parser/UriParserException.java | 1 -
.../uri/parser/UriParserSemanticException.java | 4 -
.../core/uri/queryoption/CountOptionImpl.java | 2 +-
.../core/uri/queryoption/ExpandItemImpl.java | 2 +-
.../core/uri/queryoption/SearchOptionImpl.java | 3 +-
.../odata4/server/core/uri/RawUriTest.java | 21 +-
.../server/core/uri/UriParameterImplTest.java | 502 -------
.../server/core/uri/UriResourceImplTest.java | 505 +++++++
.../core/uri/antlr/TestFullResourcePath.java | 148 +-
.../odata4/server/core/uri/antlr/TestLexer.java | 167 +--
.../server/core/uri/antlr/TestParser.java | 1359 ------------------
.../core/uri/antlr/TestUriParserImpl.java | 76 +-
.../core/uri/queryoption/QueryOptionTest.java | 2 +-
.../core/uri/testutil/ParserValidator.java | 81 --
.../core/uri/testutil/ResourceValidator.java | 17 +-
22 files changed, 682 insertions(+), 2334 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FormatOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FormatOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FormatOption.java
index 56cdff0..f672b6b 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FormatOption.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FormatOption.java
@@ -20,6 +20,6 @@ package org.apache.olingo.odata4.server.api.uri.queryoption;
public interface FormatOption extends SystemQueryOption {
- // TODO planned: define best representation for format
+ // TODO planned: define best representation for format to enable plugging in custom formats
String getFormat();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SupportedQueryOptions.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SupportedQueryOptions.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SupportedQueryOptions.java
index 047fb81..1d4d544 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SupportedQueryOptions.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SupportedQueryOptions.java
@@ -23,7 +23,7 @@ public enum SupportedQueryOptions {
FORMAT("$format"),
EXPAND("$expand"),
ID("$id"),
- INLINECOUNT("$inlinecount"),
+ COUNT("$count"),
ORDERBY("$orderby"),
SEARCH("$search"),
SELECT("$select"),
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4 b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4
index d94302f..3c36782 100644
--- a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4
+++ b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4
@@ -81,14 +81,12 @@ value : VALUE;
//; 2. Query Options
//;------------------------------------------------------------------------------
-queryOptions : vlQO+=queryOption ( AMP vlQO+=queryOption )*;
+queryOptions : vlQO+=queryOption ( AMP vlQO+=queryOption )*;//TODO can this be removed
-queryOption : systemQueryOption
- | AT_Q aliasAndValue;
+queryOption : systemQueryOption;
systemQueryOption : expand
| filter
- | format
| inlinecount
| orderBy
| search
@@ -148,7 +146,7 @@ orderByItem : vC=commonExpr ( WSP ( vA=ASC | vD=DESC ) )?;
skip : SKIP EQ INT;
top : TOP EQ INT;
-format : FORMAT EQ ( ATOM | JSON | XML | PCHARS ( SLASH PCHARS)?);
+//format : FORMAT EQ ( ATOM | JSON | XML | PCHARS ( SLASH PCHARS)?);
inlinecount : COUNT EQ booleanNonCase;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
index e527feb..eae850e 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
@@ -256,7 +256,7 @@ public class UriInfoImpl implements UriInfo {
formatOption = (FormatOptionImpl) systemOption;
} else if (systemOption.getKind() == SupportedQueryOptions.ID) {
idOption = (IdOptionImpl) systemOption;
- } else if (systemOption.getKind() == SupportedQueryOptions.INLINECOUNT) {
+ } else if (systemOption.getKind() == SupportedQueryOptions.COUNT) {
inlineCountOption = (CountOptionImpl) systemOption;
} else if (systemOption.getKind() == SupportedQueryOptions.ORDERBY) {
orderByOption = (OrderByOptionImpl) systemOption;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
index df72c82..1094404 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
@@ -195,12 +195,6 @@ public class Parser {
idOption.setText(option.value);
idOption.setValue(option.value);
context.contextUriInfo.setSystemQueryOption(idOption);
- } else if (option.name.equals("$inlinecount")) {
- CountOptionImpl inlineCountOption = new CountOptionImpl();
- inlineCountOption.setName(option.name);
- inlineCountOption.setText(option.value);
- inlineCountOption.setValue(option.value.equals("true") ? true : false);
- context.contextUriInfo.setSystemQueryOption(inlineCountOption);
} else if (option.name.equals("$orderby")) {
OrderByEOFContext ctxFilterExpression =
(OrderByEOFContext) parseRule(option.value, ParserEntryRules.Orderby);
@@ -244,19 +238,7 @@ public class Parser {
inlineCountOption.setText(option.value);
inlineCountOption.setValue(option.value.equals("true") ? true : false);
context.contextUriInfo.setSystemQueryOption(inlineCountOption);
- } else if (option.name.equals("$level")) {
- LevelsOptionImpl inlineCountOption = new LevelsOptionImpl();
- inlineCountOption.setName(option.name);
- inlineCountOption.setText(option.value);
- if (option.value.equals("max")) {
- inlineCountOption.setMax();
- } else {
- inlineCountOption.setValue(Integer.parseInt(option.value));
- }
-
- context.contextUriInfo.setSystemQueryOption(inlineCountOption);
}
-
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
index 2369961..84d51ec 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
@@ -96,10 +96,8 @@ public class UriDecoder {
public static void splittPath(final RawUri rawUri, int scipSegments) {
List<String> list = splitt(rawUri.path, '/');
- if (list.size() > 0) {
- if (list.get(0).length() == 0) {
- scipSegments++;
- }
+ if (list.get(0).length() == 0) {
+ scipSegments++;
}
if (scipSegments > 0) {
@@ -121,9 +119,9 @@ public class UriDecoder {
start = end + 1;
}
- if (end == -1) {
- list.add(input.substring(start));
- }
+
+ list.add(input.substring(start));
+
return list;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
index f98e53b..a4eaeda 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
@@ -108,7 +108,6 @@ import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandRefO
import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.FilterContext;
import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.FilterExpressionEOFContext;
import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.FloorMethodCallExprContext;
-import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.FormatContext;
import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.FractionalsecondsMethodCallExprContext;
import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.GeoDistanceMethodCallExprContext;
import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.GeoIntersectsMethodCallExprContext;
@@ -189,22 +188,16 @@ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.TypeLiter
/**
* UriVisitor
*
- * Converts the URI parse tree from the generate URI parser into an internal representation
- * which maybe (TODO) given to the application.
- * While converting the tree is validated against the EDM.
+ * Converts the URI parse tree the generated by ANTLR into an internal representation
+ * which maybe is given to the application.
+ * While converting the tree is only validated against the EDM if necessary.
*
* Attention:
- * <li> This UriVisitor is at some point more lax than the original ABNF:
+ * <li> This UriVisitor is at somes point more lax than the original ABNF
* <li> It is more tolerable against additional white spaces
- * - Whenever it is possible to move edm validation to the AST classes then
- * this should be done ( see visit {@link #visitSelectSegment} for example)
- *
- * Not supported
- * <li>Parsing the context of $metadata
- *
- * TODO planned
- * <li>Overview testcases
- * <li>search
+ * Currently not supported
+ * <li>Parsing the context of $metadata</li>
+ * <li>Parsing $search</li>
*/
public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@@ -218,7 +211,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
public TypeInformation() {
- // TODO Auto-generated constructor stub
}
}
@@ -228,14 +220,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
// --- class ---
- public void setContext(final UriContext context) {
- this.context = context;
- }
-
- public UriInfoImpl getUriInfo() {
- return context.contextUriInfo;
- }
-
public UriParseTreeVisitor(final Edm edm, final UriContext context) {
this.edm = edm;
this.context = context;
@@ -642,15 +626,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitAliasAndValue(final AliasAndValueContext ctx) {
- AliasQueryOptionImpl alias = new AliasQueryOptionImpl();
- alias.setName(ctx.vODI.getText());
- alias.setText(ctx.vV.getText());
- alias.setAliasValue((ExpressionImpl) ctx.vV.accept(this));
- return alias;
- }
-
- @Override
public Object visitAllEOF(final AllEOFContext ctx) {
UriInfoImpl crossJoin = new UriInfoImpl().setKind(UriInfoKind.all);
context.contextUriInfo = crossJoin;
@@ -1011,7 +986,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (type instanceof EdmEntityType) {
context.contextUriInfo.addResourcePart(new UriResourceRefImpl());
} else {
- throw wrap(new UriParserSemanticException("$ref only allowd on endity types"));
+ throw wrap(new UriParserSemanticException("$ref only allowed on endity types"));
}
} else {
throw wrap(new UriParserSemanticException("$ref only allowed on typed properties"));
@@ -1122,7 +1097,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
levels.setText(ctx.vM.getText());
expandItem.setSystemQueryOption(levels);
} else if (ctx.vL != null) {
- // TODO set value as integer
LevelsOptionImpl levels = new LevelsOptionImpl();
String text = ctx.vL.getText();
levels.setText(text);
@@ -1256,35 +1230,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitFormat(final FormatContext ctx) {
- FormatOptionImpl format = new FormatOptionImpl();
-
- TerminalNodeImpl c2 = (TerminalNodeImpl) ctx.children.get(2);
- if (c2.symbol.getType() == UriLexer.ATOM) {
- format.setFormat("atom");
- } else if (c2.symbol.getType() == UriLexer.JSON) {
- format.setFormat("json");
- } else if (c2.symbol.getType() == UriLexer.XML) {
- format.setFormat("xml");
- } else if (c2.symbol.getType() == UriLexer.PCHARS) {
- if (ctx.getChildCount() == 2) {
- format.setFormat(c2.getText());
- } else {
- format.setFormat(c2.getText() + "/" + ctx.children.get(4).getText());
- }
- }
- String text = ctx.children.get(2).getText();
- if (ctx.getChildCount() > 4) {
- text += ctx.children.get(3).getText();
- text += ctx.children.get(4).getText();
- }
-
- format.setText(text);
-
- return format;
- }
-
- @Override
public ExpressionImpl visitFractionalsecondsMethodCallExpr(final FractionalsecondsMethodCallExprContext ctx) {
return new MethodCallImpl()
.setMethod(MethodCallKind.FRACTIONALSECONDS)
@@ -1365,9 +1310,11 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (text.equals("max")) {
levels.setMax();
+ } else {
+ levels.setValue(Integer.parseInt(text));
}
levels.setText(text);
- // TODO set value as integer
+
return levels;
@@ -2036,7 +1983,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
// check for action
EdmAction action = edm.getAction(fullName, finalTypeName, null);
- // TODO verify that null ignores if it is a collection
if (action != null) {
UriResourceActionImpl uriAction = new UriResourceActionImpl();
@@ -2048,7 +1994,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
// check for function
EdmFunction function = edm.getFunction(fullName, finalTypeName, null, null);
- // TODO verify that null ignores if it is a collection
if (function != null) {
UriResourceFunctionImpl uriFunction = new UriResourceFunctionImpl();
@@ -2153,11 +2098,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
- @Override
- public Object visitUnary(final UnaryContext ctx) {
- // TODO implement
- return super.visitUnary(ctx);
- }
@Override
public ExpressionImpl visitYearMethodCallExpr(final YearMethodCallExprContext ctx) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
index 7c2a8ea..db42556 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
@@ -18,7 +18,6 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.parser;
-//TODO Check name of this exception when implementing proper error handling
public class UriParserException extends Exception {
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
index 4e13b93..2f8f1d6 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
@@ -18,12 +18,8 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.parser;
-//TODO Check name of this exception when implementing proper error handling
public class UriParserSemanticException extends UriParserException {
- /**
- *
- */
private static final long serialVersionUID = 1L;
public UriParserSemanticException(final String message, final Throwable cause) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
index a9a2fe0..7975dcc 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
@@ -26,7 +26,7 @@ public class CountOptionImpl extends SystemQueryOptionImpl implements CountOptio
private boolean count;
public CountOptionImpl() {
- setKind(SupportedQueryOptions.INLINECOUNT);
+ setKind(SupportedQueryOptions.COUNT);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
index 1c30657..f26d900 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
@@ -60,7 +60,7 @@ public class ExpandItemImpl implements ExpandItem {
expandOption = (ExpandOptionImpl) sysItem;
} else if (sysItem.getKind() == SupportedQueryOptions.FILTER) {
filterOption = (FilterOptionImpl) sysItem;
- } else if (sysItem.getKind() == SupportedQueryOptions.INLINECOUNT) {
+ } else if (sysItem.getKind() == SupportedQueryOptions.COUNT) {
inlineCountOption = (CountOptionImpl) sysItem;
} else if (sysItem.getKind() == SupportedQueryOptions.ORDERBY) {
orderByOption = (OrderByOptionImpl) sysItem;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
index c7320bd..397d77e 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
@@ -23,7 +23,7 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption;
import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
import org.apache.olingo.odata4.server.api.uri.queryoption.search.SearchExpression;
-// TODO $search is not supported yet
+// TODO planned: support $search
public class SearchOptionImpl extends SystemQueryOptionImpl implements SearchOption {
public SearchOptionImpl() {
@@ -32,7 +32,6 @@ public class SearchOptionImpl extends SystemQueryOptionImpl implements SearchOpt
@Override
public SearchExpression getSearchExpression() {
- // TODO $search is not supported yet
return null;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java
index 4333a06..a9405e0 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java
@@ -124,16 +124,17 @@ public class RawUriTest {
checkPath(rawUri, "nonServiceSegment/entitySet", Arrays.asList("entitySet"));
}
- /*
- * @Test
- * public void testSplitt() {
- * UriRawParser.splitt("", '/');
- * UriRawParser.splitt("a", '/');
- * UriRawParser.splitt("a/", '/');
- * UriRawParser.splitt("/a", '/');
- * UriRawParser.splitt("a/a", '/');
- * }
- */
+
+ @Test
+ public void testSplitt() {
+ UriDecoder.splitt("", '/');
+ UriDecoder.splitt("/", '/');
+ UriDecoder.splitt("a", '/');
+ UriDecoder.splitt("a/", '/');
+ UriDecoder.splitt("/a", '/');
+ UriDecoder.splitt("a/a", '/');
+ }
+
private void checkPath(final RawUri rawUri, final String path, final List<String> list) {
assertEquals(path, rawUri.path);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
deleted file mode 100644
index 1462ab9..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
+++ /dev/null
@@ -1,502 +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.server.core.uri;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-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.EdmEntityType;
-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.EdmNavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.core.edm.provider.EdmComplexTypeImpl;
-import org.apache.olingo.odata4.server.core.edm.provider.EdmEntitySetImpl;
-import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.odata4.server.core.edm.provider.EdmSingletonImpl;
-import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
-import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
-import org.junit.Test;
-
-public class UriParameterImplTest {
- Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
-
- @Test
- public void testUriParameterImpl() {
- UriParameterImpl impl = new UriParameterImpl();
- ExpressionImpl expression = new LiteralImpl().setText("Expression");
-
- impl.setText("Text");
- impl.setName("A");
- impl.setAlias("@A");
- impl.setExpression(expression);
-
- assertEquals("Text", impl.getText());
- assertEquals("A", impl.getName());
- assertEquals("@A", impl.getAlias());
- assertEquals(expression, impl.getExression());
- }
-
- @Test
- public void testUriResourceActionImpl() {
- UriResourceActionImpl impl = new UriResourceActionImpl();
- assertEquals(UriResourceKind.action, impl.getKind());
- assertEquals("", impl.toString());
-
- // action
- EdmAction action = edm.getAction(EdmTechProvider.nameUARTETParam, null, null);
- impl.setAction(action);
- assertEquals(action, impl.getAction());
- assertEquals(EdmTechProvider.nameUARTETParam.getName(), impl.toString());
-
- // action import
- impl = new UriResourceActionImpl();
- EdmActionImport actionImport = edm.getEntityContainer(null).getActionImport("AIRTPrimParam");
- impl.setActionImport(actionImport);
- assertEquals(actionImport, impl.getActionImport());
- assertEquals(actionImport.getAction(), impl.getAction());
- assertEquals(false, impl.isCollection());
- assertEquals("AIRTPrimParam", impl.toString());
- assertEquals(actionImport.getAction().getReturnType().getType(), impl.getType());
- }
-
- @Test
- public void testUriResourceLambdaAllImpl() {
- UriResourceLambdaAllImpl impl = new UriResourceLambdaAllImpl();
- assertEquals(UriResourceKind.lambdaAll, impl.getKind());
-
- ExpressionImpl expression = new LiteralImpl().setText("Expression");
- impl.setExpression(expression);
- impl.setLamdaVariable("A");
-
- assertEquals(false, impl.isCollection());
- assertEquals(expression, impl.getExpression());
- assertEquals("A", impl.getLamdaVariable());
- assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
- assertEquals("all", impl.toString());
- }
-
- @Test
- public void testUriResourceLambdaAnyImpl() {
- UriResourceLambdaAnyImpl impl = new UriResourceLambdaAnyImpl();
- assertEquals(UriResourceKind.lambdaAny, impl.getKind());
-
- ExpressionImpl expression = new LiteralImpl().setText("Expression");
- impl.setExpression(expression);
- impl.setLamdaVariable("A");
-
- assertEquals(false, impl.isCollection());
- assertEquals(expression, impl.getExpression());
- assertEquals("A", impl.getLamdaVariable());
- assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
- assertEquals("any", impl.toString());
- }
-
- @Test
- public void testUriResourceComplexPropertyImpl() {
- UriResourceComplexPropertyImpl impl = new UriResourceComplexPropertyImpl();
- assertEquals(UriResourceKind.complexProperty, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
- EdmProperty property = (EdmProperty) entityType.getProperty("PropertyComplex");
- impl.setProperty(property);
-
- assertEquals(property, impl.getProperty());
- assertEquals(property.getName(), impl.toString());
- assertEquals(false, impl.isCollection());
- assertEquals(property.getType(), impl.getType());
- assertEquals(property.getType(), impl.getComplexType());
- impl.getComplexType();
-
- EdmComplexTypeImpl complexTypeImplType =
- (EdmComplexTypeImpl) edm.getComplexType(EdmTechProvider.nameCTBasePrimCompNav);
-
- impl.setTypeFilter(complexTypeImplType);
- assertEquals(complexTypeImplType, impl.getTypeFilter());
- assertEquals(complexTypeImplType, impl.getComplexTypeFilter());
- impl.getComplexTypeFilter();
-
- }
-
- @Test
- public void testUriResourcePrimitivePropertyImpl() {
- UriResourcePrimitivePropertyImpl impl = new UriResourcePrimitivePropertyImpl();
- assertEquals(UriResourceKind.primitiveProperty, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
- EdmProperty property = (EdmProperty) entityType.getProperty("PropertyInt16");
- impl.setProperty(property);
-
- assertEquals(property, impl.getProperty());
- assertEquals(property.getName(), impl.toString());
- assertEquals(false, impl.isCollection());
- assertEquals(property.getType(), impl.getType());
- }
-
- @Test
- public void testUriResourceCountImpl() {
- UriResourceCountImpl impl = new UriResourceCountImpl();
- assertEquals(UriResourceKind.count, impl.getKind());
- assertEquals("$count", impl.toString());
- }
-
- @Test
- public void testUriResourceEntitySetImpl() {
- UriResourceEntitySetImpl impl = new UriResourceEntitySetImpl();
- assertEquals(UriResourceKind.entitySet, impl.getKind());
-
- EdmEntitySetImpl entitySet = (EdmEntitySetImpl) edm.getEntityContainer(null).getEntitySet("ESAllPrim");
- impl.setEntitSet(entitySet);
-
- assertEquals("ESAllPrim", impl.toString());
- assertEquals(entitySet, impl.getEntitySet());
-
- assertEquals(entitySet.getEntityType(), impl.getType());
- assertEquals(entitySet.getEntityType(), impl.getEntityType());
- impl.getEntityType();
-
- // is Collection
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceFunctionImpl() {
- UriResourceFunctionImpl impl = new UriResourceFunctionImpl();
- assertEquals(UriResourceKind.function, impl.getKind());
- assertEquals("", impl.toString());
-
- // function
- EdmFunction function = (EdmFunction) edm.getEntityContainer(null).getFunctionImport("FINRTInt16")
- .getFunction(new ArrayList<String>());
- assertNotNull(function);
- impl.setFunction(function);
-
- assertEquals(function, impl.getFunction());
- assertEquals("UFNRTInt16", impl.toString());
- assertEquals(function.getReturnType().getType(), impl.getType());
-
- // function import
- impl = new UriResourceFunctionImpl();
- EdmFunctionImport functionImport = edm.getEntityContainer(null).getFunctionImport("FINRTInt16");
- impl.setFunctionImport(functionImport, new ArrayList<UriParameterImpl>());
- assertEquals(functionImport, impl.getFunctionImport());
- assertEquals("FINRTInt16", impl.toString());
-
- // function collection
- impl = new UriResourceFunctionImpl();
- functionImport = edm.getEntityContainer(null).getFunctionImport("FICRTESTwoKeyNavParam");
- assertNotNull(function);
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- impl.setFunctionImport(functionImport, Arrays.asList(parameter));
- assertEquals("FICRTESTwoKeyNavParam", impl.toString());
-
- impl.setFunction(functionImport.getFunction(Arrays.asList("ParameterInt16")));
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
- assertEquals(false, impl.isCollection());
-
- assertEquals(parameter, impl.getParameters().get(0));
- }
-
- @Test
- public void testUriResourceImplKeyPred() {
- class Mock extends UriResourceWithKeysImpl {
- EdmType type;
-
- public Mock() {
- super(UriResourceKind.action);
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public Mock setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public String toString() {
- return "mock";
- }
- }
-
- Mock impl = new Mock();
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
- EdmEntityType entityTypeBaseEntry = edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav);
-
- impl.setType(entityType);
- assertEquals(entityType, impl.getType());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock", impl.toString(true));
-
- // set both
- impl.setCollectionTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
- impl.setEntryTypeFilter(entityTypeBaseEntry);
- assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav/()com.sap.odata.test1.ETTwoBaseTwoKeyNav",
- impl.toString(true));
-
- // set entry
- impl = new Mock();
- impl.setType(entityType);
- impl.setEntryTypeFilter(entityTypeBaseEntry);
- assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/com.sap.odata.test1.ETTwoBaseTwoKeyNav", impl.toString(true));
-
- // set collection
- impl = new Mock();
- impl.setType(entityType);
- impl.setCollectionTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
-
- impl = new Mock();
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- impl.setKeyPredicates(keyPredicates);
- assertNotNull(null, impl.getKeyPredicates());
-
- }
-
- @Test
- public void testUriResourceImplTyped() {
- class Mock extends UriResourceTypedImpl {
- EdmType type;
-
- public Mock() {
- super(UriResourceKind.action);
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- public Mock setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public String toString() {
- return "mock";
- }
-
- }
-
- Mock impl = new Mock();
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
- edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav);
-
- impl.setType(entityType);
- assertEquals("mock", impl.toString());
- assertEquals("mock", impl.toString(true));
- assertEquals("mock", impl.toString(false));
-
- impl.setTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getTypeFilter());
- assertEquals("mock", impl.toString());
- assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
- assertEquals("mock", impl.toString(false));
- //
- }
-
- @Test
- public void testUriResourceItImpl() {
- UriResourceItImpl impl = new UriResourceItImpl();
- assertEquals(UriResourceKind.it, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- assertEquals("$it", impl.toString());
-
- impl.setType(entityType);
- assertEquals(entityType, impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceNavigationPropertyImpl() {
- UriResourceNavigationPropertyImpl impl = new UriResourceNavigationPropertyImpl();
- assertEquals(UriResourceKind.navigationProperty, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- EdmNavigationProperty property = (EdmNavigationProperty) entityType.getProperty("NavPropertyETKeyNavMany");
- assertNotNull(property);
-
- impl.setNavigationProperty(property);
- assertEquals(property, impl.getProperty());
-
- assertEquals("NavPropertyETKeyNavMany", impl.toString());
- assertEquals(property.getType(), impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceRefImpl() {
- UriResourceRefImpl impl = new UriResourceRefImpl();
- assertEquals(UriResourceKind.ref, impl.getKind());
- assertEquals("$ref", impl.toString());
- }
-
- @Test
- public void testUriResourceRootImpl() {
- UriResourceRootImpl impl = new UriResourceRootImpl();
- assertEquals(UriResourceKind.root, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- assertEquals("$root", impl.toString());
-
- impl.setType(entityType);
- assertEquals(entityType, impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceSingletonImpl() {
- UriResourceSingletonImpl impl = new UriResourceSingletonImpl();
- assertEquals(UriResourceKind.singleton, impl.getKind());
-
- EdmSingletonImpl singleton = (EdmSingletonImpl) edm.getEntityContainer(null).getSingleton("SINav");
- EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
- impl.setSingleton(singleton);
-
- assertEquals("SINav", impl.toString());
- assertEquals(singleton, impl.getSingleton());
-
- assertEquals(singleton.getEntityType(), impl.getType());
- assertEquals(singleton.getEntityType(), impl.getEntityType());
- impl.getEntityType();
-
- impl.setTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getEntityTypeFilter());
-
- // is Collection
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceValueImpl() {
- UriResourceValueImpl impl = new UriResourceValueImpl();
- assertEquals(UriResourceKind.value, impl.getKind());
- assertEquals("$value", impl.toString());
- }
-
- @Test
- public void testUriResourceLambdaVarImpl() {
- UriResourceLambdaVarImpl impl = new UriResourceLambdaVarImpl();
- assertEquals(UriResourceKind.lambdaVariable, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- impl.setType(entityType);
- impl.setVariableText("A");
-
- assertEquals("A", impl.toString());
- assertEquals(entityType, impl.getType());
- assertEquals("A", impl.getVariableText());
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- }
-
- /*
- @Test
- public void testUriResourceStartingTypeFilterImpl() {
- UriResourceStartingTypeFilterImpl impl = new UriResourceStartingTypeFilterImpl();
- assertEquals(UriResourceKind.startingTypeFilter, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
-
- impl.setType(entityType);
- assertEquals("com.sap.odata.test1.ETTwoKeyNav", impl.toString());
- assertEquals(entityType, impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
-
- }*/
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriResourceImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriResourceImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriResourceImplTest.java
new file mode 100644
index 0000000..c55488f
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriResourceImplTest.java
@@ -0,0 +1,505 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+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.EdmEntityType;
+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.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.core.edm.provider.EdmComplexTypeImpl;
+import org.apache.olingo.odata4.server.core.edm.provider.EdmEntitySetImpl;
+import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.server.core.edm.provider.EdmSingletonImpl;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
+import org.junit.Test;
+
+public class UriResourceImplTest {
+ Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
+
+ @Test
+ public void testUriParameterImpl() {
+ UriParameterImpl impl = new UriParameterImpl();
+ ExpressionImpl expression = new LiteralImpl().setText("Expression");
+
+ impl.setText("Text");
+ impl.setName("A");
+ impl.setAlias("@A");
+ impl.setExpression(expression);
+
+ assertEquals("Text", impl.getText());
+ assertEquals("A", impl.getName());
+ assertEquals("@A", impl.getAlias());
+ assertEquals(expression, impl.getExression());
+ }
+
+ @Test
+ public void testUriResourceActionImpl() {
+ UriResourceActionImpl impl = new UriResourceActionImpl();
+ assertEquals(UriResourceKind.action, impl.getKind());
+ assertEquals("", impl.toString());
+
+ // action
+ EdmAction action = edm.getAction(EdmTechProvider.nameUARTETParam, null, null);
+ impl.setAction(action);
+ assertEquals(action, impl.getAction());
+ assertEquals(EdmTechProvider.nameUARTETParam.getName(), impl.toString());
+
+ // action import
+ impl = new UriResourceActionImpl();
+ EdmActionImport actionImport = edm.getEntityContainer(null).getActionImport("AIRTPrimParam");
+ impl.setActionImport(actionImport);
+ assertEquals(actionImport, impl.getActionImport());
+ assertEquals(actionImport.getAction(), impl.getAction());
+ assertEquals(false, impl.isCollection());
+ assertEquals("AIRTPrimParam", impl.toString());
+ assertEquals(actionImport.getAction().getReturnType().getType(), impl.getType());
+ }
+
+ @Test
+ public void testUriResourceLambdaAllImpl() {
+ UriResourceLambdaAllImpl impl = new UriResourceLambdaAllImpl();
+ assertEquals(UriResourceKind.lambdaAll, impl.getKind());
+
+ ExpressionImpl expression = new LiteralImpl().setText("Expression");
+ impl.setExpression(expression);
+ impl.setLamdaVariable("A");
+
+ assertEquals(false, impl.isCollection());
+ assertEquals(expression, impl.getExpression());
+ assertEquals("A", impl.getLamdaVariable());
+ assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
+ assertEquals("all", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceLambdaAnyImpl() {
+ UriResourceLambdaAnyImpl impl = new UriResourceLambdaAnyImpl();
+ assertEquals(UriResourceKind.lambdaAny, impl.getKind());
+
+ ExpressionImpl expression = new LiteralImpl().setText("Expression");
+ impl.setExpression(expression);
+ impl.setLamdaVariable("A");
+
+ assertEquals(false, impl.isCollection());
+ assertEquals(expression, impl.getExpression());
+ assertEquals("A", impl.getLamdaVariable());
+ assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
+ assertEquals("any", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceComplexPropertyImpl() {
+ UriResourceComplexPropertyImpl impl = new UriResourceComplexPropertyImpl();
+ assertEquals(UriResourceKind.complexProperty, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+ EdmProperty property = (EdmProperty) entityType.getProperty("PropertyComplex");
+ impl.setProperty(property);
+
+ assertEquals(property, impl.getProperty());
+ assertEquals(property.getName(), impl.toString());
+ assertEquals(false, impl.isCollection());
+ assertEquals(property.getType(), impl.getType());
+ assertEquals(property.getType(), impl.getComplexType());
+ impl.getComplexType();
+
+ EdmComplexTypeImpl complexTypeImplType =
+ (EdmComplexTypeImpl) edm.getComplexType(EdmTechProvider.nameCTBasePrimCompNav);
+
+ impl.setTypeFilter(complexTypeImplType);
+ assertEquals(complexTypeImplType, impl.getTypeFilter());
+ assertEquals(complexTypeImplType, impl.getComplexTypeFilter());
+ impl.getComplexTypeFilter();
+
+ }
+
+ @Test
+ public void testUriResourcePrimitivePropertyImpl() {
+ UriResourcePrimitivePropertyImpl impl = new UriResourcePrimitivePropertyImpl();
+ assertEquals(UriResourceKind.primitiveProperty, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+ EdmProperty property = (EdmProperty) entityType.getProperty("PropertyInt16");
+ impl.setProperty(property);
+
+ assertEquals(property, impl.getProperty());
+ assertEquals(property.getName(), impl.toString());
+ assertEquals(false, impl.isCollection());
+ assertEquals(property.getType(), impl.getType());
+ }
+
+ @Test
+ public void testUriResourceCountImpl() {
+ UriResourceCountImpl impl = new UriResourceCountImpl();
+ assertEquals(UriResourceKind.count, impl.getKind());
+ assertEquals("$count", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceEntitySetImpl() {
+ UriResourceEntitySetImpl impl = new UriResourceEntitySetImpl();
+ assertEquals(UriResourceKind.entitySet, impl.getKind());
+
+ EdmEntitySetImpl entitySet = (EdmEntitySetImpl) edm.getEntityContainer(null).getEntitySet("ESAllPrim");
+ impl.setEntitSet(entitySet);
+
+ assertEquals("ESAllPrim", impl.toString());
+ assertEquals(entitySet, impl.getEntitySet());
+
+ assertEquals(entitySet.getEntityType(), impl.getType());
+ assertEquals(entitySet.getEntityType(), impl.getEntityType());
+ impl.getEntityType();
+
+ // is Collection
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceFunctionImpl() {
+ UriResourceFunctionImpl impl = new UriResourceFunctionImpl();
+ assertEquals(UriResourceKind.function, impl.getKind());
+ assertEquals("", impl.toString());
+
+ // function
+ EdmFunction function = (EdmFunction) edm.getEntityContainer(null).getFunctionImport("FINRTInt16")
+ .getFunction(new ArrayList<String>());
+ assertNotNull(function);
+ impl.setFunction(function);
+
+
+ assertEquals(function, impl.getFunction());
+ assertEquals("UFNRTInt16", impl.toString());
+ assertEquals(function.getReturnType().getType(), impl.getType());
+ assertEquals(false,impl.isParameterListFilled());
+
+ // function import
+ impl = new UriResourceFunctionImpl();
+ EdmFunctionImport functionImport = edm.getEntityContainer(null).getFunctionImport("FINRTInt16");
+ impl.setFunctionImport(functionImport, new ArrayList<UriParameterImpl>());
+ assertEquals(functionImport, impl.getFunctionImport());
+ assertEquals("FINRTInt16", impl.toString());
+
+ // function collection
+ impl = new UriResourceFunctionImpl();
+ functionImport = edm.getEntityContainer(null).getFunctionImport("FICRTESTwoKeyNavParam");
+ assertNotNull(function);
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ impl.setFunctionImport(functionImport, Arrays.asList(parameter));
+ assertEquals("FICRTESTwoKeyNavParam", impl.toString());
+
+ impl.setFunction(functionImport.getFunction(Arrays.asList("ParameterInt16")));
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
+ assertEquals(false, impl.isCollection());
+
+ assertEquals(parameter, impl.getParameters().get(0));
+ assertEquals(true,impl.isParameterListFilled());
+ }
+
+ @Test
+ public void testUriResourceImplKeyPred() {
+ class Mock extends UriResourceWithKeysImpl {
+ EdmType type;
+
+ public Mock() {
+ super(UriResourceKind.action);
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ public Mock setType(final EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "mock";
+ }
+ }
+
+ Mock impl = new Mock();
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ EdmEntityType entityTypeBaseEntry = edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ impl.setType(entityType);
+ assertEquals(entityType, impl.getType());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock", impl.toString(true));
+
+ // set both
+ impl.setCollectionTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
+ impl.setEntryTypeFilter(entityTypeBaseEntry);
+ assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav/()com.sap.odata.test1.ETTwoBaseTwoKeyNav",
+ impl.toString(true));
+
+ // set entry
+ impl = new Mock();
+ impl.setType(entityType);
+ impl.setEntryTypeFilter(entityTypeBaseEntry);
+ assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETTwoBaseTwoKeyNav", impl.toString(true));
+
+ // set collection
+ impl = new Mock();
+ impl.setType(entityType);
+ impl.setCollectionTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
+
+ impl = new Mock();
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ impl.setKeyPredicates(keyPredicates);
+ assertNotNull(null, impl.getKeyPredicates());
+
+ }
+
+ @Test
+ public void testUriResourceImplTyped() {
+ class Mock extends UriResourceTypedImpl {
+ EdmType type;
+
+ public Mock() {
+ super(UriResourceKind.action);
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ public Mock setType(final EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return "mock";
+ }
+
+ }
+
+ Mock impl = new Mock();
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ impl.setType(entityType);
+ assertEquals("mock", impl.toString());
+ assertEquals("mock", impl.toString(true));
+ assertEquals("mock", impl.toString(false));
+
+ impl.setTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getTypeFilter());
+ assertEquals("mock", impl.toString());
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
+ assertEquals("mock", impl.toString(false));
+ //
+ }
+
+ @Test
+ public void testUriResourceItImpl() {
+ UriResourceItImpl impl = new UriResourceItImpl();
+ assertEquals(UriResourceKind.it, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ assertEquals("$it", impl.toString());
+
+ impl.setType(entityType);
+ assertEquals(entityType, impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceNavigationPropertyImpl() {
+ UriResourceNavigationPropertyImpl impl = new UriResourceNavigationPropertyImpl();
+ assertEquals(UriResourceKind.navigationProperty, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ EdmNavigationProperty property = (EdmNavigationProperty) entityType.getProperty("NavPropertyETKeyNavMany");
+ assertNotNull(property);
+
+ impl.setNavigationProperty(property);
+ assertEquals(property, impl.getProperty());
+
+ assertEquals("NavPropertyETKeyNavMany", impl.toString());
+ assertEquals(property.getType(), impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceRefImpl() {
+ UriResourceRefImpl impl = new UriResourceRefImpl();
+ assertEquals(UriResourceKind.ref, impl.getKind());
+ assertEquals("$ref", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceRootImpl() {
+ UriResourceRootImpl impl = new UriResourceRootImpl();
+ assertEquals(UriResourceKind.root, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ assertEquals("$root", impl.toString());
+
+ impl.setType(entityType);
+ assertEquals(entityType, impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceSingletonImpl() {
+ UriResourceSingletonImpl impl = new UriResourceSingletonImpl();
+ assertEquals(UriResourceKind.singleton, impl.getKind());
+
+ EdmSingletonImpl singleton = (EdmSingletonImpl) edm.getEntityContainer(null).getSingleton("SINav");
+ EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ impl.setSingleton(singleton);
+
+ assertEquals("SINav", impl.toString());
+ assertEquals(singleton, impl.getSingleton());
+
+ assertEquals(singleton.getEntityType(), impl.getType());
+ assertEquals(singleton.getEntityType(), impl.getEntityType());
+ impl.getEntityType();
+
+ impl.setTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getEntityTypeFilter());
+
+ // is Collection
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceValueImpl() {
+ UriResourceValueImpl impl = new UriResourceValueImpl();
+ assertEquals(UriResourceKind.value, impl.getKind());
+ assertEquals("$value", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceLambdaVarImpl() {
+ UriResourceLambdaVarImpl impl = new UriResourceLambdaVarImpl();
+ assertEquals(UriResourceKind.lambdaVariable, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ impl.setType(entityType);
+ impl.setVariableText("A");
+
+ assertEquals("A", impl.toString());
+ assertEquals(entityType, impl.getType());
+ assertEquals("A", impl.getVariableText());
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ }
+
+
+ @Test
+ public void testUriResourceStartingTypeFilterImpl() {
+ UriResourceStartingTypeFilterImpl impl = new UriResourceStartingTypeFilterImpl();
+ assertEquals(UriResourceKind.startingTypeFilter, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+
+ impl.setType(entityType);
+ assertEquals("com.sap.odata.test1.ETTwoKeyNav", impl.toString());
+ assertEquals(entityType, impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/217fe957/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
index ecbcaaf..1d4ee7b 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
@@ -18,17 +18,12 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.antlr;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Arrays;
import org.apache.olingo.odata4.commons.api.ODataApplicationException;
import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryOperatorKind;
@@ -38,7 +33,6 @@ import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl;
import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
import org.apache.olingo.odata4.server.core.uri.parser.UriParserException;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
import org.apache.olingo.odata4.server.core.uri.testutil.FilterValidator;
import org.apache.olingo.odata4.server.core.uri.testutil.ResourceValidator;
import org.apache.olingo.odata4.server.core.uri.testutil.UriValidator;
@@ -68,8 +62,7 @@ public class TestFullResourcePath {
testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
.at(1)
.isUriPathInfoKind(UriResourceKind.function)
.isType(EdmTechProvider.nameETTwoKeyNav);
@@ -78,8 +71,7 @@ public class TestFullResourcePath {
testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')").goPath()
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
.at(1)
.isUriPathInfoKind(UriResourceKind.function)
.isType(EdmTechProvider.nameETTwoKeyNav);
@@ -88,8 +80,7 @@ public class TestFullResourcePath {
testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
.at(1)
.isUriPathInfoKind(UriResourceKind.function)
.isType(EdmTechProvider.nameETTwoKeyNav);
@@ -807,8 +798,7 @@ public class TestFullResourcePath {
.goPath()
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETAllPrim)
- .isCollection(false)
+ .isType(EdmTechProvider.nameETAllPrim, false)
.at(1)
.isUriPathInfoKind(UriResourceKind.primitiveProperty)
.isType(EdmTechProvider.nameString);
@@ -818,8 +808,7 @@ public class TestFullResourcePath {
.goPath()
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETCollAllPrim)
- .isCollection(false)
+ .isType(EdmTechProvider.nameETCollAllPrim, false)
.at(1)
.isUriPathInfoKind(UriResourceKind.primitiveProperty)
.isType(EdmTechProvider.nameString);
@@ -830,8 +819,7 @@ public class TestFullResourcePath {
.goPath()
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(false)
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
.at(1)
.isUriPathInfoKind(UriResourceKind.complexProperty)
.at(2)
@@ -843,8 +831,7 @@ public class TestFullResourcePath {
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
.at(1)
- .isType(EdmTechProvider.nameCTPrimComp)
- .isCollection(true)
+ .isType(EdmTechProvider.nameCTPrimComp, true)
.at(2)
.isUriPathInfoKind(UriResourceKind.function)
.isType(EdmTechProvider.nameETAllPrim);
@@ -855,8 +842,7 @@ public class TestFullResourcePath {
.goPath()
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(false)
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
.at(1)
.isUriPathInfoKind(UriResourceKind.function)
.isType(EdmTechProvider.nameETTwoKeyNav);
@@ -866,8 +852,7 @@ public class TestFullResourcePath {
.goPath()
.at(0)
.isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
.at(1).isUriPathInfoKind(UriResourceKind.function)
.isType(EdmTechProvider.nameETTwoKeyNav);
}
@@ -1118,15 +1103,16 @@ public class TestFullResourcePath {
@Test
public void runEsNameKeyCast() {
-
- testUri.runEx("xESTwoPrim(1)/com.sap.odata.test1.ETBase(1)")
- .isExSemantic(0);
-
- testUri.runEx("xESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase(1)")
- .isExSemantic(0);
-
- testUri.runEx("xESBase/com.sap.odata.test1.ETTwoPrim(1)")
- .isExSemantic(0);
+ /*
+ * testUri.runEx("ESTwoPrim(1)/com.sap.odata.test1.ETBase(1)")
+ * .isExSemantic(0);
+ *
+ * testUri.runEx("ESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase(1)")
+ * .isExSemantic(0);
+ *
+ * testUri.runEx("ESBase/com.sap.odata.test1.ETTwoPrim(1)")
+ * .isExSemantic(0);
+ */
testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETBase")
.isKind(UriInfoKind.resource).goPath()
@@ -2365,9 +2351,9 @@ public class TestFullResourcePath {
.goExpand().first()
.isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
.goPath().first()
- //.isType(EdmTechProvider.nameETTwoKeyNav)
- //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- //.n()
+ // .isType(EdmTechProvider.nameETTwoKeyNav)
+ // .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ // .n()
.isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?"
@@ -2378,9 +2364,9 @@ public class TestFullResourcePath {
.goExpand().first()
.isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
.goPath().first()
- //.isType(EdmTechProvider.nameETTwoKeyNav)
- //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- //.n()
+ // .isType(EdmTechProvider.nameETTwoKeyNav)
+ // .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ // .n()
.isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true);
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$expand=com.sap.odata.test1.ETBaseTwoKeyNav"
@@ -2391,9 +2377,9 @@ public class TestFullResourcePath {
.goExpand().first()
.isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
.goPath().first()
- //.isType(EdmTechProvider.nameETTwoKeyNav)
- //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- //.n()
+ // .isType(EdmTechProvider.nameETTwoKeyNav)
+ // .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ // .n()
.isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true)
.isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav);
@@ -2402,9 +2388,9 @@ public class TestFullResourcePath {
.goExpand().first()
.isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
.goPath().first()
- //.isType(EdmTechProvider.nameETTwoKeyNav)
- //.isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- //.n()
+ // .isType(EdmTechProvider.nameETTwoKeyNav)
+ // .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ // .n()
.isComplex("PropertyComplexNav")
.isType(EdmTechProvider.nameCTBasePrimCompNav)
.n()
@@ -2416,9 +2402,9 @@ public class TestFullResourcePath {
.goExpand().first()
.isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
.goPath().first()
- //.isType(EdmTechProvider.nameETTwoKeyNav)
- //.isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- //.n()
+ // .isType(EdmTechProvider.nameETTwoKeyNav)
+ // .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ // .n()
.isComplex("PropertyComplexNav")
.isType(EdmTechProvider.nameCTBasePrimCompNav)
.n()
@@ -2448,10 +2434,10 @@ public class TestFullResourcePath {
.goExpand().first()
.isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
.goPath().first()
- //.isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- //.isType(EdmTechProvider.nameETTwoKeyNav)
- //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- //.n().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true)
+ // .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+ // .isType(EdmTechProvider.nameETTwoKeyNav)
+ // .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ // .n().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true)
.isType(EdmTechProvider.nameETTwoKeyNav)
.isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav)
.goUpExpandValidator()
@@ -2475,7 +2461,7 @@ public class TestFullResourcePath {
.goPath().first()
.isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
.isType(EdmTechProvider.nameETKeyNav);
-
+
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$select=com.sap.odata.test1.ETBaseTwoKeyNav"
+ "/PropertyInt16")
.isKind(UriInfoKind.resource).goPath()
@@ -2485,7 +2471,7 @@ public class TestFullResourcePath {
.isSelectStartType(0, EdmTechProvider.nameETBaseTwoKeyNav)
.goSelectItem(0)
.first()
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyInt16)")
.isKind(UriInfoKind.resource)
@@ -4170,7 +4156,6 @@ public class TestFullResourcePath {
.n().isComplex("PropertyComplex")
.n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
- // TODO lambda does not check if the previous path segment is a collection
testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyInt16 eq 1 or d/any"
+ "(e:e/CollPropertyString eq 'SomeString'))")
.is("<NavPropertyETTwoKeyNavMany/<ANY;<<<d/PropertyInt16> eq <1>> or "
@@ -4381,7 +4366,6 @@ public class TestFullResourcePath {
.goUpFilterValidator()
.root().goParameter(1).isTypedLiteral(EdmTechProvider.nameString);
- // TODO cross check with abap coding
testFilter.runOnETTwoKeyNav("isof(PropertyComplex/PropertyComplex/PropertyString,Edm.Guid)")
.is("<isof(<PropertyComplex/PropertyComplex/PropertyString>,<Edm.Guid>)>")
.root()
@@ -5020,7 +5004,6 @@ public class TestFullResourcePath {
.goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator()
.goOrder(0).right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String1"));
- // TODO
testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 1").isExSyntax(0);
testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16, PropertyInt32 PropertyDuration").isExSyntax(0);
testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 PropertyInt32, PropertyDuration desc").isExSyntax(0);
@@ -5062,6 +5045,57 @@ public class TestFullResourcePath {
testUri.run("ESTwoKeyNav?$search= abc AND (def ghi)");
}
+ @Test
+ public void testErrors() {
+ testUri.runEx("FICRTString(wrong1='ABC')/com.sap.odata.test1.BFCStringRTESTwoKeyNav()").isExSemantic(0);
+ testUri.runEx("FICRTString(wrong1='ABC', wrong2=1)/com.sap.odata.test1.BFCStringRTESTwoKeyNav()").isExSemantic(0);
+
+ // type filter for entity incompatible
+ testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBase").isExSemantic(0);
+
+ // type filter for entity double on entry
+ testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav").isExSemantic(0);
+ // type filter for entity double on collection
+ testUri.runEx("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isExSemantic(0);
+ // type filter for entity double on non key pred
+ testUri.runEx("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav").isExSemantic(0);
+
+ // type filter for complex incompatible
+ testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplexTwoPrim"
+ + "/com.sap.odata.test1.CTCollAllPrim").isExSemantic(0);
+
+ // type filter for complex double on entry
+ testUri.runEx("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')"
+ + "/com.sap.odata.test1.CTBase/com.sap.odata.test1.CTBase").isExSemantic(0);
+
+ // type filter for complex double on collection
+ testUri.runEx("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')"
+ + "/com.sap.odata.test1.CTBase/com.sap.odata.test1.CTBase").isExSemantic(0);
+
+ // type filter for complex double on non key pred
+ testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplexTwoPrim"
+ + "/com.sap.odata.test1.CTBase/com.sap.odata.test1.CTBase").isExSemantic(0);
+
+ testUri.runEx("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav").isExSemantic(0);
+
+ // $ref
+ testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplexTwoPrim/$ref").isExSemantic(0);
+ testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplexTwoPrim/$count").isExSemantic(0);
+
+ }
+
+ @Test
+ public void testAlias() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString=@A)?@A='2'").goPath()
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicateAlias(1, "PropertyString", "A")
+ .goUpUriValidator()
+ .isCustomParameter(0, "@A", "'2'");
+
+ }
+
public static String encode(final String decoded) throws UnsupportedEncodingException {
return URLEncoder.encode(decoded, "UTF-8");
[05/14] [OLINGO-169] First huge import from ODataJClient: for the
moment,
it just build (no tests yet) and dummy Edm interfaces are used instead of the
ones from commons-api
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Path.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Path.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Path.java
new file mode 100644
index 0000000..8416a36
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Path.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.client.core.edm.v4.annotation;
+
+public class Path extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = -2551058493469292082L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyPath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyPath.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyPath.java
new file mode 100644
index 0000000..96288e2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyPath.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.client.core.edm.v4.annotation;
+
+public class PropertyPath extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = 2328584735437885159L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValue.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValue.java
new file mode 100644
index 0000000..5bbdc06
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValue.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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = PropertyValueDeserializer.class)
+public class PropertyValue extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 3081968466425707461L;
+
+ private String property;
+
+ private ExprConstruct value;
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(final String property) {
+ this.property = property;
+ }
+
+ public ExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final ExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValueDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValueDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValueDeserializer.java
new file mode 100644
index 0000000..66793ab
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/PropertyValueDeserializer.java
@@ -0,0 +1,55 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+
+public class PropertyValueDeserializer extends AbstractEdmDeserializer<PropertyValue> {
+
+ @Override
+ protected PropertyValue doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final PropertyValue propValue = new PropertyValue();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Property".equals(jp.getCurrentName())) {
+ propValue.setProperty(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ propValue.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ } else if (isAnnotationConstExprConstruct(jp)) {
+ propValue.setValue(parseAnnotationConstExprConstruct(jp));
+ } else {
+ propValue.setValue(jp.getCodec().readValue(jp, DynExprConstruct.class));
+ }
+ }
+ }
+
+ return propValue;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Record.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Record.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Record.java
new file mode 100644
index 0000000..2bed70c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Record.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+
+@JsonDeserialize(using = RecordDeserializer.class)
+public class Record extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = -2886526224721870304L;
+
+ private String type;
+
+ private final List<PropertyValue> propertyValues = new ArrayList<PropertyValue>();
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public List<PropertyValue> getPropertyValues() {
+ return propertyValues;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/RecordDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/RecordDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/RecordDeserializer.java
new file mode 100644
index 0000000..5d9c4ab
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/RecordDeserializer.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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+
+public class RecordDeserializer extends AbstractEdmDeserializer<Record> {
+
+ @Override
+ protected Record doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Record record = new Record();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Tyoe".equals(jp.getCurrentName())) {
+ record.setType(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ record.setAnnotation(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ } else {
+ record.getPropertyValues().add(jp.getCodec().readValue(jp, PropertyValue.class));
+ }
+ }
+ }
+
+ return record;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRef.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRef.java
new file mode 100644
index 0000000..164ddfe
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRef.java
@@ -0,0 +1,38 @@
+/*
+ * 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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = UrlRefDeserializer.class)
+public class UrlRef extends DynExprConstruct {
+
+ private static final long serialVersionUID = 3755101394647430897L;
+
+ private ExprConstruct value;
+
+ public ExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final ExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRefDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRefDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRefDeserializer.java
new file mode 100644
index 0000000..57a9f5c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/UrlRefDeserializer.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.client.core.edm.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+
+public class UrlRefDeserializer extends AbstractEdmDeserializer<UrlRef> {
+
+ @Override
+ protected UrlRef doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final UrlRef urlref = new UrlRef();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if (isAnnotationConstExprConstruct(jp)) {
+ urlref.setValue(parseAnnotationConstExprConstruct(jp));
+ } else {
+ urlref.setValue(jp.getCodec().readValue(jp, DynExprConstruct.class));
+ }
+ }
+ }
+
+ return urlref;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/AbstractBasicAuthHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/AbstractBasicAuthHttpClientFactory.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/AbstractBasicAuthHttpClientFactory.java
new file mode 100644
index 0000000..1c3d8fd
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/AbstractBasicAuthHttpClientFactory.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.client.core.http;
+
+import java.net.URI;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.olingo.odata4.client.api.http.HttpMethod;
+
+/**
+ * Base implementation for working with Basic Authentication: needs to be subclassed in order to provide actual username
+ * and password.
+ */
+public abstract class AbstractBasicAuthHttpClientFactory extends DefaultHttpClientFactory {
+
+ private static final long serialVersionUID = 7985626503125490244L;
+
+ protected abstract String getUsername();
+
+ protected abstract String getPassword();
+
+ @Override
+ public HttpClient createHttpClient(final HttpMethod method, final URI uri) {
+ final DefaultHttpClient httpclient = (DefaultHttpClient) super.createHttpClient(method, uri);
+
+ httpclient.getCredentialsProvider().setCredentials(
+ new AuthScope(uri.getHost(), uri.getPort()),
+ new UsernamePasswordCredentials(getUsername(), getPassword()));
+
+ return httpclient;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/AbstractNTLMAuthHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/AbstractNTLMAuthHttpClientFactory.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/AbstractNTLMAuthHttpClientFactory.java
new file mode 100644
index 0000000..579032b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/AbstractNTLMAuthHttpClientFactory.java
@@ -0,0 +1,62 @@
+/*
+ * 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.client.core.http;
+
+import java.net.URI;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.NTCredentials;
+import org.apache.http.client.CredentialsProvider;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.olingo.odata4.client.api.http.HttpMethod;
+
+/**
+ * Base implementation for working with NTLM Authentication via embedded HttpClient features: needs to be subclassed in
+ * order to provide all needed login information.
+ * <br/>
+ * External NTLM engine such as <a href="http://jcifs.samba.org/">JCIFS</a> library developed by the
+ * <a href="http://www.samba.org/">Samba</a> project as a part of their Windows interoperability suite of programs.
+ *
+ * @see NTCredentials
+ * @see http://hc.apache.org/httpcomponents-client-ga/ntlm.html#Using_Samba_JCIFS_as_an_alternative_NTLM_engine
+ */
+public abstract class AbstractNTLMAuthHttpClientFactory extends DefaultHttpClientFactory {
+
+ protected abstract String getUsername();
+
+ protected abstract String getPassword();
+
+ protected abstract String getWorkstation();
+
+ protected abstract String getDomain();
+
+ @Override
+ public HttpClient createHttpClient(final HttpMethod method, final URI uri) {
+ final DefaultHttpClient httpclient = (DefaultHttpClient) super.createHttpClient(method, uri);
+
+ final CredentialsProvider credsProvider = new BasicCredentialsProvider();
+ credsProvider.setCredentials(AuthScope.ANY,
+ new NTCredentials(getUsername(), getPassword(), getWorkstation(), getDomain()));
+
+ httpclient.setCredentialsProvider(credsProvider);
+
+ return httpclient;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/DefaultHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/DefaultHttpClientFactory.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/DefaultHttpClientFactory.java
new file mode 100644
index 0000000..f008ff5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/DefaultHttpClientFactory.java
@@ -0,0 +1,39 @@
+/*
+ * 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.client.core.http;
+
+import java.io.Serializable;
+import java.net.URI;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.olingo.odata4.client.api.http.HttpClientFactory;
+import org.apache.olingo.odata4.client.api.http.HttpMethod;
+
+/**
+ * Default implementation returning HttpClients with default parameters.
+ */
+public class DefaultHttpClientFactory implements HttpClientFactory, Serializable {
+
+ private static final long serialVersionUID = -2461355444507227332L;
+
+ @Override
+ public HttpClient createHttpClient(final HttpMethod method, final URI uri) {
+ return new DefaultHttpClient();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/DefaultHttpUriRequestFactory.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/DefaultHttpUriRequestFactory.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/DefaultHttpUriRequestFactory.java
new file mode 100644
index 0000000..10b2e85
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/DefaultHttpUriRequestFactory.java
@@ -0,0 +1,68 @@
+/*
+ * 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.client.core.http;
+
+import java.net.URI;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.olingo.odata4.client.api.http.HttpMethod;
+import org.apache.olingo.odata4.client.api.http.HttpUriRequestFactory;
+
+/**
+ * Default implementation returning default HttpUriRequest implementations.
+ */
+public class DefaultHttpUriRequestFactory implements HttpUriRequestFactory {
+
+ @Override
+ public HttpUriRequest createHttpUriRequest(final HttpMethod method, final URI uri) {
+ HttpUriRequest result;
+
+ switch (method) {
+ case POST:
+ result = new HttpPost(uri);
+ break;
+
+ case PUT:
+ result = new HttpPut(uri);
+ break;
+
+ case PATCH:
+ result = new HttpPatch(uri);
+ break;
+
+ case MERGE:
+ result = new HttpMerge(uri);
+ break;
+
+ case DELETE:
+ result = new HttpDelete(uri);
+ break;
+
+ case GET:
+ default:
+ result = new HttpGet(uri);
+ break;
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/HttpMerge.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/HttpMerge.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/HttpMerge.java
new file mode 100644
index 0000000..ffe20a9
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/HttpMerge.java
@@ -0,0 +1,70 @@
+/*
+ * 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.client.core.http;
+
+import java.net.URI;
+import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+
+/**
+ * Class identifying MERGE HTTP method.
+ */
+@NotThreadSafe
+public class HttpMerge extends HttpEntityEnclosingRequestBase {
+
+ public final static String METHOD_NAME = "MERGE";
+
+ /**
+ * Constructor.
+ */
+ public HttpMerge() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param uri request URI.
+ */
+ public HttpMerge(final URI uri) {
+ super();
+ setURI(uri);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param uri request URI.
+ * @throws IllegalArgumentException if the uri is invalid.
+ */
+ public HttpMerge(final String uri) {
+ super();
+ setURI(URI.create(uri));
+ }
+
+ /**
+ * Gets HTTP method name.
+ *
+ * @return HTTP method name.
+ */
+ @Override
+ public String getMethod() {
+ return METHOD_NAME;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/HttpPatch.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/HttpPatch.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/HttpPatch.java
new file mode 100644
index 0000000..244bdc1
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/http/HttpPatch.java
@@ -0,0 +1,70 @@
+/*
+ * 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.client.core.http;
+
+import java.net.URI;
+import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+
+/**
+ * Class identifying PATCH HTTP method.
+ */
+@NotThreadSafe
+public class HttpPatch extends HttpEntityEnclosingRequestBase {
+
+ public final static String METHOD_NAME = "PATCH";
+
+ /**
+ * Constructor.
+ */
+ public HttpPatch() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param uri request URI.
+ */
+ public HttpPatch(final URI uri) {
+ super();
+ setURI(uri);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param uri request URI.
+ * @throws IllegalArgumentException if the uri is invalid.
+ */
+ public HttpPatch(final String uri) {
+ super();
+ setURI(URI.create(uri));
+ }
+
+ /**
+ * Gets HTTP method name.
+ *
+ * @return HTTP method name.
+ */
+ @Override
+ public String getMethod() {
+ return METHOD_NAME;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/AbstractDOMParser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/AbstractDOMParser.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/AbstractDOMParser.java
new file mode 100644
index 0000000..49f3285
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/AbstractDOMParser.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.utils;
+
+import java.io.InputStream;
+import java.io.Writer;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * DOM Parser.
+ */
+public abstract class AbstractDOMParser {
+
+ /**
+ * Parses the given input into a DOM tree.
+ *
+ * @param input stream to be parsed and de-serialized.
+ * @return DOM tree
+ */
+ public abstract Element deserialize(InputStream input);
+
+ /**
+ * Writes DOM object by the given writer.
+ *
+ * @param content DOM to be streamed.
+ * @param writer writer.
+ */
+ public abstract void serialize(Node content, Writer writer);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/AndroidDOMParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/AndroidDOMParserImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/AndroidDOMParserImpl.java
new file mode 100644
index 0000000..bbf5bd8
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/AndroidDOMParserImpl.java
@@ -0,0 +1,49 @@
+/*
+ * 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.client.core.utils;
+
+import java.io.InputStream;
+import java.io.Writer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class AndroidDOMParserImpl extends AbstractDOMParser {
+
+ @Override
+ public Element deserialize(final InputStream input) {
+ try {
+ return XMLUtils.DOC_BUILDER_FACTORY.newDocumentBuilder().parse(input).getDocumentElement();
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Could not parse DOM", e);
+ }
+ }
+
+ @Override
+ public void serialize(final Node content, final Writer writer) {
+ try {
+ TransformerFactory.newInstance().newTransformer().
+ transform(new DOMSource(content), new StreamResult(writer));
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While serializing DOM element", e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/DefaultDOMParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/DefaultDOMParserImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/DefaultDOMParserImpl.java
new file mode 100644
index 0000000..d8215f7
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/DefaultDOMParserImpl.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.utils;
+
+import java.io.InputStream;
+import java.io.Writer;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSOutput;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSSerializer;
+
+public class DefaultDOMParserImpl extends AbstractDOMParser {
+
+ private static final Object MONITOR = new Object();
+
+ private static DOMImplementationLS DOM_IMPL;
+
+ private void lazyInit() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
+ synchronized (MONITOR) {
+ if (DOM_IMPL == null) {
+ final DOMImplementationRegistry reg = DOMImplementationRegistry.newInstance();
+ DOM_IMPL = (DOMImplementationLS) reg.getDOMImplementation("LS");
+ }
+ }
+ }
+
+ @Override
+ public Element deserialize(final InputStream input) {
+ try {
+ lazyInit();
+
+ final LSParser parser = DOM_IMPL.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
+
+ final LSInput lsinput = DOM_IMPL.createLSInput();
+ lsinput.setByteStream(input);
+
+ return parser.parse(lsinput).getDocumentElement();
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Could not parse DOM", e);
+ }
+ }
+
+ @Override
+ public void serialize(final Node content, final Writer writer) {
+ try {
+ lazyInit();
+
+ final LSSerializer serializer = DOM_IMPL.createLSSerializer();
+
+ final LSOutput lso = DOM_IMPL.createLSOutput();
+ lso.setCharacterStream(writer);
+
+ serializer.write(content, lso);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While serializing DOM element", e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/XMLUtils.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/XMLUtils.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/XMLUtils.java
new file mode 100644
index 0000000..90f5743
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/utils/XMLUtils.java
@@ -0,0 +1,186 @@
+/*
+ * 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.client.core.utils;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ServiceLoader;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.odata4.client.api.Constants;
+import org.apache.olingo.odata4.client.core.data.EdmSimpleType;
+import org.apache.olingo.odata4.client.core.data.geospatial.Geospatial;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * XML utilities.
+ */
+public final class XMLUtils {
+
+ /**
+ * DOM factory.
+ */
+ public static final DocumentBuilderFactory DOC_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
+
+ public static final AbstractDOMParser PARSER;
+
+ static {
+ final Iterator<AbstractDOMParser> itor
+ = ServiceLoader.load(AbstractDOMParser.class, Thread.currentThread().getContextClassLoader()).iterator();
+ PARSER = itor.hasNext() ? itor.next() : new DefaultDOMParserImpl();
+ }
+
+ private XMLUtils() {
+ // Empty private constructor for static utility classes
+ }
+
+ /**
+ * Gets XML node name.
+ *
+ * @param node node.
+ * @return node name.
+ */
+ public static String getSimpleName(final Node node) {
+ return node.getLocalName() == null
+ ? node.getNodeName().substring(node.getNodeName().indexOf(':') + 1)
+ : node.getLocalName();
+ }
+
+ /**
+ * Gets the given node's children of the given type.
+ *
+ * @param node parent.
+ * @param nodetype searched child type.
+ * @return children.
+ */
+ public static List<Node> getChildNodes(final Node node, final short nodetype) {
+ final List<Node> result = new ArrayList<Node>();
+
+ final NodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ final Node child = children.item(i);
+ if (child.getNodeType() == nodetype) {
+ result.add(child);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets the given node's children with the given name.
+ *
+ * @param node parent.
+ * @param name searched child name.
+ * @return children.
+ */
+ public static List<Element> getChildElements(final Element node, final String name) {
+ final List<Element> result = new ArrayList<Element>();
+
+ if (StringUtils.isNotBlank(name)) {
+ final NodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ final Node child = children.item(i);
+ if ((child instanceof Element) && name.equals(child.getNodeName())) {
+ result.add((Element) child);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Checks if the given node has <tt>element</tt> children.
+ *
+ * @param node parent.
+ * @return 'TRUE' if the given node has at least one <tt>element</tt> child; 'FALSE' otherwise.
+ */
+ public static boolean hasElementsChildNode(final Node node) {
+ boolean found = false;
+
+ for (Node child : getChildNodes(node, Node.ELEMENT_NODE)) {
+ if (Constants.ELEM_ELEMENT.equals(XMLUtils.getSimpleName(child))) {
+ found = true;
+ }
+ }
+
+ return found;
+ }
+
+ /**
+ * Checks if the given node has only text children.
+ *
+ * @param node parent.
+ * @return 'TRUE' if the given node has only text children; 'FALSE' otherwise.
+ */
+ public static boolean hasOnlyTextChildNodes(final Node node) {
+ boolean result = true;
+ final NodeList children = node.getChildNodes();
+ for (int i = 0; result && i < children.getLength(); i++) {
+ final Node child = children.item(i);
+ if (child.getNodeType() != Node.TEXT_NODE) {
+ result = false;
+ }
+ }
+
+ return result;
+ }
+
+ public static EdmSimpleType simpleTypeForNode(final Geospatial.Dimension dimension, final Node node) {
+ EdmSimpleType type = null;
+
+ if (Constants.ELEM_POINT.equals(node.getNodeName())) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyPoint
+ : EdmSimpleType.GeometryPoint;
+ } else if (Constants.ELEM_MULTIPOINT.equals(node.getNodeName())) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyMultiPoint
+ : EdmSimpleType.GeometryMultiPoint;
+ } else if (Constants.ELEM_LINESTRING.equals(node.getNodeName())) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyLineString
+ : EdmSimpleType.GeometryLineString;
+ } else if (Constants.ELEM_MULTILINESTRING.equals(node.getNodeName())) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyMultiLineString
+ : EdmSimpleType.GeometryMultiLineString;
+ } else if (Constants.ELEM_POLYGON.equals(node.getNodeName())) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyPolygon
+ : EdmSimpleType.GeometryPolygon;
+ } else if (Constants.ELEM_MULTIPOLYGON.equals(node.getNodeName())) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyMultiPolygon
+ : EdmSimpleType.GeometryMultiPolygon;
+ } else if (Constants.ELEM_GEOCOLLECTION.equals(node.getNodeName())
+ || Constants.ELEM_GEOMEMBERS.equals(node.getNodeName())) {
+
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmSimpleType.GeographyCollection
+ : EdmSimpleType.GeometryCollection;
+ }
+
+ return type;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataClientTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataClientTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataClientTest.java
index 814435b..0dc7004 100644
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataClientTest.java
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataClientTest.java
@@ -19,15 +19,22 @@
package org.apache.olingo.odata4.client.core;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
import org.junit.Test;
public class ODataClientTest {
@Test
public void before() {
- ODataClient client = ODataClient.create();
+ ODataClient client = ODataClientFactory.getV3();
assertNotNull(client);
+ assertEquals(ODataServiceVersion.V30, client.getServiceVersion());
+
+ client = ODataClientFactory.getV4();
+ assertNotNull(client);
+ assertEquals(ODataServiceVersion.V40, client.getServiceVersion());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java
index ff4d6c3..12d1bca 100644
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java
@@ -24,36 +24,40 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.InputStream;
+import org.apache.commons.io.IOUtils;
import org.apache.olingo.odata4.client.api.deserializer.ComplexValue;
import org.apache.olingo.odata4.client.api.deserializer.Property;
import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
import org.apache.olingo.odata4.client.api.deserializer.Value;
-import org.apache.olingo.odata4.client.core.testutil.StringHelper;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class JsonReaderPerformance {
+ private static final Logger LOG = LoggerFactory.getLogger(JsonReaderPerformance.class);
+
@Test
public void testComplexPropertyPerformance() throws Exception {
JsonReader consumer = new JsonReader();
int runs = 1000; // * 100;
InputStream in = JsonReaderPerformance.class.getResourceAsStream("/complexProperty.json");
- String content = StringHelper.inputStreamToString(in);
+ String content = IOUtils.toString(in);
-// System.out.println("Started...");
+ LOG.debug("Started...");
ComplexValue complex = null;
-// long startTime = System.currentTimeMillis();
+ long startTime = System.currentTimeMillis();
for (int i = 0; i < runs; i++) {
- Property property = consumer.readProperty(StringHelper.encapsulate(content));
+ Property property = consumer.readProperty(IOUtils.toInputStream(content));
complex = (ComplexValue) ((StructuralProperty) property).getValue();
}
-// long endTime = System.currentTimeMillis();
+ long endTime = System.currentTimeMillis();
-// long duration = endTime - startTime;
-// System.out.println("Duration: " + duration + " ms");
-// System.out.println("Duration per run: " + (duration / (float) runs) + " ms");
+ long duration = endTime - startTime;
+ LOG.debug("Duration: " + duration + " ms");
+ LOG.debug("Duration per run: " + (duration / (float) runs) + " ms");
testComplexProperty(complex);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java
deleted file mode 100644
index 90b7479..0000000
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java
+++ /dev/null
@@ -1,108 +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.client.core.testutil;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
-
-// TODO: remove this class in favor of StringUtils, IOUtils, ...
-public class StringHelper {
-
- public static String inputStreamToString(final InputStream in, final boolean preserveLineBreaks) throws IOException {
- final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in, Charset.forName("UTF-8")));
- final StringBuilder stringBuilder = new StringBuilder();
- String line = null;
-
- while ((line = bufferedReader.readLine()) != null) {
- stringBuilder.append(line);
- if (preserveLineBreaks) {
- stringBuilder.append("\n");
- }
- }
-
- bufferedReader.close();
-
- final String result = stringBuilder.toString();
-
- return result;
- }
-
- public static String inputStreamToString(final InputStream in) throws IOException {
- return inputStreamToString(in, false);
- }
-
- /**
- * Encapsulate given content in an {@link InputStream} with charset <code>UTF-8</code>.
- *
- * @param content to encapsulate content
- * @return content as stream
- */
- public static InputStream encapsulate(final String content) {
- try {
- return encapsulate(content, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- // we know that UTF-8 is supported
- throw new RuntimeException("UTF-8 MUST be supported.", e);
- }
- }
-
- /**
- * Encapsulate given content in an {@link InputStream} with given charset.
- *
- * @param content to encapsulate content
- * @param charset to be used charset
- * @return content as stream
- * @throws UnsupportedEncodingException if charset is not supported
- */
- public static InputStream encapsulate(final String content, final String charset)
- throws UnsupportedEncodingException {
- return new ByteArrayInputStream(content.getBytes(charset));
- }
-
- /**
- * Generate a string with given length containing random upper case characters ([A-Z]).
- *
- * @param len length of to generated string
- * @return random upper case characters ([A-Z]).
- */
- public static InputStream generateDataStream(final int len) {
- return encapsulate(generateData(len));
- }
-
- /**
- * Generate a string with given length containing random upper case characters ([A-Z]).
- *
- * @param len length of to generated string
- * @return random upper case characters ([A-Z]).
- */
- public static String generateData(final int len) {
- final StringBuilder builder = new StringBuilder(len);
- for (int j = 0; j < len; j++) {
- final char c = (char) (Math.random() * 26 + 65);
- builder.append(c);
- }
- return builder.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ConcurrencyMode.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ConcurrencyMode.java b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ConcurrencyMode.java
new file mode 100644
index 0000000..335ae8d
--- /dev/null
+++ b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ConcurrencyMode.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.commons.api.edm.constants;
+
+public enum ConcurrencyMode {
+
+ None,
+ Fixed
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmContentKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmContentKind.java b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmContentKind.java
new file mode 100644
index 0000000..9ec3c7a
--- /dev/null
+++ b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmContentKind.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.commons.api.edm.constants;
+
+/**
+ * Specifies the content type of the value of the property being mapped via a customizable feed mapping.
+ */
+public enum EdmContentKind {
+
+ text,
+ html,
+ xhtml;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ODataServiceVersion.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ODataServiceVersion.java b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ODataServiceVersion.java
index 9c6a3fa..4f35ebd 100644
--- a/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ODataServiceVersion.java
+++ b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ODataServiceVersion.java
@@ -18,35 +18,61 @@
*/
package org.apache.olingo.odata4.commons.api.edm.constants;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* This class is a container for the supported ODataServiceVersions.
*/
-public class ODataServiceVersion {
+public enum ODataServiceVersion {
+
+ V10("1.0"),
+ V20("2.0"),
+ V30("3.0"),
+ V40("4.0");
private static final Pattern DATASERVICEVERSIONPATTERN = Pattern.compile("(\\p{Digit}+\\.\\p{Digit}+)(:?;.*)?");
- /**
- * ODataServiceVersion 1.0
- */
- public static final String V10 = "1.0";
+ public static final String NS_DATASERVICES = "dataservices";
- /**
- * ODataServiceVersion 2.0
- */
- public static final String V20 = "2.0";
+ public static final String NS_METADATA = "metadata";
- /**
- * ODataServiceVersion 3.0
- */
- public static final String V30 = "3.0";
+ public static final String NS_DATA = "data";
- /**
- * ODataServiceVersion 4.0
- */
- public static final String V40 = "4.0";
+ public static final String NS_SCHEME = "scheme";
+
+ public static final String NAVIGATION_LINK_REL = "navigationLinkRel";
+
+ public static final String ASSOCIATION_LINK_REL = "associationLinkRel";
+
+ public static final String MEDIA_EDIT_LINK_REL = "mediaEditLinkRel";
+
+ private static final Map<String, String> V30_NAMESPACES = Collections.unmodifiableMap(new HashMap<String, String>() {
+
+ private static final long serialVersionUID = 3109256773218160485L;
+
+ {
+ put(NS_DATASERVICES, "http://schemas.microsoft.com/ado/2007/08/dataservices");
+ put(NS_METADATA, "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");
+ put(NS_SCHEME, "http://schemas.microsoft.com/ado/2007/08/dataservices/scheme");
+ put(NAVIGATION_LINK_REL, "http://schemas.microsoft.com/ado/2007/08/dataservices/related/");
+ put(ASSOCIATION_LINK_REL, "http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/");
+ put(MEDIA_EDIT_LINK_REL, "http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/");
+ }
+ });
+
+ private static final Map<String, String> V40_NAMESPACES = Collections.unmodifiableMap(new HashMap<String, String>() {
+
+ private static final long serialVersionUID = 3109256773218160485L;
+
+ {
+ put(NS_METADATA, "http://docs.oasis-open.org/odata/ns/metadata");
+ put(NS_DATA, "http://docs.oasis-open.org/odata/ns/data");
+ }
+ });
/**
* Validates format and range of a data service version string.
@@ -58,10 +84,10 @@ public class ODataServiceVersion {
final Matcher matcher = DATASERVICEVERSIONPATTERN.matcher(version);
if (matcher.matches()) {
final String possibleDataServiceVersion = matcher.group(1);
- return V10.equals(possibleDataServiceVersion)
- || V20.equals(possibleDataServiceVersion)
- || V30.equals(possibleDataServiceVersion)
- || V40.equals(possibleDataServiceVersion);
+ return V10.toString().equals(possibleDataServiceVersion)
+ || V20.toString().equals(possibleDataServiceVersion)
+ || V30.toString().equals(possibleDataServiceVersion)
+ || V40.toString().equals(possibleDataServiceVersion);
} else {
throw new IllegalArgumentException(version);
}
@@ -93,5 +119,22 @@ public class ODataServiceVersion {
return null;
}
+ private final String version;
+
+ private ODataServiceVersion(final String version) {
+ this.version = version;
+ }
+ public Map<String, String> getNamespaceMap() {
+ return this == V10 || this == V20
+ ? Collections.<String, String>emptyMap()
+ : this == V30
+ ? V30_NAMESPACES
+ : V40_NAMESPACES;
+ }
+
+ @Override
+ public String toString() {
+ return version;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/StoreGeneratedPattern.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/StoreGeneratedPattern.java b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/StoreGeneratedPattern.java
new file mode 100644
index 0000000..3dad36b
--- /dev/null
+++ b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/StoreGeneratedPattern.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.commons.api.edm.constants;
+
+public enum StoreGeneratedPattern {
+
+ None,
+ Identity,
+ Computed
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImpl.java
index 8b09be8..f44f1d6 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImpl.java
@@ -55,7 +55,7 @@ public class EdmServiceMetadataImpl implements EdmServiceMetadata {
@Override
public String getDataServiceVersion() {
- return ODataServiceVersion.V40;
+ return ODataServiceVersion.V40.toString();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImplTest.java
index 0933288..5c7f154 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImplTest.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImplTest.java
@@ -74,7 +74,7 @@ public class EdmServiceMetadataImplTest {
public void initialProvider() {
EdmProvider provider = new EdmProvider() {};
EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImpl(provider);
- assertEquals(ODataServiceVersion.V40, serviceMetadata.getDataServiceVersion());
+ assertEquals(ODataServiceVersion.V40.toString(), serviceMetadata.getDataServiceVersion());
}
@Test(expected = EdmException.class)
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ec5487f..5a1e0a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,49 +62,92 @@
</modules>
<properties>
+ <commons.codec.version>1.9</commons.codec.version>
+ <commons.io.version>2.4</commons.io.version>
+ <commons.lang3.version>3.2.1</commons.lang3.version>
+
+ <hc.client.version>4.2.6</hc.client.version>
+ <jackson.version>2.3.1</jackson.version>
+
<antlr.version>4.1</antlr.version>
+
+ <sl4j.version>1.7.5</sl4j.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons.codec.version}</version>
</dependency>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.9.5</version>
- <scope>test</scope>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>${commons.io.version}</version>
</dependency>
<dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.9</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>${commons.lang3.version}</version>
</dependency>
+
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>${antlr.version}</version>
- <scope>compile</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>${hc.client.version}</version>
+ </dependency>
+
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
- <version>2.2.3</version>
+ <version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
- <version>2.2.3</version>
+ <version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
- <version>2.2.3</version>
+ <version>${jackson.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml</groupId>
+ <artifactId>aalto-xml</artifactId>
+ <version>0.9.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${sl4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</dependencyManagement>