You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/04/01 11:00:13 UTC
[01/52] [abbrv] Consistently using package name to differentiate V3
and V4
Repository: olingo-odata4
Updated Branches:
refs/heads/olingo-206-validator fbafc3a4f -> b25080359
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
index 3d39037..b76c453 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.v3;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.data.ODataError;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
@@ -30,7 +30,7 @@ import org.junit.Test;
public class ErrorTest extends AbstractTest {
@Override
- protected ODataV3Client getClient() {
+ protected ODataClient getClient() {
return v3Client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java
index e56ffda..9d7e0a3 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.olingo.client.core.v3;
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-import org.apache.olingo.client.api.uri.filter.V3FilterArgFactory;
-import org.apache.olingo.client.api.uri.filter.V3FilterFactory;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.client.api.uri.v3.FilterArgFactory;
+import org.apache.olingo.client.api.uri.v3.FilterFactory;
import org.apache.olingo.client.core.AbstractTest;
import static org.junit.Assert.assertEquals;
@@ -31,15 +31,15 @@ import org.junit.Test;
public class FilterFactoryTest extends AbstractTest {
@Override
- protected ODataV3Client getClient() {
+ protected ODataClient getClient() {
return v3Client;
}
- private V3FilterFactory getFilterFactory() {
+ private FilterFactory getFilterFactory() {
return getClient().getFilterFactory();
}
- private V3FilterArgFactory getFilterArgFactory() {
+ private FilterArgFactory getFilterArgFactory() {
return getFilterFactory().getArgFactory();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
index 6723d2b..fea25ca 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
@@ -29,7 +29,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.edm.xml.EntityContainer;
import org.apache.olingo.client.api.edm.xml.EntityType;
import org.apache.olingo.client.api.edm.xml.Schema;
@@ -56,7 +56,7 @@ import org.junit.Test;
public class MetadataTest extends AbstractTest {
@Override
- protected ODataV3Client getClient() {
+ protected ODataClient getClient() {
return v3Client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
index c1a1f4a..641fafa 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
@@ -28,7 +28,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import org.apache.commons.codec.binary.Base64;
-import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataDuration;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
@@ -49,7 +49,7 @@ import org.junit.Test;
public class PrimitiveValueTest extends AbstractTest {
@Override
- protected ODataV3Client getClient() {
+ protected ODataClient getClient() {
return v3Client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java
index 3aba0a8..b42b513 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.v3;
-import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.core.AbstractTest;
@@ -31,7 +31,7 @@ import org.junit.Test;
public class ServiceDocumentTest extends AbstractTest {
@Override
- protected ODataV3Client getClient() {
+ protected ODataClient getClient() {
return v3Client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java
index b67bea9..1838cf8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java
@@ -26,8 +26,8 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.api.uri.V3URIBuilder;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.uri.v3.URIBuilder;
import org.apache.olingo.client.core.AbstractTest;
import org.junit.Test;
@@ -36,7 +36,7 @@ public class URIBuilderTest extends AbstractTest {
private static final String SERVICE_ROOT = "http://host/service";
@Override
- protected ODataV3Client getClient() {
+ protected ODataClient getClient() {
return v3Client;
}
@@ -57,7 +57,7 @@ public class URIBuilderTest extends AbstractTest {
final Map<String, Object> multiKey = new HashMap<String, Object>();
multiKey.put("OrderId", -10);
multiKey.put("ProductId", -10);
- V3URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendEntitySetSegment("OrderLine").appendKeySegment(multiKey).
appendPropertySegment("Quantity").appendValueSegment();
@@ -84,7 +84,7 @@ public class URIBuilderTest extends AbstractTest {
assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products/$count").build(), uri);
uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").
- inlineCount(V3URIBuilder.InlineCount.allpages).build();
+ inlineCount(URIBuilder.InlineCount.allpages).build();
assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products").
addParameter("$inlinecount", "allpages").build(), uri);
@@ -92,7 +92,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void filter() throws URISyntaxException {
- final V3URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
filter(getClient().getFilterFactory().lt("VIN", 16));
assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet").
@@ -102,7 +102,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void unboundAction() throws URISyntaxException {
- final V3URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendOperationCallSegment("ProductsByCategoryId",
Collections.<String, Object>singletonMap("categoryId", 2));
@@ -112,7 +112,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void boundAction() throws URISyntaxException {
- final V3URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendEntitySetSegment("Products").appendOperationCallSegment("MostExpensive", null);
assertEquals(new org.apache.http.client.utils.URIBuilder(
@@ -121,7 +121,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void derived() throws URISyntaxException {
- final V3URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendEntitySetSegment("Customers").appendNavigationSegment("Model").
appendDerivedEntityTypeSegment("Namespace.VipCustomer").appendKeySegment(1);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
index 1a48be4..3d74f7b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.olingo.client.core.v4;
-import org.apache.olingo.client.api.ODataV4Client;
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-import org.apache.olingo.client.api.uri.filter.V4FilterArgFactory;
-import org.apache.olingo.client.api.uri.filter.V4FilterFactory;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.client.api.uri.v4.FilterArgFactory;
+import org.apache.olingo.client.api.uri.v4.FilterFactory;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.client.core.edm.EdmEnumTypeImpl;
import org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl;
@@ -35,15 +35,15 @@ import org.junit.Test;
public class FilterFactoryTest extends AbstractTest {
@Override
- protected ODataV4Client getClient() {
+ protected ODataClient getClient() {
return v4Client;
}
- private V4FilterFactory getFilterFactory() {
+ private FilterFactory getFilterFactory() {
return getClient().getFilterFactory();
}
- private V4FilterArgFactory getFilterArgFactory() {
+ private FilterArgFactory getFilterArgFactory() {
return getFilterFactory().getArgFactory();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
index 78e925a..afeba92 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import org.apache.olingo.client.api.ODataV4Client;
+import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.api.edm.xml.v4.Annotation;
import org.apache.olingo.client.api.edm.xml.v4.Annotations;
import org.apache.olingo.client.api.edm.xml.v4.ComplexType;
@@ -58,7 +58,7 @@ import org.junit.Test;
public class MetadataTest extends AbstractTest {
@Override
- protected ODataV4Client getClient() {
+ protected ODataClient getClient() {
return v4Client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
index 6e9b3b2..c146fee 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.v4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.apache.olingo.client.api.ODataV4Client;
+import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataDuration;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
@@ -34,7 +34,7 @@ import org.junit.Test;
public class PrimitiveValueTest extends AbstractTest {
@Override
- protected ODataV4Client getClient() {
+ protected ODataClient getClient() {
return v4Client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
index b26bb31..7945692 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertTrue;
import java.net.URI;
-import org.apache.olingo.client.api.ODataV4Client;
+import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.core.AbstractTest;
@@ -33,7 +33,7 @@ import org.junit.Test;
public class ServiceDocumentTest extends AbstractTest {
@Override
- protected ODataV4Client getClient() {
+ protected ODataClient getClient() {
return v4Client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java
index 29069b7..868b363 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java
@@ -21,8 +21,8 @@ package org.apache.olingo.client.core.v4;
import java.net.URI;
import java.net.URISyntaxException;
-import org.apache.olingo.client.api.ODataV4Client;
-import org.apache.olingo.client.api.uri.V4URIBuilder;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.api.uri.v4.URIBuilder;
import org.apache.olingo.client.core.AbstractTest;
import static org.junit.Assert.assertEquals;
@@ -34,7 +34,7 @@ public class URIBuilderTest extends AbstractTest {
private static final String SERVICE_ROOT = "http://host/service";
@Override
- protected ODataV4Client getClient() {
+ protected ODataClient getClient() {
return v4Client;
}
@@ -52,7 +52,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void singleton() throws URISyntaxException {
- final V4URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendSingletonSegment("BestProductEverCreated");
assertEquals(new org.apache.http.client.utils.URIBuilder(
@@ -61,7 +61,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void entityId() throws URISyntaxException {
- final V4URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendEntityIdSegment("Products(0)");
assertEquals(new org.apache.http.client.utils.URIBuilder(
@@ -70,7 +70,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void boundAction() throws URISyntaxException {
- final V4URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendEntitySetSegment("Categories").appendKeySegment(1).
appendNavigationSegment("Products").appendNavigationSegment("Model").
appendOperationCallSegment("AllOrders", null);
@@ -81,7 +81,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void ref() throws URISyntaxException {
- V4URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendEntitySetSegment("Categories").appendKeySegment(1).
appendNavigationSegment("Products").appendRefSegment();
@@ -99,7 +99,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void derived() throws URISyntaxException {
- final V4URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendEntitySetSegment("Customers").appendNavigationSegment("Model").
appendDerivedEntityTypeSegment("VipCustomer").appendKeySegment(1);
@@ -109,7 +109,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void crossjoin() throws URISyntaxException {
- final V4URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendCrossjoinSegment("Products", "Sales");
assertEquals(new org.apache.http.client.utils.URIBuilder(
@@ -118,7 +118,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void all() throws URISyntaxException {
- final V4URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendAllSegment();
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendAllSegment();
assertEquals(new org.apache.http.client.utils.URIBuilder(
SERVICE_ROOT + "/$all").build(), uriBuilder.build());
@@ -126,7 +126,7 @@ public class URIBuilderTest extends AbstractTest {
@Test
public void search() throws URISyntaxException {
- final V4URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendEntitySetSegment("Products").search("blue OR green");
assertEquals(new org.apache.http.client.utils.URIBuilder(
[35/52] [abbrv] [OLINGO-200] Moving Atom and JSON (de)serializer to
commons
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
deleted file mode 100644
index 461e829..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
+++ /dev/null
@@ -1,172 +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.client.core.edm;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EdmTypeInfo {
-
- private static final Logger LOG = LoggerFactory.getLogger(EdmTypeInfo.class);
-
- public static class Builder {
-
- private String typeExpression;
-
- private String defaultNamespace;
-
- private Edm edm;
-
- public Builder setTypeExpression(final String typeExpression) {
- this.typeExpression = typeExpression;
- return this;
- }
-
- public Builder setDefaultNamespace(final String defaultNamespace) {
- this.defaultNamespace = defaultNamespace;
- return this;
- }
-
- public Builder setEdm(final Edm edm) {
- this.edm = edm;
- return this;
- }
-
- public EdmTypeInfo build() {
- return new EdmTypeInfo(edm, typeExpression.indexOf('.') == -1
- ? defaultNamespace + "." + typeExpression
- : typeExpression);
- }
- }
-
- private final Edm edm;
-
- private final String typeExpression;
-
- private final boolean collection;
-
- private final FullQualifiedName fullQualifiedName;
-
- private EdmPrimitiveTypeKind primitiveType;
-
- private EdmEnumType enumType;
-
- private EdmComplexType complexType;
-
- private EdmEntityType entityType;
-
- private EdmTypeInfo(final Edm edm, final String typeExpression) {
- this.edm = edm;
- this.typeExpression = typeExpression;
-
- String baseType;
- final int collStartIdx = typeExpression.indexOf("Collection(");
- final int collEndIdx = typeExpression.lastIndexOf(')');
- if (collStartIdx == -1) {
- baseType = typeExpression;
- this.collection = false;
- } else {
- if (collEndIdx == -1) {
- throw new IllegalArgumentException("Malformed type: " + typeExpression);
- }
-
- this.collection = true;
- baseType = typeExpression.substring(collStartIdx + 11, collEndIdx);
- }
-
- final int lastDotIdx = baseType.lastIndexOf('.');
- if (lastDotIdx == -1) {
- throw new IllegalArgumentException("Cannot find namespace or alias in " + typeExpression);
- }
- final String namespace = baseType.substring(0, lastDotIdx);
- final String typeName = baseType.substring(lastDotIdx + 1);
- if (StringUtils.isBlank(typeName)) {
- throw new IllegalArgumentException("Null or empty type name in " + typeExpression);
- }
-
- this.fullQualifiedName = new FullQualifiedName(namespace, typeName);
-
- try {
- this.primitiveType = EdmPrimitiveTypeKind.valueOf(this.fullQualifiedName.getName());
- } catch (IllegalArgumentException e) {
- LOG.debug("{} does not appear to refer to an Edm primitive type", this.fullQualifiedName);
- }
- if (this.primitiveType == null && this.edm != null) {
- this.enumType = this.edm.getEnumType(this.fullQualifiedName);
- if (this.enumType == null) {
- this.complexType = this.edm.getComplexType(this.fullQualifiedName);
- if (this.complexType == null) {
- this.entityType = this.edm.getEntityType(this.fullQualifiedName);
- }
- }
- }
- }
-
- public String getTypeExpression() {
- return typeExpression;
- }
-
- public boolean isCollection() {
- return collection;
- }
-
- public FullQualifiedName getFullQualifiedName() {
- return fullQualifiedName;
- }
-
- public boolean isPrimitiveType() {
- return this.primitiveType != null;
- }
-
- public EdmPrimitiveTypeKind getPrimitiveTypeKind() {
- return primitiveType;
- }
-
- public boolean isEnumType() {
- return this.enumType != null;
- }
-
- public EdmEnumType getEnumType() {
- return enumType;
- }
-
- public boolean isComplexType() {
- return this.complexType != null;
- }
-
- public EdmComplexType getComplexType() {
- return complexType;
- }
-
- public boolean isEntityType() {
- return this.entityType != null;
- }
-
- public EdmEntityType getEntityType() {
- return entityType;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmActionImportProxy.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmActionImportProxy.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmActionImportProxy.java
index 32429c0..8b7496f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmActionImportProxy.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmActionImportProxy.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.core.edm.v3;
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
import org.apache.olingo.client.core.edm.EdmOperationImportImpl;
-import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmActionImport;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmFunctionImportProxy.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmFunctionImportProxy.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmFunctionImportProxy.java
index 90364a8..9014c4a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmFunctionImportProxy.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmFunctionImportProxy.java
@@ -22,7 +22,7 @@ import java.util.List;
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
import org.apache.olingo.client.core.edm.EdmOperationImportImpl;
-import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmFunction;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java
index c3ff9c4..e21436f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java
@@ -26,13 +26,13 @@ import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
import java.io.IOException;
-import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.core.edm.xml.v4.ReturnTypeImpl;
import org.apache.olingo.client.core.edm.xml.v4.annotation.ConstExprConstructImpl;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
- protected CommonODataClient client;
+ protected ODataServiceVersion version;
protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
return ConstExprConstructImpl.Type.fromString(jp.getCurrentName()) != null;
@@ -52,7 +52,7 @@ public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
returnType.setType(jp.nextTextValue());
} else {
jp.nextToken();
- returnType = jp.readValueAs( ReturnTypeImpl.class);
+ returnType = jp.readValueAs(ReturnTypeImpl.class);
}
return returnType;
}
@@ -64,7 +64,7 @@ public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
public T deserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- client = (CommonODataClient) ctxt.findInjectableValue(CommonODataClient.class.getName(), null, null);
+ version = (ODataServiceVersion) ctxt.findInjectableValue(ODataServiceVersion.class.getName(), null, null);
return doDeserialize(jp, ctxt);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeDeserializer.java
index c9730cb..ea62ba4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeDeserializer.java
@@ -35,7 +35,7 @@ public class ComplexTypeDeserializer extends AbstractEdmDeserializer<AbstractCom
protected AbstractComplexType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractComplexType complexType = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractComplexType complexType = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl()
: new org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
index ef2e201..c94c049 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
@@ -33,7 +33,7 @@ public class DataServicesDeserializer extends AbstractEdmDeserializer<AbstractDa
protected AbstractDataServices doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractDataServices dataServices = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractDataServices dataServices = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.edm.xml.v3.DataServicesImpl()
: new org.apache.olingo.client.core.edm.xml.v4.DataServicesImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
index f617d5b..1e3de6f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
@@ -34,7 +34,7 @@ public class EdmxDeserializer extends AbstractEdmDeserializer<AbstractEdmx> {
protected AbstractEdmx doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractEdmx edmx = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractEdmx edmx = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.edm.xml.v3.EdmxImpl()
: new org.apache.olingo.client.core.edm.xml.v4.EdmxImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerDeserializer.java
index 67735a8..f626365 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerDeserializer.java
@@ -39,7 +39,7 @@ public class EntityContainerDeserializer extends AbstractEdmDeserializer<Abstrac
protected AbstractEntityContainer doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractEntityContainer entityContainer = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractEntityContainer entityContainer = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl()
: new org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetDeserializer.java
index 861ea2f..c71f4de 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetDeserializer.java
@@ -36,7 +36,7 @@ public class EntitySetDeserializer extends AbstractEdmDeserializer<AbstractEntit
protected AbstractEntitySet doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractEntitySet entitySet = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractEntitySet entitySet = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.edm.xml.v3.EntitySetImpl()
: new org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeDeserializer.java
index 8f3c60d..a55a9e0 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeDeserializer.java
@@ -35,7 +35,7 @@ public class EntityTypeDeserializer extends AbstractEdmDeserializer<AbstractEnti
protected AbstractEntityType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractEntityType entityType = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractEntityType entityType = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl()
: new org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeDeserializer.java
index 9c99ea2..7a8f888 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeDeserializer.java
@@ -35,7 +35,7 @@ public class EnumTypeDeserializer extends AbstractEdmDeserializer<AbstractEnumTy
protected AbstractEnumType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractEnumType enumType = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractEnumType enumType = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.edm.xml.v3.EnumTypeImpl()
: new org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
index 2aa3cdd..68baf15 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
@@ -35,7 +35,7 @@ public class ParameterDeserializer extends AbstractEdmDeserializer<AbstractParam
protected AbstractParameter doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractParameter parameter = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractParameter parameter = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.edm.xml.v3.ParameterImpl()
: new org.apache.olingo.client.core.edm.xml.v4.ParameterImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
index 8815e44..4b6c2bd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
@@ -38,7 +38,7 @@ public class PropertyDeserializer extends AbstractEdmDeserializer<AbstractProper
protected AbstractProperty doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractProperty property = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractProperty property = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.edm.xml.v3.PropertyImpl()
: new org.apache.olingo.client.core.edm.xml.v4.PropertyImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaDeserializer.java
index afa0a84..abdfa33 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaDeserializer.java
@@ -41,7 +41,7 @@ public class SchemaDeserializer extends AbstractEdmDeserializer<AbstractSchema>
protected AbstractSchema doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractSchema schema = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractSchema schema = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.edm.xml.v3.SchemaImpl()
: new org.apache.olingo.client.core.edm.xml.v4.SchemaImpl();
@@ -55,11 +55,11 @@ public class SchemaDeserializer extends AbstractEdmDeserializer<AbstractSchema>
} else if ("Using".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getUsings().add(jp.readValueAs( UsingImpl.class));
+ getUsings().add(jp.readValueAs(UsingImpl.class));
} else if ("Association".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getAssociations().add(jp.readValueAs( AssociationImpl.class));
+ getAssociations().add(jp.readValueAs(AssociationImpl.class));
} else if ("ComplexType".equals(jp.getCurrentName())) {
jp.nextToken();
if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
@@ -96,7 +96,7 @@ public class SchemaDeserializer extends AbstractEdmDeserializer<AbstractSchema>
} else if ("ValueTerm".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getValueTerms().add(jp.readValueAs( ValueTermImpl.class));
+ getValueTerms().add(jp.readValueAs(ValueTermImpl.class));
} else if ("EntityContainer".equals(jp.getCurrentName())) {
jp.nextToken();
@@ -105,8 +105,8 @@ public class SchemaDeserializer extends AbstractEdmDeserializer<AbstractSchema>
getEntityContainers().add(jp.readValueAs(
org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl.class));
} else {
- org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl entityContainer
- = jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl entityContainer =
+ jp.readValueAs(
org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl.class);
entityContainer.setDefaultEntityContainer(true);
((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
@@ -126,19 +126,19 @@ public class SchemaDeserializer extends AbstractEdmDeserializer<AbstractSchema>
} else if ("Action".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getActions().
- add(jp.readValueAs( ActionImpl.class));
+ add(jp.readValueAs(ActionImpl.class));
} else if ("Annotation".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotations().
- add(jp.readValueAs( AnnotationImpl.class));
+ add(jp.readValueAs(AnnotationImpl.class));
} else if ("Function".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getFunctions().
- add(jp.readValueAs( FunctionImpl.class));
+ add(jp.readValueAs(FunctionImpl.class));
} else if ("TypeDefinition".equals(jp.getCurrentName())) {
jp.nextToken();
((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
- getTypeDefinitions().add(jp.readValueAs( TypeDefinitionImpl.class));
+ getTypeDefinitions().add(jp.readValueAs(TypeDefinitionImpl.class));
}
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java
index 901b175..2d62a7d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java
@@ -31,10 +31,8 @@ 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.client.api.CommonODataClient;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,19 +40,19 @@ abstract class AbstractJacksonTool {
protected static final Logger LOG = LoggerFactory.getLogger(AbstractJacksonTool.class);
- protected final CommonODataClient client;
+ protected final ODataServiceVersion version;
- protected AbstractJacksonTool(final CommonODataClient client) {
- this.client = client;
+ protected AbstractJacksonTool(final ODataServiceVersion client) {
+ this.version = client;
}
protected ObjectMapper getObjectMapper() {
final ObjectMapper mapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
- mapper.setInjectableValues(new InjectableValues.Std().addValue(CommonODataClient.class, client));
+ mapper.setInjectableValues(new InjectableValues.Std().addValue(ODataServiceVersion.class, version));
mapper.setSerializerProvider(new InjectableSerializerProvider(mapper.getSerializerProvider(),
- mapper.getSerializationConfig().withAttribute(CommonODataClient.class, client),
+ mapper.getSerializationConfig().withAttribute(ODataServiceVersion.class, version),
mapper.getSerializerFactory()));
return mapper;
@@ -64,7 +62,7 @@ abstract class AbstractJacksonTool {
final XmlMapper xmlMapper = new XmlMapper(
new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());
- xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(CommonODataClient.class, client));
+ xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(ODataServiceVersion.class, version));
xmlMapper.addHandler(new DeserializationProblemHandler() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 4e53ce3..d2e9ede 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -23,14 +23,14 @@ import java.net.URI;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
-import org.apache.olingo.client.api.data.Value;
+import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataEntity;
@@ -44,13 +44,13 @@ import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.op.CommonODataBinder;
-import org.apache.olingo.client.core.data.CollectionValueImpl;
-import org.apache.olingo.client.core.data.ComplexValueImpl;
-import org.apache.olingo.client.core.data.GeospatialValueImpl;
-import org.apache.olingo.client.core.data.JSONPropertyImpl;
-import org.apache.olingo.client.core.data.LinkImpl;
-import org.apache.olingo.client.core.data.NullValueImpl;
-import org.apache.olingo.client.core.data.PrimitiveValueImpl;
+import org.apache.olingo.commons.core.data.CollectionValueImpl;
+import org.apache.olingo.commons.core.data.ComplexValueImpl;
+import org.apache.olingo.commons.core.data.GeospatialValueImpl;
+import org.apache.olingo.commons.core.data.JSONPropertyImpl;
+import org.apache.olingo.commons.core.data.LinkImpl;
+import org.apache.olingo.commons.core.data.NullValueImpl;
+import org.apache.olingo.commons.core.data.PrimitiveValueImpl;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
index 0f2ad2b..ed49ca8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
@@ -19,23 +19,23 @@
package org.apache.olingo.client.core.op;
import java.io.InputStream;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.data.Entry;
+import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.op.CommonODataDeserializer;
-import org.apache.olingo.client.core.data.AtomDeserializer;
-import org.apache.olingo.client.core.data.AtomEntryImpl;
-import org.apache.olingo.client.core.data.AtomFeedImpl;
-import org.apache.olingo.client.core.data.AtomPropertyImpl;
-import org.apache.olingo.client.core.data.JSONEntryImpl;
-import org.apache.olingo.client.core.data.JSONErrorBundle;
-import org.apache.olingo.client.core.data.JSONFeedImpl;
-import org.apache.olingo.client.core.data.JSONPropertyImpl;
-import org.apache.olingo.client.core.data.XMLErrorImpl;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.data.AtomDeserializer;
+import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.AtomFeedImpl;
+import org.apache.olingo.commons.core.data.AtomPropertyImpl;
+import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.core.data.JSONErrorBundle;
+import org.apache.olingo.commons.core.data.JSONFeedImpl;
+import org.apache.olingo.commons.core.data.JSONPropertyImpl;
+import org.apache.olingo.commons.core.data.XMLErrorImpl;
public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements CommonODataDeserializer {
@@ -43,10 +43,10 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
private final AtomDeserializer atomDeserializer;
- public AbstractODataDeserializer(final CommonODataClient client) {
- super(client);
+ public AbstractODataDeserializer(final ODataServiceVersion version) {
+ super(version);
- this.atomDeserializer = new AtomDeserializer(client.getServiceVersion());
+ this.atomDeserializer = new AtomDeserializer(version);
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
index abc1070..55b0d57 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -22,7 +22,7 @@ import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
index 7a1a015..c314139 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
@@ -24,21 +24,21 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.ODataSerializer;
-import org.apache.olingo.client.core.data.AtomEntryImpl;
-import org.apache.olingo.client.core.data.AtomFeedImpl;
-import org.apache.olingo.client.core.data.AtomPropertyImpl;
-import org.apache.olingo.client.core.data.AtomSerializer;
-import org.apache.olingo.client.core.data.JSONEntryImpl;
-import org.apache.olingo.client.core.data.JSONFeedImpl;
-import org.apache.olingo.client.core.data.JSONPropertyImpl;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.AtomFeedImpl;
+import org.apache.olingo.commons.core.data.AtomPropertyImpl;
+import org.apache.olingo.commons.core.data.AtomSerializer;
+import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.core.data.JSONFeedImpl;
+import org.apache.olingo.commons.core.data.JSONPropertyImpl;
public abstract class AbstractODataSerializer extends AbstractJacksonTool implements ODataSerializer {
@@ -46,10 +46,10 @@ public abstract class AbstractODataSerializer extends AbstractJacksonTool implem
private final AtomSerializer atomSerializer;
- public AbstractODataSerializer(final CommonODataClient client) {
- super(client);
+ public AbstractODataSerializer(final ODataServiceVersion version) {
+ super(version);
- this.atomSerializer = new AtomSerializer(client.getServiceVersion());
+ this.atomSerializer = new AtomSerializer(version);
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
index a7bf76d..e5e7aa3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
@@ -19,7 +19,6 @@
package org.apache.olingo.client.core.op;
import java.net.URI;
-import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
@@ -32,15 +31,16 @@ import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataObjectFactory;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ODataObjectFactoryImpl implements ODataObjectFactory {
private static final long serialVersionUID = -3769695665946919447L;
- protected final CommonODataClient client;
+ protected final ODataServiceVersion version;
- public ODataObjectFactoryImpl(final CommonODataClient client) {
- this.client = client;
+ public ODataObjectFactoryImpl(final ODataServiceVersion version) {
+ this.version = version;
}
@Override
@@ -69,76 +69,73 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
final ODataEntitySet entitySet) {
- return new ODataInlineEntitySet(client.getServiceVersion(),
- link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ return new ODataInlineEntitySet(version, link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
}
@Override
public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
final ODataEntitySet entitySet) {
- return new ODataInlineEntitySet(client.getServiceVersion(),
- baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ return new ODataInlineEntitySet(version, baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
}
@Override
public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
- return new ODataInlineEntity(client.getServiceVersion(), link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ return new ODataInlineEntity(version, link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
}
@Override
public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
final ODataEntity entity) {
- return new ODataInlineEntity(client.getServiceVersion(),
- baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
}
@Override
public ODataLink newEntityNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
+ return new ODataLink.Builder().setVersion(version).setURI(link).
setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
}
@Override
public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
}
@Override
public ODataLink newFeedNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
+ return new ODataLink.Builder().setVersion(version).setURI(link).
setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
}
@Override
public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
}
@Override
public ODataLink newAssociationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
+ return new ODataLink.Builder().setVersion(version).setURI(link).
setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
}
@Override
public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
}
@Override
public ODataLink newMediaEditLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
+ return new ODataLink.Builder().setVersion(version).setURI(link).
setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
}
@Override
public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
index 8b44e2b..525114e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
@@ -18,16 +18,16 @@
*/
package org.apache.olingo.client.core.op;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.core.data.AtomEntryImpl;
-import org.apache.olingo.client.core.data.AtomFeedImpl;
-import org.apache.olingo.client.core.data.AtomPropertyImpl;
-import org.apache.olingo.client.core.data.JSONEntryImpl;
-import org.apache.olingo.client.core.data.JSONFeedImpl;
-import org.apache.olingo.client.core.data.JSONPropertyImpl;
+import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.AtomFeedImpl;
+import org.apache.olingo.commons.core.data.AtomPropertyImpl;
+import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.core.data.JSONFeedImpl;
+import org.apache.olingo.commons.core.data.JSONPropertyImpl;
public class ResourceFactory {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
index ba9f7c2..3c5f5a4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.op.impl.v3;
-import org.apache.olingo.client.api.data.v3.LinkCollection;
+import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.client.api.op.v3.ODataBinder;
import org.apache.olingo.client.core.op.AbstractODataBinder;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
index 0baf403..9abd8e3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
@@ -21,24 +21,24 @@ package org.apache.olingo.client.core.op.impl.v3;
import java.io.InputStream;
import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.data.v3.LinkCollection;
+import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.v3.ODataDeserializer;
-import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.core.data.v3.JSONLinkCollectionImpl;
-import org.apache.olingo.client.core.data.v3.XMLLinkCollectionImpl;
+import org.apache.olingo.commons.core.data.v3.JSONLinkCollectionImpl;
+import org.apache.olingo.commons.core.data.v3.XMLLinkCollectionImpl;
import org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl;
import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
import org.apache.olingo.client.core.edm.xml.v3.EdmxImpl;
import org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl;
import org.apache.olingo.client.core.op.AbstractODataDeserializer;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ODataDeserializerImpl extends AbstractODataDeserializer implements ODataDeserializer {
private static final long serialVersionUID = -8221085862548914611L;
- public ODataDeserializerImpl(final ODataClient client) {
- super(client);
+ public ODataDeserializerImpl(final ODataServiceVersion version) {
+ super(version);
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
index 14f5a40..d1fa5f0 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
@@ -18,15 +18,15 @@
*/
package org.apache.olingo.client.core.op.impl.v3;
-import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.core.op.AbstractODataSerializer;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ODataSerializerImpl extends AbstractODataSerializer {
private static final long serialVersionUID = -8861908250297989806L;
- public ODataSerializerImpl(final CommonODataClient client) {
- super(client);
+ public ODataSerializerImpl(final ODataServiceVersion version) {
+ super(version);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
index 3b825e2..4147901 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
@@ -24,19 +24,19 @@ import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.v4.ODataDeserializer;
-import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl;
import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
import org.apache.olingo.client.core.edm.xml.v4.EdmxImpl;
import org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl;
import org.apache.olingo.client.core.op.AbstractODataDeserializer;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ODataDeserializerImpl extends AbstractODataDeserializer implements ODataDeserializer {
private static final long serialVersionUID = 8593081342440470415L;
- public ODataDeserializerImpl(final ODataClient client) {
- super(client);
+ public ODataDeserializerImpl(final ODataServiceVersion version) {
+ super(version);
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
index d79b8f8..309ed91 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
@@ -18,15 +18,15 @@
*/
package org.apache.olingo.client.core.op.impl.v4;
-import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.core.op.AbstractODataSerializer;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ODataSerializerImpl extends AbstractODataSerializer {
private static final long serialVersionUID = 7587265188399685309L;
- public ODataSerializerImpl(final CommonODataClient client) {
- super(client);
+ public ODataSerializerImpl(final ODataServiceVersion version) {
+ super(version);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
index 095f8ae..36bb1c2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -32,7 +32,7 @@ import org.apache.commons.codec.binary.Hex;
import org.apache.commons.io.IOUtils;
import org.apache.http.entity.InputStreamEntity;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTime;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
index b7f0c3b..34d7069 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
@@ -56,9 +56,9 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient
private final FilterFactory filterFactory = new FilterFactoryImpl();
- private final ODataDeserializer deserializer = new ODataDeserializerImpl(this);
+ private final ODataDeserializer deserializer = new ODataDeserializerImpl(getServiceVersion());
- private final ODataSerializer serializer = new ODataSerializerImpl(this);
+ private final ODataSerializer serializer = new ODataSerializerImpl(getServiceVersion());
private final ODataReader reader = new ODataReaderImpl(this);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
index 74c439a..ebab41a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
@@ -56,9 +56,9 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient
private final FilterFactory filterFactory = new FilterFactoryImpl();
- private final ODataDeserializer deserializer = new ODataDeserializerImpl(this);
+ private final ODataDeserializer deserializer = new ODataDeserializerImpl(getServiceVersion());
- private final ODataSerializer serializer = new ODataSerializerImpl(this);
+ private final ODataSerializer serializer = new ODataSerializerImpl(getServiceVersion());
private final ODataReader reader = new ODataReaderImpl(this);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
index fe3f098..21d8c5d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
@@ -28,7 +28,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import org.apache.commons.codec.binary.Base64;
-import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.domain.ODataProperty;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/test/java/org/apache/olingo/client/core/AtomLinksQualifier.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AtomLinksQualifier.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AtomLinksQualifier.java
index 94aab69..2e6eedf 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AtomLinksQualifier.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AtomLinksQualifier.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core;
-import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.Constants;
import org.custommonkey.xmlunit.ElementNameQualifier;
import org.w3c.dom.Element;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index 5e7ea2f..9b4bd39 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -50,8 +50,8 @@ import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataEntity;
@@ -65,8 +65,8 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.client.core.data.AtomEntryImpl;
-import org.apache.olingo.client.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.JSONEntryImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.BeforeClass;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
index d34da88..548edd2 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
@@ -28,14 +28,14 @@ import java.util.List;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.data.Entry;
+import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.uri.v3.URIBuilder.InlineCount;
-import org.apache.olingo.client.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.AtomEntryImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
index d57c561..c3b1552 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
@@ -29,7 +29,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
new file mode 100644
index 0000000..b4c048f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+
+/**
+ * Constant values related to the OData protocol.
+ */
+public interface Constants {
+
+ // Other stuff
+ public final static String UTF8 = "UTF-8";
+
+ public final static String METADATA = "$metadata";
+
+ public final static Integer DEFAULT_PRECISION = 40;
+
+ public final static Integer DEFAULT_SCALE = 25;
+
+ // 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 PREFIX_DATASERVICES = "d";
+
+ public static final String PREFIX_METADATA = "m";
+
+ public static final String PREFIX_GEORSS = "georss";
+
+ public static final String PREFIX_GML = "gml";
+
+ public final static String SRS_URLPREFIX = "http://www.opengis.net/def/crs/EPSG/0/";
+
+ // Link rel(s)
+ public static final String EDIT_LINK_REL = "edit";
+
+ public static final String SELF_LINK_REL = "self";
+
+ public static final String NEXT_LINK_REL = "next";
+
+ // XML elements and attributes
+ public static final String PROPERTIES = "properties";
+
+ public static final String ELEM_ELEMENT = "element";
+
+ public final static String ATTR_TYPE = "type";
+
+ public final static String ATTR_NULL = "null";
+
+ public static final String ATTR_XML_BASE = "base";
+
+ public static final QName QNAME_ATTR_XML_BASE = new QName(XMLConstants.XML_NS_URI, ATTR_XML_BASE);
+
+ public static final String ATTR_REL = "rel";
+
+ public static final String ATTR_TITLE = "title";
+
+ public static final String ATTR_METADATA = "metadata";
+
+ public static final String ATTR_HREF = "href";
+
+ public static final String ATTR_TARGET = "target";
+
+ public static final String ATTR_SRSNAME = "srsName";
+
+ public static final QName QNAME_ATTR_SRSNAME = new QName(NS_GML, ATTR_SRSNAME);
+
+ public static final String ELEM_POINT = "Point";
+
+ public static final String ELEM_MULTIPOINT = "MultiPoint";
+
+ public static final String ELEM_POINTMEMBERS = "pointMembers";
+
+ public static final QName QNAME_POINTMEMBERS = new QName(NS_GML, ELEM_POINTMEMBERS);
+
+ public static final String ELEM_LINESTRING = "LineString";
+
+ public static final QName QNAME_LINESTRING = new QName(NS_GML, ELEM_LINESTRING);
+
+ public static final String ELEM_MULTILINESTRING = "MultiCurve";
+
+ public static final String ELEM_LINESTRINGMEMBERS = "curveMembers";
+
+ public static final String ELEM_POLYGON = "Polygon";
+
+ public static final QName QNAME_POLYGON = new QName(NS_GML, ELEM_POLYGON);
+
+ public static final String ELEM_POLYGON_EXTERIOR = "exterior";
+
+ public static final QName QNAME_POLYGON_EXTERIOR = new QName(NS_GML, ELEM_POLYGON_EXTERIOR);
+
+ public static final String ELEM_POLYGON_INTERIOR = "interior";
+
+ public static final QName QNAME_POLYGON_INTERIOR = new QName(NS_GML, ELEM_POLYGON_INTERIOR);
+
+ public static final String ELEM_POLYGON_LINEARRING = "LinearRing";
+
+ public static final String ELEM_MULTIPOLYGON = "MultiSurface";
+
+ public static final String ELEM_SURFACEMEMBERS = "surfaceMembers";
+
+ public static final String ELEM_GEOCOLLECTION = "MultiGeometry";
+
+ public static final String ELEM_GEOMEMBERS = "geometryMembers";
+
+ public static final QName QNAME_GEOMEMBERS = new QName(NS_GML, ELEM_GEOMEMBERS);
+
+ public static final String ELEM_POS = "pos";
+
+ public static final String ELEM_PROPERTY = "property";
+
+ public static final String ELEM_LINKS = "links";
+
+ public static final String ELEM_URI = "uri";
+
+ // JSON stuff
+ public final static String JSON_CONTEXT = "@odata.context";
+
+ public final static String JSON_METADATA = "odata.metadata";
+
+ public final static String JSON_TYPE = "odata.type";
+
+ public final static String JSON_TYPE_SUFFIX = "@" + JSON_TYPE;
+
+ public final static String JSON_ETAG = "odata.etag";
+
+ public final static String JSON_MEDIA_ETAG = "odata.mediaETag";
+
+ public final static String JSON_MEDIA_ETAG_SUFFIX = "@" + JSON_MEDIA_ETAG;
+
+ 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_MEDIAEDIT_LINK_SUFFIX = "@" + JSON_MEDIAEDIT_LINK;
+
+ public final static String JSON_MEDIA_CONTENT_TYPE = "odata.mediaContentType";
+
+ public final static String JSON_MEDIA_CONTENT_TYPE_SUFFIX = "@" + JSON_MEDIA_CONTENT_TYPE;
+
+ 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_NULL = "odata.null";
+
+ 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_COUNT = "odata.count";
+
+ public final static String JSON_NEXT_LINK = "odata.nextLink";
+
+ public final static String JSON_NAME = "name";
+
+ // Atom stuff
+ public final static String ATOM_ELEM_ENTRY = "entry";
+
+ public static final QName QNAME_ATOM_ELEM_ENTRY = new QName(NS_ATOM, ATOM_ELEM_ENTRY);
+
+ public final static String ATOM_ELEM_FEED = "feed";
+
+ public static final QName QNAME_ATOM_ELEM_FEED = new QName(NS_ATOM, ATOM_ELEM_FEED);
+
+ public final static String ATOM_ELEM_CATEGORY = "category";
+
+ public static final QName QNAME_ATOM_ELEM_CATEGORY = new QName(NS_ATOM, ATOM_ELEM_CATEGORY);
+
+ public static final String ATOM_ELEM_COUNT = "count";
+
+ public final static String ATOM_ELEM_ID = "id";
+
+ public static final QName QNAME_ATOM_ELEM_ID = new QName(NS_ATOM, ATOM_ELEM_ID);
+
+ public static final String ATOM_ELEM_TITLE = "title";
+
+ public static final QName QNAME_ATOM_ELEM_TITLE = new QName(NS_ATOM, ATOM_ELEM_TITLE);
+
+ public static final String ATOM_ELEM_SUMMARY = "summary";
+
+ public static final QName QNAME_ATOM_ELEM_SUMMARY = new QName(NS_ATOM, ATOM_ELEM_SUMMARY);
+
+ public static final String ATOM_ELEM_UPDATED = "updated";
+
+ public static final QName QNAME_ATOM_ELEM_UPDATED = new QName(NS_ATOM, ATOM_ELEM_UPDATED);
+
+ public final static String ATOM_ELEM_LINK = "link";
+
+ public static final QName QNAME_ATOM_ELEM_LINK = new QName(NS_ATOM, ATOM_ELEM_LINK);
+
+ public final static String ATOM_ELEM_CONTENT = "content";
+
+ public static final QName QNAME_ATOM_ELEM_CONTENT = new QName(NS_ATOM, ATOM_ELEM_CONTENT);
+
+ public static final String ATOM_ELEM_ACTION = "action";
+
+ public static final String ATOM_ELEM_INLINE = "inline";
+
+ 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 = "etag";
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/CollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/CollectionValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/CollectionValue.java
new file mode 100644
index 0000000..0d55671
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/CollectionValue.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.commons.api.data;
+
+import java.util.List;
+
+public interface CollectionValue extends Value {
+
+ @Override
+ List<Value> get();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ComplexValue.java
new file mode 100644
index 0000000..67a2f04
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ComplexValue.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.commons.api.data;
+
+import java.util.List;
+
+public interface ComplexValue extends Value {
+
+ @Override
+ List<Property> get();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
new file mode 100644
index 0000000..ea73b7d
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.data;
+
+import org.apache.olingo.commons.api.domain.ODataOperation;
+import java.net.URI;
+import java.util.List;
+
+public interface Entry {
+
+ /**
+ * Gets ETag.
+ *
+ * @return ETag.
+ */
+ String getETag();
+
+ /**
+ * Gets base URI.
+ *
+ * @return base URI.
+ */
+ URI getBaseURI();
+
+ /**
+ * Gets entry type.
+ *
+ * @return entry type.
+ */
+ String getType();
+
+ /**
+ * Sets entry type.
+ *
+ * @param type entry type.
+ */
+ void setType(String type);
+
+ /**
+ * Gest entry ID.
+ *
+ * @return entry ID.
+ */
+ String getId();
+
+ /**
+ * Gets entry self link.
+ *
+ * @return self link.
+ */
+ Link getSelfLink();
+
+ /**
+ * Sets entry self link.
+ *
+ * @param selfLink self link.
+ */
+ void setSelfLink(Link selfLink);
+
+ /**
+ * Gets entry edit link.
+ *
+ * @return edit link.
+ */
+ Link getEditLink();
+
+ /**
+ * Sets entry edit link.
+ *
+ * @param editLink edit link.
+ */
+ void setEditLink(Link editLink);
+
+ /**
+ * Gets association links.
+ *
+ * @return association links.
+ */
+ List<Link> getAssociationLinks();
+
+ /**
+ * Gets navigation links.
+ *
+ * @return links.
+ */
+ List<Link> getNavigationLinks();
+
+ /**
+ * Gets media entity links.
+ *
+ * @return links.
+ */
+ List<Link> getMediaEditLinks();
+
+ /**
+ * Gets operations.
+ *
+ * @return operations.
+ */
+ List<ODataOperation> getOperations();
+
+ /**
+ * Gets properties.
+ *
+ * @return properties.
+ */
+ List<Property> getProperties();
+
+ /**
+ * Gets property with given name.
+ *
+ * @param name property name
+ * @return property with given name if found, null otherwise
+ */
+ Property getProperty(String name);
+
+ /**
+ * Gets media content type.
+ *
+ * @return media content type.
+ */
+ String getMediaContentType();
+
+ /**
+ * Gets media content resource.
+ *
+ * @return media content resource.
+ */
+ String getMediaContentSource();
+
+ /**
+ * Set media content source.
+ *
+ * @param mediaContentSource media content source.
+ */
+ void setMediaContentSource(String mediaContentSource);
+
+ /**
+ * Set media content type.
+ *
+ * @param mediaContentType media content type.
+ */
+ void setMediaContentType(String mediaContentType);
+
+ /**
+ * Checks if the current entry is a media entry.
+ *
+ * @return 'TRUE' if is a media entry; 'FALSE' otherwise.
+ */
+ boolean isMediaEntry();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java
new file mode 100644
index 0000000..4e98ac6
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.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.commons.api.data;
+
+import java.net.URI;
+import java.util.List;
+
+public interface Feed {
+
+ /**
+ * Gets base URI.
+ *
+ * @return base URI.
+ */
+ URI getBaseURI();
+
+ /**
+ * Sets number of entries.
+ *
+ * @param count number of entries
+ */
+ void setCount(Integer count);
+
+ /**
+ * Gets number of entries - if it was required.
+ *
+ * @return number of entries into the feed.
+ */
+ Integer getCount();
+
+ /**
+ * Gest feed ID.
+ *
+ * @return feed ID.
+ */
+ String getId();
+
+ /**
+ * Gets entries.
+ *
+ * @return entries.
+ */
+ List<Entry> getEntries();
+
+ /**
+ * Gets next link if exists.
+ *
+ * @return next link if exists; null otherwise.
+ */
+ URI getNext();
+
+ /**
+ * Sets next link.
+ *
+ * @param next next link.
+ */
+ void setNext(URI next);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java
new file mode 100644
index 0000000..fa7538d
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.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.commons.api.data;
+
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+
+public final class GeoUtils {
+
+ private GeoUtils() {
+ // Empty private constructor for static utility classes
+ }
+
+ public static Geospatial.Dimension getDimension(final EdmPrimitiveTypeKind type) {
+ Geospatial.Dimension dimension;
+
+ switch (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;
+ }
+
+ public static EdmPrimitiveTypeKind getType(final Geospatial.Dimension dimension, final String elementName) {
+ EdmPrimitiveTypeKind type = null;
+
+ if (Constants.ELEM_POINT.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyPoint
+ : EdmPrimitiveTypeKind.GeometryPoint;
+ } else if (Constants.ELEM_MULTIPOINT.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyMultiPoint
+ : EdmPrimitiveTypeKind.GeometryMultiPoint;
+ } else if (Constants.ELEM_LINESTRING.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyLineString
+ : EdmPrimitiveTypeKind.GeometryLineString;
+ } else if (Constants.ELEM_MULTILINESTRING.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyMultiLineString
+ : EdmPrimitiveTypeKind.GeometryMultiLineString;
+ } else if (Constants.ELEM_POLYGON.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyPolygon
+ : EdmPrimitiveTypeKind.GeometryPolygon;
+ } else if (Constants.ELEM_MULTIPOLYGON.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyMultiPolygon
+ : EdmPrimitiveTypeKind.GeometryMultiPolygon;
+ } else if (Constants.ELEM_GEOCOLLECTION.equals(elementName)
+ || Constants.ELEM_GEOMEMBERS.equals(elementName)) {
+
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyCollection
+ : EdmPrimitiveTypeKind.GeometryCollection;
+ }
+
+ return type;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeospatialValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeospatialValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeospatialValue.java
new file mode 100644
index 0000000..08dcf4b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeospatialValue.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.commons.api.data;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+
+public interface GeospatialValue extends Value {
+
+ @Override
+ Geospatial get();
+
+}
[51/52] [abbrv] git commit: More test encoding to UTF-8
Posted by sk...@apache.org.
More test encoding to UTF-8
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/4a19c8db
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/4a19c8db
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/4a19c8db
Branch: refs/heads/olingo-206-validator
Commit: 4a19c8dbc5c6afa64153ff3ba9e82b431c87c5ab
Parents: 81da510
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 24 13:00:42 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 24 13:00:42 2014 +0100
----------------------------------------------------------------------
pom.xml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a19c8db/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 82a3967..6b0668b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -301,8 +301,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
- <encoding>utf-8</encoding>
<runOrder>alphabetical</runOrder>
+ <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
+ <outputEncoding>UTF-8</outputEncoding>
+ <argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
<plugin>
[20/52] [abbrv] git commit: [OLINGO-65] Implementation completed
Posted by sk...@apache.org.
[OLINGO-65] Implementation completed
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/4780fc51
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/4780fc51
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/4780fc51
Branch: refs/heads/olingo-206-validator
Commit: 4780fc513b5f85ae6a6aa0615fdde0e258caa4f5
Parents: 130a49f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 22 16:12:31 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 22 16:12:31 2014 +0100
----------------------------------------------------------------------
.../EdmSingleSet/3.4028235E38f/entity.full.json | 2 +-
.../v3/EdmSingleSet/3.4028235E38f/entity.xml | 8 +-
.../olingo/client/api/CommonODataClient.java | 2 +-
.../request/retrieve/ODataValueRequest.java | 4 +-
.../response/ODataValueUpdateResponse.java | 4 +-
.../client/api/domain/AbstractODataValue.java | 127 ++++++
.../client/api/domain/ODataCollectionValue.java | 4 +-
.../client/api/domain/ODataComplexValue.java | 6 +-
.../olingo/client/api/domain/ODataDuration.java | 79 ----
.../client/api/domain/ODataGeospatialValue.java | 92 +---
.../olingo/client/api/domain/ODataLink.java | 29 +-
.../client/api/domain/ODataObjectFactory.java | 20 +-
.../client/api/domain/ODataPrimitiveValue.java | 415 +------------------
.../olingo/client/api/domain/ODataProperty.java | 18 +
.../client/api/domain/ODataTimestamp.java | 147 -------
.../olingo/client/api/domain/ODataValue.java | 65 +--
.../olingo/client/api/utils/URIUtils.java | 196 ---------
.../olingo/client/core/AbstractODataClient.java | 12 +-
.../cud/ODataEntityCreateRequestImpl.java | 2 +-
.../cud/ODataEntityUpdateRequestImpl.java | 2 +-
.../request/cud/ODataLinkCreateRequestImpl.java | 2 +-
.../request/cud/ODataLinkUpdateRequestImpl.java | 2 +-
.../cud/ODataPropertyUpdateRequestImpl.java | 2 +-
.../cud/ODataValueUpdateRequestImpl.java | 17 +-
.../request/invoke/ODataInvokeRequestImpl.java | 2 +-
.../invoke/v3/InvokeRequestFactoryImpl.java | 1 +
.../request/retrieve/ODataValueRequestImpl.java | 15 +-
.../streamed/AbstractODataStreamedRequest.java | 2 +-
.../core/data/AtomGeoValueSerializer.java | 4 +-
.../core/data/AtomPropertyDeserializer.java | 10 +-
.../core/domain/ODataGeospatialValueImpl.java | 130 ++++++
.../core/domain/ODataPrimitiveValueImpl.java | 174 ++++++++
.../core/op/impl/AbstractODataBinder.java | 27 +-
.../core/op/impl/ODataObjectFactoryImpl.java | 145 +------
.../client/core/op/impl/v4/ODataBinderImpl.java | 2 +-
.../client/core/uri/AbstractURIBuilder.java | 1 -
.../olingo/client/core/uri/FilterLiteral.java | 1 -
.../apache/olingo/client/core/uri/URIUtils.java | 202 +++++++++
.../client/core/uri/v3/URIBuilderImpl.java | 2 +-
.../client/core/AbstractPrimitiveTest.java | 156 ++++---
.../client/core/AbstractPropertyTest.java | 16 +-
.../client/core/it/AbstractTestITCase.java | 6 +-
.../client/core/it/v3/AsyncTestITCase.java | 9 +-
.../client/core/it/v3/CountTestITCase.java | 52 ++-
.../core/it/v3/EntityCreateTestITCase.java | 29 +-
.../core/it/v3/EntityRetrieveTestITCase.java | 9 +-
.../client/core/it/v3/EntitySetTestITCase.java | 2 +-
.../core/it/v3/EntityUpdateTestITCase.java | 25 +-
.../client/core/it/v3/ErrorTestITCase.java | 2 +-
.../core/it/v3/MediaEntityTestITCase.java | 2 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 15 +-
.../client/core/it/v3/OpenTypeTestITCase.java | 76 ++--
.../core/it/v3/PrimitiveKeysTestITCase.java | 13 +-
.../client/core/it/v3/PropertyTestITCase.java | 30 +-
.../core/it/v3/QueryOptionsTestITCase.java | 11 +-
.../olingo/client/core/v3/EntityTest.java | 10 +-
.../client/core/v3/PrimitiveValueTest.java | 176 ++++----
.../client/core/v4/PrimitiveValueTest.java | 61 ++-
58 files changed, 1177 insertions(+), 1498 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.full.json b/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.full.json
index 468dd3b..61537ff 100644
--- a/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.full.json
+++ b/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.full.json
@@ -1 +1 @@
-{"odata.metadata":"http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#EdmSingleSet/@Element","Id":3.40282347E+38}
\ No newline at end of file
+{"odata.metadata":"http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#EdmSingleSet/@Element","Id":3.4028235E+38}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.xml b/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.xml
index 420d5cd..0dc282f 100644
--- a/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.xml
+++ b/fit/src/main/resources/v3/EdmSingleSet/3.4028235E38f/entity.xml
@@ -20,9 +20,9 @@
-->
<entry xml:base="http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
- <id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/EdmSingleSet(3.40282347E%2B38f)</id>
+ <id>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/EdmSingleSet(3.4028235E%2B38f)</id>
<category term="Microsoft.Test.OData.Services.PrimitiveKeysService.EdmSingle" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link rel="edit" title="EdmSingle" href="EdmSingleSet(3.40282347E%2B38f)" />
+ <link rel="edit" title="EdmSingle" href="EdmSingleSet(3.4028235E%2B38f)" />
<title />
<updated>2014-02-12T15:20:45Z</updated>
<author>
@@ -30,7 +30,7 @@
</author>
<content type="application/xml">
<m:properties>
- <d:Id m:type="Edm.Single">3.40282347E+38</d:Id>
+ <d:Id m:type="Edm.Single">3.4028235E+38</d:Id>
</m:properties>
</content>
-</entry>
\ No newline at end of file
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
index 1ad480a..6c44360 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
@@ -24,8 +24,8 @@ import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFa
import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
import org.apache.olingo.client.api.domain.ODataObjectFactory;
+import org.apache.olingo.client.api.domain.ODataGeospatialValue;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.op.CommonODataBinder;
import org.apache.olingo.client.api.op.CommonODataDeserializer;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
index d125c65..e731dfe 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
@@ -18,11 +18,11 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.format.ODataValueFormat;
/**
* This class implements an OData entity property value query request.
*/
-public interface ODataValueRequest extends ODataRetrieveRequest<ODataValue, ODataValueFormat> {
+public interface ODataValueRequest extends ODataRetrieveRequest<ODataPrimitiveValue, ODataValueFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
index 5a7aaae..9d8855b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
/**
* This class implements the response to an OData update entity property request.
@@ -32,5 +32,5 @@ public interface ODataValueUpdateResponse extends ODataResponse {
*
* @return updated object.
*/
- ODataValue getBody();
+ ODataPrimitiveValue getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java
new file mode 100644
index 0000000..37ca0da
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.domain;
+
+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 AbstractODataValue implements ODataValue {
+
+ private static final long serialVersionUID = 7445422004232581877L;
+
+ /**
+ * Check is is a primitive value.
+ *
+ * @return 'TRUE' if primitive; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isPrimitive() {
+ return (this instanceof ODataPrimitiveValue);
+ }
+
+ /**
+ * Casts to primitive value.
+ *
+ * @return primitive value.
+ */
+ @Override
+ public ODataPrimitiveValue asPrimitive() {
+ return isPrimitive() ? (ODataPrimitiveValue) this : null;
+ }
+
+ /**
+ * Check is is a geospatail value.
+ *
+ * @return 'TRUE' if geospatail; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isGeospatial() {
+ return (this instanceof ODataGeospatialValue);
+ }
+
+ /**
+ * Casts to geospatail value.
+ *
+ * @return geospatail value.
+ */
+ @Override
+ public ODataGeospatialValue asGeospatial() {
+ return isGeospatial() ? (ODataGeospatialValue) this : null;
+ }
+
+ /**
+ * Check is is a complex value.
+ *
+ * @return 'TRUE' if complex; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isComplex() {
+ return (this instanceof ODataComplexValue);
+ }
+
+ /**
+ * Casts to complex value.
+ *
+ * @return complex value.
+ */
+ @Override
+ public ODataComplexValue asComplex() {
+ return isComplex() ? (ODataComplexValue) this : null;
+ }
+
+ /**
+ * Check is is a collection value.
+ *
+ * @return 'TRUE' if collection; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isCollection() {
+ return (this instanceof ODataCollectionValue);
+ }
+
+ /**
+ * Casts to collection value.
+ *
+ * @return collection value.
+ */
+ @Override
+ public ODataCollectionValue asCollection() {
+ return isCollection() ? (ODataCollectionValue) this : null;
+ }
+
+ @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/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java
index afe46b7..df743df 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java
@@ -25,7 +25,7 @@ import java.util.List;
/**
* OData collection property value.
*/
-public class ODataCollectionValue extends ODataValue implements Iterable<ODataValue> {
+public class ODataCollectionValue extends AbstractODataValue implements Iterable<ODataValue> {
private static final long serialVersionUID = -3665659846001987187L;
@@ -74,7 +74,7 @@ public class ODataCollectionValue extends ODataValue implements Iterable<ODataVa
*
* @return value type name.
*/
- public String getTypeName() {
+ public String getType() {
return typeName;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java
index 2e15c8b..d9b8a24 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java
@@ -25,7 +25,7 @@ import java.util.Map;
/**
* OData complex property value.
*/
-public class ODataComplexValue extends ODataValue implements Iterable<ODataProperty> {
+public class ODataComplexValue extends AbstractODataValue implements Iterable<ODataProperty> {
private static final long serialVersionUID = -1878555027714020431L;
@@ -42,7 +42,7 @@ public class ODataComplexValue extends ODataValue implements Iterable<ODataPrope
/**
* Constructor.
*
- * @param typeName type name.
+ * @param type type name.
*/
public ODataComplexValue(final String typeName) {
this.typeName = typeName;
@@ -82,7 +82,7 @@ public class ODataComplexValue extends ODataValue implements Iterable<ODataPrope
*
* @return value type name.
*/
- public String getTypeName() {
+ public String getType() {
return typeName;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataDuration.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataDuration.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataDuration.java
deleted file mode 100644
index 2d3b1b2..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataDuration.java
+++ /dev/null
@@ -1,79 +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.client.api.domain;
-
-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 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/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
index bd96587..af1c545 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
@@ -18,92 +18,40 @@
*/
package org.apache.olingo.client.api.domain;
-import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.commons.api.edm.EdmGeospatialType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
-public class ODataGeospatialValue extends ODataPrimitiveValue {
+public interface ODataGeospatialValue extends ODataValue {
- private static final long serialVersionUID = -3984105137562291082L;
+ interface Builder {
- /**
- * Geospatial value builder.
- */
- public static class Builder extends AbstractBuilder {
-
- private final ODataGeospatialValue ogv;
+ Builder setType(EdmPrimitiveTypeKind type);
- /**
- * Constructor.
- */
- public Builder(final CommonODataClient client) {
- super(client);
- this.ogv = new ODataGeospatialValue(client);
- }
+ Builder setValue(Geospatial value);
- /**
- * 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;
- }
+ ODataGeospatialValue build();
- /**
- * Sets actual value type.
- *
- * @param type type.
- * @return the current builder.
- */
- public Builder setType(final EdmPrimitiveTypeKind type) {
- isSupported(type);
-
- if (type != null && !type.isGeospatial()) {
- throw new IllegalArgumentException(
- "Use " + ODataPrimitiveValue.class.getSimpleName() + " for non-geospatial types");
- }
+ }
- if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.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;
- }
+ EdmPrimitiveTypeKind getTypeKind();
- /**
- * Builds the geospatial value.
- *
- * @return <tt>ODataGeospatialValue</tt> object.
- */
- public ODataGeospatialValue build() {
- if (this.ogv.value == null) {
- throw new IllegalArgumentException("No Geospatial value provided");
- }
- if (this.ogv.type == null) {
- this.ogv.type = ((Geospatial) this.ogv.value).getEdmPrimitiveTypeKind();
- }
+ EdmGeospatialType getType();
- return this.ogv;
- }
- }
+ /**
+ * Returns the current geospatial value.
+ *
+ * @return the current geospatial value.
+ */
+ Geospatial toValue();
/**
- * Protected constructor, need to use the builder to instantiate this class.
+ * Returns the current value casted to the given type.
*
- * @see Builder
+ * @param <T> cast type
+ * @param reference class reference
+ * @return the current value as typed java instance
*/
- protected ODataGeospatialValue(final CommonODataClient client) {
- super(client);
- }
+ <T extends Geospatial> T toCastValue(Class<T> reference);
- public Geospatial getGeospatial() {
- return (Geospatial) this.value;
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java
index 67746dc..11005a7 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java
@@ -19,7 +19,6 @@
package org.apache.olingo.client.api.domain;
import java.net.URI;
-import org.apache.olingo.client.api.utils.URIUtils;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
@@ -52,7 +51,7 @@ public class ODataLink extends ODataItem {
}
public Builder setURI(final URI baseURI, final String href) {
- this.uri = URIUtils.getURI(baseURI, href);
+ this.uri = getURI(baseURI, href);
return this;
}
@@ -76,6 +75,30 @@ public class ODataLink extends ODataItem {
return instance;
}
}
+
+ /**
+ * Build URI starting from the given base and href.
+ * <br/>
+ * If href is absolute or base is null then base will be ignored.
+ *
+ * @param base URI prefix.
+ * @param href URI suffix.
+ * @return built URI.
+ */
+ private static URI getURI(final URI base, final String href) {
+ if (href == null) {
+ throw new IllegalArgumentException("Null link provided");
+ }
+
+ URI uri = URI.create(href);
+
+ if (!uri.isAbsolute() && base != null) {
+ uri = URI.create(base.toASCIIString() + "/" + href);
+ }
+
+ return uri.normalize();
+ }
+
/**
* Link type.
*/
@@ -134,7 +157,7 @@ public class ODataLink extends ODataItem {
protected ODataLink(final ODataServiceVersion version,
final URI baseURI, final String href, final ODataLinkType type, final String title) {
- this(version, URIUtils.getURI(baseURI, href), type, title);
+ this(version, getURI(baseURI, href), type, title);
}
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java
index 7ba039d..ddafea4 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java
@@ -19,15 +19,6 @@
package org.apache.olingo.client.api.domain;
import java.net.URI;
-import org.apache.olingo.client.api.domain.ODataCollectionValue;
-import org.apache.olingo.client.api.domain.ODataComplexValue;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInlineEntity;
-import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataProperty;
/**
* Entry point for generating OData domain objects.
@@ -193,12 +184,21 @@ public interface ODataObjectFactory {
* Instantiates a new primitive property.
*
* @param name name.
- * @param value value.
+ * @param value primitive value.
* @return primitive property.
*/
ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
/**
+ * Instantiates a new primitive property.
+ *
+ * @param name name.
+ * @param value geospatial value.
+ * @return primitive property.
+ */
+ ODataProperty newPrimitiveProperty(String name, ODataGeospatialValue value);
+
+ /**
* Instantiates a new complex property.
*
* @param name name.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
index 21d8562..a615eed 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
@@ -18,419 +18,50 @@
*/
package org.apache.olingo.client.api.domain;
-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.olingo.client.api.CommonODataClient;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-/**
- * OData primitive property value.
- */
-public class ODataPrimitiveValue extends ODataValue {
-
- private static final long serialVersionUID = 2841837627899878223L;
+public interface ODataPrimitiveValue extends ODataValue {
- protected abstract static class AbstractBuilder {
+ interface Builder {
- private final CommonODataClient client;
+ Builder setType(EdmPrimitiveTypeKind type);
- /**
- * Constructor.
- */
- public AbstractBuilder(final CommonODataClient client) {
- this.client = client;
- }
+ Builder setText(String text);
- public AbstractBuilder isSupported(final EdmPrimitiveTypeKind type) {
- if (type != null && !type.getSupportedVersions().contains(client.getServiceVersion())) {
- throw new IllegalArgumentException(String.format(
- "Type %s not supported by the current OData working version", type.toString()));
- }
+ Builder setValue(Object value);
- return this;
- }
+ ODataPrimitiveValue build();
}
- /**
- * Primitive value builder.
- */
- public static class Builder extends AbstractBuilder {
-
- private final ODataPrimitiveValue opv;
-
- /**
- * Constructor.
- */
- public Builder(final CommonODataClient 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 EdmPrimitiveTypeKind type) {
- isSupported(type);
-
- if (type == EdmPrimitiveTypeKind.Stream) {
- throw new IllegalArgumentException(String.format(
- "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
- }
-
- this.opv.type = type;
- return this;
- }
+ EdmPrimitiveTypeKind getTypeKind();
- /**
- * 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 = EdmPrimitiveTypeKind.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.getJavaType().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 CommonODataClient client;
-
- /**
- * Text value.
- */
- private String text;
+ EdmPrimitiveType getType();
/**
- * Actual value.
- */
- protected Object value;
-
- /**
- * Value type.
- */
- protected EdmPrimitiveTypeKind type;
-
- /**
- * Protected constructor, need to use the builder to instantiate this class.
+ * Returns the current value as generic Object.
*
- * @see Builder
+ * @return an uncasted instance of this value
*/
- protected ODataPrimitiveValue(final CommonODataClient client) {
- super();
- this.client = client;
- }
-
- private Class<?> getJavaType() {
- Class<?> javaType = null;
-
- switch (this.type) {
- case Binary:
- javaType = byte[].class;
- break;
-
- case SByte:
- javaType = Byte.class;
- break;
-
- case Boolean:
- javaType = Boolean.class;
- break;
-
- case Date:
- case DateTime:
- case DateTimeOffset:
- javaType = ODataTimestamp.class;
- break;
-
- case Time:
- case TimeOfDay:
- javaType = ODataDuration.class;
- break;
-
- case Decimal:
- javaType = BigDecimal.class;
- break;
-
- case Single:
- javaType = Float.class;
- break;
-
- case Double:
- javaType = Double.class;
- break;
-
- case Guid:
- javaType = UUID.class;
- break;
-
- case Int16:
- javaType = Short.class;
- break;
-
- case Byte:
- case Int32:
- javaType = Integer.class;
- break;
-
- case Int64:
- javaType = Long.class;
- break;
-
- case Stream:
- javaType = URI.class;
- break;
-
- case String:
- javaType = String.class;
- break;
-
- default:
- javaType = this.value.getClass();
- }
-
- return javaType;
- }
+ Object toValue();
/**
- * Parses given text as object value.
- */
- private void parseText() {
- switch (this.type) {
- 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 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("#.#######################").format(this.<BigDecimal>toCastValue());
- break;
-
- case Single:
- this.text = new DecimalFormat("#.#######E0").format(this.<Float>toCastValue());
- break;
-
- case Double:
- this.text = new DecimalFormat("#.#######################E0").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.
+ * Returns the current value casted to the given type.
*
- * @return type name.
+ * @param <T> cast type
+ * @param reference class reference
+ * @return the current value as typed java instance
+ * @throws EdmPrimitiveTypeException if the object is not assignable to the type T.
*/
- public String getTypeName() {
- return type.getFullQualifiedName().toString();
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public String toString() {
- return this.text;
- }
+ <T> T toCastValue(Class<T> reference) throws EdmPrimitiveTypeException;
/**
- * Gets actual primitive value.
+ * Serialize the current value as String.
*
- * @return
+ * @return a String representation of this value
*/
- public Object toValue() {
- return this.value;
- }
+ @Override
+ String toString();
- /**
- * Casts primitive value.
- *
- * @param <T> cast.
- * @return casted value.
- */
- @SuppressWarnings("unchecked")
- public <T> T toCastValue() {
- return (T) getJavaType().cast(toValue());
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java
index 04350cf..440b461 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java
@@ -107,6 +107,24 @@ public class ODataProperty implements Serializable, ODataInvokeResult {
}
/**
+ * Checks if has geospatial value.
+ *
+ * @return 'TRUE' if has geospatial value; 'FALSE' otherwise.
+ */
+ public boolean hasGeospatialValue() {
+ return !hasNullValue() && this.value.isGeospatial();
+ }
+
+ /**
+ * Gets geospatial value.
+ *
+ * @return geospatial value if exists; null otherwise.
+ */
+ public ODataGeospatialValue getGeospatialValue() {
+ return hasGeospatialValue() ? this.value.asGeospatial() : null;
+ }
+
+ /**
* Checks if has complex value.
*
* @return 'TRUE' if has complex value; 'FALSE' otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
deleted file mode 100644
index 3f3eb9c..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
+++ /dev/null
@@ -1,147 +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.client.api.domain;
-
-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;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-
-/**
- * Helper class for handling datetime and datetime-offset primitive values.
- */
-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;
-
- private static String getPattern(final EdmPrimitiveTypeKind type) {
- return type == EdmPrimitiveTypeKind.DateTime
- ? "yyyy-MM-dd'T'HH:mm:ss"
- : type == EdmPrimitiveTypeKind.Date
- ? "yyyy-MM-dd"
- : "yyyy-MM-dd'T'HH:mm:ss";
- }
-
- public static ODataTimestamp getInstance(final EdmPrimitiveTypeKind type, final Timestamp timestamp) {
- return new ODataTimestamp(new SimpleDateFormat(getPattern(type)),
- new Date(timestamp.getTime()), timestamp.getNanos(), type == EdmPrimitiveTypeKind.DateTimeOffset);
- }
-
- public static ODataTimestamp parse(final EdmPrimitiveTypeKind type, final String input) {
- final ODataTimestamp instance;
-
- final String[] dateParts = input.split("\\.");
- final SimpleDateFormat sdf = new SimpleDateFormat(getPattern(type));
- final boolean isOffset = type == EdmPrimitiveTypeKind.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 " + getPattern(type), 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();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java
index e6b5279..d56f188 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java
@@ -19,93 +19,66 @@
package org.apache.olingo.client.api.domain;
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;
+public interface ODataValue extends Serializable {
/**
* Check is is a primitive value.
*
* @return 'TRUE' if primitive; 'FALSE' otherwise.
*/
- public boolean isPrimitive() {
- return (this instanceof ODataPrimitiveValue);
- }
+ boolean isPrimitive();
/**
* Casts to primitive value.
*
* @return primitive value.
*/
- public ODataPrimitiveValue asPrimitive() {
- return isPrimitive() ? (ODataPrimitiveValue) this : null;
- }
+ ODataPrimitiveValue asPrimitive();
/**
- * Check is is a complex value.
+ * Check is is a geospatail value.
*
- * @return 'TRUE' if complex; 'FALSE' otherwise.
+ * @return 'TRUE' if geospatail; 'FALSE' otherwise.
*/
- public boolean isComplex() {
- return (this instanceof ODataComplexValue);
- }
+ boolean isGeospatial();
/**
- * Casts to complex value.
+ * Casts to geospatail value.
*
- * @return complex value.
+ * @return geospatail value.
*/
- public ODataComplexValue asComplex() {
- return isComplex() ? (ODataComplexValue) this : null;
- }
+ ODataGeospatialValue asGeospatial();
/**
* Check is is a collection value.
*
* @return 'TRUE' if collection; 'FALSE' otherwise.
*/
- public boolean isCollection() {
- return (this instanceof ODataCollectionValue);
- }
+ boolean isCollection();
/**
* Casts to collection value.
*
* @return collection value.
*/
- public ODataCollectionValue asCollection() {
- return isCollection() ? (ODataCollectionValue) this : null;
- }
+ ODataCollectionValue asCollection();
/**
- * {@inheritDoc }
+ * Check is is a complex value.
+ *
+ * @return 'TRUE' if complex; 'FALSE' otherwise.
*/
- @Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
+ boolean isComplex();
/**
- * {@inheritDoc }
+ * Casts to complex value.
+ *
+ * @return complex value.
*/
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
+ ODataComplexValue asComplex();
- /**
- * {@inheritDoc }
- */
- @Override
- public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
deleted file mode 100644
index 9ba47da..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
+++ /dev/null
@@ -1,196 +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.client.api.utils;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URLEncoder;
-import java.text.DecimalFormat;
-import java.util.UUID;
-
-import org.apache.commons.codec.binary.Hex;
-import org.apache.commons.io.IOUtils;
-import org.apache.http.entity.InputStreamEntity;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.ODataDuration;
-import org.apache.olingo.client.api.domain.ODataTimestamp;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * URI utilities.
- */
-public final class URIUtils {
-
- /**
- * Logger.
- */
- private static final Logger LOG = LoggerFactory.getLogger(URIUtils.class);
-
- private URIUtils() {
- // Empty private constructor for static utility classes
- }
-
- /**
- * Build URI starting from the given base and href.
- * <br/>
- * If href is absolute or base is null then base will be ignored.
- *
- * @param base URI prefix.
- * @param href URI suffix.
- * @return built URI.
- */
- public static URI getURI(final String base, final String href) {
- if (href == null) {
- throw new IllegalArgumentException("Null link provided");
- }
-
- URI uri = URI.create(href);
-
- if (!uri.isAbsolute() && base != null) {
- uri = URI.create(base + "/" + href);
- }
-
- return uri.normalize();
- }
-
- /**
- * Build URI starting from the given base and href.
- * <br/>
- * If href is absolute or base is null then base will be ignored.
- *
- * @param base URI prefix.
- * @param href URI suffix.
- * @return built URI.
- */
- public static URI getURI(final URI base, final URI href) {
- if (href == null) {
- throw new IllegalArgumentException("Null link provided");
- }
- return getURI(base, href.toASCIIString());
- }
-
- /**
- * Build URI starting from the given base and href.
- * <br/>
- * If href is absolute or base is null then base will be ignored.
- *
- * @param base URI prefix.
- * @param href URI suffix.
- * @return built URI.
- */
- public static URI getURI(final URI base, final String href) {
- if (href == null) {
- throw new IllegalArgumentException("Null link provided");
- }
-
- URI uri = URI.create(href);
-
- if (!uri.isAbsolute() && base != null) {
- uri = URI.create(base.toASCIIString() + "/" + href);
- }
-
- return uri.normalize();
- }
-
- /**
- * Gets function import URI segment.
- *
- * @param entityContainer entity container.
- * @param functionImport function import.
- * @return URI segment.
- */
- public static String rootFunctionImportURISegment(
- final EdmEntityContainer entityContainer, final EdmFunctionImport functionImport) {
-
- final StringBuilder result = new StringBuilder();
- // TODO: https://issues.apache.org/jira/browse/OLINGO-209
- // if (!entityContainer.isDefaultEntityContainer()) {
- // result.append(entityContainer.getName()).append('.');
- // }
- result.append(functionImport.getName());
-
- return result.toString();
- }
-
- /**
- * Turns primitive values into their respective URI representation.
- *
- * @param obj primitive value
- * @return URI representation
- */
- public static String escape(final Object obj) {
- String value;
-
- try {
- value = (obj instanceof UUID)
- ? "guid'" + obj.toString() + "'"
- : (obj instanceof byte[])
- ? "X'" + Hex.encodeHexString((byte[]) obj) + "'"
- : ((obj instanceof ODataTimestamp) && ((ODataTimestamp) obj).getTimezone() == null)
- ? "datetime'" + URLEncoder.encode(((ODataTimestamp) obj).toString(), Constants.UTF8) + "'"
- : ((obj instanceof ODataTimestamp) && ((ODataTimestamp) obj).getTimezone() != null)
- ? "datetimeoffset'" + URLEncoder.encode(((ODataTimestamp) obj).toString(), Constants.UTF8)
- + "'"
- : (obj instanceof ODataDuration)
- ? "time'" + ((ODataDuration) obj).toString() + "'"
- : (obj instanceof BigDecimal)
- ? new DecimalFormat("#.#######################").format((BigDecimal) obj) + "M"
- : (obj instanceof Double)
- ? new DecimalFormat("#.#######################E0").format((Double) obj) + "D"
- : (obj instanceof Float)
- ? new DecimalFormat("#.#######E0").format((Float) obj) + "f"
- : (obj instanceof Long)
- ? ((Long) obj).toString() + "L"
- : (obj instanceof String)
- ? "'" + URLEncoder.encode((String) obj, Constants.UTF8) + "'"
- : obj.toString();
- } catch (Exception e) {
- LOG.warn("While escaping '{}', using toString()", obj, e);
- value = obj.toString();
- }
-
- return value;
- }
-
- public static InputStreamEntity buildInputStreamEntity(final CommonODataClient client, final InputStream input) {
- InputStreamEntity entity;
- if (client.getConfiguration().isUseChuncked()) {
- entity = new InputStreamEntity(input, -1);
- } else {
- byte[] bytes = new byte[0];
- try {
- bytes = IOUtils.toByteArray(input);
- } catch (IOException e) {
- LOG.error("While reading input for not chunked encoding", e);
- }
-
- entity = new InputStreamEntity(new ByteArrayInputStream(bytes), bytes.length);
- }
- entity.setChunked(client.getConfiguration().isUseChuncked());
-
- return entity;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index 52d5d1c..2ecd92c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -19,10 +19,10 @@
package org.apache.olingo.client.core;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
import org.apache.olingo.client.api.domain.ODataObjectFactory;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.op.ODataWriter;
+import org.apache.olingo.client.core.domain.ODataGeospatialValueImpl;
+import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
import org.apache.olingo.client.core.op.impl.ODataObjectFactoryImpl;
import org.apache.olingo.client.core.op.impl.ODataWriterImpl;
@@ -35,13 +35,13 @@ public abstract class AbstractODataClient implements CommonODataClient {
private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(this);
@Override
- public ODataPrimitiveValue.Builder getPrimitiveValueBuilder() {
- return new ODataPrimitiveValue.Builder(this);
+ public ODataPrimitiveValueImpl.BuilderImpl getPrimitiveValueBuilder() {
+ return new ODataPrimitiveValueImpl.BuilderImpl(this.getServiceVersion());
}
@Override
- public ODataGeospatialValue.Builder getGeospatialValueBuilder() {
- return new ODataGeospatialValue.Builder(this);
+ public ODataGeospatialValueImpl.BuilderImpl getGeospatialValueBuilder() {
+ return new ODataGeospatialValueImpl.BuilderImpl();
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
index 1cad2a9..6cf1927 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataEntityCreateResp
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
index 662a844..012d975 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResp
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
index f02dc34..0f91864 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataLinkOperationRes
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
index 419ee03..0fea3a9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataLinkOperationRes
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
index f782a6e..04c87cc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateRe
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
index af0eba6..dc3a727 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.client.core.communication.request.cud;
-import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import org.apache.commons.io.IOUtils;
@@ -30,13 +29,13 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
@@ -48,7 +47,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
/**
* Value to be created.
*/
- private final ODataValue value;
+ private final ODataPrimitiveValue value;
/**
* Constructor.
@@ -59,7 +58,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
* @param value value to be created.
*/
ODataValueUpdateRequestImpl(final CommonODataClient odataClient,
- final HttpMethod method, final URI targetURI, final ODataValue value) {
+ final HttpMethod method, final URI targetURI, final ODataPrimitiveValue value) {
super(odataClient, ODataValueFormat.class, method, targetURI);
// set request body
@@ -94,7 +93,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
*/
private class ODataValueUpdateResponseImpl extends AbstractODataResponse implements ODataValueUpdateResponse {
- private ODataValue value = null;
+ private ODataPrimitiveValue value = null;
/**
* Constructor.
@@ -118,17 +117,17 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
* {@inheritDoc }
*/
@Override
- public ODataValue getBody() {
+ public ODataPrimitiveValue getBody() {
if (value == null) {
final ODataValueFormat format = ODataValueFormat.fromString(getAccept());
try {
- value = new ODataPrimitiveValue.Builder(odataClient).
+ value = new ODataPrimitiveValueImpl.BuilderImpl(odataClient.getServiceVersion()).
setType(format == ODataValueFormat.TEXT
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(getRawResponse())).
build();
- } catch (IOException e) {
+ } catch (Exception e) {
throw new HttpClientException(e);
} finally {
this.close();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
index 3dc9485..c6355e4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
@@ -44,7 +44,7 @@ import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
index f5cb270..0ccb3c7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
@@ -52,6 +52,7 @@ public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory imple
}
@Override
+ @SuppressWarnings("unchecked")
public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(final URI uri, final Edm edm,
final FullQualifiedName container, final String functionImport,
final LinkedHashMap<String, ODataValue> parameters) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
index 7a2ef0c..fd4e647 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.client.core.communication.request.retrieve;
-import java.io.IOException;
import java.net.URI;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
@@ -27,15 +26,15 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
* This class implements an OData entity property value query request.
*/
-public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataValue, ODataValueFormat>
+public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataPrimitiveValue, ODataValueFormat>
implements ODataValueRequest {
/**
@@ -52,7 +51,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataVal
* {@inheritDoc }
*/
@Override
- public ODataRetrieveResponse<ODataValue> execute() {
+ public ODataRetrieveResponse<ODataPrimitiveValue> execute() {
final HttpResponse res = doExecute();
return new ODataValueResponseImpl(httpClient, res);
}
@@ -62,7 +61,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataVal
*/
protected class ODataValueResponseImpl extends ODataRetrieveResponseImpl {
- private ODataValue value = null;
+ private ODataPrimitiveValue value = null;
/**
* Constructor.
@@ -86,17 +85,17 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataVal
* {@inheritDoc }
*/
@Override
- public ODataValue getBody() {
+ public ODataPrimitiveValue getBody() {
if (value == null) {
final ODataValueFormat format = ODataValueFormat.fromString(getContentType());
try {
- value = new ODataPrimitiveValue.Builder(odataClient).
+ value = new ODataPrimitiveValueImpl.BuilderImpl(odataClient.getServiceVersion()).
setType(format == ODataValueFormat.TEXT
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(getRawResponse())).
build();
- } catch (IOException e) {
+ } catch (Exception e) {
throw new HttpClientException(e);
} finally {
this.close();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
index 3726e60..5563a74 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
@@ -36,7 +36,7 @@ import org.apache.olingo.client.api.communication.request.batch.ODataBatchReques
import org.apache.olingo.client.api.communication.response.ODataResponse;
import org.apache.olingo.client.api.format.ODataMediaFormat;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.Wrapper;
import org.apache.olingo.client.core.communication.request.ODataRequestImpl;
import org.apache.commons.io.IOUtils;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
index 2d69ef7..78d87ba 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
@@ -36,10 +36,10 @@ import org.apache.olingo.commons.api.edm.geo.Polygon;
class AtomGeoValueSerializer {
- public static final ThreadLocal<DecimalFormat> DOUBLE_FORMAT = new ThreadLocal<DecimalFormat>() {
+ private static final ThreadLocal<DecimalFormat> DOUBLE_FORMAT = new ThreadLocal<DecimalFormat>() {
@Override
protected DecimalFormat initialValue() {
- DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols();
+ final DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols();
otherSymbols.setDecimalSeparator('.');
return new DecimalFormat("#.#########################", otherSymbols);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
index 9780e12..884d815 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
@@ -51,12 +51,10 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
while (reader.hasNext() && !foundEndProperty) {
final XMLEvent event = reader.nextEvent();
- if (event.isStartElement()) {
- if (typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
- final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(
- version, typeInfo.getFullQualifiedName().toString());
- value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
- }
+ if (event.isStartElement() && typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+ final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(
+ version, typeInfo.getFullQualifiedName().toString());
+ value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
}
if (event.isCharacters() && !event.asCharacters().isWhiteSpace()
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
new file mode 100644
index 0000000..43ef056
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.domain;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.olingo.client.api.domain.AbstractODataValue;
+import org.apache.olingo.client.api.domain.ODataGeospatialValue;
+import org.apache.olingo.commons.api.edm.EdmGeospatialType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public class ODataGeospatialValueImpl extends AbstractODataValue implements ODataGeospatialValue {
+
+ private static final long serialVersionUID = 8277433906326348952L;
+
+ public static class BuilderImpl implements Builder {
+
+ private final ODataGeospatialValueImpl instance;
+
+ public BuilderImpl() {
+ this.instance = new ODataGeospatialValueImpl();
+ }
+
+ @Override
+ public BuilderImpl setType(final EdmPrimitiveTypeKind type) {
+ if (type != null && !type.isGeospatial()) {
+ throw new IllegalArgumentException("Don't use this for non-geospatial types");
+ }
+ if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.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.");
+ }
+
+ if (type != null) {
+ this.instance.typeKind = type;
+ this.instance.type = EdmPrimitiveTypeFactory.getGeoInstance(type);
+ }
+
+ return this;
+ }
+
+ @Override
+ public BuilderImpl setValue(final Geospatial value) {
+ this.instance.value = value;
+ if (value != null) {
+ setType(value.getEdmPrimitiveTypeKind());
+ }
+ return this;
+ }
+
+ @Override
+ public ODataGeospatialValueImpl build() {
+ if (this.instance.type == null) {
+ throw new IllegalArgumentException("Must provide geospatial type");
+ }
+ if (this.instance.value == null) {
+ throw new IllegalArgumentException("Must provide geospatial value");
+ }
+
+ return this.instance;
+ }
+ }
+
+ /**
+ * Type kind.
+ */
+ private EdmPrimitiveTypeKind typeKind;
+
+ /**
+ * Type.
+ */
+ private EdmGeospatialType type;
+
+ /**
+ * Value.
+ */
+ private Geospatial value;
+
+ @Override
+ public EdmPrimitiveTypeKind getTypeKind() {
+ return typeKind;
+ }
+
+ @Override
+ public EdmGeospatialType getType() {
+ return type;
+ }
+
+ @Override
+ public Geospatial toValue() {
+ return value;
+ }
+
+ @Override
+ public <T extends Geospatial> T toCastValue(final Class<T> reference) {
+ return reference.cast(this.value);
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+}
[31/52] [abbrv] git commit: [OLINGO-200] ODataError was missing...
Posted by sk...@apache.org.
[OLINGO-200] ODataError was missing...
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/fa7a9ab8
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/fa7a9ab8
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/fa7a9ab8
Branch: refs/heads/olingo-206-validator
Commit: fa7a9ab80ef23f24628f0b702970d134baf3513f
Parents: 0b4b86c
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 24 08:54:09 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 24 08:54:09 2014 +0100
----------------------------------------------------------------------
.../ODataClientErrorException.java | 2 +-
.../olingo/client/api/data/ODataError.java | 67 --------------------
.../client/api/op/CommonODataDeserializer.java | 2 +-
.../olingo/client/api/op/CommonODataReader.java | 2 +-
.../communication/request/ODataRequestImpl.java | 2 +-
.../olingo/client/core/data/JSONErrorImpl.java | 2 +-
.../olingo/client/core/data/XMLErrorImpl.java | 2 +-
.../core/op/AbstractODataDeserializer.java | 2 +-
.../client/core/op/AbstractODataReader.java | 2 +-
.../apache/olingo/client/core/v3/ErrorTest.java | 2 +-
.../olingo/commons/api/domain/ODataError.java | 67 ++++++++++++++++++++
11 files changed, 76 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fa7a9ab8/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
index e25fd62..85ae888 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
@@ -25,7 +25,7 @@ import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.StatusLine;
-import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.commons.api.domain.ODataError;
/**
* Represents a client error in OData.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fa7a9ab8/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ODataError.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ODataError.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ODataError.java
deleted file mode 100644
index eab263b..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ODataError.java
+++ /dev/null
@@ -1,67 +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.client.api.data;
-
-/**
- * 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/olingo-odata4/blob/fa7a9ab8/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
index 0c0428c..6828b44 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.api.op;
import java.io.InputStream;
import java.io.Serializable;
import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.client.api.data.Feed;
import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.client.api.data.ServiceDocument;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fa7a9ab8/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
index 3f28f62..829c5a7 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.api.op;
import java.io.InputStream;
import java.io.Serializable;
-import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataProperty;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fa7a9ab8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
index 44f7c45..b77b1b7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
@@ -50,7 +50,7 @@ import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.data.JSONErrorImpl;
import org.apache.olingo.client.core.data.XMLErrorImpl;
-import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.client.core.communication.header.ODataHeadersImpl;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fa7a9ab8/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java
index 583f438..5305695 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.core.data;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.commons.api.domain.ODataError;
/**
* This class represents an OData error returned as JSON.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fa7a9ab8/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java
index c5128f5..9e5b3c8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java
@@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;
import java.util.Map;
-import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.commons.api.domain.ODataError;
/**
* This class represents an OData error returned as JSON.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fa7a9ab8/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
index 2b4385e..0f2ad2b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.op;
import java.io.InputStream;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.client.api.data.Feed;
import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.commons.api.format.ODataFormat;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fa7a9ab8/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
index b0869cf..abc1070 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.op;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fa7a9ab8/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
index 57f3516..0b10d51 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
@@ -22,7 +22,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fa7a9ab8/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
new file mode 100644
index 0000000..2993964
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/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.commons.api.domain;
+
+/**
+ * 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();
+}
[44/52] [abbrv] [OLINGO-205,
OLINGO-200] provided atom v4 deserialization for entity type/set +
entity set request
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/utils/JSONUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/JSONUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/JSONUtilities.java
deleted file mode 100644
index 79d2d8f..0000000
--- a/fit/src/main/java/org/apache/olingo/fit/utils/JSONUtilities.java
+++ /dev/null
@@ -1,503 +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.fit.utils;
-
-import static org.apache.olingo.fit.utils.Constants.*;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.fasterxml.jackson.databind.node.TextNode;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.util.AbstractMap.SimpleEntry;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.ws.rs.NotFoundException;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-
-public class JSONUtilities extends AbstractUtilities {
-
- public JSONUtilities(final ODataVersion version) throws Exception {
- super(version);
- }
-
- @Override
- protected Accept getDefaultFormat() {
- return Accept.JSON_FULLMETA;
- }
-
- @Override
- protected InputStream addLinks(
- final String entitySetName, final String entitykey, final InputStream is, final Set<String> links)
- throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
- IOUtils.closeQuietly(is);
-
- for (String link : links) {
- srcNode.set(link + JSON_NAVIGATION_SUFFIX,
- new TextNode(Commons.getLinksURI(version, entitySetName, entitykey, link)));
- }
-
- return IOUtils.toInputStream(srcNode.toString());
- }
-
- @Override
- protected Set<String> retrieveAllLinkNames(InputStream is) throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
- IOUtils.closeQuietly(is);
-
- final Set<String> links = new HashSet<String>();
-
- final Iterator<String> fieldIter = srcNode.fieldNames();
-
- while (fieldIter.hasNext()) {
- final String field = fieldIter.next();
-
- if (field.endsWith(JSON_NAVIGATION_BIND_SUFFIX)
- || field.endsWith(JSON_NAVIGATION_SUFFIX)
- || field.endsWith(JSON_MEDIA_SUFFIX)
- || field.endsWith(JSON_EDITLINK_NAME)) {
- if (field.indexOf('@') > 0) {
- links.add(field.substring(0, field.indexOf('@')));
- } else {
- links.add(field);
- }
- }
- }
-
- return links;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- protected NavigationLinks retrieveNavigationInfo(
- final String entitySetName, final InputStream is)
- throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
- IOUtils.closeQuietly(is);
-
- final NavigationLinks links = new NavigationLinks();
-
- final Iterator<Map.Entry<String, JsonNode>> fieldIter = srcNode.fields();
-
- while (fieldIter.hasNext()) {
- final Map.Entry<String, JsonNode> field = fieldIter.next();
- if (field.getKey().endsWith(JSON_NAVIGATION_BIND_SUFFIX)) {
- final String title = field.getKey().substring(0, field.getKey().indexOf('@'));
- final List<String> hrefs = new ArrayList<String>();
- if (field.getValue().isArray()) {
- for (JsonNode href : ((ArrayNode) field.getValue())) {
- final String uri = href.asText();
- hrefs.add(uri.substring(uri.lastIndexOf('/') + 1));
- }
- } else {
- final String uri = field.getValue().asText();
- hrefs.add(uri.substring(uri.lastIndexOf('/') + 1));
- }
-
- links.addLinks(title, hrefs);
- } else if (Commons.linkInfo.get(version).exists(entitySetName, field.getKey())) {
- links.addInlines(field.getKey(), IOUtils.toInputStream(field.getValue().toString()));
- }
- }
-
- return links;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- protected InputStream normalizeLinks(
- final String entitySetName, final String entityKey, final InputStream is, final NavigationLinks links)
- throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
-
- if (links != null) {
- for (String linkTitle : links.getLinkNames()) {
- // normalize link
- srcNode.remove(linkTitle + JSON_NAVIGATION_BIND_SUFFIX);
- srcNode.set(
- linkTitle + JSON_NAVIGATION_SUFFIX,
- new TextNode(String.format("%s(%s)/%s", entitySetName, entityKey, linkTitle)));
- }
-
- for (String linkTitle : links.getInlineNames()) {
- // normalize link if exist; declare a new one if missing
- srcNode.remove(linkTitle + JSON_NAVIGATION_BIND_SUFFIX);
- srcNode.set(
- linkTitle + JSON_NAVIGATION_SUFFIX,
- new TextNode(String.format("%s(%s)/%s", entitySetName, entityKey, linkTitle)));
-
- // remove inline
- srcNode.remove(linkTitle);
-
- // remove from links
- links.removeLink(linkTitle);
- }
- }
-
- srcNode.set(
- JSON_EDITLINK_NAME,
- new TextNode(Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")"));
-
- return IOUtils.toInputStream(srcNode.toString());
- }
-
- @Override
- public InputStream getPropertyValue(final InputStream src, final List<String> path)
- throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final JsonNode srcNode = mapper.readTree(src);
- JsonNode node = getProperty(srcNode, path);
- return IOUtils.toInputStream(node.asText());
- }
-
- @Override
- public InputStream getProperty(
- final String entitySetName, final String entityId, final List<String> path, final String edmType)
- throws Exception {
-
- final InputStream src =
- fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.JSON_FULLMETA);
-
- final ObjectMapper mapper = new ObjectMapper();
- final JsonNode srcNode = mapper.readTree(src);
-
- final ObjectNode propertyNode = new ObjectNode(JsonNodeFactory.instance);
-
- if (StringUtils.isNotBlank(edmType)) {
- propertyNode.put(JSON_ODATAMETADATA_NAME, ODATA_METADATA_PREFIX + edmType);
- }
-
- JsonNode jsonNode = getProperty(srcNode, path);
-
- if (jsonNode.isArray()) {
- propertyNode.put("value", (ArrayNode) jsonNode);
- } else if (jsonNode.isObject()) {
- propertyNode.putAll((ObjectNode) jsonNode);
- } else {
- propertyNode.put("value", jsonNode.asText());
- }
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- mapper.writeValue(bos, propertyNode);
-
- final InputStream res = new ByteArrayInputStream(bos.toByteArray());
- IOUtils.closeQuietly(bos);
-
- return res;
- }
-
- private JsonNode getProperty(final JsonNode node, final List<String> path)
- throws NotFoundException {
-
- JsonNode propertyNode = node;
- for (int i = 0; i < path.size(); i++) {
- propertyNode = propertyNode.get(path.get(i));
- if (propertyNode == null) {
- throw new NotFoundException();
- }
- }
-
- return propertyNode;
- }
-
- public InputStream addJsonInlinecount(
- final InputStream src, final int count, final Accept accept)
- throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final JsonNode srcNode = mapper.readTree(src);
-
- ((ObjectNode) srcNode).put(ODATA_COUNT_NAME, count);
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- mapper.writeValue(bos, srcNode);
-
- final InputStream res = new ByteArrayInputStream(bos.toByteArray());
- IOUtils.closeQuietly(bos);
-
- return res;
- }
-
- public InputStream wrapJsonEntities(final InputStream entities) throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final JsonNode node = mapper.readTree(entities);
-
- final ObjectNode res;
-
- final JsonNode value = node.get(JSON_VALUE_NAME);
-
- if (value.isArray()) {
- res = mapper.createObjectNode();
- res.set("value", value);
- final JsonNode next = node.get(JSON_NEXTLINK_NAME);
- if (next != null) {
- res.set(JSON_NEXTLINK_NAME, next);
- }
- } else {
- res = (ObjectNode) value;
- }
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- mapper.writeValue(bos, res);
-
- final InputStream is = new ByteArrayInputStream(bos.toByteArray());
- IOUtils.closeQuietly(bos);
-
- return is;
- }
-
- @Override
- public InputStream selectEntity(final InputStream src, final String[] propertyNames) throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final ObjectNode srcNode = (ObjectNode) mapper.readTree(src);
-
- final Set<String> retain = new HashSet<String>();
- retain.add(JSON_ID_NAME);
- retain.add(JSON_TYPE_NAME);
- retain.add(JSON_EDITLINK_NAME);
- retain.add(JSON_NEXTLINK_NAME);
- retain.add(JSON_ODATAMETADATA_NAME);
- retain.add(JSON_VALUE_NAME);
-
- for (String name : propertyNames) {
- retain.add(name);
- retain.add(name + JSON_NAVIGATION_SUFFIX);
- retain.add(name + JSON_MEDIA_SUFFIX);
- retain.add(name + JSON_TYPE_SUFFIX);
- }
-
- srcNode.retain(retain);
-
- return IOUtils.toInputStream(srcNode.toString());
- }
-
- @Override
- public InputStream readEntities(
- final List<String> links, final String linkName, final String next, final boolean forceFeed)
- throws Exception {
-
- if (links.isEmpty()) {
- throw new NotFoundException();
- }
-
- final ObjectMapper mapper = new ObjectMapper();
- final ObjectNode node = mapper.createObjectNode();
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
-
- if (forceFeed || links.size() > 1) {
- bos.write("[".getBytes());
- }
-
- for (String link : links) {
- try {
- final Map.Entry<String, String> uri = Commons.parseEntityURI(link);
- final Map.Entry<String, InputStream> entity =
- readEntity(uri.getKey(), uri.getValue(), Accept.JSON_FULLMETA);
-
- if (bos.size() > 1) {
- bos.write(",".getBytes());
- }
-
- IOUtils.copy(entity.getValue(), bos);
- } catch (Exception e) {
- // log and ignore link
- LOG.warn("Error parsing uri {}", link, e);
- }
- }
-
- if (forceFeed || links.size() > 1) {
- bos.write("]".getBytes());
- }
-
- node.set(JSON_VALUE_NAME, mapper.readTree(new ByteArrayInputStream(bos.toByteArray())));
-
- if (StringUtils.isNotBlank(next)) {
- node.set(JSON_NEXTLINK_NAME, new TextNode(next));
- }
-
- return IOUtils.toInputStream(node.toString());
- }
-
- @Override
- protected InputStream replaceLink(
- final InputStream toBeChanged, final String linkName, final InputStream replacement)
- throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
-
- final ObjectNode toBeChangedNode = (ObjectNode) mapper.readTree(toBeChanged);
- final ObjectNode replacementNode = (ObjectNode) mapper.readTree(replacement);
-
- if (toBeChangedNode.get(linkName + JSON_NAVIGATION_SUFFIX) == null) {
- throw new NotFoundException();
- }
-
- toBeChangedNode.set(linkName, replacementNode.get(JSON_VALUE_NAME));
-
- final JsonNode next = replacementNode.get(linkName + JSON_NEXTLINK_NAME);
- if (next != null) {
- toBeChangedNode.set(linkName + JSON_NEXTLINK_SUFFIX, next);
- }
-
- return IOUtils.toInputStream(toBeChangedNode.toString());
- }
-
- @Override
- protected Map<String, InputStream> getChanges(final InputStream src) throws Exception {
- final Map<String, InputStream> res = new HashMap<String, InputStream>();
-
- final ObjectMapper mapper = new ObjectMapper();
- final JsonNode srcObject = mapper.readTree(src);
-
- final Iterator<Map.Entry<String, JsonNode>> fields = srcObject.fields();
- while (fields.hasNext()) {
- final Map.Entry<String, JsonNode> field = fields.next();
- res.put(field.getKey(), IOUtils.toInputStream(field.getValue().toString()));
- }
-
- return res;
- }
-
- @Override
- protected InputStream setChanges(
- final InputStream toBeChanged, final Map<String, InputStream> properties) throws Exception {
-
- final ObjectMapper mapper = new ObjectMapper();
- final ObjectNode toBeChangedObject = (ObjectNode) mapper.readTree(toBeChanged);
-
- for (Map.Entry<String, InputStream> property : properties.entrySet()) {
- final JsonNode propertyNode = mapper.readTree(property.getValue());
- toBeChangedObject.set(property.getKey(), propertyNode);
- }
-
- return IOUtils.toInputStream(toBeChangedObject.toString());
- }
-
- @Override
- public Map.Entry<String, List<String>> extractLinkURIs(
- final String entitySetName, final String entityId, final String linkName)
- throws Exception {
- final LinkInfo links = readLinks(entitySetName, entityId, linkName, Accept.JSON_FULLMETA);
- return extractLinkURIs(links.getLinks());
- }
-
- @Override
- public Map.Entry<String, List<String>> extractLinkURIs(final InputStream is)
- throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
- IOUtils.closeQuietly(is);
-
- final List<String> links = new ArrayList<String>();
-
- JsonNode uris = srcNode.get("value");
- if (uris == null) {
- final JsonNode url = srcNode.get("url");
- if (url != null) {
- links.add(url.textValue());
- }
- } else {
- final Iterator<JsonNode> iter = ((ArrayNode) uris).iterator();
- while (iter.hasNext()) {
- links.add(iter.next().get("url").textValue());
- }
- }
-
- final JsonNode next = srcNode.get(JSON_NEXTLINK_NAME);
-
- return new SimpleEntry<String, List<String>>(next == null ? null : next.asText(), links);
- }
-
- @Override
- public InputStream addEditLink(
- final InputStream content, final String title, final String href) throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final ObjectNode srcNode = (ObjectNode) mapper.readTree(content);
- IOUtils.closeQuietly(content);
-
- srcNode.set(JSON_EDITLINK_NAME, new TextNode(href));
- return IOUtils.toInputStream(srcNode.toString());
- }
-
- @Override
- public InputStream replaceProperty(
- final InputStream src, final InputStream replacement, final List<String> path, final boolean justValue)
- throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final ObjectNode srcNode = (ObjectNode) mapper.readTree(src);
- IOUtils.closeQuietly(src);
-
- final JsonNode replacementNode;
- if (justValue) {
- replacementNode = new TextNode(IOUtils.toString(replacement));
- } else {
- replacementNode = (ObjectNode) mapper.readTree(replacement);
- }
- IOUtils.closeQuietly(replacement);
-
- JsonNode node = srcNode;
- for (int i = 0; i < path.size() - 1; i++) {
- node = node.get(path.get(i));
- if (node == null) {
- throw new NotFoundException();
- }
- }
-
- ((ObjectNode) node).set(path.get(path.size() - 1), replacementNode);
-
- return IOUtils.toInputStream(srcNode.toString());
- }
-
- @Override
- public InputStream deleteProperty(final InputStream src, final List<String> path) throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final ObjectNode srcNode = (ObjectNode) mapper.readTree(src);
- IOUtils.closeQuietly(src);
-
- JsonNode node = srcNode;
- for (int i = 0; i < path.size() - 1; i++) {
- node = node.get(path.get(i));
- if (node == null) {
- throw new NotFoundException();
- }
- }
-
- ((ObjectNode) node).set(path.get(path.size() - 1), null);
-
- return IOUtils.toInputStream(srcNode.toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/utils/XMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/XMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/XMLUtilities.java
deleted file mode 100644
index 0009eea..0000000
--- a/fit/src/main/java/org/apache/olingo/fit/utils/XMLUtilities.java
+++ /dev/null
@@ -1,1388 +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.fit.utils;
-
-import static org.apache.olingo.fit.utils.Constants.*;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.StringWriter;
-import java.util.AbstractMap;
-import java.util.AbstractMap.SimpleEntry;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.ws.rs.NotFoundException;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLEventFactory;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLEventWriter;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Attribute;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.vfs2.FileObject;
-import org.apache.commons.vfs2.FileSystemException;
-
-public class XMLUtilities extends AbstractUtilities {
-
- protected static XMLInputFactory ifactory = null;
-
- protected static XMLOutputFactory ofactory = null;
-
- public XMLUtilities(final ODataVersion version) throws Exception {
- super(version);
- }
-
- public void retrieveLinkInfoFromMetadata() throws Exception {
-
- final MetadataLinkInfo metadataLinkInfo = new MetadataLinkInfo();
- Commons.linkInfo.put(version, metadataLinkInfo);
-
- final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
- final XMLEventReader reader = getEventReader(metadata);
-
- int initialDepth = 0;
- try {
- while (true) {
- Map.Entry<Integer, XmlElement> entityType =
- extractElement(reader, null, Collections.<String>singletonList("EntityType"),
- null, false, initialDepth, 4, 4);
- initialDepth = entityType.getKey();
-
- final String entitySetName =
- entityType.getValue().getStart().getAttributeByName(new QName("Name")).getValue();
-
- final XMLEventReader entityReader = getEventReader(entityType.getValue().toStream());
- int size = 0;
-
- try {
- while (true) {
- final XmlElement navProperty =
- extractElement(entityReader, null, Collections.<String>singletonList("NavigationProperty"),
- null, false, 0, -1, -1).getValue();
-
- final String linkName = navProperty.getStart().getAttributeByName(new QName("Name")).getValue();
- final Map.Entry<String, Boolean> target = getTargetInfo(navProperty.getStart(), linkName);
-
- metadataLinkInfo.addLink(
- entitySetName,
- linkName,
- target.getKey(),
- target.getValue());
-
- size++;
- }
- } catch (Exception e) {
- } finally {
- entityReader.close();
- }
-
- if (size == 0) {
- metadataLinkInfo.addEntitySet(entitySetName);
- }
- }
- } catch (Exception e) {
- } finally {
- reader.close();
- }
- }
-
- private Map.Entry<String, Boolean> getTargetInfo(final StartElement element, final String linkName)
- throws Exception {
- final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
- XMLEventReader reader = getEventReader(metadata);
-
- final String associationName = element.getAttributeByName(new QName("Relationship")).getValue();
-
- final Map.Entry<Integer, XmlElement> association = extractElement(
- reader, null, Collections.<String>singletonList("Association"),
- Collections.<Map.Entry<String, String>>singleton(new SimpleEntry<String, String>(
- "Name", associationName.substring(associationName.lastIndexOf(".") + 1))), false,
- 0, 4, 4);
-
- reader.close();
- IOUtils.closeQuietly(metadata);
-
- final InputStream associationContent = association.getValue().toStream();
- reader = getEventReader(associationContent);
-
- final Map.Entry<Integer, XmlElement> associationEnd = extractElement(
- reader, null, Collections.<String>singletonList("End"),
- Collections.<Map.Entry<String, String>>singleton(new SimpleEntry<String, String>("Role", linkName)),
- false, 0, -1, -1);
-
- reader.close();
- IOUtils.closeQuietly(associationContent);
-
- final String target = associationEnd.getValue().getStart().getAttributeByName(new QName("Type")).getValue();
- final boolean feed = associationEnd.getValue().getStart().getAttributeByName(
- new QName("Multiplicity")).getValue().equals("*");
-
- return new SimpleEntry<String, Boolean>(target, feed);
- }
-
- @Override
- protected Accept getDefaultFormat() {
- return Accept.ATOM;
- }
-
- protected XMLEventReader getEventReader(final InputStream is) throws XMLStreamException {
- if (ifactory == null) {
- ifactory = XMLInputFactory.newInstance();
- }
- ifactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, false);
- return ifactory.createXMLEventReader(is);
- }
-
- protected static XMLEventWriter getEventWriter(final OutputStream os) throws XMLStreamException {
- if (ofactory == null) {
- ofactory = XMLOutputFactory.newInstance();
- }
-
- return ofactory.createXMLEventWriter(os);
- }
-
- private void writeEvent(final XMLEvent event, final XMLEventWriter writer) {
- if (writer != null) {
- try {
- writer.add(event);
- } catch (XMLStreamException e) {
- LOG.error("Error writing event {}", event, e);
- }
- }
- }
-
- private void skipElement(
- final StartElement start,
- final XMLEventReader reader,
- final XMLEventWriter writer,
- final boolean excludeStart)
- throws Exception {
-
- if (!excludeStart) {
- writeEvent(start, writer);
- }
-
- int depth = 1;
- boolean found = false;
-
- while (reader.hasNext() && !found) {
- final XMLEvent event = reader.nextEvent();
-
- writeEvent(event, writer);
-
- if (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
- depth++;
- } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT) {
- depth--;
- found = depth == 0 && start.getName().equals(event.asEndElement().getName());
- }
- }
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- protected InputStream addLinks(
- final String entitySetName, final String entitykey, final InputStream is, final Set<String> links)
- throws Exception {
-
- // -----------------------------------------
- // 0. Build reader and writer
- // -----------------------------------------
- final XMLEventReader reader = getEventReader(is);
- final XMLEventFactory eventFactory = XMLEventFactory.newInstance();
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final XMLEventWriter writer = getEventWriter(bos);
- // -----------------------------------------
- final Map.Entry<Integer, XmlElement> entry =
- extractElement(reader, writer, Collections.singletonList("entry"), 0, 1, 1);
-
- writer.add(entry.getValue().getStart());
-
- // add for links
- for (String link : links) {
- final Set<Attribute> attributes = new HashSet<Attribute>();
- attributes.add(eventFactory.createAttribute(new QName("title"), link));
- attributes.add(eventFactory.createAttribute(new QName("href"),
- Commons.getLinksURI(version, entitySetName, entitykey, link)));
- attributes.add(eventFactory.createAttribute(new QName("rel"), Constants.ATOM_LINK_REL + link));
- attributes.add(eventFactory.createAttribute(new QName("type"),
- Commons.linkInfo.get(version).isFeed(entitySetName, link) ? Constants.ATOM_LINK_FEED
- : Constants.ATOM_LINK_ENTRY));
-
- writer.add(eventFactory.createStartElement(new QName(LINK), attributes.iterator(), null));
- writer.add(eventFactory.createEndElement(new QName(LINK), null));
- }
-
- writer.add(entry.getValue().getContentReader());
- writer.add(entry.getValue().getEnd());
- writer.add(reader);
- IOUtils.closeQuietly(is);
-
- writer.flush();
- writer.close();
- reader.close();
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- protected Set<String> retrieveAllLinkNames(final InputStream is) throws Exception {
- final Set<String> links = new HashSet<String>();
-
- final XMLEventReader reader = getEventReader(is);
-
- try {
-
- int startDepth = 0;
-
- while (true) {
- final Map.Entry<Integer, XmlElement> linkInfo =
- extractElement(reader, null, Collections.<String>singletonList(LINK), startDepth, 2, 2);
-
- startDepth = linkInfo.getKey();
-
- links.add(linkInfo.getValue().getStart().getAttributeByName(new QName("title")).getValue());
- }
- } catch (Exception ignore) {
- // ignore
- } finally {
- reader.close();
- IOUtils.closeQuietly(is);
- }
-
- return links;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- protected NavigationLinks retrieveNavigationInfo(
- final String entitySetName, final InputStream is)
- throws Exception {
-
- final NavigationLinks links = new NavigationLinks();
-
- final XMLEventReader reader = getEventReader(is);
-
- try {
- final List<Map.Entry<String, String>> filter = new ArrayList<Map.Entry<String, String>>();
- filter.add(new AbstractMap.SimpleEntry<String, String>("type", "application/atom+xml;type=entry"));
- filter.add(new AbstractMap.SimpleEntry<String, String>("type", "application/atom+xml;type=feed"));
-
- int startDepth = 0;
-
- while (true) {
- // a. search for link with type attribute equals to "application/atom+xml;type=entry/feed"
- final Map.Entry<Integer, XmlElement> linkInfo = extractElement(
- reader, null, Collections.<String>singletonList(LINK), filter, true, startDepth, 2, 2);
- final XmlElement link = linkInfo.getValue();
- startDepth = linkInfo.getKey();
-
- final String title = link.getStart().getAttributeByName(new QName("title")).getValue();
-
- final Attribute hrefAttr = link.getStart().getAttributeByName(new QName("href"));
- final String href = hrefAttr == null ? null : hrefAttr.getValue();
-
- try {
- final XmlElement inlineElement =
- extractElement(link.getContentReader(), null, Collections.<String>singletonList(INLINE), 0, -1, -1).
- getValue();
- final XMLEventReader inlineReader = inlineElement.getContentReader();
-
- try {
- while (true) {
- final XmlElement entry =
- extractElement(inlineReader, null, Collections.<String>singletonList("entry"), 0, -1, -1).
- getValue();
- links.addInlines(title, entry.toStream());
- }
- } catch (Exception e) {
- // Reached the end of document
- }
-
- inlineReader.close();
- } catch (Exception ignore) {
- // inline element not found (inlines are not mondatory).
- if (StringUtils.isNotBlank(href) && entityUriPattern.matcher(href).matches()) {
- links.addLinks(title, href.substring(href.lastIndexOf('/') + 1));
- }
- }
- }
- } catch (Exception ignore) {
- // ignore
- } finally {
- reader.close();
- }
-
- return links;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- protected InputStream normalizeLinks(
- final String entitySetName, final String entityKey, final InputStream is, final NavigationLinks links)
- throws Exception {
-
- // -----------------------------------------
- // 0. Build reader and writer
- // -----------------------------------------
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- IOUtils.copy(is, bos);
- is.close();
-
- final ByteArrayOutputStream tmpBos = new ByteArrayOutputStream();
- final XMLEventWriter writer = getEventWriter(tmpBos);
-
- final XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
- // -----------------------------------------
-
- // -----------------------------------------
- // 1. Normalize links
- // -----------------------------------------
- final Set<String> added = new HashSet<String>();
-
- try {
- final List<Map.Entry<String, String>> filter = new ArrayList<Map.Entry<String, String>>();
- filter.add(new AbstractMap.SimpleEntry<String, String>("type", "application/atom+xml;type=entry"));
- filter.add(new AbstractMap.SimpleEntry<String, String>("type", "application/atom+xml;type=feed"));
-
- Map.Entry<Integer, XmlElement> linkInfo = null;
-
- while (true) {
- // a. search for link with type attribute equals to "application/atom+xml;type=entry/feed"
- linkInfo = extractElement(
- reader, writer, Collections.<String>singletonList(LINK), filter, true,
- linkInfo == null ? 0 : linkInfo.getKey(), 2, 2);
- final XmlElement link = linkInfo.getValue();
-
- final String title = link.getStart().getAttributeByName(new QName("title")).getValue();
-
- if (!added.contains(title)) {
- added.add(title);
-
- final String normalizedLink = String.format(
- "<link href=\"%s(%s)/%s\" rel=\"%s\" title=\"%s\" type=\"%s\"/>",
- entitySetName,
- entityKey,
- title,
- link.getStart().getAttributeByName(new QName("rel")).getValue(),
- title,
- link.getStart().getAttributeByName(new QName("type")).getValue());
-
- addAtomElement(IOUtils.toInputStream(normalizedLink), writer);
- }
- }
- } catch (Exception ignore) {
- // ignore
- } finally {
- writer.close();
- reader.close();
- }
- // -----------------------------------------
-
- // -----------------------------------------
- // 2. Add edit link if missing
- // -----------------------------------------
- final InputStream content = addEditLink(
- new ByteArrayInputStream(tmpBos.toByteArray()),
- entitySetName,
- Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")");
- // -----------------------------------------
-
- // -----------------------------------------
- // 3. Add content element if missing
- // -----------------------------------------
- return addAtomContent(
- content,
- entitySetName,
- Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")");
- // -----------------------------------------
-
- }
-
- public XmlElement getXmlElement(
- final StartElement start,
- final XMLEventReader reader)
- throws Exception {
-
- final XmlElement res = new XmlElement();
- res.setStart(start);
-
- StringWriter content = new StringWriter();
-
- int depth = 1;
-
- while (reader.hasNext() && depth > 0) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
- depth++;
- } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT) {
- depth--;
- }
-
- if (depth == 0) {
- res.setEnd(event.asEndElement());
- } else {
- event.writeAsEncodedUnicode(content);
- }
- }
-
- content.flush();
- content.close();
-
- res.setContent(new ByteArrayInputStream(content.toString().getBytes()));
-
- return res;
- }
-
- private void addAtomElement(
- final InputStream content,
- final XMLEventWriter writer)
- throws Exception {
- final XMLEventReader reader = getEventReader(content);
-
- final XMLEventFactory eventFactory = XMLEventFactory.newInstance();
- XMLEvent newLine = eventFactory.createSpace("\n");
-
- try {
- writer.add(newLine);
-
- while (reader.hasNext()) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.getEventType() != XMLStreamConstants.START_DOCUMENT
- && event.getEventType() != XMLStreamConstants.END_DOCUMENT
- && event.getEventType() != XMLStreamConstants.COMMENT) {
- writer.add(event);
- }
- }
- writer.add(newLine);
- } finally {
- reader.close();
- IOUtils.closeQuietly(content);
- }
- }
-
- @Override
- public InputStream addEditLink(
- final InputStream content, final String title, final String href)
- throws Exception {
-
- final ByteArrayOutputStream copy = new ByteArrayOutputStream();
- IOUtils.copy(content, copy);
-
- IOUtils.closeQuietly(content);
-
- XMLEventReader reader = getEventReader(new ByteArrayInputStream(copy.toByteArray()));
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLEventWriter writer = getEventWriter(bos);
-
- final String editLinkElement = String.format("<link rel=\"edit\" title=\"%s\" href=\"%s\" />", title, href);
-
- try {
- // check edit link existence
- extractElement(reader, writer, Collections.<String>singletonList(LINK),
- Collections.<Map.Entry<String, String>>singletonList(
- new AbstractMap.SimpleEntry<String, String>("rel", "edit")), false, 0, -1, -1);
-
- addAtomElement(IOUtils.toInputStream(editLinkElement), writer);
- writer.add(reader);
-
- } catch (Exception e) {
- reader.close();
- reader = getEventReader(new ByteArrayInputStream(copy.toByteArray()));
-
- bos = new ByteArrayOutputStream();
- writer = getEventWriter(bos);
-
- final XmlElement entryElement =
- extractElement(reader, writer, Collections.<String>singletonList("entry"), 0, 1, 1).getValue();
-
- writer.add(entryElement.getStart());
-
- addAtomElement(IOUtils.toInputStream(editLinkElement), writer);
-
- writer.add(entryElement.getContentReader());
- writer.add(entryElement.getEnd());
-
- writer.add(reader);
-
- writer.flush();
- writer.close();
- } finally {
- reader.close();
- }
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- public InputStream addAtomContent(
- final InputStream content, final String title, final String href)
- throws Exception {
-
- final ByteArrayOutputStream copy = new ByteArrayOutputStream();
- IOUtils.copy(content, copy);
-
- IOUtils.closeQuietly(content);
-
- XMLEventReader reader = getEventReader(new ByteArrayInputStream(copy.toByteArray()));
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLEventWriter writer = getEventWriter(bos);
-
- try {
- // check edit link existence
- XmlElement contentElement =
- extractElement(reader, writer, Collections.<String>singletonList("content"), 0, 2, 2).getValue();
- writer.add(contentElement.getStart());
- writer.add(contentElement.getContentReader());
- writer.add(contentElement.getEnd());
- writer.add(reader);
- } catch (Exception e) {
- reader.close();
- reader = getEventReader(new ByteArrayInputStream(copy.toByteArray()));
-
- bos = new ByteArrayOutputStream();
- writer = getEventWriter(bos);
-
- if (isMediaContent(title)) {
- final XmlElement entryElement =
- extractElement(reader, writer, Collections.<String>singletonList("entry"), 0, 1, 1).getValue();
-
- writer.add(entryElement.getStart());
- writer.add(entryElement.getContentReader());
-
- addAtomElement(
- IOUtils.toInputStream(String.format("<content type=\"*/*\" src=\"%s/$value\" />", href)),
- writer);
-
- writer.add(entryElement.getEnd());
- } else {
- try {
- final XmlElement entryElement =
- extractElement(reader, writer, Collections.<String>singletonList(PROPERTIES), 0, 2, 3).getValue();
-
- addAtomElement(
- IOUtils.toInputStream("<content type=\"application/xml\">"),
- writer);
-
- writer.add(entryElement.getStart());
- writer.add(entryElement.getContentReader());
- writer.add(entryElement.getEnd());
-
- addAtomElement(
- IOUtils.toInputStream("</content>"),
- writer);
- } catch (Exception nf) {
- reader.close();
- reader = getEventReader(new ByteArrayInputStream(copy.toByteArray()));
-
- bos = new ByteArrayOutputStream();
- writer = getEventWriter(bos);
-
- final XmlElement entryElement =
- extractElement(reader, writer, Collections.<String>singletonList("entry"), 0, 1, 1).getValue();
- writer.add(entryElement.getStart());
- writer.add(entryElement.getContentReader());
-
- addAtomElement(
- IOUtils.toInputStream("<content type=\"application/xml\"/>"),
- writer);
-
- writer.add(entryElement.getEnd());
- }
- }
-
- writer.add(reader);
-
- writer.flush();
- writer.close();
- } finally {
- reader.close();
- }
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- public int countAllElements(final String entitySetName) throws Exception {
- final String basePath = entitySetName + File.separatorChar;
- int count = countFeedElements(fsManager.readFile(basePath + FEED, Accept.XML), "entry");
-
- final String skipTokenDirPath = fsManager.getAbsolutePath(basePath + SKIP_TOKEN, null);
-
-
- try {
- final FileObject skipToken = fsManager.resolve(skipTokenDirPath);
- final FileObject[] files = fsManager.findByExtension(skipToken, Accept.XML.getExtension().substring(1));
-
- for (FileObject file : files) {
- count += countFeedElements(fsManager.readFile(
- basePath + SKIP_TOKEN + File.separatorChar + file.getName().getBaseName(), null), "entry");
- }
- } catch (FileSystemException fse) {
- LOG.debug("Resource path '{}' not found", skipTokenDirPath);
- }
-
-
- return count;
- }
-
- private int countFeedElements(final InputStream is, final String elementName) throws XMLStreamException {
- final XMLEventReader reader = getEventReader(is);
-
- int count = 0;
-
- while (reader.hasNext()) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.getEventType() == XMLStreamConstants.START_ELEMENT
- && elementName.equals(event.asStartElement().getName().getLocalPart())) {
- count++;
- }
- }
-
- reader.close();
- return count;
- }
-
- public Map.Entry<Integer, XmlElement> extractElement(
- final XMLEventReader reader, final XMLEventWriter writer, final List<String> path,
- final int startPathPos, final int minPathPos, final int maxPathPos)
- throws Exception {
- return extractElement(reader, writer, path, null, false, startPathPos, minPathPos, maxPathPos);
- }
-
- public Map.Entry<Integer, XmlElement> extractElement(
- final XMLEventReader reader, final XMLEventWriter writer, final List<String> path,
- final Collection<Map.Entry<String, String>> filter,
- final boolean filterInOr,
- final int startPathPos, final int minPathPos, final int maxPathPos)
- throws Exception {
-
- StartElement start = null;
- int searchFor = 0;
- int depth = startPathPos;
-
- // Current inspected element
- String current = null;
-
- // set defaults
- final List<String> pathElementNames = path == null ? Collections.<String>emptyList() : path;
- final Collection<Map.Entry<String, String>> filterAttrs =
- filter == null ? Collections.<Map.Entry<String, String>>emptySet() : filter;
-
- while (reader.hasNext() && start == null) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
- depth++;
-
- if (current != null || ((minPathPos < 0 || minPathPos <= depth) && (maxPathPos < 0 || depth <= maxPathPos))) {
- if (pathElementNames.isEmpty()
- || pathElementNames.get(searchFor).trim().equals(event.asStartElement().getName().getLocalPart())) {
-
- if (searchFor < pathElementNames.size() - 1) {
- // path exploring not completed
- writeEvent(event, writer);
- current = pathElementNames.get(searchFor).trim();
- searchFor++;
- } else {
-
- // path exploring completed ... evaluate filter about path element name attribute
- boolean match = filterAttrs.isEmpty() || !filterInOr;
-
- for (Map.Entry<String, String> filterAttr : filterAttrs) {
- final Attribute attr = event.asStartElement().getAttributeByName(new QName(filterAttr.getKey().trim()));
-
- if (attr == null || !filterAttr.getValue().trim().equals(attr.getValue())) {
- match = filterInOr ? match : false;
- } else {
- match = filterInOr ? true : match;
- }
- }
-
- if (match) {
- // found searched element
- start = event.asStartElement();
- } else {
- skipElement(event.asStartElement(), reader, writer, false);
- depth--;
- }
- }
- } else if (current == null) {
- writeEvent(event, writer);
- } else {
- // skip element
- skipElement(event.asStartElement(), reader, writer, false);
- depth--;
- }
- } else {
- writeEvent(event, writer);
- }
-
- } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT) {
- depth--;
-
- writeEvent(event, writer);
-
- if (event.asEndElement().getName().getLocalPart().equals(current)) {
- // back step ....
- searchFor--;
- current = searchFor > 0 ? pathElementNames.get(searchFor - 1).trim() : null;
- }
- } else {
- writeEvent(event, writer);
- }
- }
-
- if (start == null) {
- throw new NotFoundException();
- }
-
- return new SimpleEntry<Integer, XmlElement>(Integer.valueOf(depth - 1), getXmlElement(start, reader));
- }
-
- public InputStream addAtomInlinecount(
- final InputStream feed, final int count, final Accept accept)
- throws Exception {
- final XMLEventReader reader = getEventReader(feed);
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final XMLEventWriter writer = getEventWriter(bos);
-
- try {
-
- final XmlElement feedElement =
- extractElement(reader, writer, Collections.<String>singletonList("feed"), 0, 1, 1).getValue();
-
- writer.add(feedElement.getStart());
- addAtomElement(IOUtils.toInputStream(String.format("<m:count>%d</m:count>", count)), writer);
- writer.add(feedElement.getContentReader());
- writer.add(feedElement.getEnd());
-
- while (reader.hasNext()) {
- writer.add(reader.nextEvent());
- }
-
- } finally {
- writer.flush();
- writer.close();
- reader.close();
- IOUtils.closeQuietly(feed);
- }
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- @Override
- public InputStream getPropertyValue(final InputStream is, final List<String> path)
- throws Exception {
-
- final List<String> pathElements = new ArrayList<String>();
-
- for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
- }
-
- final XMLEventReader reader = getEventReader(is);
- final Map.Entry<Integer, XmlElement> property = extractElement(reader, null, pathElements, 0, 3, 4);
-
- reader.close();
- IOUtils.closeQuietly(is);
-
- return property.getValue().getContent();
- }
-
- @Override
- public InputStream selectEntity(final InputStream entity, final String[] propertyNames) throws Exception {
- final XMLEventReader reader = getEventReader(entity);
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final XMLEventWriter writer = getEventWriter(bos);
-
- final List<String> found = new ArrayList<String>(Arrays.asList(propertyNames));
-
- boolean inProperties = false;
- boolean writeCurrent = true;
- Boolean writeNext = null;
- String currentName = null;
-
- final List<String> fieldToBeSaved = new ArrayList<String>(Arrays.asList(propertyNames));
-
- while (reader.hasNext()) {
- final XMLEvent event = reader.nextEvent();
- if (event.getEventType() == XMLStreamConstants.START_ELEMENT
- && LINK.equals(event.asStartElement().getName().getLocalPart())
- && !fieldToBeSaved.contains(
- event.asStartElement().getAttributeByName(new QName("title")).getValue())
- && !"edit".equals(event.asStartElement().getAttributeByName(new QName("rel")).getValue())) {
- writeCurrent = false;
- } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
- && LINK.equals(event.asEndElement().getName().getLocalPart())) {
- writeNext = true;
- } else if (event.getEventType() == XMLStreamConstants.START_ELEMENT
- && (PROPERTIES).equals(event.asStartElement().getName().getLocalPart())) {
- writeCurrent = true;
- writeNext = false;
- inProperties = true;
- } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
- && (PROPERTIES).equals(event.asEndElement().getName().getLocalPart())) {
- writeCurrent = true;
- } else if (inProperties) {
- if (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
- final String elementName = event.asStartElement().getName().getLocalPart();
-
- for (String propertyName : propertyNames) {
- if ((ATOM_PROPERTY_PREFIX + propertyName.trim()).equals(elementName)) {
- writeCurrent = true;
- found.remove(propertyName);
- currentName = propertyName;
- }
- }
-
- } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
- && StringUtils.isNotBlank(currentName)
- && (ATOM_PROPERTY_PREFIX + currentName.trim()).equals(
- event.asEndElement().getName().getLocalPart())) {
- writeNext = false;
- currentName = null;
- }
-
- }
-
- if (writeCurrent) {
- writer.add(event);
- }
-
- if (writeNext != null) {
- writeCurrent = writeNext;
- writeNext = null;
- }
- }
-
- writer.flush();
- writer.close();
- reader.close();
- IOUtils.closeQuietly(entity);
-
- // Do not raise any exception in order to support FC properties as well
- // if (!found.isEmpty()) {
- // throw new Exception(String.format("Could not find a properties '%s'", found));
- // }
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- @Override
- public InputStream readEntities(
- final List<String> links, final String linkName, final String next, final boolean forceFeed)
- throws Exception {
-
- if (links.isEmpty()) {
- throw new NotFoundException();
- }
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
-
- if (forceFeed || links.size() > 1) {
- // build a feed
- bos.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>".getBytes());
-
- bos.write(("<feed xml:base=\"" + DEFAULT_SERVICE_URL + "\" "
- + "xmlns=\"http://www.w3.org/2005/Atom\" "
- + "xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\" "
- + "xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">")
- .getBytes());
-
- bos.write(("<id>" + DEFAULT_SERVICE_URL + "entityset(entityid)/" + linkName + "</id>").getBytes());
-
- bos.write(("<title type=\"text\">" + linkName + "</title>").getBytes());
- bos.write("<updated>2014-03-03T13:40:49Z</updated>".getBytes());
- bos.write(("<link rel=\"self\" title=\"" + linkName + "\" href=\"" + linkName + "\" />").getBytes());
- }
-
- for (String link : links) {
- try {
- final Map.Entry<String, String> uri = Commons.parseEntityURI(link);
-
- final XmlElement entry =
- extractElement(
- getEventReader(readEntity(uri.getKey(), uri.getValue(), Accept.ATOM).getValue()),
- null,
- Collections.<String>singletonList("entry"),
- 0, 1, 1).getValue();
-
- IOUtils.copy(entry.toStream(), bos);
- } catch (Exception e) {
- // log and ignore link
- LOG.warn("Error parsing uri {}", link, e);
- }
- }
-
- if (forceFeed || links.size() > 1) {
-
- if (StringUtils.isNotBlank(next)) {
- bos.write(String.format("<link rel=\"next\" href=\"%s\" />", next).getBytes());
- }
-
- bos.write("</feed>".getBytes());
- }
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- @Override
- public Map<String, InputStream> getChanges(final InputStream src) throws Exception {
- final Map<String, InputStream> res = new HashMap<String, InputStream>();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- IOUtils.copy(src, bos);
- IOUtils.closeQuietly(src);
-
- // retrieve properties ...
- XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
-
- final Map.Entry<Integer, XmlElement> propertyElement =
- extractElement(reader, null, Collections.<String>singletonList(PROPERTIES), 0, 2, 3);
- reader.close();
-
- reader = propertyElement.getValue().getContentReader();
-
- try {
- while (true) {
- final XmlElement property = extractElement(reader, null, null, 0, -1, -1).getValue();
- res.put(property.getStart().getName().getLocalPart(), property.toStream());
- }
- } catch (Exception ignore) {
- // end
- }
-
- reader.close();
-
- // retrieve links ...
- reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
-
- try {
- int pos = 0;
- while (true) {
- final Map.Entry<Integer, XmlElement> linkElement =
- extractElement(reader, null, Collections.<String>singletonList(LINK), pos, 2, 2);
-
- res.put("[LINK]" + linkElement.getValue().getStart().getAttributeByName(new QName("title")).getValue(),
- linkElement.getValue().toStream());
-
- pos = linkElement.getKey();
- }
- } catch (Exception ignore) {
- // end
- }
-
- return res;
- }
-
- @Override
- public InputStream setChanges(
- final InputStream toBeChanged,
- final Map<String, InputStream> properties)
- throws Exception {
- XMLEventReader reader = getEventReader(toBeChanged);
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLEventWriter writer = getEventWriter(bos);
-
- // ---------------------------------
- // add property changes
- // ---------------------------------
- Map.Entry<Integer, XmlElement> propertyElement =
- extractElement(reader, writer, Collections.<String>singletonList(PROPERTIES), 0, 2, 3);
-
- writer.flush();
-
- ByteArrayOutputStream pbos = new ByteArrayOutputStream();
- OutputStreamWriter pwriter = new OutputStreamWriter(pbos);
-
- final XMLEventReader propertyReader = propertyElement.getValue().getContentReader();
-
- try {
- while (true) {
- final XmlElement property = extractElement(propertyReader, null, null, 0, -1, -1).getValue();
- final String name = property.getStart().getName().getLocalPart();
-
- if (properties.containsKey(name)) {
- // replace
- final InputStream replacement = properties.get(name);
- properties.remove(property.getStart().getName().getLocalPart());
- pwriter.append(IOUtils.toString(replacement));
- IOUtils.closeQuietly(replacement);
- } else {
- pwriter.append(IOUtils.toString(property.toStream()));
- }
- }
- } catch (Exception ignore) {
- // end
- }
-
- for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
- if (!remains.getKey().startsWith("[LINK]")) {
- pwriter.append(IOUtils.toString(remains.getValue()));
- IOUtils.closeQuietly(remains.getValue());
- }
- }
-
- pwriter.flush();
- pwriter.close();
-
- writer.add(propertyElement.getValue().getStart());
- writer.add(new XMLEventReaderWrapper(new ByteArrayInputStream(pbos.toByteArray())));
- writer.add(propertyElement.getValue().getEnd());
-
- IOUtils.closeQuietly(pbos);
-
- writer.add(reader);
- reader.close();
- writer.flush();
- writer.close();
- // ---------------------------------
-
- // ---------------------------------
- // add navigationm changes
- // ---------------------------------
-
- // remove existent links
- for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
-
- if (remains.getKey().startsWith("[LINK]")) {
- reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
-
- bos.reset();
- writer = getEventWriter(bos);
-
- try {
- final String linkName = remains.getKey().substring(remains.getKey().indexOf("]") + 1);
-
- extractElement(reader, writer, Collections.<String>singletonList(LINK),
- Collections.<Map.Entry<String, String>>singleton(new SimpleEntry<String, String>("title", linkName)),
- false, 0, 2, 2);
-
- writer.add(reader);
-
- } catch (Exception ignore) {
- // ignore
- }
-
- writer.flush();
- writer.close();
- }
- }
-
- reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
-
- bos.reset();
- writer = getEventWriter(bos);
-
- propertyElement = extractElement(reader, writer, Collections.<String>singletonList(CONTENT), 0, 2, 2);
- writer.flush();
-
- pbos.reset();
- pwriter = new OutputStreamWriter(pbos);
-
- for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
- if (remains.getKey().startsWith("[LINK]")) {
- pwriter.append(IOUtils.toString(remains.getValue()));
- IOUtils.closeQuietly(remains.getValue());
- }
- }
-
- pwriter.flush();
- pwriter.close();
-
- writer.add(new XMLEventReaderWrapper(new ByteArrayInputStream(pbos.toByteArray())));
- IOUtils.closeQuietly(pbos);
-
- writer.add(propertyElement.getValue().getStart());
- writer.add(propertyElement.getValue().getContentReader());
- writer.add(propertyElement.getValue().getEnd());
-
- writer.add(reader);
- reader.close();
- writer.flush();
- writer.close();
- // ---------------------------------
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- @Override
- protected InputStream replaceLink(
- final InputStream toBeChanged, final String linkName, final InputStream replacement)
- throws Exception {
- final XMLEventReader reader = getEventReader(toBeChanged);
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final XMLEventWriter writer = getEventWriter(bos);
-
- final XMLEventFactory eventFactory = XMLEventFactory.newInstance();
- XMLEvent newLine = eventFactory.createSpace("\n");
-
- try {
- final XmlElement linkElement =
- extractElement(reader, writer, Collections.<String>singletonList(LINK),
- Collections.<Map.Entry<String, String>>singletonList(new SimpleEntry<String, String>("title", linkName)),
- false, 0, -1, -1).getValue();
- writer.add(linkElement.getStart());
-
- // ------------------------------------------
- // write inline ...
- // ------------------------------------------
- writer.add(newLine);
- writer.add(eventFactory.createStartElement("m", null, "inline"));
-
- addAtomElement(replacement, writer);
-
- writer.add(eventFactory.createEndElement("m", null, "inline"));
- writer.add(newLine);
- // ------------------------------------------
-
- writer.add(linkElement.getEnd());
-
- writer.add(reader);
- writer.flush();
- writer.close();
- } finally {
- reader.close();
- IOUtils.closeQuietly(toBeChanged);
- }
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- public String getEdmTypeFromAtom(final String entitySetName, final String entityId, final List<String> path)
- throws Exception {
- InputStream src = fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.XML);
-
- final List<String> atomPathElements = new ArrayList<String>();
-
- for (String element : path) {
- atomPathElements.add(ATOM_PROPERTY_PREFIX + element);
- }
-
- final Map.Entry<Integer, XmlElement> prop = extractElement(getEventReader(src), null, atomPathElements, 0, 3, 4);
- IOUtils.closeQuietly(src);
-
- final Attribute type = prop.getValue().getStart().getAttributeByName(new QName(TYPE));
-
- final String edmType;
-
- if (type == null) {
- edmType = Constants.ATOM_DEF_TYPE;
- } else {
- edmType = type.getValue();
- }
-
- return edmType;
- }
-
- @Override
- public Map.Entry<String, List<String>> extractLinkURIs(
- final String entitySetName, final String entityId, final String linkName)
- throws Exception {
- final LinkInfo links = readLinks(entitySetName, entityId, linkName, Accept.XML);
- return extractLinkURIs(links.getLinks());
- }
-
- @Override
- public Map.Entry<String, List<String>> extractLinkURIs(final InputStream is)
- throws Exception {
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- IOUtils.copy(is, bos);
- IOUtils.closeQuietly(is);
-
- XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
- final List<String> links = new ArrayList<String>();
- try {
- while (true) {
- links.add(IOUtils.toString(extractElement(reader, null, Collections.<String>singletonList("uri"), 0, -1, -1).
- getValue().getContent()));
- }
- } catch (Exception ignore) {
- // End document reached ...
- }
- reader.close();
-
- String next;
-
- reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
- try {
- next = IOUtils.toString(extractElement(reader, null, Collections.<String>singletonList("next"), 0, -1, -1).
- getValue().getContent());
- } catch (Exception ignore) {
- // next link is not mandatory
- next = null;
- }
- reader.close();
-
- return new AbstractMap.SimpleEntry<String, List<String>>(next, links);
- }
-
- @Override
- public InputStream getProperty(
- final String entitySetName, final String entityId, final List<String> path, final String edmType)
- throws Exception {
- final List<String> pathElements = new ArrayList<String>();
-
- for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
- }
-
- final InputStream src =
- fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.XML);
-
- final XMLEventReader reader = getEventReader(src);
- final XmlElement property = extractElement(reader, null, pathElements, 0, 3, 4).getValue();
-
- reader.close();
- IOUtils.closeQuietly(src);
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final XMLEventWriter writer = getEventWriter(bos);
-
- final XMLEventFactory eventFactory = XMLEventFactory.newInstance();
- writer.add(eventFactory.createStartDocument("UTF-8", "1.0"));
- writer.add(property.getStart());
-
- if (property.getStart().getAttributeByName(new QName(ATOM_DATASERVICE_NS)) == null) {
- writer.add(eventFactory.createNamespace(ATOM_PROPERTY_PREFIX.substring(0, 1), DATASERVICES_NS));
- }
- if (property.getStart().getAttributeByName(new QName(ATOM_METADATA_NS)) == null) {
- writer.add(eventFactory.createNamespace(ATOM_METADATA_PREFIX.substring(0, 1), METADATA_NS));
- }
-
- writer.add(property.getContentReader());
- writer.add(property.getEnd());
-
- writer.flush();
- writer.close();
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- @Override
- public InputStream replaceProperty(
- final InputStream src, final InputStream replacement, final List<String> path, final boolean justValue)
- throws Exception {
-
- final List<String> pathElements = new ArrayList<String>();
-
- for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
- }
-
- final XMLEventReader reader = getEventReader(src);
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final XMLEventWriter writer = getEventWriter(bos);
-
- final Map.Entry<Integer, XmlElement> element = extractElement(reader, writer, pathElements, 0, 3, 4);
-
- if (justValue) {
- writer.add(element.getValue().getStart());
- }
-
- final XMLEventReader changesReader = new XMLEventReaderWrapper(replacement);
-
- writer.add(changesReader);
- changesReader.close();
- IOUtils.closeQuietly(replacement);
-
- if (justValue) {
- writer.add(element.getValue().getEnd());
- }
-
- writer.add(reader);
-
- reader.close();
- IOUtils.closeQuietly(src);
-
- writer.flush();
- writer.close();
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- @Override
- public InputStream deleteProperty(final InputStream src, final List<String> path) throws Exception {
-
- final List<String> pathElements = new ArrayList<String>();
-
- for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
- }
-
- final XMLEventReader reader = getEventReader(src);
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final XMLEventWriter writer = getEventWriter(bos);
-
- final Map.Entry<Integer, XmlElement> element = extractElement(reader, writer, pathElements, 0, 3, 4);
-
- final XMLEventReader changesReader = new XMLEventReaderWrapper(
- IOUtils.toInputStream(String.format("<%s m:null=\"true\" />", path.get(path.size() - 1))));
-
- writer.add(changesReader);
- changesReader.close();
-
- writer.add(reader);
-
- reader.close();
- IOUtils.closeQuietly(src);
-
- writer.flush();
- writer.close();
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/utils/v3/JSONUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/v3/JSONUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/v3/JSONUtilities.java
new file mode 100644
index 0000000..0f2a3f2
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/v3/JSONUtilities.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.fit.utils.v3;
+
+import org.apache.olingo.fit.utils.ODataVersion;
+
+public class JSONUtilities extends org.apache.olingo.fit.utils.AbstractJSONUtilities {
+
+ public JSONUtilities() throws Exception {
+ super(ODataVersion.v3);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java
new file mode 100644
index 0000000..c1a58bf
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.utils.v3;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.AbstractMap.SimpleEntry;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.events.StartElement;
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.fit.utils.Accept;
+import org.apache.olingo.fit.utils.Commons;
+import org.apache.olingo.fit.utils.Constants;
+import org.apache.olingo.fit.utils.MetadataLinkInfo;
+import org.apache.olingo.fit.utils.ODataVersion;
+import org.apache.olingo.fit.utils.XmlElement;
+
+public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtilities {
+
+ public XMLUtilities() throws Exception {
+ super(ODataVersion.v3);
+ }
+
+ @Override
+ public void retrieveLinkInfoFromMetadata() throws Exception {
+
+ final MetadataLinkInfo metadataLinkInfo = new MetadataLinkInfo();
+ Commons.getLinkInfo().put(version, metadataLinkInfo);
+
+ final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+ final XMLEventReader reader = getEventReader(metadata);
+
+ try {
+ while (true) {
+ final Map.Entry<Integer, XmlElement> entitySetElement =
+ extractElement(reader, null, Collections.<String>singletonList("EntitySet"),
+ null, false, 0, -1, -1);
+
+ retrieveLinks(entitySetElement.getValue(), metadataLinkInfo);
+ }
+ } catch (Exception e) {
+ } finally {
+ reader.close();
+ }
+ }
+
+ private void retrieveLinks(final XmlElement entitySetElement, final MetadataLinkInfo metadataLinkInfo)
+ throws Exception {
+
+ final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ IOUtils.copy(metadata, bos);
+ IOUtils.closeQuietly(metadata);
+
+ final String entitySetName = entitySetElement.getStart().getAttributeByName(new QName("Name")).getValue().trim();
+ final String entityType = entitySetElement.getStart().getAttributeByName(new QName("EntityType")).getValue().trim();
+
+ final Collection<Map.Entry<String, String>> filter = new HashSet<Map.Entry<String, String>>();
+ filter.add(new SimpleEntry<String, String>(
+ "Name", entityType.substring(entityType.lastIndexOf(".") + 1, entityType.length())));
+ filter.add(new SimpleEntry<String, String>("BaseType", entityType));
+
+ final XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+
+ final Map.Entry<Integer, XmlElement> entityTypeElement = extractElement(
+ reader, null, Collections.<String>singletonList("EntityType"), filter, true, 0, -1, -1);
+
+ final XMLEventReader entityReader = entityTypeElement.getValue().getContentReader();
+ int size = 0;
+
+ try {
+ while (true) {
+ final XmlElement navProperty =
+ extractElement(entityReader, null, Collections.<String>singletonList("NavigationProperty"),
+ null, false, 0, -1, -1).getValue();
+
+ final String linkName = navProperty.getStart().getAttributeByName(new QName("Name")).getValue();
+ final Map.Entry<String, Boolean> target = getTargetInfo(navProperty.getStart(), linkName);
+
+ metadataLinkInfo.addLink(
+ entitySetName,
+ linkName,
+ target.getKey(),
+ target.getValue());
+
+ size++;
+ }
+ } catch (Exception e) {
+ } finally {
+ entityReader.close();
+ }
+
+ if (size == 0) {
+ metadataLinkInfo.addEntitySet(entitySetName);
+ }
+ }
+
+ private Map.Entry<String, Boolean> getTargetInfo(final StartElement element, final String linkName)
+ throws Exception {
+ final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ IOUtils.copy(metadata, bos);
+ IOUtils.closeQuietly(metadata);
+
+ // ------------------------------------
+ // Retrieve association
+ // ------------------------------------
+ XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+
+ final String associationName = element.getAttributeByName(new QName("Relationship")).getValue();
+
+ final Map.Entry<Integer, XmlElement> association = extractElement(
+ reader, null, Collections.<String>singletonList("Association"),
+ Collections.<Map.Entry<String, String>>singleton(new SimpleEntry<String, String>(
+ "Name", associationName.substring(associationName.lastIndexOf(".") + 1))), false,
+ 0, 4, 4);
+
+ reader.close();
+ // ------------------------------------
+
+ // ------------------------------------
+ // check for feed or not from Association role
+ // ------------------------------------
+ InputStream associationContent = association.getValue().toStream();
+ reader = getEventReader(associationContent);
+
+ Map.Entry<Integer, XmlElement> associationEnd = extractElement(
+ reader, null, Collections.<String>singletonList("End"),
+ Collections.<Map.Entry<String, String>>singleton(new SimpleEntry<String, String>("Role", linkName)),
+ false, 0, -1, -1);
+
+ reader.close();
+ IOUtils.closeQuietly(associationContent);
+
+ final boolean feed = associationEnd.getValue().getStart().getAttributeByName(
+ new QName("Multiplicity")).getValue().equals("*");
+ // ------------------------------------
+
+ // ------------------------------------
+ // Retrieve target association set name
+ // ------------------------------------
+ reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+
+ final Map.Entry<Integer, XmlElement> associationSet = extractElement(
+ reader, null, Collections.<String>singletonList("AssociationSet"),
+ Collections.<Map.Entry<String, String>>singleton(new SimpleEntry<String, String>(
+ "Association", associationName)), false, 0, -1, -1);
+
+ reader.close();
+
+ associationContent = associationSet.getValue().toStream();
+ reader = getEventReader(associationContent);
+
+ associationEnd = extractElement(
+ reader, null, Collections.<String>singletonList("End"),
+ Collections.<Map.Entry<String, String>>singleton(new SimpleEntry<String, String>("Role", linkName)),
+ false, 0, -1, -1);
+
+ reader.close();
+ IOUtils.closeQuietly(associationContent);
+
+ final String target = associationEnd.getValue().getStart().getAttributeByName(new QName("EntitySet")).getValue();
+ // ------------------------------------
+
+ return new SimpleEntry<String, Boolean>(target, feed);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/utils/v4/JSONUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/v4/JSONUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/v4/JSONUtilities.java
new file mode 100644
index 0000000..daf75f4
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/v4/JSONUtilities.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.fit.utils.v4;
+
+import org.apache.olingo.fit.utils.ODataVersion;
+
+public class JSONUtilities extends org.apache.olingo.fit.utils.AbstractJSONUtilities {
+
+ public JSONUtilities() throws Exception {
+ super(ODataVersion.v4);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
new file mode 100644
index 0000000..c61d272
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.utils.v4;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.fit.utils.Accept;
+import org.apache.olingo.fit.utils.Commons;
+import org.apache.olingo.fit.utils.Constants;
+import org.apache.olingo.fit.utils.MetadataLinkInfo;
+import org.apache.olingo.fit.utils.ODataVersion;
+import org.apache.olingo.fit.utils.XmlElement;
+
+public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtilities {
+
+ public XMLUtilities() throws Exception {
+ super(ODataVersion.v4);
+ }
+
+ @Override
+ public void retrieveLinkInfoFromMetadata() throws Exception {
+
+ final MetadataLinkInfo metadataLinkInfo = new MetadataLinkInfo();
+ Commons.getLinkInfo().put(version, metadataLinkInfo);
+
+ final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ IOUtils.copy(metadata, bos);
+ IOUtils.closeQuietly(metadata);
+
+ XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+
+ final Set<String> singletons = new HashSet<String>();
+
+ try {
+ while (true) {
+ final Map.Entry<Integer, XmlElement> entitySetElement =
+ extractElement(reader, null, Collections.<String>singletonList("Singleton"),
+ null, false, 0, -1, -1);
+
+ final String entitySetName =
+ entitySetElement.getValue().getStart().getAttributeByName(new QName("Name")).getValue().trim();
+ singletons.add(entitySetName);
+ }
+ } catch (Exception e) {
+ } finally {
+ reader.close();
+ }
+
+ reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+
+ try {
+ while (true) {
+ final Map.Entry<Integer, XmlElement> entitySetElement =
+ extractElement(reader, null, Collections.<String>singletonList("EntitySet"),
+ null, false, 0, -1, -1);
+
+ retrieveLinks(entitySetElement.getValue(), metadataLinkInfo, singletons);
+ }
+ } catch (Exception e) {
+ } finally {
+ reader.close();
+ }
+
+ reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+
+ try {
+ while (true) {
+ final Map.Entry<Integer, XmlElement> entitySetElement =
+ extractElement(reader, null, Collections.<String>singletonList("Singleton"),
+ null, false, 0, -1, -1);
+
+ retrieveLinks(entitySetElement.getValue(), metadataLinkInfo, singletons);
+ }
+ } catch (Exception e) {
+ } finally {
+ reader.close();
+ }
+ }
+
+ private void retrieveLinks(
+ final XmlElement entitySetElement, final MetadataLinkInfo metadataLinkInfo, final Set<String> singletons)
+ throws Exception {
+
+ final String entitySetName = entitySetElement.getStart().getAttributeByName(new QName("Name")).getValue().trim();
+
+ final XMLEventReader entityReader = entitySetElement.getContentReader();
+ int size = 0;
+
+ try {
+ while (true) {
+ final XmlElement navProperty =
+ extractElement(entityReader, null, Collections.<String>singletonList("NavigationPropertyBinding"),
+ null, false, 0, -1, -1).getValue();
+
+ final String linkName = navProperty.getStart().getAttributeByName(new QName("Path")).getValue();
+ final String target = navProperty.getStart().getAttributeByName(new QName("Target")).getValue();
+ final boolean feed = !singletons.contains(target);
+
+ metadataLinkInfo.addLink(
+ entitySetName,
+ linkName,
+ target,
+ feed);
+
+ size++;
+ }
+ } catch (Exception e) {
+ } finally {
+ entityReader.close();
+ }
+
+ if (size == 0) {
+ metadataLinkInfo.addEntitySet(entitySetName);
+ }
+ }
+}
[25/52] [abbrv] Moving some classes to more appropriate packages
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ComplexTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ComplexTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ComplexTypeDeserializer.java
deleted file mode 100644
index 754bad4..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ComplexTypeDeserializer.java
+++ /dev/null
@@ -1,83 +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.client.core.op;
-
-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.client.core.edm.xml.AbstractComplexType;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.ComplexTypeImpl()
- : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- setAbstractEntityType(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("BaseType".equals(jp.getCurrentName())) {
- ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- setBaseType(jp.nextTextValue());
- } else if ("OpenType".equals(jp.getCurrentName())) {
- ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("Property".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (complexType instanceof org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl) complexType).
- getProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- getProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
- }
- } else if ("NavigationProperty".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- getNavigationProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- setAnnotation(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return complexType;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityContainerDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityContainerDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityContainerDeserializer.java
deleted file mode 100644
index 131ba9e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityContainerDeserializer.java
+++ /dev/null
@@ -1,102 +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.client.core.op;
-
-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.client.core.edm.xml.AbstractEntityContainer;
-import org.apache.olingo.client.core.edm.xml.v3.AssociationSetImpl;
-import org.apache.olingo.client.core.edm.xml.v4.ActionImportImpl;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.edm.xml.v4.SingletonImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.EntityContainerImpl()
- : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.EntityContainerImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
- getEntitySets().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.EntitySetImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
- getEntitySets().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl.class));
- }
- } else if ("AssociationSet".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
- getAssociationSets().add(jp.readValueAs(AssociationSetImpl.class));
- } else if ("Singleton".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
- getSingletons().add(jp.readValueAs(SingletonImpl.class));
- } else if ("ActionImport".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
- getActionImports().add(jp.readValueAs(ActionImportImpl.class));
- } else if ("FunctionImport".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (entityContainer instanceof org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
- getFunctionImports().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.FunctionImportImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
- getFunctionImports().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.FunctionImportImpl.class));
- }
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
- setAnnotation(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return entityContainer;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityKeyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityKeyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityKeyDeserializer.java
deleted file mode 100644
index 8462f4a..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityKeyDeserializer.java
+++ /dev/null
@@ -1,50 +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.client.core.op;
-
-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.client.core.edm.xml.EntityKeyImpl;
-import org.apache.olingo.client.core.edm.xml.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.readValueAs( PropertyRefImpl.class));
- }
- }
-
- return entityKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntitySetDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntitySetDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntitySetDeserializer.java
deleted file mode 100644
index d11206e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntitySetDeserializer.java
+++ /dev/null
@@ -1,70 +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.client.core.op;
-
-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.client.core.edm.xml.AbstractEntitySet;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyBindingImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.EntitySetImpl()
- : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v4.EntitySetImpl) entitySet).
- setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).
- getNavigationPropertyBindings().add(
- jp.readValueAs(NavigationPropertyBindingImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).
- setAnnotation(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return entitySet;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityTypeDeserializer.java
deleted file mode 100644
index b2775e5..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityTypeDeserializer.java
+++ /dev/null
@@ -1,92 +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.client.core.op;
-
-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.client.core.edm.xml.AbstractEntityType;
-import org.apache.olingo.client.core.edm.xml.EntityKeyImpl;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.EntityTypeImpl()
- : new org.apache.olingo.client.core.edm.xml.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.readValueAs(EntityKeyImpl.class));
- } else if ("Property".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (entityType instanceof org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) entityType).
- getProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
- getProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
- }
- } else if ("NavigationProperty".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (entityType instanceof org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) entityType).
- getNavigationProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.NavigationPropertyImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
- getNavigationProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyImpl.class));
- }
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
- setAnnotation(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return entityType;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EnumTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EnumTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EnumTypeDeserializer.java
deleted file mode 100644
index f2b891c..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EnumTypeDeserializer.java
+++ /dev/null
@@ -1,73 +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.client.core.op;
-
-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.client.core.edm.xml.AbstractEnumType;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.EnumTypeImpl()
- : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.EnumTypeImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.EnumTypeImpl) enumType).
- getMembers().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.MemberImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).
- getMembers().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.MemberImpl.class));
- }
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).
- setAnnotation(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return enumType;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/op/SchemaDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/SchemaDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/SchemaDeserializer.java
deleted file mode 100644
index 47eb195..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/SchemaDeserializer.java
+++ /dev/null
@@ -1,149 +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.client.core.op;
-
-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.client.core.edm.xml.AbstractSchema;
-import org.apache.olingo.client.core.edm.xml.v3.AssociationImpl;
-import org.apache.olingo.client.core.edm.xml.v3.UsingImpl;
-import org.apache.olingo.client.core.edm.xml.v3.ValueTermImpl;
-import org.apache.olingo.client.core.edm.xml.v4.ActionImpl;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.edm.xml.v4.FunctionImpl;
-import org.apache.olingo.client.core.edm.xml.v4.TypeDefinitionImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.SchemaImpl()
- : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.SchemaImpl) schema).
- getUsings().add(jp.readValueAs( UsingImpl.class));
- } else if ("Association".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getAssociations().add(jp.readValueAs( AssociationImpl.class));
- } else if ("ComplexType".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getComplexTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
- getComplexTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl.class));
- }
- } else if ("EntityType".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getEntityTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
- getEntityTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl.class));
- }
- } else if ("EnumType".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getEnumTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.EnumTypeImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
- getEnumTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl.class));
- }
- } else if ("ValueTerm".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getValueTerms().add(jp.readValueAs( ValueTermImpl.class));
- } else if ("EntityContainer".equals(jp.getCurrentName())) {
- jp.nextToken();
-
- if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getEntityContainers().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl.class));
- } else {
- org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl entityContainer
- = jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl.class);
- entityContainer.setDefaultEntityContainer(true);
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
- setEntityContainer(entityContainer);
- }
- } else if ("Annotations".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).getAnnotationsList().
- add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.AnnotationsImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotationsList().
- add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.AnnotationsImpl.class));
- }
- } else if ("Action".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getActions().
- add(jp.readValueAs( ActionImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotations().
- add(jp.readValueAs( AnnotationImpl.class));
- } else if ("Function".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getFunctions().
- add(jp.readValueAs( FunctionImpl.class));
- } else if ("TypeDefinition".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
- getTypeDefinitions().add(jp.readValueAs( TypeDefinitionImpl.class));
- }
- }
- }
-
- return schema;
- }
-}
[17/52] [abbrv] git commit: [OLINGO-214] Using Timestamp consistently
for both V4 and V3 datetime types
Posted by sk...@apache.org.
[OLINGO-214] Using Timestamp consistently for both V4 and V3 datetime types
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/130a49fe
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/130a49fe
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/130a49fe
Branch: refs/heads/olingo-206-validator
Commit: 130a49fed20c32a4f4d8272919e9bae4c9427d55
Parents: 5a15155
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 22 16:11:36 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 22 16:11:36 2014 +0100
----------------------------------------------------------------------
.../core/edm/primitivetype/EdmDateTime.java | 89 +++++++++++---------
.../edm/primitivetype/EdmDateTimeOffset.java | 68 +++++++++++++--
.../core/edm/primitivetype/EdmTimeOfDay.java | 45 ++++++++--
3 files changed, 147 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/130a49fe/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
index e061388..af2793b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
@@ -54,37 +54,43 @@ public final class EdmDateTime extends SingletonPrimitiveType {
final Boolean isNullable, final Integer maxLength, final Integer precision,
final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
- Calendar calendar = null;
- Timestamp timestamp = null;
-
final String[] dateParts = value.split("\\.");
+
+ final Date date;
try {
- final Date date = DATE_FORMAT.get().parse(dateParts[0]);
- if (dateParts.length > 1) {
- int idx = dateParts[1].indexOf('+');
- if (idx == -1) {
- idx = dateParts[1].indexOf('-');
- }
- if (idx == -1) {
- calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- calendar.setTime(date);
-
- timestamp = new Timestamp(calendar.getTimeInMillis());
- timestamp.setNanos(Integer.parseInt(dateParts[1]));
- } else {
- calendar = Calendar.getInstance(TimeZone.getTimeZone(dateParts[1].substring(idx)));
- calendar.setTime(date);
-
- timestamp = new Timestamp(calendar.getTimeInMillis());
- timestamp.setNanos(Integer.parseInt(dateParts[1].substring(0, idx)));
- }
- } else {
- timestamp = new Timestamp(date.getTime());
- }
+ date = DATE_FORMAT.get().parse(dateParts[0]);
} catch (Exception e) {
throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
}
+ TimeZone timezone = null;
+ Integer fractionalSecs = null;
+ if (dateParts.length > 1) {
+ int idx = dateParts[1].indexOf('+');
+ if (idx == -1) {
+ idx = dateParts[1].indexOf('-');
+ }
+ if (idx == -1) {
+ fractionalSecs = Integer.parseInt(dateParts[1]);
+ } else {
+ timezone = TimeZone.getTimeZone(dateParts[1].substring(idx));
+ fractionalSecs = Integer.parseInt(dateParts[1].substring(0, idx));
+ }
+ }
+
+ if (fractionalSecs != null && String.valueOf(fractionalSecs).length() > (precision == null ? 0 : precision)) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.LITERAL_FACETS_NOT_MATCHED.addContent(value, facets)");
+ }
+
+ final Calendar calendar = timezone == null ? Calendar.getInstance() : Calendar.getInstance(timezone);
+ calendar.setTime(date);
+ final Timestamp timestamp = new Timestamp(date.getTime());
+ if (fractionalSecs != null) {
+ calendar.set(Calendar.MILLISECOND, fractionalSecs);
+ timestamp.setNanos(fractionalSecs);
+ }
+
if (returnType.isAssignableFrom(Calendar.class)) {
return returnType.cast(calendar);
} else if (returnType.isAssignableFrom(Timestamp.class)) {
@@ -100,25 +106,32 @@ public final class EdmDateTime extends SingletonPrimitiveType {
final Boolean isNullable, final Integer maxLength, final Integer precision,
final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+ Date date = null;
+ Integer fractionalSecs = null;
if (value instanceof Calendar) {
final Calendar calendar = (Calendar) value;
-
- final StringBuilder formatted = new StringBuilder().append(DATE_FORMAT.get().format(calendar.getTime()));
- formatted.append(calendar.getTimeZone());
-
- return formatted.toString();
- } else if (value instanceof Timestamp) {
+ date = calendar.getTime();
+ fractionalSecs = calendar.get(Calendar.MILLISECOND);
+ }
+ if (value instanceof Timestamp) {
final Timestamp timestamp = (Timestamp) value;
+ date = new Date(timestamp.getTime());
+ fractionalSecs = timestamp.getNanos();
+ }
- final StringBuilder formatted = new StringBuilder().append(DATE_FORMAT.get().format(timestamp));
- if (timestamp.getNanos() > 0) {
- formatted.append('.').append(String.valueOf(timestamp.getNanos()));
- }
+ final StringBuilder result = new StringBuilder().append(DATE_FORMAT.get().format(date));
- return formatted.toString();
- } else {
+ try {
+ if (value instanceof Timestamp) {
+ EdmDateTimeOffset.appendFractionalSeconds(result, fractionalSecs, precision);
+ } else {
+ EdmDateTimeOffset.appendMilliseconds(result, fractionalSecs, precision);
+ }
+ } catch (final IllegalArgumentException e) {
throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ "EdmPrimitiveTypeException.VALUE_FACETS_NOT_MATCHED.addContent(value, facets)", e);
}
+
+ return result.toString();
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/130a49fe/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java
index 7a511d6..f1b707f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
@@ -33,7 +34,7 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
private static final Pattern PATTERN = Pattern.compile(
"(-?\\p{Digit}{4,})-(\\p{Digit}{2})-(\\p{Digit}{2})"
- + "T(\\p{Digit}{2}):(\\p{Digit}{2})(?::(\\p{Digit}{2})(\\.(\\p{Digit}{0,3}?)0*)?)?"
+ + "T(\\p{Digit}{2}):(\\p{Digit}{2})(?::(\\p{Digit}{2})(\\.(\\p{Digit}{0,12}?)0*)?)?"
+ "(Z|([-+]\\p{Digit}{2}:\\p{Digit}{2}))?");
private static final EdmDateTimeOffset INSTANCE = new EdmDateTimeOffset();
@@ -74,6 +75,10 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
Byte.parseByte(matcher.group(5)),
matcher.group(6) == null ? 0 : Byte.parseByte(matcher.group(6)));
+ // cloning the original Calendar instance to avoid vanishing the Calendar value check - triggered by any
+ // get method - empowered by the convertDateTime() method below
+ final Timestamp timestamp = new Timestamp(((Calendar) dateTimeValue.clone()).getTimeInMillis());
+
if (matcher.group(7) != null) {
if (matcher.group(7).length() == 1 || matcher.group(7).length() > 13) {
throw new EdmPrimitiveTypeException(
@@ -84,18 +89,28 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
throw new EdmPrimitiveTypeException(
"EdmPrimitiveTypeException.LITERAL_FACETS_NOT_MATCHED.addContent(value, facets)");
}
- final String milliSeconds = decimals + "000".substring(decimals.length());
+ final String milliSeconds = decimals.length() > 3
+ ? decimals.substring(0, 3)
+ : decimals + "000".substring(decimals.length());
dateTimeValue.set(Calendar.MILLISECOND, Short.parseShort(milliSeconds));
+
+ if (!decimals.isEmpty()) {
+ timestamp.setNanos(Integer.parseInt(decimals));
+ }
+ }
+
+ if (returnType.isAssignableFrom(Timestamp.class)) {
+ return returnType.cast(timestamp);
}
try {
return convertDateTime(dateTimeValue, returnType);
} catch (final IllegalArgumentException e) {
throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value), e");
+ "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
} catch (final ClassCastException e) {
throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType), e");
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)", e);
}
}
@@ -138,9 +153,19 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
final Boolean isNullable, final Integer maxLength, final Integer precision,
final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
- final Calendar dateTimeValue = createDateTime(value);
+ final Calendar dateTimeValue;
+ final int fractionalSecs;
+ if (value instanceof Timestamp) {
+ final Calendar tmp = Calendar.getInstance();
+ tmp.setTimeInMillis(((Timestamp) value).getTime());
+ dateTimeValue = createDateTime(tmp);
+ fractionalSecs = ((Timestamp) value).getNanos();
+ } else {
+ dateTimeValue = createDateTime(value);
+ fractionalSecs = dateTimeValue.get(Calendar.MILLISECOND);
+ }
- final StringBuilder result = new StringBuilder(23); // 23 characters are enough for millisecond precision.
+ final StringBuilder result = new StringBuilder();
final int year = dateTimeValue.get(Calendar.YEAR);
appendTwoDigits(result, year / 100);
appendTwoDigits(result, year % 100);
@@ -156,10 +181,14 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
appendTwoDigits(result, dateTimeValue.get(Calendar.SECOND));
try {
- appendMilliseconds(result, dateTimeValue.get(Calendar.MILLISECOND), precision);
+ if (value instanceof Timestamp) {
+ appendFractionalSeconds(result, fractionalSecs, precision);
+ } else {
+ appendMilliseconds(result, fractionalSecs, precision);
+ }
} catch (final IllegalArgumentException e) {
throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.VALUE_FACETS_NOT_MATCHED.addContent(value, facets), e");
+ "EdmPrimitiveTypeException.VALUE_FACETS_NOT_MATCHED.addContent(value, facets)", e);
}
final int offsetInMinutes = (dateTimeValue.get(Calendar.ZONE_OFFSET)
@@ -218,8 +247,9 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
* @param result a {@link StringBuilder}
* @param milliseconds an integer that must satisfy <code>0 <= milliseconds <= 999</code>
* @param precision the upper limit for decimal digits (optional, defaults to zero)
+ * @throws IllegalArgumentException if precision is not met
*/
- protected static void appendMilliseconds(final StringBuilder result, final long milliseconds,
+ protected static void appendMilliseconds(final StringBuilder result, final int milliseconds,
final Integer precision) throws IllegalArgumentException {
final int digits = milliseconds % 1000 == 0 ? 0 : milliseconds % 100 == 0 ? 1 : milliseconds % 10 == 0 ? 2 : 3;
if (digits > 0) {
@@ -236,4 +266,24 @@ public final class EdmDateTimeOffset extends SingletonPrimitiveType {
}
}
}
+
+ /**
+ * Appends the given fractional seconds to the given string builder.
+ *
+ * @param result a {@link StringBuilder}
+ * @param fractionalSeconds fractional seconds
+ * @param precision the upper limit for decimal digits (optional, defaults to zero)
+ * @throws IllegalArgumentException if precision is not met
+ */
+ protected static void appendFractionalSeconds(final StringBuilder result, final int fractionalSeconds,
+ final Integer precision) throws IllegalArgumentException {
+
+ if (fractionalSeconds > 0) {
+ if (precision == null || precision < String.valueOf(fractionalSeconds).length()) {
+ throw new IllegalArgumentException();
+ }
+
+ result.append('.').append(fractionalSeconds);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/130a49fe/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDay.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDay.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDay.java
index 7d8cf9e..2003b09 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDay.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDay.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import java.sql.Timestamp;
import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
@@ -28,7 +29,7 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
public final class EdmTimeOfDay extends SingletonPrimitiveType {
private static final Pattern PATTERN = Pattern.compile(
- "(\\p{Digit}{2}):(\\p{Digit}{2})(?::(\\p{Digit}{2})(\\.(\\p{Digit}{0,3}?)0*)?)?");
+ "(\\p{Digit}{2}):(\\p{Digit}{2})(?::(\\p{Digit}{2})(\\.(\\p{Digit}{0,}?)0*)?)?");
private static final EdmTimeOfDay INSTANCE = new EdmTimeOfDay();
@@ -57,6 +58,10 @@ public final class EdmTimeOfDay extends SingletonPrimitiveType {
dateTimeValue.set(Calendar.MINUTE, Byte.parseByte(matcher.group(2)));
dateTimeValue.set(Calendar.SECOND, matcher.group(3) == null ? 0 : Byte.parseByte(matcher.group(3)));
+ // cloning the original Calendar instance to avoid vanishing the Calendar value check - triggered by any
+ // get method - empowered by the convertDateTime() method below
+ final Timestamp timestamp = new Timestamp(((Calendar) dateTimeValue.clone()).getTimeInMillis());
+
if (matcher.group(4) != null) {
if (matcher.group(4).length() == 1 || matcher.group(4).length() > 13) {
throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)");
@@ -66,18 +71,28 @@ public final class EdmTimeOfDay extends SingletonPrimitiveType {
throw new EdmPrimitiveTypeException(
"EdmPrimitiveTypeException.LITERAL_FACETS_NOT_MATCHED.addContent(value, facets)");
}
- final String milliSeconds = decimals + "000".substring(decimals.length());
+ final String milliSeconds = decimals.length() > 3
+ ? decimals.substring(0, 3)
+ : decimals + "000".substring(decimals.length());
dateTimeValue.set(Calendar.MILLISECOND, Short.parseShort(milliSeconds));
+
+ if (!decimals.isEmpty()) {
+ timestamp.setNanos(Integer.parseInt(decimals));
+ }
+ }
+
+ if (returnType.isAssignableFrom(Timestamp.class)) {
+ return returnType.cast(timestamp);
}
try {
return EdmDateTimeOffset.convertDateTime(dateTimeValue, returnType);
} catch (final IllegalArgumentException e) {
throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value), e");
+ "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
} catch (final ClassCastException e) {
throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType), e");
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)", e);
}
}
@@ -86,9 +101,19 @@ public final class EdmTimeOfDay extends SingletonPrimitiveType {
final Boolean isNullable, final Integer maxLength, final Integer precision,
final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
- final Calendar dateTimeValue = EdmDateTimeOffset.createDateTime(value);
+ final Calendar dateTimeValue;
+ final int fractionalSecs;
+ if (value instanceof Timestamp) {
+ final Calendar tmp = Calendar.getInstance();
+ tmp.setTimeInMillis(((Timestamp) value).getTime());
+ dateTimeValue = EdmDateTimeOffset.createDateTime(tmp);
+ fractionalSecs = ((Timestamp) value).getNanos();
+ } else {
+ dateTimeValue = EdmDateTimeOffset.createDateTime(value);
+ fractionalSecs = dateTimeValue.get(Calendar.MILLISECOND);
+ }
- final StringBuilder result = new StringBuilder(8); // Eight characters are enough for "normal" times.
+ final StringBuilder result = new StringBuilder();
EdmDateTimeOffset.appendTwoDigits(result, dateTimeValue.get(Calendar.HOUR_OF_DAY));
result.append(':');
EdmDateTimeOffset.appendTwoDigits(result, dateTimeValue.get(Calendar.MINUTE));
@@ -96,10 +121,14 @@ public final class EdmTimeOfDay extends SingletonPrimitiveType {
EdmDateTimeOffset.appendTwoDigits(result, dateTimeValue.get(Calendar.SECOND));
try {
- EdmDateTimeOffset.appendMilliseconds(result, dateTimeValue.get(Calendar.MILLISECOND), precision);
+ if (value instanceof Timestamp) {
+ EdmDateTimeOffset.appendFractionalSeconds(result, fractionalSecs, precision);
+ } else {
+ EdmDateTimeOffset.appendMilliseconds(result, fractionalSecs, precision);
+ }
} catch (final IllegalArgumentException e) {
throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.VALUE_FACETS_NOT_MATCHED.addContent(value, facets), e");
+ "EdmPrimitiveTypeException.VALUE_FACETS_NOT_MATCHED.addContent(value, facets)", e);
}
return result.toString();
[27/52] [abbrv] [OLINGO-200] Moving domain objects to commons-api
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
new file mode 100644
index 0000000..b973718
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/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.commons.api.domain;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * OData complex property value.
+ */
+public class ODataComplexValue extends AbstractODataValue 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 type 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 getType() {
+ return typeName;
+ }
+
+ /**
+ * Gets number of fields.
+ *
+ * @return number of fields.
+ */
+ public int size() {
+ return fields.size();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
new file mode 100644
index 0000000..6f84e4b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
@@ -0,0 +1,316 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * OData entity.
+ */
+public class ODataEntity extends ODataItem implements ODataInvokeResult {
+
+ private static final long serialVersionUID = 8360640095932811034L;
+
+ /**
+ * ETag.
+ */
+ private String eTag;
+
+ /**
+ * Media entity flag.
+ */
+ private boolean mediaEntity = false;
+
+ /**
+ * In case of media entity, media content type.
+ */
+ private String mediaContentType;
+
+ /**
+ * In case of media entity, media content source.
+ */
+ private String mediaContentSource;
+
+ /**
+ * Edit link.
+ */
+ protected URI editLink;
+
+ /**
+ * Navigation links (might contain in-line entities or feeds).
+ */
+ protected final List<ODataLink> navigationLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Association links.
+ */
+ protected final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Media edit links.
+ */
+ protected final List<ODataLink> editMediaLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Operations (legacy, functions, actions).
+ */
+ protected final List<ODataOperation> operations = new ArrayList<ODataOperation>();
+
+ /**
+ * Entity properties.
+ */
+ protected final List<ODataProperty> properties = new ArrayList<ODataProperty>();
+
+ /**
+ * Constructor.
+ *
+ * @param name OData entity name.
+ */
+ public ODataEntity(final String name) {
+ super(name);
+ }
+
+ /**
+ * Gets ETag.
+ *
+ * @return ETag.
+ */
+ public String getETag() {
+ return eTag;
+ }
+
+ /**
+ * Sets ETag.
+ *
+ * @param eTag ETag.
+ */
+ public void setETag(final String eTag) {
+ this.eTag = eTag;
+ }
+
+ /**
+ * Searches for operation with given title.
+ *
+ * @param title operation to look for
+ * @return operation if found with given title, <tt>null</tt> otherwise
+ */
+ public ODataOperation getOperation(final String title) {
+ ODataOperation result = null;
+ for (ODataOperation operation : operations) {
+ if (title.equals(operation.getTitle())) {
+ result = operation;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets operations.
+ *
+ * @return operations.
+ */
+ public List<ODataOperation> getOperations() {
+ return this.operations;
+ }
+
+ /**
+ * Searches for property with given name.
+ *
+ * @param name property to look for
+ * @return property if found with given name, <tt>null</tt> otherwise
+ */
+ public ODataProperty getProperty(final String name) {
+ ODataProperty result = null;
+
+ if (StringUtils.isNotBlank(name)) {
+ for (ODataProperty property : properties) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns OData entity properties.
+ *
+ * @return OData entity properties.
+ */
+ public List<ODataProperty> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Puts the given link into one of available lists, based on its type.
+ *
+ * @param link to be added
+ * @return <tt>true</tt> if the given link was added in one of available lists
+ */
+ public boolean addLink(final ODataLink link) {
+ boolean result = false;
+
+ switch (link.getType()) {
+ case ASSOCIATION:
+ result = associationLinks.contains(link) ? false : associationLinks.add(link);
+ break;
+
+ case ENTITY_NAVIGATION:
+ case ENTITY_SET_NAVIGATION:
+ result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
+ break;
+
+ case MEDIA_EDIT:
+ result = editMediaLinks.contains(link) ? false : editMediaLinks.add(link);
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ /**
+ * Removes the given link from any list (association, navigation, edit-media).
+ *
+ * @param link to be removed
+ * @return <tt>true</tt> if the given link was contained in one of available lists
+ */
+ public boolean removeLink(final ODataLink link) {
+ return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
+ }
+
+ /**
+ * Returns all entity navigation links (including inline entities / feeds).
+ *
+ * @return OData entity links.
+ */
+ public List<ODataLink> getNavigationLinks() {
+ return navigationLinks;
+ }
+
+ /**
+ * Returns all entity association links.
+ *
+ * @return OData entity links.
+ */
+ public List<ODataLink> getAssociationLinks() {
+ return associationLinks;
+ }
+
+ /**
+ * Returns all entity media edit links.
+ *
+ * @return OData entity links.
+ */
+ public List<ODataLink> getEditMediaLinks() {
+ return editMediaLinks;
+ }
+
+ /**
+ * Returns OData entity edit link.
+ *
+ * @return entity edit link.
+ */
+ public URI getEditLink() {
+ return editLink;
+ }
+
+ /**
+ * Sets OData entity edit link.
+ *
+ * @param editLink edit link.
+ */
+ public void setEditLink(final URI editLink) {
+ this.editLink = editLink;
+ }
+
+ @Override
+ public URI getLink() {
+ return super.getLink() == null ? getEditLink() : super.getLink();
+ }
+
+ /**
+ * TRUE if read-only entity.
+ *
+ * @return TRUE if read-only; FALSE otherwise.
+ */
+ public boolean isReadOnly() {
+ return super.getLink() != null;
+ }
+
+ /**
+ * Checks if the current entity is a media entity.
+ *
+ * @return 'TRUE' if media entity; 'FALSE' otherwise.
+ */
+ public boolean isMediaEntity() {
+ return mediaEntity;
+ }
+
+ /**
+ * Sets media entity flag.
+ *
+ * @param isMediaEntity media entity flag value.
+ */
+ public void setMediaEntity(final boolean isMediaEntity) {
+ this.mediaEntity = isMediaEntity;
+ }
+
+ /**
+ * Gets media content type.
+ *
+ * @return media content type.
+ */
+ public String getMediaContentType() {
+ return mediaContentType;
+ }
+
+ /**
+ * Sets media content type.
+ *
+ * @param mediaContentType media content type.
+ */
+ public void setMediaContentType(final String mediaContentType) {
+ this.mediaContentType = mediaContentType;
+ }
+
+ /**
+ * Gets media content source.
+ *
+ * @return media content source.
+ */
+ public String getMediaContentSource() {
+ return mediaContentSource;
+ }
+
+ /**
+ * Sets media content source.
+ *
+ * @param mediaContentSource media content source.
+ */
+ public void setMediaContentSource(final String mediaContentSource) {
+ this.mediaContentSource = mediaContentSource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
new file mode 100644
index 0000000..d3b146d
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.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.commons.api.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * OData entity collection. If pagination was used to get this instance, forward page navigation URI will be available.
+ */
+public class ODataEntitySet extends ODataItem implements ODataInvokeResult {
+
+ private static final long serialVersionUID = 9039605899821494024L;
+
+ /**
+ * Link to the next page.
+ */
+ protected URI next;
+
+ /**
+ * Number of ODataEntities contained in this feed. If <tt>$inlinecount</tt> was requested, this value comes from
+ * there.
+ */
+ protected Integer count;
+
+ /**
+ * OData entities contained in this feed.
+ */
+ protected List<ODataEntity> entities = new ArrayList<ODataEntity>();
+
+ /**
+ * Constructor.
+ */
+ public ODataEntitySet() {
+ super(null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param next next link.
+ */
+ public ODataEntitySet(final URI next) {
+ super(null);
+ this.next = next;
+ }
+
+ /**
+ * Gets next page link.
+ *
+ * @return next page link; null value if single page or last page reached.
+ */
+ public URI getNext() {
+ return next;
+ }
+
+ /**
+ * Sets in-line count.
+ *
+ * @param count in-line count value.
+ */
+ public void setCount(final int count) {
+ this.count = count;
+ }
+
+ /**
+ * Gets in-line count.
+ *
+ * @return in-line count value.
+ */
+ public int getCount() {
+ return count == null ? entities.size() : count;
+ }
+
+ /**
+ * Adds entity to the current feed.
+ *
+ * @param entity entity to be added.
+ * @return 'FALSE' if already exists; 'TRUE' otherwise.
+ */
+ public boolean addEntity(final ODataEntity entity) {
+ return entities.contains(entity) ? false : entities.add(entity);
+ }
+
+ /**
+ * Removes an entity.
+ *
+ * @param entity entity to be removed.
+ * @return 'TRUE' in case of success; 'FALSE' otherwise.
+ */
+ public boolean removeEntity(final ODataEntity entity) {
+ return entities.remove(entity);
+ }
+
+ /**
+ * Gets contained entities.
+ *
+ * @return feed entries.
+ */
+ public List<ODataEntity> getEntities() {
+ return entities;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataGeospatialValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataGeospatialValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataGeospatialValue.java
new file mode 100644
index 0000000..7563907
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataGeospatialValue.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.commons.api.domain;
+
+import org.apache.olingo.commons.api.edm.EdmGeospatialType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+
+public interface ODataGeospatialValue extends ODataValue {
+
+ interface Builder {
+
+ Builder setType(EdmPrimitiveTypeKind type);
+
+ Builder setValue(Geospatial value);
+
+ ODataGeospatialValue build();
+
+ }
+
+ EdmPrimitiveTypeKind getTypeKind();
+
+ EdmGeospatialType getType();
+
+ /**
+ * Returns the current geospatial value.
+ *
+ * @return the current geospatial value.
+ */
+ Geospatial toValue();
+
+ /**
+ * Returns the current value casted to the given type.
+ *
+ * @param <T> cast type
+ * @param reference class reference
+ * @return the current value as typed java instance
+ */
+ <T extends Geospatial> T toCastValue(Class<T> reference);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java
new file mode 100644
index 0000000..46e29dd
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.domain;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+/**
+ * OData in-line entity.
+ */
+public class ODataInlineEntity extends ODataLink {
+
+ private static final long serialVersionUID = -4763341581843700743L;
+
+ private final ODataEntity entity;
+
+ /**
+ * Constructor.
+ *
+ * @param version OData service version.
+ * @param uri edit link.
+ * @param type type.
+ * @param title title.
+ * @param entity entity.
+ */
+ public ODataInlineEntity(final ODataServiceVersion version,
+ final URI uri, final ODataLinkType type, final String title, final ODataEntity entity) {
+
+ super(version, uri, type, title);
+ this.entity = entity;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param version OData service version.
+ * @param baseURI base URI.
+ * @param href href.
+ * @param type type.
+ * @param title title.
+ * @param entity entity.
+ */
+ public ODataInlineEntity(final ODataServiceVersion version, final URI baseURI, final String href,
+ final ODataLinkType type, final String title, final ODataEntity entity) {
+
+ super(version, baseURI, href, type, title);
+ this.entity = entity;
+ }
+
+ /**
+ * Gets wrapped entity.
+ *
+ * @return wrapped entity.
+ */
+ public ODataEntity getEntity() {
+ return entity;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java
new file mode 100644
index 0000000..1ace20b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.domain;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+/**
+ * OData in-line entity set.
+ */
+public class ODataInlineEntitySet extends ODataLink {
+
+ private static final long serialVersionUID = -77628001615355449L;
+
+ private ODataEntitySet entitySet;
+
+ /**
+ * Constructor.
+ *
+ * @param version OData service version.
+ * @param uri edit link.
+ * @param type type.
+ * @param title title.
+ * @param entitySet entity set.
+ */
+ public ODataInlineEntitySet(final ODataServiceVersion version, final URI uri, final ODataLinkType type,
+ final String title, final ODataEntitySet entitySet) {
+
+ super(version, uri, type, title);
+ this.entitySet = entitySet;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param version OData service version.
+ * @param baseURI base URI.
+ * @param href href.
+ * @param type type.
+ * @param title title.
+ * @param entitySet entity set.
+ */
+ public ODataInlineEntitySet(final ODataServiceVersion version, final URI baseURI, final String href,
+ final ODataLinkType type, final String title, final ODataEntitySet entitySet) {
+
+ super(version, baseURI, href, type, title);
+ this.entitySet = entitySet;
+ }
+
+ /**
+ * Gets wrapped entity set.
+ *
+ * @return wrapped entity set.
+ */
+ public ODataEntitySet getEntitySet() {
+ return entitySet;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInvokeResult.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInvokeResult.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInvokeResult.java
new file mode 100644
index 0000000..d4b8c44
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/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.commons.api.domain;
+
+/**
+ * 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/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java
new file mode 100644
index 0000000..b40eeb7
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.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.commons.api.domain;
+
+import java.io.Serializable;
+import java.net.URI;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstract representation of OData entities and links.
+ */
+public abstract class ODataItem implements Serializable {
+
+ private static final long serialVersionUID = -2600707722689304686L;
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(ODataItem.class);
+
+ /**
+ * OData item self link.
+ */
+ protected URI link;
+
+ /**
+ * OData entity name/type.
+ */
+ private final String name;
+
+ /**
+ * Constructor.
+ *
+ * @param name OData entity name.
+ */
+ public ODataItem(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns self link.
+ *
+ * @return entity edit link.
+ */
+ public URI getLink() {
+ return link;
+ }
+
+ /**
+ * Sets self link.
+ *
+ * @param link link.
+ */
+ public void setLink(final URI link) {
+ this.link = link;
+ }
+
+ /**
+ * Returns OData entity name.
+ *
+ * @return entity name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * {@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/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
new file mode 100644
index 0000000..9e68454
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.domain;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+/**
+ * OData link.
+ */
+public class ODataLink extends ODataItem {
+
+ private static final long serialVersionUID = 7274966414277952124L;
+
+ public static class Builder {
+
+ private ODataServiceVersion version;
+
+ private URI uri;
+
+ private ODataLinkType type;
+
+ private String title;
+
+ private String mediaETag;
+
+ public Builder setVersion(final ODataServiceVersion version) {
+ this.version = version;
+ return this;
+ }
+
+ public Builder setURI(final URI uri) {
+ this.uri = uri;
+ return this;
+ }
+
+ public Builder setURI(final URI baseURI, final String href) {
+ this.uri = getURI(baseURI, href);
+ return this;
+ }
+
+ public Builder setType(final ODataLinkType type) {
+ this.type = type;
+ return this;
+ }
+
+ public Builder setTitle(final String title) {
+ this.title = title;
+ return this;
+ }
+
+ public void setMediaETag(final String mediaETag) {
+ this.mediaETag = mediaETag;
+ }
+
+ public ODataLink build() {
+ ODataLink instance = new ODataLink(version, uri, type, title);
+ instance.mediaETag = this.mediaETag;
+ return instance;
+ }
+ }
+
+ /**
+ * Build URI starting from the given base and href.
+ * <br/>
+ * If href is absolute or base is null then base will be ignored.
+ *
+ * @param base URI prefix.
+ * @param href URI suffix.
+ * @return built URI.
+ */
+ private static URI getURI(final URI base, final String href) {
+ if (href == null) {
+ throw new IllegalArgumentException("Null link provided");
+ }
+
+ URI uri = URI.create(href);
+
+ if (!uri.isAbsolute() && base != null) {
+ uri = URI.create(base.toASCIIString() + "/" + href);
+ }
+
+ return uri.normalize();
+ }
+
+ /**
+ * Link type.
+ */
+ protected final ODataLinkType type;
+
+ /**
+ * Link rel.
+ */
+ protected final String rel;
+
+ /**
+ * ETag for media edit links.
+ */
+ private String mediaETag;
+
+ /**
+ * Constructor.
+ *
+ * @param version OData service version.
+ * @param uri URI.
+ * @param type type.
+ * @param title title.
+ */
+ protected ODataLink(final ODataServiceVersion version, final URI uri, final ODataLinkType type, final String title) {
+ super(title);
+
+ this.link = uri;
+ this.type = type;
+
+ switch (this.type) {
+ case ASSOCIATION:
+ this.rel = version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL) + title;
+ break;
+
+ case ENTITY_NAVIGATION:
+ case ENTITY_SET_NAVIGATION:
+ this.rel = version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL) + title;
+ break;
+
+ case MEDIA_EDIT:
+ default:
+ this.rel = version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL) + title;
+ break;
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param version OData service version.
+ * @param baseURI base URI.
+ * @param href href.
+ * @param type type.
+ * @param title title.
+ */
+ protected ODataLink(final ODataServiceVersion version,
+ final URI baseURI, final String href, final ODataLinkType type, final String title) {
+
+ this(version, getURI(baseURI, href), type, title);
+ }
+
+ /**
+ * Gets link type.
+ *
+ * @return link type;
+ */
+ public ODataLinkType getType() {
+ return type;
+ }
+
+ /**
+ * Gets link rel.
+ *
+ * @return link rel
+ */
+ public String getRel() {
+ return rel;
+ }
+
+ /**
+ * Gets Media ETag.
+ *
+ * @return media ETag
+ */
+ public String getMediaETag() {
+ return mediaETag;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java
new file mode 100644
index 0000000..59dc834
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.domain;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+
+/**
+ * OData link types.
+ */
+public enum ODataLinkType {
+
+ /**
+ * Entity navigation link.
+ */
+ ENTITY_NAVIGATION(ODataPubFormat.ATOM + ";type=entry"),
+ /**
+ * Entity set navigation link.
+ */
+ ENTITY_SET_NAVIGATION(ODataPubFormat.ATOM + ";type=feed"),
+ /**
+ * Association link.
+ */
+ ASSOCIATION(ContentType.APPLICATION_XML),
+ /**
+ * Media-edit link.
+ */
+ MEDIA_EDIT("*/*");
+
+ private String type;
+
+ private ODataLinkType(final String type) {
+ this.type = type;
+ }
+
+ private ODataLinkType setType(final String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * Gets <code>LinkType</code> instance from the given rel and type.
+ *
+ * @param version OData protocol version.
+ * @param rel rel.
+ * @param type type.
+ * @return <code>ODataLinkType</code> object.
+ */
+ public static ODataLinkType fromString(final ODataServiceVersion version, final String rel, final String type) {
+ if (StringUtils.isNotBlank(rel)
+ && rel.startsWith(version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL))) {
+
+ return MEDIA_EDIT.setType(StringUtils.isBlank(type) ? "*/*" : type);
+ }
+
+ if (ODataLinkType.ENTITY_NAVIGATION.type.equals(type)) {
+ return ENTITY_NAVIGATION;
+ }
+
+ if (ODataLinkType.ENTITY_SET_NAVIGATION.type.equals(type)) {
+ return ENTITY_SET_NAVIGATION;
+ }
+
+ if (ODataLinkType.ASSOCIATION.type.equals(type)) {
+ return ASSOCIATION;
+ }
+
+ throw new IllegalArgumentException("Invalid link type: " + type);
+ }
+
+ @Override
+ public String toString() {
+ return type;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
new file mode 100644
index 0000000..b38a5e8
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.domain;
+
+import java.net.URI;
+
+/**
+ * Entry point for generating OData domain objects.
+ *
+ * @see ODataEntitySet
+ * @see ODataEntity
+ * @see ODataProperty
+ * @see ODataLink
+ */
+public interface ODataObjectFactory {
+
+ /**
+ * Instantiates a new entity set.
+ *
+ * @return entity set.
+ */
+ ODataEntitySet newEntitySet();
+
+ /**
+ * Instantiates a new entity set.
+ *
+ * @param next next link.
+ * @return entity set.
+ */
+ ODataEntitySet newEntitySet(URI next);
+
+ /**
+ * Instantiates a new entity.
+ *
+ * @param name OData entity name.
+ * @return entity.
+ */
+ ODataEntity newEntity(String name);
+
+ /**
+ * Instantiates a new entity.
+ *
+ * @param name OData entity name.
+ * @param link self link.
+ * @return entity.
+ */
+ ODataEntity newEntity(String name, URI link);
+
+ /**
+ * Instantiates a new in-line entity set.
+ *
+ * @param name name.
+ * @param link edit link.
+ * @param entitySet entity set.
+ * @return in-line entity set.
+ */
+ ODataInlineEntitySet newInlineEntitySet(String name, URI link, ODataEntitySet entitySet);
+
+ /**
+ * Instantiates a new in-line entity set.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @param entitySet entity set.
+ * @return in-line entity set.
+ */
+ ODataInlineEntitySet newInlineEntitySet(String name, URI baseURI, String href, ODataEntitySet entitySet);
+
+ /**
+ * Instantiates a new in-line entity.
+ *
+ * @param name name.
+ * @param link edit link.
+ * @param entity entity.
+ * @return in-line entity.
+ */
+ ODataInlineEntity newInlineEntity(String name, URI link, ODataEntity entity);
+
+ /**
+ * Instantiates a new in-line entity.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @param entity entity.
+ * @return in-line entity.
+ */
+ ODataInlineEntity newInlineEntity(String name, URI baseURI, String href, ODataEntity entity);
+
+ /**
+ * Instantiates a new entity navigation link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return entity navigation link.
+ */
+ ODataLink newEntityNavigationLink(String name, URI link);
+
+ /**
+ * Instantiates a new entity navigation link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return entity navigation link.
+ */
+ ODataLink newEntityNavigationLink(String name, URI baseURI, String href);
+
+ /**
+ * Instantiates a new entity set navigation link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return entity set navigation link.
+ */
+ ODataLink newFeedNavigationLink(String name, URI link);
+
+ /**
+ * Instantiates a new entity set navigation link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return entity set navigation link.
+ */
+ ODataLink newFeedNavigationLink(String name, URI baseURI, String href);
+
+ /**
+ * Instantiates a new association link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return association link.
+ */
+ ODataLink newAssociationLink(String name, URI link);
+
+ /**
+ * Instantiates a new association link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return association link.
+ */
+ ODataLink newAssociationLink(String name, URI baseURI, String href);
+
+ /**
+ * Instantiates a new media-edit link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return media-edit link.
+ */
+ ODataLink newMediaEditLink(String name, URI link);
+
+ /**
+ * Instantiates a new media-edit link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return media-edit link.
+ */
+ ODataLink newMediaEditLink(String name, URI baseURI, String href);
+
+ /**
+ * Instantiates a new primitive property.
+ *
+ * @param name name.
+ * @param value primitive value.
+ * @return primitive property.
+ */
+ ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
+
+ /**
+ * Instantiates a new primitive property.
+ *
+ * @param name name.
+ * @param value geospatial value.
+ * @return primitive property.
+ */
+ ODataProperty newPrimitiveProperty(String name, ODataGeospatialValue value);
+
+ /**
+ * Instantiates a new complex property.
+ *
+ * @param name name.
+ * @param value value.
+ * @return complex property.
+ */
+ ODataProperty newComplexProperty(String name, ODataComplexValue value);
+
+ /**
+ * Instantiates a new collection property.
+ *
+ * @param name name.
+ * @param value value.
+ * @return collection property.
+ */
+ ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataOperation.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataOperation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataOperation.java
new file mode 100644
index 0000000..47daba4
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataOperation.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.commons.api.domain;
+
+import java.io.Serializable;
+import java.net.URI;
+
+public class ODataOperation implements Serializable {
+
+ private static final long serialVersionUID = 4155165768886762490L;
+
+ private String metadataAnchor;
+
+ private String title;
+
+ private URI target;
+
+ /**
+ * Gets metadata anchor.
+ *
+ * @return metadata anchor.
+ */
+ public String getMetadataAnchor() {
+ return metadataAnchor;
+ }
+
+ /**
+ * Sets metadata anchor.
+ *
+ * @param metadataAnchor metadata anchor.
+ */
+ public void setMetadataAnchor(final String metadataAnchor) {
+ this.metadataAnchor = metadataAnchor;
+ }
+
+ /**
+ * Gets title.
+ *
+ * @return title.
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Sets title.
+ *
+ * @param title title.
+ */
+ public void setTitle(final String title) {
+ this.title = title;
+ }
+
+ /**
+ * Gets target.
+ *
+ * @return target.
+ */
+ public URI getTarget() {
+ return target;
+ }
+
+ /**
+ * Sets target.
+ *
+ * @param target target.
+ */
+ public void setTarget(final URI target) {
+ this.target = target;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPrimitiveValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPrimitiveValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPrimitiveValue.java
new file mode 100644
index 0000000..77e83ae
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPrimitiveValue.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.commons.api.domain;
+
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+public interface ODataPrimitiveValue extends ODataValue {
+
+ interface Builder {
+
+ Builder setType(EdmPrimitiveTypeKind type);
+
+ Builder setText(String text);
+
+ Builder setValue(Object value);
+
+ ODataPrimitiveValue build();
+ }
+
+ EdmPrimitiveTypeKind getTypeKind();
+
+ EdmPrimitiveType getType();
+
+ /**
+ * Returns the current value as generic Object.
+ *
+ * @return an uncasted instance of this value
+ */
+ Object toValue();
+
+ /**
+ * Returns the current value casted to the given type.
+ *
+ * @param <T> cast type
+ * @param reference class reference
+ * @return the current value as typed java instance
+ * @throws EdmPrimitiveTypeException if the object is not assignable to the type T.
+ */
+ <T> T toCastValue(Class<T> reference) throws EdmPrimitiveTypeException;
+
+ /**
+ * Serialize the current value as String.
+ *
+ * @return a String representation of this value
+ */
+ @Override
+ String toString();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
new file mode 100644
index 0000000..7217282
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.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.commons.api.domain;
+
+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 {
+
+ 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.
+ */
+ public 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 geospatial value.
+ *
+ * @return 'TRUE' if has geospatial value; 'FALSE' otherwise.
+ */
+ public boolean hasGeospatialValue() {
+ return !hasNullValue() && this.value.isGeospatial();
+ }
+
+ /**
+ * Gets geospatial value.
+ *
+ * @return geospatial value if exists; null otherwise.
+ */
+ public ODataGeospatialValue getGeospatialValue() {
+ return hasGeospatialValue() ? this.value.asGeospatial() : 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/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java
new file mode 100644
index 0000000..d173e50
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.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.commons.api.domain;
+
+public enum ODataPropertyType {
+
+ /**
+ * Primitive (including geospatial and enum).
+ */
+ PRIMITIVE,
+ /**
+ * Collection
+ */
+ COLLECTION,
+ /**
+ * Complex.
+ */
+ COMPLEX,
+ /**
+ * Empty type (possibly, no type information could be retrieved).
+ */
+ EMPTY
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java
new file mode 100644
index 0000000..13f807b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.domain;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ODataServiceDocument {
+
+ private URI metadataContext;
+
+ private String metadataETag;
+
+ private final Map<String, URI> entitySets = new HashMap<String, URI>();
+
+ private final Map<String, URI> functionImports = new HashMap<String, URI>();
+
+ private final Map<String, URI> singletons = new HashMap<String, URI>();
+
+ private final Map<String, URI> relatedServiceDocuments = new HashMap<String, URI>();
+
+ public URI getMetadataContext() {
+ return metadataContext;
+ }
+
+ public void setMetadataContext(final URI metadataContext) {
+ this.metadataContext = metadataContext;
+ }
+
+ public String getMetadataETag() {
+ return metadataETag;
+ }
+
+ public void setMetadataETag(final String metadataETag) {
+ this.metadataETag = metadataETag;
+ }
+
+ public Map<String, URI> getEntitySets() {
+ return entitySets;
+ }
+
+ /**
+ * Gets entity set titles.
+ *
+ * @return entity set titles.
+ */
+ public Collection<String> getEntitySetTitles() {
+ return entitySets.keySet();
+ }
+
+ /**
+ * Gets entity set URIs.
+ *
+ * @return entity set URIs.
+ */
+ public Collection<URI> getEntitySetURIs() {
+ return entitySets.values();
+ }
+
+ /**
+ * Gets URI about the given entity set.
+ *
+ * @param title title.
+ * @return URI.
+ */
+ public URI getEntitySetURI(final String title) {
+ return entitySets.get(title);
+ }
+
+ public Map<String, URI> getFunctionImports() {
+ return functionImports;
+ }
+
+ /**
+ * Gets function import titles.
+ *
+ * @return function import titles.
+ */
+ public Collection<String> getFunctionImportTitles() {
+ return functionImports.keySet();
+ }
+
+ /**
+ * Gets function import URIs.
+ *
+ * @return function import URIs.
+ */
+ public Collection<URI> getFunctionImportURIs() {
+ return functionImports.values();
+ }
+
+ /**
+ * Gets URI of the given function import.
+ *
+ * @param title title.
+ * @return URI.
+ */
+ public URI getFunctionImportURI(final String title) {
+ return functionImports.get(title);
+ }
+
+ public Map<String, URI> getSingletons() {
+ return singletons;
+ }
+
+ /**
+ * Gets singleton titles.
+ *
+ * @return singleton titles.
+ */
+ public Collection<String> getSingletonTitles() {
+ return singletons.keySet();
+ }
+
+ /**
+ * Gets singleton URIs.
+ *
+ * @return singleton URIs.
+ */
+ public Collection<URI> getSingletonURIs() {
+ return singletons.values();
+ }
+
+ /**
+ * Gets URI of the given singleton.
+ *
+ * @param title title.
+ * @return URI.
+ */
+ public URI getSingletonURI(final String title) {
+ return singletons.get(title);
+ }
+
+ public Map<String, URI> getRelatedServiceDocuments() {
+ return relatedServiceDocuments;
+ }
+
+ /**
+ * Gets related service documents titles.
+ *
+ * @return related service documents titles.
+ */
+ public Collection<String> getRelatedServiceDocumentsTitles() {
+ return relatedServiceDocuments.keySet();
+ }
+
+ /**
+ * Gets related service documents URIs.
+ *
+ * @return related service documents URIs.
+ */
+ public Collection<URI> getRelatedServiceDocumentsURIs() {
+ return relatedServiceDocuments.values();
+ }
+
+ /**
+ * Gets URI of the given related service documents.
+ *
+ * @param title title.
+ * @return URI.
+ */
+ public URI getRelatedServiceDocumentURI(final String title) {
+ return relatedServiceDocuments.get(title);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
new file mode 100644
index 0000000..e1c9be9
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.domain;
+
+import java.io.Serializable;
+
+/**
+ * Abstract representation of an OData entity property value.
+ */
+public interface ODataValue extends Serializable {
+
+ /**
+ * Check is is a primitive value.
+ *
+ * @return 'TRUE' if primitive; 'FALSE' otherwise.
+ */
+ boolean isPrimitive();
+
+ /**
+ * Casts to primitive value.
+ *
+ * @return primitive value.
+ */
+ ODataPrimitiveValue asPrimitive();
+
+ /**
+ * Check is is a geospatail value.
+ *
+ * @return 'TRUE' if geospatail; 'FALSE' otherwise.
+ */
+ boolean isGeospatial();
+
+ /**
+ * Casts to geospatail value.
+ *
+ * @return geospatail value.
+ */
+ ODataGeospatialValue asGeospatial();
+
+ /**
+ * Check is is a collection value.
+ *
+ * @return 'TRUE' if collection; 'FALSE' otherwise.
+ */
+ boolean isCollection();
+
+ /**
+ * Casts to collection value.
+ *
+ * @return collection value.
+ */
+ ODataCollectionValue asCollection();
+
+ /**
+ * Check is is a complex value.
+ *
+ * @return 'TRUE' if complex; 'FALSE' otherwise.
+ */
+ boolean isComplex();
+
+ /**
+ * Casts to complex value.
+ *
+ * @return complex value.
+ */
+ ODataComplexValue asComplex();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java
new file mode 100644
index 0000000..21ed548
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.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.commons.api.format;
+
+public interface ContentType {
+
+ public static final String APPLICATION_ATOM_XML = "application/atom+xml";
+
+ public static final String APPLICATION_FORM_URLENCODED = "application/x-www-form-urlencoded";
+
+ public static final String APPLICATION_JSON = "application/json";
+
+ public static final String APPLICATION_OCTET_STREAM = "application/octet-stream";
+
+ public static final String APPLICATION_SVG_XML = "application/svg+xml";
+
+ public static final String APPLICATION_XHTML_XML = "application/xhtml+xml";
+
+ public static final String APPLICATION_XML = "application/xml";
+
+ public static final String MULTIPART_FORM_DATA = "multipart/form-data";
+
+ public static final String TEXT_HTML = "text/html";
+
+ public static final String TEXT_PLAIN = "text/plain";
+
+ public static final String TEXT_XML = "text/xml";
+
+ public static final String WILDCARD = "*/*";
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
new file mode 100644
index 0000000..30d9e09
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.format;
+
+/**
+ * Available formats to be used in various contexts.
+ */
+public enum ODataFormat {
+
+ /**
+ * JSON format with no metadata.
+ */
+ JSON_NO_METADATA(ContentType.APPLICATION_JSON + ";odata=nometadata"),
+ /**
+ * JSON format with minimal metadata (default).
+ */
+ JSON(ContentType.APPLICATION_JSON + ";odata=minimalmetadata"),
+ /**
+ * JSON format with no metadata.
+ */
+ JSON_FULL_METADATA(ContentType.APPLICATION_JSON + ";odata=fullmetadata"),
+ /**
+ * XML format.
+ */
+ XML(ContentType.APPLICATION_XML);
+
+ 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].trim());
+ if (ContentType.APPLICATION_JSON.equals(parts[0].trim())) {
+ if (parts.length > 1) {
+ _format.append(';').append(parts[1].trim());
+ } 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/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataMediaFormat.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataMediaFormat.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataMediaFormat.java
new file mode 100644
index 0000000..c479de4
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataMediaFormat.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.commons.api.format;
+
+/**
+ * Available formats for media.
+ */
+public enum ODataMediaFormat {
+
+ CHARSET_PARAMETER("charset"),
+ MEDIA_TYPE_WILDCARD("*"),
+ WILDCARD(ContentType.WILDCARD),
+ APPLICATION_XML(ContentType.APPLICATION_XML),
+ APPLICATION_ATOM_XML(ContentType.APPLICATION_ATOM_XML),
+ APPLICATION_XHTML_XML(ContentType.APPLICATION_XHTML_XML),
+ APPLICATION_SVG_XML(ContentType.APPLICATION_SVG_XML),
+ APPLICATION_JSON(ContentType.APPLICATION_JSON),
+ APPLICATION_FORM_URLENCODED(ContentType.APPLICATION_FORM_URLENCODED),
+ MULTIPART_FORM_DATA(ContentType.MULTIPART_FORM_DATA),
+ APPLICATION_OCTET_STREAM(ContentType.APPLICATION_OCTET_STREAM),
+ TEXT_PLAIN(ContentType.TEXT_PLAIN),
+ TEXT_XML(ContentType.TEXT_XML),
+ TEXT_HTML(ContentType.TEXT_HTML);
+
+ 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/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java
new file mode 100644
index 0000000..6cd6a05
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.format;
+
+/**
+ * Available formats for AtomPub exchange.
+ */
+public enum ODataPubFormat {
+
+ /**
+ * JSON format with no metadata.
+ */
+ JSON_NO_METADATA(ContentType.APPLICATION_JSON + ";odata=nometadata"),
+ /**
+ * JSON format with minimal metadata (default).
+ */
+ JSON(ContentType.APPLICATION_JSON + ";odata=minimalmetadata"),
+ /**
+ * JSON format with no metadata.
+ */
+ JSON_FULL_METADATA(ContentType.APPLICATION_JSON + ";odata=fullmetadata"),
+ /**
+ * Atom format.
+ */
+ ATOM(ContentType.APPLICATION_ATOM_XML);
+
+ 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].trim());
+ if (ContentType.APPLICATION_JSON.equals(parts[0].trim())) {
+ if (parts.length > 1 && parts[1].startsWith("odata=")) {
+ _format.append(';').append(parts[1].trim());
+ } 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/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataValueFormat.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataValueFormat.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataValueFormat.java
new file mode 100644
index 0000000..1b290bf
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataValueFormat.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.format;
+
+/**
+ * Available formats for property values.
+ */
+public enum ODataValueFormat {
+
+ /**
+ * Application octet stream.
+ */
+ STREAM(ContentType.APPLICATION_OCTET_STREAM),
+ /**
+ * Plain text format.
+ */
+ TEXT(ContentType.TEXT_PLAIN);
+
+ 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;
+ }
+}
[43/52] [abbrv] [OLINGO-205,
OLINGO-200] provided atom v4 deserialization for entity type/set +
entity set request
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/resources/v4/People/feed.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/People/feed.full.json b/fit/src/main/resources/v4/People/feed.full.json
new file mode 100644
index 0000000..0c998f6
--- /dev/null
+++ b/fit/src/main/resources/v4/People/feed.full.json
@@ -0,0 +1,332 @@
+{
+ "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#People",
+ "value":
+ [
+ {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)",
+ "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ "PersonID": 1,
+ "FirstName": "Bob",
+ "LastName": "Cat",
+ "MiddleName": null,
+ "HomeAddress":
+ {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress",
+ "Street": "1 Microsoft Way",
+ "City": "London",
+ "PostalCode": "98052",
+ "FamilyName": "Cats"
+ },
+ "Home@odata.type": "#GeographyPoint",
+ "Home":
+ {
+ "type": "Point",
+ "coordinates":
+ [
+ 23.1,
+ 32.1
+ ],
+ "crs":
+ {
+ "type": "name",
+ "properties":
+ {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Numbers@odata.type": "#Collection(String)",
+ "Numbers":
+ [
+ "111-111-1111"
+ ],
+ "Emails@odata.type": "#Collection(String)",
+ "Emails":
+ [
+ "abc@abc.com"
+ ],
+ "City": "London",
+ "Birthday@odata.type": "#DateTimeOffset",
+ "Birthday": "1957-04-03T00:00:00Z",
+ "TimeBetweenLastTwoOrders@odata.type": "#Duration",
+ "TimeBetweenLastTwoOrders": "PT0.0000001S",
+ "Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent/$ref",
+ "Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent",
+ "Orders@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders/$ref",
+ "Orders@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders",
+ "Company@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company/$ref",
+ "Company@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company",
+ "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress":
+ {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+ "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress":
+ {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+ "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+ }
+ },
+ {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)",
+ "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ "PersonID": 2,
+ "FirstName": "Jill",
+ "LastName": "Jones",
+ "MiddleName": null,
+ "HomeAddress": null,
+ "Home@odata.type": "#GeographyPoint",
+ "Home":
+ {
+ "type": "Point",
+ "coordinates":
+ [
+ 161.8,
+ 15
+ ],
+ "crs":
+ {
+ "type": "name",
+ "properties":
+ {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Numbers@odata.type": "#Collection(String)",
+ "Numbers":
+ [
+ ],
+ "Emails@odata.type": "#Collection(String)",
+ "Emails":
+ [
+ ],
+ "City": "Sydney",
+ "Birthday@odata.type": "#DateTimeOffset",
+ "Birthday": "1983-01-15T00:00:00Z",
+ "TimeBetweenLastTwoOrders@odata.type": "#Duration",
+ "TimeBetweenLastTwoOrders": "PT0.0000002S",
+ "Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent/$ref",
+ "Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent",
+ "Orders@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders/$ref",
+ "Orders@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders",
+ "Company@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company/$ref",
+ "Company@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company",
+ "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress":
+ {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+ "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress":
+ {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+ "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+ }
+ },
+ {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Employee",
+ "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)",
+ "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)/Microsoft.Test.OData.Services.ODataWCFService.Employee",
+ "PersonID": 3,
+ "FirstName": "Jacob",
+ "LastName": "Zip",
+ "MiddleName": null,
+ "HomeAddress":
+ {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Address",
+ "Street": "1 Microsoft Way",
+ "City": "Sydney",
+ "PostalCode": "98052"
+ },
+ "Home@odata.type": "#GeographyPoint",
+ "Home":
+ {
+ "type": "Point",
+ "coordinates":
+ [
+ 161.8,
+ 15
+ ],
+ "crs":
+ {
+ "type": "name",
+ "properties":
+ {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Numbers@odata.type": "#Collection(String)",
+ "Numbers":
+ [
+ "333-333-3333"
+ ],
+ "Emails@odata.type": "#Collection(String)",
+ "Emails":
+ [
+ null
+ ],
+ "DateHired@odata.type": "#DateTimeOffset",
+ "DateHired": "2010-12-13T00:00:00Z",
+ "Office@odata.type": "#GeographyPoint",
+ "Office":
+ {
+ "type": "Point",
+ "coordinates":
+ [
+ 162,
+ 15
+ ],
+ "crs":
+ {
+ "type": "name",
+ "properties":
+ {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Parent/$ref",
+ "Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Parent",
+ "Company@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Company/$ref",
+ "Company@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Company",
+ "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress":
+ {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+ "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress":
+ {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+ "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+ }
+ },
+ {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Employee",
+ "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)",
+ "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)/Microsoft.Test.OData.Services.ODataWCFService.Employee",
+ "PersonID": 4,
+ "FirstName": "Elmo",
+ "LastName": "Rogers",
+ "MiddleName": null,
+ "HomeAddress": null,
+ "Home@odata.type": "#GeographyPoint",
+ "Home":
+ {
+ "type": "Point",
+ "coordinates":
+ [
+ -61.8,
+ -15
+ ],
+ "crs":
+ {
+ "type": "name",
+ "properties":
+ {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Numbers@odata.type": "#Collection(String)",
+ "Numbers":
+ [
+ "444-444-4444",
+ "555-555-5555",
+ "666-666-6666"
+ ],
+ "Emails@odata.type": "#Collection(String)",
+ "Emails":
+ [
+ "def@def.org",
+ "lmn@lmn.com"
+ ],
+ "DateHired@odata.type": "#DateTimeOffset",
+ "DateHired": "2008-03-27T00:00:00Z",
+ "Office@odata.type": "#GeographyPoint",
+ "Office":
+ {
+ "type": "Point",
+ "coordinates":
+ [
+ -62,
+ -15
+ ],
+ "crs":
+ {
+ "type": "name",
+ "properties":
+ {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Parent/$ref",
+ "Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Parent",
+ "Company@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Company/$ref",
+ "Company@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Company",
+ "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress":
+ {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+ "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress":
+ {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+ "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+ }
+ },
+ {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Person",
+ "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)",
+ "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)",
+ "PersonID": 5,
+ "FirstName": "Peter",
+ "LastName": "Bee",
+ "MiddleName": null,
+ "HomeAddress": null,
+ "Home@odata.type": "#GeographyPoint",
+ "Home":
+ {
+ "type": "Point",
+ "coordinates":
+ [
+ -261.8,
+ -16
+ ],
+ "crs":
+ {
+ "type": "name",
+ "properties":
+ {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Numbers@odata.type": "#Collection(String)",
+ "Numbers":
+ [
+ "555-555-5555"
+ ],
+ "Emails@odata.type": "#Collection(String)",
+ "Emails":
+ [
+ "def@test.msn"
+ ],
+ "Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Parent/$ref",
+ "Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Parent",
+ "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress":
+ {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+ "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress":
+ {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+ "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+ }
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/resources/v4/People/feed.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/People/feed.xml b/fit/src/main/resources/v4/People/feed.xml
new file mode 100644
index 0000000..f79bb49
--- /dev/null
+++ b/fit/src/main/resources/v4/People/feed.xml
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/"
+ xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#People">
+ <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People</id>
+ <title />
+ <updated>2014-03-20T14:31:00Z</updated>
+ <entry>
+ <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(1)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company" />
+ <title />
+ <updated>2014-03-20T14:31:00Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">1</d:PersonID>
+ <d:FirstName>Bob</d:FirstName>
+ <d:LastName>Cat</d:LastName>
+ <d:MiddleName m:null="true" />
+ <d:HomeAddress m:type="#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress">
+ <d:Street>1 Microsoft Way</d:Street>
+ <d:City>London</d:City>
+ <d:PostalCode>98052</d:PostalCode>
+ <d:FamilyName>Cats</d:FamilyName>
+ </d:HomeAddress>
+ <d:Home m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>32.1 23.1</gml:pos>
+ </gml:Point>
+ </d:Home>
+ <d:Numbers m:type="#Collection(String)">
+ <m:element>111-111-1111</m:element>
+ </d:Numbers>
+ <d:Emails m:type="#Collection(String)">
+ <m:element>abc@abc.com</m:element>
+ </d:Emails>
+ <d:City>London</d:City>
+ <d:Birthday m:type="DateTimeOffset">1957-04-03T00:00:00Z</d:Birthday>
+ <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000001S</d:TimeBetweenLastTwoOrders>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(2)/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company" />
+ <title />
+ <updated>2014-03-20T14:31:00Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">2</d:PersonID>
+ <d:FirstName>Jill</d:FirstName>
+ <d:LastName>Jones</d:LastName>
+ <d:MiddleName m:null="true" />
+ <d:HomeAddress m:null="true" />
+ <d:Home m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>15 161.8</gml:pos>
+ </gml:Point>
+ </d:Home>
+ <d:Numbers m:type="#Collection(String)" />
+ <d:Emails m:type="#Collection(String)" />
+ <d:City>Sydney</d:City>
+ <d:Birthday m:type="DateTimeOffset">1983-01-15T00:00:00Z</d:Birthday>
+ <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000002S</d:TimeBetweenLastTwoOrders>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Employee" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)/Microsoft.Test.OData.Services.ODataWCFService.Employee" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Parent" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(3)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Company" />
+ <title />
+ <updated>2014-03-20T14:31:00Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">3</d:PersonID>
+ <d:FirstName>Jacob</d:FirstName>
+ <d:LastName>Zip</d:LastName>
+ <d:MiddleName m:null="true" />
+ <d:HomeAddress m:type="#Microsoft.Test.OData.Services.ODataWCFService.Address">
+ <d:Street>1 Microsoft Way</d:Street>
+ <d:City>Sydney</d:City>
+ <d:PostalCode>98052</d:PostalCode>
+ </d:HomeAddress>
+ <d:Home m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>15 161.8</gml:pos>
+ </gml:Point>
+ </d:Home>
+ <d:Numbers m:type="#Collection(String)">
+ <m:element>333-333-3333</m:element>
+ </d:Numbers>
+ <d:Emails m:type="#Collection(String)">
+ <m:element m:null="true" />
+ </d:Emails>
+ <d:DateHired m:type="DateTimeOffset">2010-12-13T00:00:00Z</d:DateHired>
+ <d:Office m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>15 162</gml:pos>
+ </gml:Point>
+ </d:Office>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Employee" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)/Microsoft.Test.OData.Services.ODataWCFService.Employee" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Parent" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(4)/Microsoft.Test.OData.Services.ODataWCFService.Employee/Company" />
+ <title />
+ <updated>2014-03-20T14:31:00Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">4</d:PersonID>
+ <d:FirstName>Elmo</d:FirstName>
+ <d:LastName>Rogers</d:LastName>
+ <d:MiddleName m:null="true" />
+ <d:HomeAddress m:null="true" />
+ <d:Home m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>-15 -61.8</gml:pos>
+ </gml:Point>
+ </d:Home>
+ <d:Numbers m:type="#Collection(String)">
+ <m:element>444-444-4444</m:element>
+ <m:element>555-555-5555</m:element>
+ <m:element>666-666-6666</m:element>
+ </d:Numbers>
+ <d:Emails m:type="#Collection(String)">
+ <m:element>def@def.org</m:element>
+ <m:element>lmn@lmn.com</m:element>
+ </d:Emails>
+ <d:DateHired m:type="DateTimeOffset">2008-03-27T00:00:00Z</d:DateHired>
+ <d:Office m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>-15 -62</gml:pos>
+ </gml:Point>
+ </d:Office>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Person" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Parent" />
+ <title />
+ <updated>2014-03-20T14:31:00Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">5</d:PersonID>
+ <d:FirstName>Peter</d:FirstName>
+ <d:LastName>Bee</d:LastName>
+ <d:MiddleName m:null="true" />
+ <d:HomeAddress m:null="true" />
+ <d:Home m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>-16 -261.8</gml:pos>
+ </gml:Point>
+ </d:Home>
+ <d:Numbers m:type="#Collection(String)">
+ <m:element>555-555-5555</m:element>
+ </d:Numbers>
+ <d:Emails m:type="#Collection(String)">
+ <m:element>def@test.msn</m:element>
+ </d:Emails>
+ </m:properties>
+ </content>
+ </entry>
+</feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/resources/v4/metadata.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/metadata.xml b/fit/src/main/resources/v4/metadata.xml
index ae13a4e..b51bf0f 100644
--- a/fit/src/main/resources/v4/metadata.xml
+++ b/fit/src/main/resources/v4/metadata.xml
@@ -21,499 +21,418 @@
-->
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:DataServices>
- <Schema Namespace="NorthwindModel" xmlns="http://docs.oasis-open.org/odata/ns/edm">
- <!-- EnumType with values -->
- <EnumType Name="FileAccess" UnderlyingType="Edm.Int32" IsFlags="true">
- <Member Name="Read" Value="1" />
- <Member Name="Write" Value="2" />
- <Member Name="Create" Value="4" />
- <Member Name="Delete" Value="8" />
- </EnumType>
- <!-- EnumType without any values -->
- <EnumType Name="ShippingMethod">
- <Member Name="FirstClass" />
- <Member Name="TwoDay" />
- <Member Name="Overnight" />
- </EnumType>
- <!-- ComplexType -->
- <ComplexType Name="Dimensions">
- <Property Name="Height" Nullable="false" Type="Edm.Decimal" />
- <Property Name="Weight" Nullable="false" Type="Edm.Decimal" />
- <Property Name="Length" Nullable="false" Type="Edm.Decimal" />
+ <Schema Namespace="Microsoft.Test.OData.Services.ODataWCFService" xmlns="http://docs.oasis-open.org/odata/ns/edm">
+ <ComplexType Name="Address">
+ <Property Name="Street" Type="Edm.String" Nullable="false" />
+ <Property Name="City" Type="Edm.String" Nullable="false" />
+ <Property Name="PostalCode" Type="Edm.String" Nullable="false" />
</ComplexType>
- <!-- ComplexType with enum property -->
- <ComplexType Name="ACL">
- <Property Name="Filename" Nullable="false" Type="Edm.String" />
- <Property Name="Access" Nullable="false" Type="NorthwindModel.FileAccess" />
+ <ComplexType Name="HomeAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
+ <Property Name="FamilyName" Type="Edm.String" />
</ComplexType>
- <EntityType Name="Category">
- <Key>
- <PropertyRef Name="CategoryID" />
- </Key>
- <Property Name="CategoryID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
- <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
- <Property Name="Description" Type="Edm.String" MaxLength="max" />
- <Property Name="Picture" Type="Edm.Binary" MaxLength="max" />
- <NavigationProperty Name="Products" Type="Collection(NorthwindModel.Product)" Partner="Category" />
- </EntityType>
- <EntityType Name="CustomerDemographic">
+ <ComplexType Name="CompanyAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
+ <Property Name="CompanyName" Type="Edm.String" Nullable="false" />
+ </ComplexType>
+ <EnumType Name="AccessLevel" IsFlags="true">
+ <Member Name="None" Value="0" />
+ <Member Name="Read" Value="1" />
+ <Member Name="Write" Value="2" />
+ <Member Name="Execute" Value="4" />
+ <Member Name="ReadWrite" Value="3" />
+ </EnumType>
+ <EnumType Name="Color">
+ <Member Name="Red" Value="1" />
+ <Member Name="Green" Value="2" />
+ <Member Name="Blue" Value="4" />
+ </EnumType>
+ <EnumType Name="CompanyCategory">
+ <Member Name="IT" Value="0" />
+ <Member Name="Communication" Value="1" />
+ <Member Name="Electronics" Value="2" />
+ <Member Name="Others" Value="4" />
+ </EnumType>
+ <EntityType Name="Person">
<Key>
- <PropertyRef Name="CustomerTypeID" />
+ <PropertyRef Name="PersonID" />
</Key>
- <Property Name="CustomerTypeID" Type="Edm.String" Nullable="false" MaxLength="10" />
- <Property Name="CustomerDesc" Type="Edm.String" MaxLength="max" />
- <NavigationProperty Name="Customers" Type="Collection(NorthwindModel.Customer)" Partner="CustomerDemographics" />
+ <Property Name="PersonID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="FirstName" Type="Edm.String" Nullable="false" />
+ <Property Name="LastName" Type="Edm.String" Nullable="false" />
+ <Property Name="MiddleName" Type="Edm.String" />
+ <Property Name="HomeAddress" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" />
+ <Property Name="Home" Type="Edm.GeographyPoint" SRID="4326" />
+ <Property Name="Numbers" Type="Collection(Edm.String)" Nullable="false" />
+ <Property Name="Emails" Type="Collection(Edm.String)" />
+ <NavigationProperty Name="Parent" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
</EntityType>
- <EntityType Name="Customer">
- <Key>
- <PropertyRef Name="CustomerID" />
- </Key>
- <Property Name="CustomerID" Type="Edm.String" Nullable="false" MaxLength="5" />
- <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="ContactName" Type="Edm.String" MaxLength="30" />
- <Property Name="ContactTitle" Type="Edm.String" MaxLength="30" />
- <Property Name="Address" Type="Edm.String" MaxLength="60" />
- <Property Name="City" Type="Edm.String" MaxLength="15" />
- <Property Name="Region" Type="Edm.String" MaxLength="15" />
- <Property Name="PostalCode" Type="Edm.String" MaxLength="10" />
- <Property Name="Country" Type="Edm.String" MaxLength="15" />
- <Property Name="Phone" Type="Edm.String" MaxLength="24" />
- <Property Name="Fax" Type="Edm.String" MaxLength="24" />
- <!-- EnumType attribute -->
- <Property Name="FileAccess" Type="NorthwindModel.FileAccess" />
- <NavigationProperty Name="Orders" Type="Collection(NorthwindModel.Order)" Partner="Customer" />
- <NavigationProperty Name="CustomerDemographics" Type="Collection(NorthwindModel.CustomerDemographic)" Partner="Customers" />
+ <EntityType Name="Customer" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
+ <Property Name="City" Type="Edm.String" Nullable="false" />
+ <Property Name="Birthday" Type="Edm.DateTimeOffset" Nullable="false" />
+ <Property Name="TimeBetweenLastTwoOrders" Type="Edm.Duration" Nullable="false" />
+ <NavigationProperty Name="Orders" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Order)" />
+ <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="VipCustomer" />
</EntityType>
- <EntityType Name="Employee">
- <Key>
- <PropertyRef Name="EmployeeID" />
- </Key>
- <Property Name="EmployeeID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
- <Property Name="LastName" Type="Edm.String" Nullable="false" MaxLength="20" />
- <Property Name="FirstName" Type="Edm.String" Nullable="false" MaxLength="10" />
- <Property Name="Title" Type="Edm.String" MaxLength="30" />
- <Property Name="TitleOfCourtesy" Type="Edm.String" MaxLength="25" />
- <Property Name="BirthDate" Type="Edm.DateTimeOffset" />
- <Property Name="HireDate" Type="Edm.DateTimeOffset" />
- <Property Name="Address" Type="Edm.String" MaxLength="60" />
- <Property Name="City" Type="Edm.String" MaxLength="15" />
- <Property Name="Region" Type="Edm.String" MaxLength="15" />
- <Property Name="PostalCode" Type="Edm.String" MaxLength="10" />
- <Property Name="Country" Type="Edm.String" MaxLength="15" />
- <Property Name="HomePhone" Type="Edm.String" MaxLength="24" />
- <Property Name="Extension" Type="Edm.String" MaxLength="4" />
- <Property Name="Photo" Type="Edm.Binary" MaxLength="max" />
- <Property Name="Notes" Type="Edm.String" MaxLength="max" />
- <Property Name="ReportsTo" Type="Edm.Int32" />
- <Property Name="PhotoPath" Type="Edm.String" MaxLength="255" />
- <NavigationProperty Name="Employees1" Type="Collection(NorthwindModel.Employee)" Partner="Employee1" />
- <NavigationProperty Name="Employee1" Type="NorthwindModel.Employee" Partner="Employees1">
- <ReferentialConstraint Property="ReportsTo" ReferencedProperty="EmployeeID" />
- </NavigationProperty>
- <NavigationProperty Name="Orders" Type="Collection(NorthwindModel.Order)" Partner="Employee" />
- <NavigationProperty Name="Territories" Type="Collection(NorthwindModel.Territory)" Partner="Employees" />
+ <EntityType Name="Employee" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
+ <Property Name="DateHired" Type="Edm.DateTimeOffset" Nullable="false" />
+ <Property Name="Office" Type="Edm.GeographyPoint" SRID="4326" />
+ <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Employees" />
</EntityType>
- <EntityType Name="Order_Detail">
+ <EntityType Name="Product">
<Key>
- <PropertyRef Name="OrderID" />
<PropertyRef Name="ProductID" />
</Key>
- <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
<Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
- <Property Name="UnitPrice" Type="Edm.Decimal" Nullable="false" Precision="19" Scale="4" />
- <Property Name="Quantity" Type="Edm.Int16" Nullable="false" />
- <Property Name="Discount" Type="Edm.Single" Nullable="false" />
- <NavigationProperty Name="Order" Type="NorthwindModel.Order" Nullable="false" Partner="Order_Details">
- <ReferentialConstraint Property="OrderID" ReferencedProperty="OrderID" />
- </NavigationProperty>
- <NavigationProperty Name="Product" Type="NorthwindModel.Product" Nullable="false" Partner="Order_Details">
+ <Property Name="Name" Type="Edm.String" Nullable="false" />
+ <Property Name="QuantityPerUnit" Type="Edm.String" Nullable="false" />
+ <Property Name="UnitPrice" Type="Edm.Single" Nullable="false" />
+ <Property Name="QuantityInStock" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" />
+ <Property Name="UserAccess" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
+ <Property Name="SkinColor" Type="Microsoft.Test.OData.Services.ODataWCFService.Color" />
+ <Property Name="CoverColors" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)" Nullable="false" />
+ <NavigationProperty Name="Details" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)">
<ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID" />
</NavigationProperty>
</EntityType>
- <EntityType Name="Order">
- <Key>
- <PropertyRef Name="OrderID" />
- </Key>
- <Property Name="OrderID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
- <Property Name="CustomerID" Type="Edm.String" MaxLength="5" />
- <Property Name="EmployeeID" Type="Edm.Int32" />
- <Property Name="OrderDate" Type="Edm.DateTimeOffset" />
- <Property Name="RequiredDate" Type="Edm.DateTimeOffset" />
- <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
- <Property Name="ShipVia" Type="Edm.Int32" />
- <Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" />
- <Property Name="ShipName" Type="Edm.String" MaxLength="40" />
- <Property Name="ShipAddress" Type="Edm.String" MaxLength="60" />
- <Property Name="ShipCity" Type="Edm.String" MaxLength="15" />
- <Property Name="ShipRegion" Type="Edm.String" MaxLength="15" />
- <Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" />
- <Property Name="ShipCountry" Type="Edm.String" MaxLength="15" />
- <NavigationProperty Name="Customer" Type="NorthwindModel.Customer" Partner="Orders">
- <ReferentialConstraint Property="CustomerID" ReferencedProperty="CustomerID" />
- </NavigationProperty>
- <NavigationProperty Name="Employee" Type="NorthwindModel.Employee" Partner="Orders">
- <ReferentialConstraint Property="EmployeeID" ReferencedProperty="EmployeeID" />
- </NavigationProperty>
- <NavigationProperty Name="Order_Details" Type="Collection(NorthwindModel.Order_Detail)" Partner="Order" />
- <NavigationProperty Name="Shipper" Type="NorthwindModel.Shipper" Partner="Orders">
- <ReferentialConstraint Property="ShipVia" ReferencedProperty="ShipperID" />
- </NavigationProperty>
- </EntityType>
- <EntityType Name="Product">
+ <EntityType Name="ProductDetail">
<Key>
<PropertyRef Name="ProductID" />
+ <PropertyRef Name="ProductDetailID" />
</Key>
- <Property Name="ProductID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
- <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="SupplierID" Type="Edm.Int32" />
- <Property Name="CategoryID" Type="Edm.Int32" />
- <Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" />
- <Property Name="UnitPrice" Type="Edm.Decimal" Precision="19" Scale="4" />
- <Property Name="UnitsInStock" Type="Edm.Int16" />
- <Property Name="UnitsOnOrder" Type="Edm.Int16" />
- <Property Name="ReorderLevel" Type="Edm.Int16" />
- <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" />
- <!-- ComplexType attributes -->
- <Property Name="ProductDimensions" Type="NorthwindModel.Dimensions" />
- <Property Name="ShippingDimensions" Type="NorthwindModel.Dimensions" />
- <NavigationProperty Name="Category" Type="NorthwindModel.Category" Partner="Products">
- <ReferentialConstraint Property="CategoryID" ReferencedProperty="CategoryID" />
- </NavigationProperty>
- <NavigationProperty Name="Order_Details" Type="Collection(NorthwindModel.Order_Detail)" Partner="Product" />
- <NavigationProperty Name="Supplier" Type="NorthwindModel.Supplier" Partner="Products">
- <ReferentialConstraint Property="SupplierID" ReferencedProperty="SupplierID" />
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="ProductName" Type="Edm.String" Nullable="false" />
+ <Property Name="Description" Type="Edm.String" Nullable="false" />
+ <NavigationProperty Name="RelatedProduct" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" />
+ <NavigationProperty Name="Reviews" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductReview)">
+ <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID" />
+ <ReferentialConstraint Property="ProductDetailID" ReferencedProperty="ProductDetailID" />
</NavigationProperty>
</EntityType>
- <EntityType Name="Region">
+ <EntityType Name="ProductReview">
<Key>
- <PropertyRef Name="RegionID" />
- </Key>
- <Property Name="RegionID" Type="Edm.Int32" Nullable="false" />
- <Property Name="RegionDescription" Type="Edm.String" Nullable="false" MaxLength="50" />
- <NavigationProperty Name="Territories" Type="Collection(NorthwindModel.Territory)" Partner="Region" />
- </EntityType>
- <EntityType Name="Shipper">
- <Key>
- <PropertyRef Name="ShipperID" />
- </Key>
- <Property Name="ShipperID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
- <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="Phone" Type="Edm.String" MaxLength="24" />
- <NavigationProperty Name="Orders" Type="Collection(NorthwindModel.Order)" Partner="Shipper" />
- </EntityType>
- <EntityType Name="Supplier">
- <Key>
- <PropertyRef Name="SupplierID" />
+ <PropertyRef Name="ProductID" />
+ <PropertyRef Name="ProductDetailID" />
+ <PropertyRef Name="ReviewTitle" />
+ <PropertyRef Name="RevisionID" />
</Key>
- <Property Name="SupplierID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
- <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="ContactName" Type="Edm.String" MaxLength="30" />
- <Property Name="ContactTitle" Type="Edm.String" MaxLength="30" />
- <Property Name="Address" Type="Edm.String" MaxLength="60" />
- <Property Name="City" Type="Edm.String" MaxLength="15" />
- <Property Name="Region" Type="Edm.String" MaxLength="15" />
- <Property Name="PostalCode" Type="Edm.String" MaxLength="10" />
- <Property Name="Country" Type="Edm.String" MaxLength="15" />
- <Property Name="Phone" Type="Edm.String" MaxLength="24" />
- <Property Name="Fax" Type="Edm.String" MaxLength="24" />
- <Property Name="HomePage" Type="Edm.String" MaxLength="max" />
- <NavigationProperty Name="Products" Type="Collection(NorthwindModel.Product)" Partner="Supplier" />
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="ReviewTitle" Type="Edm.String" Nullable="false" />
+ <Property Name="RevisionID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Comment" Type="Edm.String" Nullable="false" />
+ <Property Name="Author" Type="Edm.String" Nullable="false" />
</EntityType>
- <EntityType Name="Territory">
+ <EntityType Name="Order">
<Key>
- <PropertyRef Name="TerritoryID" />
+ <PropertyRef Name="OrderID" />
</Key>
- <Property Name="TerritoryID" Type="Edm.String" Nullable="false" MaxLength="20" />
- <Property Name="TerritoryDescription" Type="Edm.String" Nullable="false" MaxLength="50" />
- <Property Name="RegionID" Type="Edm.Int32" Nullable="false" />
- <NavigationProperty Name="Region" Type="NorthwindModel.Region" Nullable="false" Partner="Territories">
- <ReferentialConstraint Property="RegionID" ReferencedProperty="RegionID" />
- </NavigationProperty>
- <NavigationProperty Name="Employees" Type="Collection(NorthwindModel.Employee)" Partner="Territories" />
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="OrderDate" Type="Edm.DateTimeOffset" Nullable="false" />
+ <Property Name="ShelfLife" Type="Edm.Duration" />
+ <Property Name="OrderShelfLifes" Type="Collection(Edm.Duration)" />
+ <NavigationProperty Name="LoggedInEmployee" Type="Microsoft.Test.OData.Services.ODataWCFService.Employee" Nullable="false" />
+ <NavigationProperty Name="CustomerForOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" />
+ <NavigationProperty Name="OrderDetails" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.OrderDetail)" />
</EntityType>
- <EntityType Name="Alphabetical_list_of_product">
+ <EntityType Name="OrderDetail">
<Key>
- <PropertyRef Name="CategoryName" />
- <PropertyRef Name="Discontinued" />
+ <PropertyRef Name="OrderID" />
<PropertyRef Name="ProductID" />
- <PropertyRef Name="ProductName" />
</Key>
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
<Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
- <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="SupplierID" Type="Edm.Int32" />
- <Property Name="CategoryID" Type="Edm.Int32" />
- <Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" />
- <Property Name="UnitPrice" Type="Edm.Decimal" Precision="19" Scale="4" />
- <Property Name="UnitsInStock" Type="Edm.Int16" />
- <Property Name="UnitsOnOrder" Type="Edm.Int16" />
- <Property Name="ReorderLevel" Type="Edm.Int16" />
- <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" />
- <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
+ <Property Name="OrderPlaced" Type="Edm.DateTimeOffset" Nullable="false" />
+ <Property Name="Quantity" Type="Edm.Int32" Nullable="false" />
+ <Property Name="UnitPrice" Type="Edm.Single" Nullable="false" />
+ <NavigationProperty Name="ProductOrdered" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" />
+ <NavigationProperty Name="AssociatedOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Order" Nullable="false" />
</EntityType>
- <EntityType Name="Category_Sales_for_1997">
+ <EntityType Name="Department">
<Key>
- <PropertyRef Name="CategoryName" />
+ <PropertyRef Name="DepartmentID" />
</Key>
- <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
- <Property Name="CategorySales" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="DepartmentID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Name" Type="Edm.String" Nullable="false" />
+ <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Departments" />
</EntityType>
- <EntityType Name="Current_Product_List">
+ <EntityType Name="Company">
<Key>
- <PropertyRef Name="ProductID" />
- <PropertyRef Name="ProductName" />
+ <PropertyRef Name="CompanyID" />
</Key>
- <Property Name="ProductID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
- <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="CompanyID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="CompanyCategory" Type="Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory" />
+ <Property Name="Revenue" Type="Edm.Int64" Nullable="false" />
+ <Property Name="Name" Type="Edm.String" />
+ <Property Name="Address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" />
+ <NavigationProperty Name="Employees" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Employee)" Partner="Company" />
+ <NavigationProperty Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" Partner="Company" />
+ <NavigationProperty Name="Departments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Department)" Partner="Company" />
+ <NavigationProperty Name="CoreDepartment" Type="Microsoft.Test.OData.Services.ODataWCFService.Department" Nullable="false" />
</EntityType>
- <EntityType Name="Customer_and_Suppliers_by_City">
- <Key>
- <PropertyRef Name="CompanyName" />
- <PropertyRef Name="Relationship" />
- </Key>
- <Property Name="City" Type="Edm.String" MaxLength="15" />
- <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="ContactName" Type="Edm.String" MaxLength="30" />
- <Property Name="Relationship" Type="Edm.String" Nullable="false" MaxLength="9" Unicode="false" />
+ <EntityType Name="PublicCompany" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Company">
+ <Property Name="StockExchange" Type="Edm.String" />
+ <NavigationProperty Name="Assets" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Asset)" ContainsTarget="true" />
+ <NavigationProperty Name="Club" Type="Microsoft.Test.OData.Services.ODataWCFService.Club" Nullable="false" ContainsTarget="true" />
+ <NavigationProperty Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" Nullable="false" />
</EntityType>
- <EntityType Name="Invoice">
+ <EntityType Name="Asset">
<Key>
- <PropertyRef Name="CustomerName" />
- <PropertyRef Name="Discount" />
- <PropertyRef Name="OrderID" />
- <PropertyRef Name="ProductID" />
- <PropertyRef Name="ProductName" />
- <PropertyRef Name="Quantity" />
- <PropertyRef Name="Salesperson" />
- <PropertyRef Name="ShipperName" />
- <PropertyRef Name="UnitPrice" />
+ <PropertyRef Name="AssetID" />
</Key>
- <Property Name="ShipName" Type="Edm.String" MaxLength="40" />
- <Property Name="ShipAddress" Type="Edm.String" MaxLength="60" />
- <Property Name="ShipCity" Type="Edm.String" MaxLength="15" />
- <Property Name="ShipRegion" Type="Edm.String" MaxLength="15" />
- <Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" />
- <Property Name="ShipCountry" Type="Edm.String" MaxLength="15" />
- <Property Name="CustomerID" Type="Edm.String" MaxLength="5" />
- <Property Name="CustomerName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="Address" Type="Edm.String" MaxLength="60" />
- <Property Name="City" Type="Edm.String" MaxLength="15" />
- <Property Name="Region" Type="Edm.String" MaxLength="15" />
- <Property Name="PostalCode" Type="Edm.String" MaxLength="10" />
- <Property Name="Country" Type="Edm.String" MaxLength="15" />
- <Property Name="Salesperson" Type="Edm.String" Nullable="false" MaxLength="31" />
- <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
- <Property Name="OrderDate" Type="Edm.DateTimeOffset" />
- <Property Name="RequiredDate" Type="Edm.DateTimeOffset" />
- <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
- <Property Name="ShipperName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
- <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="UnitPrice" Type="Edm.Decimal" Nullable="false" Precision="19" Scale="4" />
- <Property Name="Quantity" Type="Edm.Int16" Nullable="false" />
- <Property Name="Discount" Type="Edm.Single" Nullable="false" />
- <Property Name="ExtendedPrice" Type="Edm.Decimal" Precision="19" Scale="4" />
- <Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="AssetID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Name" Type="Edm.String" />
+ <Property Name="Number" Type="Edm.Int32" Nullable="false" />
</EntityType>
- <EntityType Name="Order_Details_Extended">
+ <EntityType Name="Club">
<Key>
- <PropertyRef Name="Discount" />
- <PropertyRef Name="OrderID" />
- <PropertyRef Name="ProductID" />
- <PropertyRef Name="ProductName" />
- <PropertyRef Name="Quantity" />
- <PropertyRef Name="UnitPrice" />
+ <PropertyRef Name="ClubID" />
</Key>
- <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
- <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
- <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="UnitPrice" Type="Edm.Decimal" Nullable="false" Precision="19" Scale="4" />
- <Property Name="Quantity" Type="Edm.Int16" Nullable="false" />
- <Property Name="Discount" Type="Edm.Single" Nullable="false" />
- <Property Name="ExtendedPrice" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="ClubID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Name" Type="Edm.String" />
</EntityType>
- <EntityType Name="Order_Subtotal">
+ <EntityType Name="LabourUnion">
<Key>
- <PropertyRef Name="OrderID" />
+ <PropertyRef Name="LabourUnionID" />
</Key>
- <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
- <Property Name="Subtotal" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="LabourUnionID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Name" Type="Edm.String" />
</EntityType>
- <EntityType Name="Orders_Qry">
+ <Action Name="AddAccessRight" IsBound="true">
+ <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" />
+ <Parameter Name="accessRight" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
+ </Action>
+ <Action Name="IncreaseRevenue" IsBound="true">
+ <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" />
+ <Parameter Name="IncreaseValue" Type="Edm.Int64" />
+ <ReturnType Type="Edm.Int64" Nullable="false" />
+ </Action>
+ <Action Name="ResetAddress" IsBound="true" EntitySetPath="person">
+ <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
+ <Parameter Name="addresses" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)" Nullable="false" />
+ <Parameter Name="index" Type="Edm.Int32" Nullable="false" />
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
+ </Action>
+ <Action Name="Discount" IsBound="true" EntitySetPath="products">
+ <Parameter Name="products" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" />
+ <Parameter Name="percentage" Type="Edm.Int32" Nullable="false" />
+ <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" />
+ </Action>
+ <Action Name="Discount">
+ <Parameter Name="percentage" Type="Edm.Int32" Nullable="false" />
+ </Action>
+ <Action Name="ResetBossEmail">
+ <Parameter Name="emails" Type="Collection(Edm.String)" Nullable="false" />
+ <ReturnType Type="Collection(Edm.String)" Nullable="false" />
+ </Action>
+ <Action Name="ResetBossAddress">
+ <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" />
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" />
+ </Action>
+ <Function Name="GetEmployeesCount" IsBound="true">
+ <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" />
+ <ReturnType Type="Edm.Int32" Nullable="false" />
+ </Function>
+ <Function Name="GetProductDetails" IsBound="true" EntitySetPath="product/Details" IsComposable="true">
+ <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" />
+ <Parameter Name="count" Type="Edm.Int32" />
+ <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)" Nullable="false" />
+ </Function>
+ <Function Name="GetRelatedProduct" IsBound="true" EntitySetPath="productDetail/Products" IsComposable="true">
+ <Parameter Name="productDetail" Type="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail" Nullable="false" />
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" />
+ </Function>
+ <Function Name="GetDefaultColor" IsComposable="true">
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Color" />
+ </Function>
+ <Function Name="GetPerson" IsComposable="true">
+ <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" />
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
+ </Function>
+ <Function Name="GetPerson2" IsComposable="true">
+ <Parameter Name="city" Type="Edm.String" Nullable="false" />
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
+ </Function>
+ <Function Name="GetAllProducts" IsComposable="true">
+ <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" />
+ </Function>
+ <Function Name="GetBossEmails">
+ <Parameter Name="start" Type="Edm.Int32" Nullable="false" />
+ <Parameter Name="count" Type="Edm.Int32" Nullable="false" />
+ <ReturnType Type="Collection(Edm.String)" Nullable="false" />
+ </Function>
+ <Function Name="GetProductsByAccessLevel">
+ <Parameter Name="accessLevel" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
+ <ReturnType Type="Collection(Edm.String)" Nullable="false" />
+ </Function>
+ <Function Name="GetActualAmount" IsBound="true">
+ <Parameter Name="giftcard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" Nullable="false" />
+ <Parameter Name="bonusRate" Type="Edm.Double" />
+ <ReturnType Type="Edm.Double" Nullable="false" />
+ </Function>
+ <Function Name="GetDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
+ <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" />
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" />
+ </Function>
+ <Action Name="RefreshDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
+ <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" />
+ <Parameter Name="newDate" Type="Edm.DateTimeOffset" />
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" />
+ </Action>
+ <Function Name="GetHomeAddress" IsBound="true" IsComposable="true">
+ <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.HomeAddress" Nullable="false" />
+ </Function>
+ <Function Name="GetAccountInfo" IsBound="true" IsComposable="true">
+ <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" />
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" Nullable="false" />
+ </Function>
+ <ComplexType Name="AccountInfo" OpenType="true">
+ <Property Name="FirstName" Type="Edm.String" Nullable="false" />
+ <Property Name="LastName" Type="Edm.String" Nullable="false" />
+ </ComplexType>
+ <EntityType Name="Account">
<Key>
- <PropertyRef Name="CompanyName" />
- <PropertyRef Name="OrderID" />
+ <PropertyRef Name="AccountID" />
</Key>
- <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
- <Property Name="CustomerID" Type="Edm.String" MaxLength="5" />
- <Property Name="EmployeeID" Type="Edm.Int32" />
- <Property Name="OrderDate" Type="Edm.DateTimeOffset" />
- <Property Name="RequiredDate" Type="Edm.DateTimeOffset" />
- <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
- <Property Name="ShipVia" Type="Edm.Int32" />
- <Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" />
- <Property Name="ShipName" Type="Edm.String" MaxLength="40" />
- <Property Name="ShipAddress" Type="Edm.String" MaxLength="60" />
- <Property Name="ShipCity" Type="Edm.String" MaxLength="15" />
- <Property Name="ShipRegion" Type="Edm.String" MaxLength="15" />
- <Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" />
- <Property Name="ShipCountry" Type="Edm.String" MaxLength="15" />
- <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="Address" Type="Edm.String" MaxLength="60" />
- <Property Name="City" Type="Edm.String" MaxLength="15" />
- <Property Name="Region" Type="Edm.String" MaxLength="15" />
- <Property Name="PostalCode" Type="Edm.String" MaxLength="10" />
- <Property Name="Country" Type="Edm.String" MaxLength="15" />
+ <Property Name="AccountID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Country" Type="Edm.String" Nullable="false" />
+ <Property Name="AccountInfo" Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" />
+ <NavigationProperty Name="MyGiftCard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" ContainsTarget="true" />
+ <NavigationProperty Name="MyPaymentInstruments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument)" ContainsTarget="true" />
+ <NavigationProperty Name="ActiveSubscriptions" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" ContainsTarget="true" />
+ <NavigationProperty Name="AvailableSubscriptionTemplatess" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" />
</EntityType>
- <EntityType Name="Product_Sales_for_1997">
+ <EntityType Name="GiftCard">
<Key>
- <PropertyRef Name="CategoryName" />
- <PropertyRef Name="ProductName" />
+ <PropertyRef Name="GiftCardID" />
</Key>
- <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
- <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="ProductSales" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="GiftCardID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="GiftCardNO" Type="Edm.String" Nullable="false" />
+ <Property Name="Amount" Type="Edm.Double" Nullable="false" />
+ <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false" />
</EntityType>
- <EntityType Name="Products_Above_Average_Price">
+ <EntityType Name="PaymentInstrument">
<Key>
- <PropertyRef Name="ProductName" />
+ <PropertyRef Name="PaymentInstrumentID" />
</Key>
- <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="UnitPrice" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="PaymentInstrumentID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="FriendlyName" Type="Edm.String" Nullable="false" />
+ <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
+ <NavigationProperty Name="TheStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false" />
+ <NavigationProperty Name="BillingStatements" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Statement)" ContainsTarget="true" />
+ <NavigationProperty Name="BackupStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false" />
</EntityType>
- <EntityType Name="Products_by_Category">
- <Key>
- <PropertyRef Name="CategoryName" />
- <PropertyRef Name="Discontinued" />
- <PropertyRef Name="ProductName" />
- </Key>
- <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
- <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" />
- <Property Name="UnitsInStock" Type="Edm.Int16" />
- <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" />
+ <EntityType Name="CreditCardPI" BaseType="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument">
+ <Property Name="CardNumber" Type="Edm.String" Nullable="false" />
+ <Property Name="CVV" Type="Edm.String" Nullable="false" />
+ <Property Name="HolderName" Type="Edm.String" Nullable="false" />
+ <Property Name="Balance" Type="Edm.Double" Nullable="false" />
+ <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false" />
+ <NavigationProperty Name="CreditRecords" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.CreditRecord)" ContainsTarget="true" />
</EntityType>
- <EntityType Name="Sales_by_Category">
+ <EntityType Name="StoredPI">
<Key>
- <PropertyRef Name="CategoryID" />
- <PropertyRef Name="CategoryName" />
- <PropertyRef Name="ProductName" />
+ <PropertyRef Name="StoredPIID" />
</Key>
- <Property Name="CategoryID" Type="Edm.Int32" Nullable="false" />
- <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
- <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="ProductSales" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="StoredPIID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="PIName" Type="Edm.String" Nullable="false" />
+ <Property Name="PIType" Type="Edm.String" Nullable="false" />
+ <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
</EntityType>
- <EntityType Name="Sales_Totals_by_Amount">
+ <EntityType Name="Statement">
<Key>
- <PropertyRef Name="CompanyName" />
- <PropertyRef Name="OrderID" />
+ <PropertyRef Name="StatementID" />
</Key>
- <Property Name="SaleAmount" Type="Edm.Decimal" Precision="19" Scale="4" />
- <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
- <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
- <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
+ <Property Name="StatementID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="TransactionType" Type="Edm.String" Nullable="false" />
+ <Property Name="TransactionDescription" Type="Edm.String" Nullable="false" />
+ <Property Name="Amount" Type="Edm.Double" Nullable="false" />
</EntityType>
- <EntityType Name="Summary_of_Sales_by_Quarter">
+ <EntityType Name="CreditRecord">
<Key>
- <PropertyRef Name="OrderID" />
+ <PropertyRef Name="CreditRecordID" />
</Key>
- <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
- <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
- <Property Name="Subtotal" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="CreditRecordID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="IsGood" Type="Edm.Boolean" Nullable="false" />
+ <Property Name="Reason" Type="Edm.String" Nullable="false" />
+ <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
</EntityType>
- <EntityType Name="Summary_of_Sales_by_Year">
+ <EntityType Name="Subscription">
<Key>
- <PropertyRef Name="OrderID" />
+ <PropertyRef Name="SubscriptionID" />
</Key>
- <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
- <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
- <Property Name="Subtotal" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="SubscriptionID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="TemplateGuid" Type="Edm.String" Nullable="false" />
+ <Property Name="Title" Type="Edm.String" Nullable="false" />
+ <Property Name="Category" Type="Edm.String" Nullable="false" />
+ <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
</EntityType>
- <Annotations Target="ODataWebExperimental.Northwind.Model.NorthwindEntities">
- <Annotation Term="Com.Microsoft.OData.Service.Conventions.V1.UrlConventions" String="KeyAsSegment" />
- </Annotations>
- <!-- Function -->
- <Function Name="TopSellingProducts" ReturnType="Collection(NorthwindModel.Product)" IsComposable="true" EntitySetPath="ODataWebExperimental.Northwind.Model.Products">
- <Parameter Name="Year" Type="Edm.Decimal" Precision="4" Scale="0" />
- </Function>
- <Function Name="TopSellingProducts2" ReturnType="Collection(NorthwindModel.Product)" IsComposable="true" EntitySetPath="ODataWebExperimental.Northwind.Model.Products" IsBound="true">
- <Parameter Name="Product" Type="NorthwindModel.Product" />
- <Parameter Name="Year" Type="Edm.Decimal" Precision="4" Scale="0" />
- </Function>
- <!-- Action -->
- <Action Name="TopSellingProducts" EntitySetPath="ODataWebExperimental.Northwind.Model.Products" IsBound="true">
- <Parameter Name="Product" Type="NorthwindModel.Product" />
- <Parameter Name="Year" Type="Edm.Decimal" Precision="4" Scale="0" />
- </Action>
- </Schema>
- <Schema Namespace="ODataWebExperimental.Northwind.Model" xmlns="http://docs.oasis-open.org/odata/ns/edm">
- <EntityContainer Name="NorthwindEntities" p4:LazyLoadingEnabled="true" xmlns:p4="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
- <EntitySet Name="Categories" EntityType="NorthwindModel.Category">
- <NavigationPropertyBinding Path="Products" Target="Products" />
- </EntitySet>
- <EntitySet Name="CustomerDemographics" EntityType="NorthwindModel.CustomerDemographic">
- <NavigationPropertyBinding Path="Customers" Target="Customers" />
+ <EntityContainer Name="InMemoryEntities">
+ <EntitySet Name="People" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Person">
+ <NavigationPropertyBinding Path="Parent" Target="People" />
</EntitySet>
- <EntitySet Name="Customers" EntityType="NorthwindModel.Customer">
- <NavigationPropertyBinding Path="CustomerDemographics" Target="CustomerDemographics" />
+ <Singleton Name="Boss" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" />
+ <EntitySet Name="Customers" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Customer">
<NavigationPropertyBinding Path="Orders" Target="Orders" />
</EntitySet>
- <EntitySet Name="Employees" EntityType="NorthwindModel.Employee">
- <NavigationPropertyBinding Path="Employees1" Target="Employees" />
- <NavigationPropertyBinding Path="Employee1" Target="Employees" />
+ <Singleton Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer">
<NavigationPropertyBinding Path="Orders" Target="Orders" />
- <NavigationPropertyBinding Path="Territories" Target="Territories" />
- </EntitySet>
- <EntitySet Name="Order_Details" EntityType="NorthwindModel.Order_Detail">
- <NavigationPropertyBinding Path="Order" Target="Orders" />
- <NavigationPropertyBinding Path="Product" Target="Products" />
+ <NavigationPropertyBinding Path="Company" Target="Company" />
+ </Singleton>
+ <EntitySet Name="Employees" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Employee">
+ <NavigationPropertyBinding Path="Company" Target="Company" />
</EntitySet>
- <EntitySet Name="Orders" EntityType="NorthwindModel.Order">
- <NavigationPropertyBinding Path="Customer" Target="Customers" />
- <NavigationPropertyBinding Path="Employee" Target="Employees" />
- <NavigationPropertyBinding Path="Order_Details" Target="Order_Details" />
- <NavigationPropertyBinding Path="Shipper" Target="Shippers" />
+ <EntitySet Name="Products" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Product">
+ <NavigationPropertyBinding Path="Details" Target="ProductDetails" />
</EntitySet>
- <EntitySet Name="Products" EntityType="NorthwindModel.Product">
- <NavigationPropertyBinding Path="Category" Target="Categories" />
- <NavigationPropertyBinding Path="Order_Details" Target="Order_Details" />
- <NavigationPropertyBinding Path="Supplier" Target="Suppliers" />
+ <EntitySet Name="ProductDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail">
+ <NavigationPropertyBinding Path="RelatedProduct" Target="Products" />
+ <NavigationPropertyBinding Path="Reviews" Target="ProductReviews" />
</EntitySet>
- <EntitySet Name="Regions" EntityType="NorthwindModel.Region">
- <NavigationPropertyBinding Path="Territories" Target="Territories" />
+ <EntitySet Name="ProductReviews" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductReview" />
+ <EntitySet Name="Orders" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Order">
+ <NavigationPropertyBinding Path="LoggedInEmployee" Target="Employees" />
+ <NavigationPropertyBinding Path="CustomerForOrder" Target="Customers" />
+ <NavigationPropertyBinding Path="OrderDetails" Target="OrderDetails" />
</EntitySet>
- <EntitySet Name="Shippers" EntityType="NorthwindModel.Shipper">
- <NavigationPropertyBinding Path="Orders" Target="Orders" />
+ <EntitySet Name="OrderDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.OrderDetail">
+ <NavigationPropertyBinding Path="AssociatedOrder" Target="Orders" />
+ <NavigationPropertyBinding Path="ProductOrdered" Target="Products" />
</EntitySet>
- <EntitySet Name="Suppliers" EntityType="NorthwindModel.Supplier">
- <NavigationPropertyBinding Path="Products" Target="Products" />
+ <EntitySet Name="Departments" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Department">
+ <NavigationPropertyBinding Path="Company" Target="Company" />
</EntitySet>
- <EntitySet Name="Territories" EntityType="NorthwindModel.Territory">
+ <Singleton Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
<NavigationPropertyBinding Path="Employees" Target="Employees" />
- <NavigationPropertyBinding Path="Region" Target="Regions" />
- </EntitySet>
- <EntitySet Name="Alphabetical_list_of_products" EntityType="NorthwindModel.Alphabetical_list_of_product" />
- <EntitySet Name="Category_Sales_for_1997" EntityType="NorthwindModel.Category_Sales_for_1997" />
- <EntitySet Name="Current_Product_Lists" EntityType="NorthwindModel.Current_Product_List" />
- <EntitySet Name="Customer_and_Suppliers_by_Cities" EntityType="NorthwindModel.Customer_and_Suppliers_by_City" />
- <EntitySet Name="Invoices" EntityType="NorthwindModel.Invoice" />
- <EntitySet Name="Order_Details_Extendeds" EntityType="NorthwindModel.Order_Details_Extended" />
- <EntitySet Name="Order_Subtotals" EntityType="NorthwindModel.Order_Subtotal" />
- <EntitySet Name="Orders_Qries" EntityType="NorthwindModel.Orders_Qry" />
- <EntitySet Name="Product_Sales_for_1997" EntityType="NorthwindModel.Product_Sales_for_1997" />
- <EntitySet Name="Products_Above_Average_Prices" EntityType="NorthwindModel.Products_Above_Average_Price" />
- <EntitySet Name="Products_by_Categories" EntityType="NorthwindModel.Products_by_Category" />
- <EntitySet Name="Sales_by_Categories" EntityType="NorthwindModel.Sales_by_Category" />
- <EntitySet Name="Sales_Totals_by_Amounts" EntityType="NorthwindModel.Sales_Totals_by_Amount" />
- <EntitySet Name="Summary_of_Sales_by_Quarters" EntityType="NorthwindModel.Summary_of_Sales_by_Quarter" />
- <EntitySet Name="Summary_of_Sales_by_Years" EntityType="NorthwindModel.Summary_of_Sales_by_Year" />
- <!-- Singleton -->
- <Singleton Name="Contoso" Type="NorthwindModel.Supplier">
- <NavigationPropertyBinding Path="Products" Target="Products"/>
+ <NavigationPropertyBinding Path="VipCustomer" Target="VipCustomer" />
+ <NavigationPropertyBinding Path="Departments" Target="Departments" />
+ <NavigationPropertyBinding Path="CoreDepartment" Target="Departments" />
</Singleton>
- <!-- FunctionImport -->
- <FunctionImport Name="TopSellingProducts" EntitySet="Products" Function="NorthwindModel.TopSellingProducts"/>
+ <Singleton Name="PublicCompany" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
+ <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PublicCompany/LabourUnion" Target="LabourUnion" />
+ </Singleton>
+ <Singleton Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" />
+ <ActionImport Name="Discount" Action="Microsoft.Test.OData.Services.ODataWCFService.Discount" />
+ <ActionImport Name="ResetBossEmail" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossEmail" />
+ <ActionImport Name="ResetBossAddress" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossAddress" />
+ <FunctionImport Name="GetDefaultColor" Function="Microsoft.Test.OData.Services.ODataWCFService.GetDefaultColor" />
+ <FunctionImport Name="GetPerson" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson" EntitySet="People" />
+ <FunctionImport Name="GetPerson2" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson2" EntitySet="People" />
+ <FunctionImport Name="GetAllProducts" Function="Microsoft.Test.OData.Services.ODataWCFService.GetAllProducts" EntitySet="Products" />
+ <FunctionImport Name="GetBossEmails" Function="Microsoft.Test.OData.Services.ODataWCFService.GetBossEmails" />
+ <FunctionImport Name="GetProductsByAccessLevel" Function="Microsoft.Test.OData.Services.ODataWCFService.GetProductsByAccessLevel" />
+ <EntitySet Name="Accounts" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Account">
+ <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/TheStoredPI" Target="StoredPIs" />
+ <NavigationPropertyBinding Path="AvailableSubscriptionTemplatess" Target="SubscriptionTemplates" />
+ <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/BackupStoredPI" Target="DefaultStoredPI" />
+ </EntitySet>
+ <EntitySet Name="StoredPIs" EntityType="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" />
+ <EntitySet Name="SubscriptionTemplates" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Subscription" />
+ <Singleton Name="DefaultStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
+
[21/52] [abbrv] git commit: [OLINGO-65] Removing any non type-based
(de)serialization
Posted by sk...@apache.org.
[OLINGO-65] Removing any non type-based (de)serialization
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/fdb18003
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/fdb18003
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/fdb18003
Branch: refs/heads/olingo-206-validator
Commit: fdb1800372f93114b370a0dfd6404e460d47b008
Parents: 4780fc5
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sun Mar 23 15:33:29 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sun Mar 23 15:33:29 2014 +0100
----------------------------------------------------------------------
.../org/apache/olingo/client/api/Constants.java | 29 ++----
.../core/data/AtomGeoValueDeserializer.java | 12 ++-
.../core/data/AtomGeoValueSerializer.java | 23 +++--
.../core/data/JSONGeoValueDeserializer.java | 14 ++-
.../core/data/JSONGeoValueSerializer.java | 16 +++-
.../core/domain/ODataPrimitiveValueImpl.java | 9 +-
.../apache/olingo/client/core/uri/URIUtils.java | 20 ++--
.../client/core/v3/AllGeoTypesSet_-10_Geom.xml | 13 ++-
.../v3/AllGeoTypesSet_-3_GeomMultiPolygon.xml | 43 ++++++++-
.../olingo/client/core/v3/AllGeoTypesSet_-5.xml | 97 ++++++++++----------
.../v3/AllGeoTypesSet_-5_GeogCollection.xml | 19 +++-
.../core/v3/AllGeoTypesSet_-5_GeogPolygon.xml | 18 +++-
.../core/v3/AllGeoTypesSet_-6_GeomMultiLine.xml | 24 ++++-
.../v3/AllGeoTypesSet_-7_GeomMultiPoint.xml | 14 ++-
.../olingo/client/core/v3/AllGeoTypesSet_-8.xml | 81 ++++++++--------
.../v3/AllGeoTypesSet_-8_GeomCollection.xml | 18 +++-
16 files changed, 302 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java
index 7d9b4a2..6f94915 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java
@@ -29,7 +29,9 @@ public class Constants {
// Other stuff
public final static String UTF8 = "UTF-8";
- public final static String NAME = "name";
+ public final static Integer DEFAULT_PRECISION = 40;
+
+ public final static Integer DEFAULT_SCALE = 25;
// XML namespaces and prefixes
public final static String NS_ATOM = "http://www.w3.org/2005/Atom";
@@ -38,32 +40,19 @@ public class Constants {
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";
public final static String SRS_URLPREFIX = "http://www.opengis.net/def/crs/EPSG/0/";
- /**
- * Edit link rel value.
- */
+ // Link rel(s)
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";
@@ -75,12 +64,8 @@ public class Constants {
public final static String ATTR_TYPE = "type";
- public static final String ATTR_M_TYPE = PREFIX_METADATA + ":" + ATTR_TYPE;
-
public final static String ATTR_NULL = "null";
- public static final String ATTR_M_NULL = PREFIX_METADATA + ":" + ATTR_NULL;
-
public static final String ATTR_XML_BASE = "base";
public static final QName QNAME_ATTR_XML_BASE = new QName(XMLConstants.XML_NS_URI, ATTR_XML_BASE);
@@ -95,8 +80,6 @@ public class Constants {
public static final String ATTR_TARGET = "target";
- public static final String ELEM_COLLECTION = "collection";
-
public static final String ATTR_SRSNAME = "srsName";
public static final QName QNAME_ATTR_SRSNAME = new QName(NS_GML, ATTR_SRSNAME);
@@ -143,8 +126,6 @@ public class Constants {
public static final String ELEM_POS = "pos";
- public static final String ELEM_POSLIST = "posList";
-
public static final String ELEM_PROPERTY = "property";
public static final String ELEM_LINKS = "links";
@@ -204,6 +185,8 @@ public class Constants {
public final static String JSON_NEXT_LINK = "odata.nextLink";
+ public final static String JSON_NAME = "name";
+
// Atom stuff
public final static String ATOM_ELEM_ENTRY = "entry";
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
index 20dd164..1187a81 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
@@ -29,6 +29,7 @@ import javax.xml.stream.events.XMLEvent;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.GeoUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
@@ -38,6 +39,7 @@ import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
class AtomGeoValueDeserializer {
@@ -54,8 +56,14 @@ class AtomGeoValueDeserializer {
final String[] pointInfo = event.asCharacters().getData().split(" ");
final Point point = new Point(GeoUtils.getDimension(type), crs);
- point.setX(Double.valueOf(pointInfo[0]));
- point.setY(Double.valueOf(pointInfo[1]));
+ try {
+ point.setX(EdmDouble.getInstance().valueOfString(pointInfo[0], null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ point.setY(EdmDouble.getInstance().valueOfString(pointInfo[1], null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new XMLStreamException("While deserializing point coordinates as double", e);
+ }
result.add(point);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
index 78d87ba..02425b4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
@@ -18,13 +18,12 @@
*/
package org.apache.olingo.client.core.data;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
import java.util.Collections;
import java.util.Iterator;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.LineString;
@@ -33,18 +32,10 @@ import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
class AtomGeoValueSerializer {
- private static final ThreadLocal<DecimalFormat> DOUBLE_FORMAT = new ThreadLocal<DecimalFormat>() {
- @Override
- protected DecimalFormat initialValue() {
- final DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols();
- otherSymbols.setDecimalSeparator('.');
- return new DecimalFormat("#.#########################", otherSymbols);
- }
- };
-
private void points(final XMLStreamWriter writer, final Iterator<Point> itor, final boolean wrap)
throws XMLStreamException {
@@ -56,7 +47,15 @@ class AtomGeoValueSerializer {
}
writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POS, Constants.NS_GML);
- writer.writeCharacters(DOUBLE_FORMAT.get().format(point.getX()) + " " + DOUBLE_FORMAT.get().format(point.getY()));
+ try {
+ writer.writeCharacters(EdmDouble.getInstance().valueToString(point.getX(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ + " "
+ + EdmDouble.getInstance().valueToString(point.getY(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new XMLStreamException("While serializing point coordinates as double", e);
+ }
writer.writeEndElement();
if (wrap) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
index eebfef3..c58ff66 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
@@ -26,6 +26,7 @@ import java.util.List;
import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.GeoUtils;
import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
@@ -36,6 +37,7 @@ import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
class JSONGeoValueDeserializer {
@@ -50,8 +52,14 @@ class JSONGeoValueDeserializer {
if (itor.hasNext()) {
point = new Point(GeoUtils.getDimension(type), crs);
- point.setX(Double.valueOf(itor.next().asText()));
- point.setY(Double.valueOf(itor.next().asText()));
+ try {
+ point.setX(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ point.setY(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException("While deserializing point coordinates as double", e);
+ }
}
return point;
@@ -217,7 +225,7 @@ class JSONGeoValueDeserializer {
String crs = null;
if (node.has(Constants.JSON_CRS)) {
- crs = node.get(Constants.JSON_CRS).get(Constants.PROPERTIES).get(Constants.NAME).asText().split(":")[1];
+ crs = node.get(Constants.JSON_CRS).get(Constants.PROPERTIES).get(Constants.JSON_NAME).asText().split(":")[1];
}
Geospatial value = null;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
index 2e692ae..4794b01 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
@@ -22,6 +22,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
import java.io.IOException;
import java.util.Iterator;
import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.ComposedGeospatial;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
@@ -32,21 +33,28 @@ import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
class JSONGeoValueSerializer {
private void crs(final JsonGenerator jgen, final String crs) throws IOException {
jgen.writeObjectFieldStart(Constants.JSON_CRS);
- jgen.writeStringField(Constants.ATTR_TYPE, Constants.NAME);
+ jgen.writeStringField(Constants.ATTR_TYPE, Constants.JSON_NAME);
jgen.writeObjectFieldStart(Constants.PROPERTIES);
- jgen.writeStringField(Constants.NAME, "EPSG:" + crs);
+ jgen.writeStringField(Constants.JSON_NAME, "EPSG:" + crs);
jgen.writeEndObject();
jgen.writeEndObject();
}
private void point(final JsonGenerator jgen, final Point point) throws IOException {
- jgen.writeNumber(point.getX());
- jgen.writeNumber(point.getY());
+ try {
+ jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getX(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
+ jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getY(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException("While serializing point coordinates as double", e);
+ }
}
private void multipoint(final JsonGenerator jgen, final MultiPoint multiPoint) throws IOException {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
index 4f191d8..e6a0408 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
@@ -22,6 +22,7 @@ import java.sql.Timestamp;
import java.util.Calendar;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.domain.AbstractODataValue;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
@@ -96,7 +97,8 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData
try {
// TODO: when Edm is available, set facets when calling this method
this.instance.value = this.instance.type.valueOfString(
- this.instance.text, null, null, 40, 25, null, returnType);
+ this.instance.text, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null,
+ returnType);
} catch (EdmPrimitiveTypeException e) {
throw new IllegalArgumentException(e);
}
@@ -105,7 +107,7 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData
try {
// TODO: when Edm is available, set facets when calling this method
this.instance.text = this.instance.type.valueToString(
- this.instance.value, null, null, 40, 25, null);
+ this.instance.value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
} catch (EdmPrimitiveTypeException e) {
throw new IllegalArgumentException(e);
}
@@ -153,7 +155,8 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData
@Override
public <T> T toCastValue(final Class<T> reference) throws EdmPrimitiveTypeException {
// TODO: when Edm is available, set facets when calling this method
- return type.valueOfString(this.text, null, null, 40, 25, null, reference);
+ return type.valueOfString(this.text, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null,
+ reference);
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
index 50245ff..095f8ae 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -25,7 +25,6 @@ import java.math.BigDecimal;
import java.net.URI;
import java.net.URLEncoder;
import java.sql.Timestamp;
-import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.UUID;
import javax.xml.datatype.Duration;
@@ -38,6 +37,10 @@ import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTime;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt64;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmSingle;
import org.apache.olingo.commons.core.edm.primitivetype.EdmTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -157,19 +160,22 @@ public final class URIUtils {
valueToString(obj, null, null, null, null, null), Constants.UTF8) + "'"
: (obj instanceof Calendar)
? "datetimeoffset'" + URLEncoder.encode(EdmDateTimeOffset.getInstance().
- valueToString(obj, null, null, null, null, null), Constants.UTF8)
- + "'"
+ valueToString(obj, null, null, null, null, null), Constants.UTF8) + "'"
: (obj instanceof Duration)
? "time'" + URLEncoder.encode(EdmTime.getInstance().
valueToString(obj, null, null, null, null, null), Constants.UTF8) + "'"
: (obj instanceof BigDecimal)
- ? new DecimalFormat("#.#######################").format((BigDecimal) obj) + "M"
+ ? EdmDecimal.getInstance().valueToString(obj, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null) + "M"
: (obj instanceof Double)
- ? new DecimalFormat("#.#######################E0").format((Double) obj) + "D"
+ ? EdmDouble.getInstance().valueToString(obj, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null) + "D"
: (obj instanceof Float)
- ? new DecimalFormat("#.#######E0").format((Float) obj) + "f"
+ ? EdmSingle.getInstance().valueToString(obj, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null) + "f"
: (obj instanceof Long)
- ? ((Long) obj).toString() + "L"
+ ? EdmInt64.getInstance().valueToString(obj, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null) + "L"
: (obj instanceof String)
? "'" + URLEncoder.encode((String) obj, Constants.UTF8) + "'"
: obj.toString();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_Geom.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_Geom.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_Geom.xml
index e103b35..50c16a2 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_Geom.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_Geom.xml
@@ -19,4 +19,15 @@
under the License.
-->
-<d:Geom xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:type="Edm.GeometryLineString"><gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"><gml:pos>1 1</gml:pos><gml:pos>3 3</gml:pos><gml:pos>2 4</gml:pos><gml:pos>2 0</gml:pos></gml:LineString></d:Geom>
+<d:Geom xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:type="Edm.GeometryLineString">
+ <gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
+ <gml:pos>1.0 1.0</gml:pos>
+ <gml:pos>3.0 3.0</gml:pos>
+ <gml:pos>2.0 4.0</gml:pos>
+ <gml:pos>2.0 0.0</gml:pos>
+ </gml:LineString>
+</d:Geom>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-3_GeomMultiPolygon.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-3_GeomMultiPolygon.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-3_GeomMultiPolygon.xml
index 7353d0a..f9e00cf 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-3_GeomMultiPolygon.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-3_GeomMultiPolygon.xml
@@ -5,7 +5,7 @@
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
+ to you under the Apache License, Version 2.0.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
@@ -19,4 +19,43 @@
under the License.
-->
-<d:GeomMultiPolygon xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:type="Edm.GeometryMultiPolygon"><gml:MultiSurface gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"><gml:surfaceMembers><gml:Polygon><gml:exterior><gml:LinearRing><gml:pos>40 40</gml:pos><gml:pos>20 45</gml:pos><gml:pos>45 30</gml:pos><gml:pos>40 40</gml:pos></gml:LinearRing></gml:exterior></gml:Polygon><gml:Polygon><gml:exterior><gml:LinearRing><gml:pos>20 35</gml:pos><gml:pos>45 20</gml:pos><gml:pos>30 5</gml:pos><gml:pos>10 10</gml:pos><gml:pos>10 30</gml:pos><gml:pos>20 35</gml:pos></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:pos>30 20</gml:pos><gml:pos>20 25</gml:pos><gml:pos>20 15</gml:pos><gml:pos>30 20</gml:pos></gml:LinearRing></gml:interior></gml:Polygon></gml:surfaceMembers></gml:MultiSurface></d:GeomMultiPol
ygon>
+<d:GeomMultiPolygon xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:type="Edm.GeometryMultiPolygon">
+ <gml:MultiSurface gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
+ <gml:surfaceMembers>
+ <gml:Polygon>
+ <gml:exterior>
+ <gml:LinearRing>
+ <gml:pos>40.0 40.0</gml:pos>
+ <gml:pos>20.0 45.0</gml:pos>
+ <gml:pos>45.0 30.0</gml:pos>
+ <gml:pos>40.0 40.0</gml:pos>
+ </gml:LinearRing>
+ </gml:exterior>
+ </gml:Polygon>
+ <gml:Polygon>
+ <gml:exterior>
+ <gml:LinearRing>
+ <gml:pos>20.0 35.0</gml:pos>
+ <gml:pos>45.0 20.0</gml:pos>
+ <gml:pos>30.0 5.0</gml:pos>
+ <gml:pos>10.0 10.0</gml:pos>
+ <gml:pos>10.0 30.0</gml:pos>
+ <gml:pos>20.0 35.0</gml:pos>
+ </gml:LinearRing>
+ </gml:exterior>
+ <gml:interior>
+ <gml:LinearRing>
+ <gml:pos>30.0 20.0</gml:pos>
+ <gml:pos>20.0 25.0</gml:pos>
+ <gml:pos>20.0 15.0</gml:pos>
+ <gml:pos>30.0 20.0</gml:pos>
+ </gml:LinearRing>
+ </gml:interior>
+ </gml:Polygon>
+ </gml:surfaceMembers>
+ </gml:MultiSurface>
+</d:GeomMultiPolygon>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5.xml
index 90037fd..738dcbf 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5.xml
@@ -19,22 +19,27 @@
under the License.
-->
-<entry xml:base="http://192.168.0.160:8080/DefaultService.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
+<entry xml:base="http://192.168.0.160:8080/DefaultService.svc/"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>http://192.168.0.160:8080/DefaultService.svc/AllGeoTypesSet(-5)</id>
- <category term="Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link rel="edit" title="AllSpatialTypes" href="AllGeoTypesSet(-5)" />
- <title />
+ <category term="Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes"
+ scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
+ <link rel="edit" title="AllSpatialTypes" href="AllGeoTypesSet(-5)"/>
+ <title/>
<updated>2013-09-11T07:48:06Z</updated>
<author>
- <name />
+ <name/>
</author>
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int32">-5</d:Id>
<d:Geog m:type="Edm.GeographyCollection">
- <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326" />
+ <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"/>
</d:Geog>
- <d:GeogPoint m:null="true" />
+ <d:GeogPoint m:null="true"/>
<d:GeogLine m:type="Edm.GeographyLineString">
<gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
<gml:pos>10.5 10.5</gml:pos>
@@ -46,11 +51,11 @@
<gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
<gml:exterior>
<gml:LinearRing>
- <gml:pos>5 15</gml:pos>
- <gml:pos>10 40</gml:pos>
- <gml:pos>20 10</gml:pos>
- <gml:pos>10 5</gml:pos>
- <gml:pos>5 15</gml:pos>
+ <gml:pos>5.0 15.0</gml:pos>
+ <gml:pos>10.0 40.0</gml:pos>
+ <gml:pos>20.0 10.0</gml:pos>
+ <gml:pos>10.0 5.0</gml:pos>
+ <gml:pos>5.0 15.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
@@ -58,11 +63,11 @@
<d:GeogCollection m:type="Edm.GeographyCollection">
<gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
<gml:geometryMembers>
- <gml:MultiGeometry />
+ <gml:MultiGeometry/>
<gml:MultiGeometry>
<gml:geometryMembers>
<gml:Point>
- <gml:pos>2 1</gml:pos>
+ <gml:pos>2.0 1.0</gml:pos>
</gml:Point>
</gml:geometryMembers>
</gml:MultiGeometry>
@@ -79,7 +84,7 @@
</gml:MultiPoint>
</d:GeogMultiPoint>
<d:GeogMultiLine m:type="Edm.GeographyMultiLineString">
- <gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326" />
+ <gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"/>
</d:GeogMultiLine>
<d:GeogMultiPolygon m:type="Edm.GeographyMultiPolygon">
<gml:MultiSurface gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
@@ -87,30 +92,30 @@
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
- <gml:pos>40 40</gml:pos>
- <gml:pos>45 20</gml:pos>
- <gml:pos>30 45</gml:pos>
- <gml:pos>40 40</gml:pos>
+ <gml:pos>40.0 40.0</gml:pos>
+ <gml:pos>45.0 20.0</gml:pos>
+ <gml:pos>30.0 45.0</gml:pos>
+ <gml:pos>40.0 40.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
- <gml:pos>35 20</gml:pos>
- <gml:pos>20 45</gml:pos>
- <gml:pos>5 30</gml:pos>
- <gml:pos>10 10</gml:pos>
- <gml:pos>30 10</gml:pos>
- <gml:pos>35 20</gml:pos>
+ <gml:pos>35.0 20.0</gml:pos>
+ <gml:pos>20.0 45.0</gml:pos>
+ <gml:pos>5.0 30.0</gml:pos>
+ <gml:pos>10.0 10.0</gml:pos>
+ <gml:pos>30.0 10.0</gml:pos>
+ <gml:pos>35.0 20.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
<gml:interior>
<gml:LinearRing>
- <gml:pos>20 30</gml:pos>
- <gml:pos>25 20</gml:pos>
- <gml:pos>15 20</gml:pos>
- <gml:pos>20 30</gml:pos>
+ <gml:pos>20.0 30.0</gml:pos>
+ <gml:pos>25.0 20.0</gml:pos>
+ <gml:pos>15.0 20.0</gml:pos>
+ <gml:pos>20.0 30.0</gml:pos>
</gml:LinearRing>
</gml:interior>
</gml:Polygon>
@@ -118,7 +123,7 @@
</gml:MultiSurface>
</d:GeogMultiPolygon>
<d:Geom m:type="Edm.GeometryPolygon">
- <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0" />
+ <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"/>
</d:Geom>
<d:GeomPoint m:type="Edm.GeometryPoint">
<gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
@@ -127,23 +132,23 @@
</d:GeomPoint>
<d:GeomLine m:type="Edm.GeometryLineString">
<gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:pos>1 1</gml:pos>
- <gml:pos>3 3</gml:pos>
- <gml:pos>2 4</gml:pos>
- <gml:pos>2 0</gml:pos>
+ <gml:pos>1.0 1.0</gml:pos>
+ <gml:pos>3.0 3.0</gml:pos>
+ <gml:pos>2.0 4.0</gml:pos>
+ <gml:pos>2.0 0.0</gml:pos>
</gml:LineString>
</d:GeomLine>
<d:GeomPolygon m:type="Edm.GeometryPolygon">
- <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0" />
+ <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"/>
</d:GeomPolygon>
<d:GeomCollection m:type="Edm.GeometryCollection">
<gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
<gml:geometryMembers>
- <gml:MultiGeometry />
+ <gml:MultiGeometry/>
<gml:MultiGeometry>
<gml:geometryMembers>
<gml:Point>
- <gml:pos>1 2</gml:pos>
+ <gml:pos>1.0 2.0</gml:pos>
</gml:Point>
</gml:geometryMembers>
</gml:MultiGeometry>
@@ -151,26 +156,26 @@
</gml:MultiGeometry>
</d:GeomCollection>
<d:GeomMultiPoint m:type="Edm.GeometryMultiPoint">
- <gml:MultiPoint gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0" />
+ <gml:MultiPoint gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"/>
</d:GeomMultiPoint>
<d:GeomMultiLine m:type="Edm.GeometryMultiLineString">
<gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
<gml:curveMembers>
<gml:LineString>
- <gml:pos>10 10</gml:pos>
- <gml:pos>20 20</gml:pos>
- <gml:pos>10 40</gml:pos>
+ <gml:pos>10.0 10.0</gml:pos>
+ <gml:pos>20.0 20.0</gml:pos>
+ <gml:pos>10.0 40.0</gml:pos>
</gml:LineString>
<gml:LineString>
- <gml:pos>40 40</gml:pos>
- <gml:pos>30 30</gml:pos>
- <gml:pos>40 20</gml:pos>
- <gml:pos>30 10</gml:pos>
+ <gml:pos>40.0 40.0</gml:pos>
+ <gml:pos>30.0 30.0</gml:pos>
+ <gml:pos>40.0 20.0</gml:pos>
+ <gml:pos>30.0 10.0</gml:pos>
</gml:LineString>
</gml:curveMembers>
</gml:MultiCurve>
</d:GeomMultiLine>
- <d:GeomMultiPolygon m:null="true" />
+ <d:GeomMultiPolygon m:null="true"/>
</m:properties>
</content>
</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogCollection.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogCollection.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogCollection.xml
index a13a98d..5e1eaa2 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogCollection.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogCollection.xml
@@ -19,4 +19,21 @@
under the License.
-->
-<d:GeogCollection xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:type="Edm.GeographyCollection"><gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gml:geometryMembers><gml:MultiGeometry /><gml:MultiGeometry><gml:geometryMembers><gml:Point><gml:pos>2 1</gml:pos></gml:Point></gml:geometryMembers></gml:MultiGeometry></gml:geometryMembers></gml:MultiGeometry></d:GeogCollection>
+<d:GeogCollection xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:type="Edm.GeographyCollection">
+ <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:geometryMembers>
+ <gml:MultiGeometry />
+ <gml:MultiGeometry>
+ <gml:geometryMembers>
+ <gml:Point>
+ <gml:pos>2.0 1.0</gml:pos>
+ </gml:Point>
+ </gml:geometryMembers>
+ </gml:MultiGeometry>
+ </gml:geometryMembers>
+ </gml:MultiGeometry>
+</d:GeogCollection>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogPolygon.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogPolygon.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogPolygon.xml
index 766d2c8..947f48f 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogPolygon.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogPolygon.xml
@@ -19,4 +19,20 @@
under the License.
-->
-<d:GeogPolygon xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:type="Edm.GeographyPolygon"><gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gml:exterior><gml:LinearRing><gml:pos>5 15</gml:pos><gml:pos>10 40</gml:pos><gml:pos>20 10</gml:pos><gml:pos>10 5</gml:pos><gml:pos>5 15</gml:pos></gml:LinearRing></gml:exterior></gml:Polygon></d:GeogPolygon>
+<d:GeogPolygon xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:type="Edm.GeographyPolygon">
+ <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:exterior>
+ <gml:LinearRing>
+ <gml:pos>5.0 15.0</gml:pos>
+ <gml:pos>10.0 40.0</gml:pos>
+ <gml:pos>20.0 10.0</gml:pos>
+ <gml:pos>10.0 5.0</gml:pos>
+ <gml:pos>5.0 15.0</gml:pos>
+ </gml:LinearRing>
+ </gml:exterior>
+ </gml:Polygon>
+</d:GeogPolygon>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-6_GeomMultiLine.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-6_GeomMultiLine.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-6_GeomMultiLine.xml
index dbaf3ad..847eb02 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-6_GeomMultiLine.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-6_GeomMultiLine.xml
@@ -5,7 +5,7 @@
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
+ to you under the Apache License, Version 2.0.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
@@ -19,4 +19,24 @@
under the License.
-->
-<d:GeomMultiLine xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:type="Edm.GeometryMultiLineString"><gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"><gml:curveMembers><gml:LineString><gml:pos>10 10</gml:pos><gml:pos>20 20</gml:pos><gml:pos>10 40</gml:pos></gml:LineString><gml:LineString><gml:pos>40 40</gml:pos><gml:pos>30 30</gml:pos><gml:pos>40 20</gml:pos><gml:pos>30 10</gml:pos></gml:LineString></gml:curveMembers></gml:MultiCurve></d:GeomMultiLine>
+<d:GeomMultiLine xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:type="Edm.GeometryMultiLineString">
+ <gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
+ <gml:curveMembers>
+ <gml:LineString>
+ <gml:pos>10.0 10.0</gml:pos>
+ <gml:pos>20.0 20.0</gml:pos>
+ <gml:pos>10.0 40.0</gml:pos>
+ </gml:LineString>
+ <gml:LineString>
+ <gml:pos>40.0 40.0</gml:pos>
+ <gml:pos>30.0 30.0</gml:pos>
+ <gml:pos>40.0 20.0</gml:pos>
+ <gml:pos>30.0 10.0</gml:pos>
+ </gml:LineString>
+ </gml:curveMembers>
+ </gml:MultiCurve>
+</d:GeomMultiLine>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-7_GeomMultiPoint.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-7_GeomMultiPoint.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-7_GeomMultiPoint.xml
index f7b1dfb..5aac3b9 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-7_GeomMultiPoint.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-7_GeomMultiPoint.xml
@@ -19,4 +19,16 @@
under the License.
-->
-<d:GeomMultiPoint xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:type="Edm.GeometryMultiPoint"><gml:MultiPoint gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"><gml:pointMembers><gml:Point><gml:pos>0 0</gml:pos></gml:Point></gml:pointMembers></gml:MultiPoint></d:GeomMultiPoint>
+<d:GeomMultiPoint xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:type="Edm.GeometryMultiPoint">
+ <gml:MultiPoint gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
+ <gml:pointMembers>
+ <gml:Point>
+ <gml:pos>0.0 0.0</gml:pos>
+ </gml:Point>
+ </gml:pointMembers>
+ </gml:MultiPoint>
+</d:GeomMultiPoint>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8.xml
index 2d1ce3c..a5bf4eb 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8.xml
@@ -20,16 +20,19 @@
-->
<entry xml:base="http://192.168.43.55:8080/DefaultService.svc/"
- xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml">
<id>http://192.168.43.55:8080/DefaultService.svc/AllGeoTypesSet(-8)</id>
- <category term="Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link rel="edit" title="AllSpatialTypes" href="AllGeoTypesSet(-8)" />
- <title />
+ <category term="Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes"
+ scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
+ <link rel="edit" title="AllSpatialTypes" href="AllGeoTypesSet(-8)"/>
+ <title/>
<updated>2013-08-21T10:50:04Z</updated>
<author>
- <name />
+ <name/>
</author>
<content type="application/xml">
<m:properties>
@@ -46,16 +49,16 @@
</d:GeogPoint>
<d:GeogLine m:type="Edm.GeographyLineString">
<gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:pos>10 10</gml:pos>
- <gml:pos>20 20</gml:pos>
- <gml:pos>40 10</gml:pos>
+ <gml:pos>10.0 10.0</gml:pos>
+ <gml:pos>20.0 20.0</gml:pos>
+ <gml:pos>40.0 10.0</gml:pos>
</gml:LineString>
</d:GeogLine>
<d:GeogPolygon m:type="Edm.GeographyPolygon">
- <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326" />
+ <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"/>
</d:GeogPolygon>
<d:GeogCollection m:type="Edm.GeographyCollection">
- <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326" />
+ <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"/>
</d:GeogCollection>
<d:GeogMultiPoint m:type="Edm.GeographyMultiPoint">
<gml:MultiPoint gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
@@ -89,30 +92,30 @@
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
- <gml:pos>40 40</gml:pos>
- <gml:pos>45 20</gml:pos>
- <gml:pos>30 45</gml:pos>
- <gml:pos>40 40</gml:pos>
+ <gml:pos>40.0 40.0</gml:pos>
+ <gml:pos>45.0 20.0</gml:pos>
+ <gml:pos>30.0 45.0</gml:pos>
+ <gml:pos>40.0 40.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
- <gml:pos>35 20</gml:pos>
- <gml:pos>20 45</gml:pos>
- <gml:pos>5 30</gml:pos>
- <gml:pos>10 10</gml:pos>
- <gml:pos>30 10</gml:pos>
- <gml:pos>35 20</gml:pos>
+ <gml:pos>35.0 20.0</gml:pos>
+ <gml:pos>20.0 45.0</gml:pos>
+ <gml:pos>5.0 30.0</gml:pos>
+ <gml:pos>10.0 10.0</gml:pos>
+ <gml:pos>30.0 10.0</gml:pos>
+ <gml:pos>35.0 20.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
<gml:interior>
<gml:LinearRing>
- <gml:pos>20 30</gml:pos>
- <gml:pos>25 20</gml:pos>
- <gml:pos>15 20</gml:pos>
- <gml:pos>20 30</gml:pos>
+ <gml:pos>20.0 30.0</gml:pos>
+ <gml:pos>25.0 20.0</gml:pos>
+ <gml:pos>15.0 20.0</gml:pos>
+ <gml:pos>20.0 30.0</gml:pos>
</gml:LinearRing>
</gml:interior>
</gml:Polygon>
@@ -131,20 +134,20 @@
</d:GeomPoint>
<d:GeomLine m:type="Edm.GeometryLineString">
<gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:pos>1 1</gml:pos>
- <gml:pos>3 3</gml:pos>
- <gml:pos>2 4</gml:pos>
- <gml:pos>2 0</gml:pos>
+ <gml:pos>1.0 1.0</gml:pos>
+ <gml:pos>3.0 3.0</gml:pos>
+ <gml:pos>2.0 4.0</gml:pos>
+ <gml:pos>2.0 0.0</gml:pos>
</gml:LineString>
</d:GeomLine>
<d:GeomPolygon m:type="Edm.GeometryPolygon">
<gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
<gml:exterior>
<gml:LinearRing>
- <gml:pos>30 20</gml:pos>
- <gml:pos>10 40</gml:pos>
- <gml:pos>45 40</gml:pos>
- <gml:pos>30 20</gml:pos>
+ <gml:pos>30.0 20.0</gml:pos>
+ <gml:pos>10.0 40.0</gml:pos>
+ <gml:pos>45.0 40.0</gml:pos>
+ <gml:pos>30.0 20.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
@@ -153,21 +156,21 @@
<gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
<gml:geometryMembers>
<gml:Point>
- <gml:pos>4 6</gml:pos>
+ <gml:pos>4.0 6.0</gml:pos>
</gml:Point>
<gml:LineString>
- <gml:pos>4 6</gml:pos>
- <gml:pos>7 10</gml:pos>
+ <gml:pos>4.0 6.0</gml:pos>
+ <gml:pos>7.0 10.0</gml:pos>
</gml:LineString>
</gml:geometryMembers>
</gml:MultiGeometry>
</d:GeomCollection>
- <d:GeomMultiPoint m:null="true" />
+ <d:GeomMultiPoint m:null="true"/>
<d:GeomMultiLine m:type="Edm.GeometryMultiLineString">
- <gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0" />
+ <gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"/>
</d:GeomMultiLine>
<d:GeomMultiPolygon m:type="Edm.GeometryMultiPolygon">
- <gml:MultiSurface gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0" />
+ <gml:MultiSurface gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"/>
</d:GeomMultiPolygon>
</m:properties>
</content>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdb18003/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8_GeomCollection.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8_GeomCollection.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8_GeomCollection.xml
index d1374bd..130f8be 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8_GeomCollection.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8_GeomCollection.xml
@@ -19,4 +19,20 @@
under the License.
-->
-<d:GeomCollection xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:type="Edm.GeometryCollection"><gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"><gml:geometryMembers><gml:Point><gml:pos>4 6</gml:pos></gml:Point><gml:LineString><gml:pos>4 6</gml:pos><gml:pos>7 10</gml:pos></gml:LineString></gml:geometryMembers></gml:MultiGeometry></d:GeomCollection>
+<d:GeomCollection xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:type="Edm.GeometryCollection">
+ <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
+ <gml:geometryMembers>
+ <gml:Point>
+ <gml:pos>4.0 6.0</gml:pos>
+ </gml:Point>
+ <gml:LineString>
+ <gml:pos>4.0 6.0</gml:pos>
+ <gml:pos>7.0 10.0</gml:pos>
+ </gml:LineString>
+ </gml:geometryMembers>
+ </gml:MultiGeometry>
+</d:GeomCollection>
[22/52] [abbrv] Package rename
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataSerializer.java
deleted file mode 100644
index 4c43052..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataSerializer.java
+++ /dev/null
@@ -1,141 +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.client.core.op.impl;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.op.ODataSerializer;
-import org.apache.olingo.client.core.data.AtomEntryImpl;
-import org.apache.olingo.client.core.data.AtomFeedImpl;
-import org.apache.olingo.client.core.data.AtomPropertyImpl;
-import org.apache.olingo.client.core.data.AtomSerializer;
-import org.apache.olingo.client.core.data.JSONEntryImpl;
-import org.apache.olingo.client.core.data.JSONFeedImpl;
-import org.apache.olingo.client.core.data.JSONPropertyImpl;
-
-public abstract class AbstractODataSerializer extends AbstractJacksonTool implements ODataSerializer {
-
- private static final long serialVersionUID = -357777648541325363L;
-
- private final AtomSerializer atomSerializer;
-
- public AbstractODataSerializer(final CommonODataClient client) {
- super(client);
-
- this.atomSerializer = new AtomSerializer(client.getServiceVersion());
- }
-
- @Override
- public void feed(final Feed obj, final OutputStream out) {
- feed(obj, new OutputStreamWriter(out));
- }
-
- @Override
- public void feed(final Feed obj, final Writer writer) {
- if (obj instanceof AtomFeedImpl) {
- atom((AtomFeedImpl) obj, writer);
- } else {
- json((JSONFeedImpl) obj, writer);
- }
- }
-
- @Override
- public void entry(final Entry obj, final OutputStream out) {
- entry(obj, new OutputStreamWriter(out));
- }
-
- @Override
- public void entry(final Entry obj, final Writer writer) {
- if (obj instanceof AtomEntryImpl) {
- atom((AtomEntryImpl) obj, writer);
- } else {
- json((JSONEntryImpl) obj, writer);
- }
- }
-
- @Override
- public void property(final Property obj, final OutputStream out) {
- property(obj, new OutputStreamWriter(out));
- }
-
- @Override
- public void property(final Property obj, final Writer writer) {
- if (obj instanceof AtomPropertyImpl) {
- atom((AtomPropertyImpl) obj, writer);
- } else {
- json((JSONPropertyImpl) obj, writer);
- }
- }
-
- @Override
- public void link(final Link link, final ODataFormat format, final OutputStream out) {
- link(link, format, new OutputStreamWriter(out));
- }
-
- @Override
- public void link(final Link link, final ODataFormat format, final Writer writer) {
- if (format == ODataFormat.XML) {
- atom(link, writer);
- } else {
- jsonLink(link, writer);
- }
- }
-
- /*
- * ------------------ Protected methods ------------------
- */
- protected <T> void atom(final T obj, final Writer writer) {
- try {
- atomSerializer.write(writer, obj);
- } catch (Exception e) {
- throw new IllegalArgumentException("While serializing Atom object", e);
- }
- }
-
- protected <T> 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 jsonLink(final Link link, final Writer writer) {
- final ObjectMapper mapper = getObjectMapper();
- final ObjectNode uri = mapper.createObjectNode();
- uri.put(Constants.JSON_URL, link.getHref());
-
- try {
- mapper.writeValue(writer, uri);
- } catch (Exception e) {
- throw new IllegalArgumentException("While serializing JSON link", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ComplexTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ComplexTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ComplexTypeDeserializer.java
deleted file mode 100644
index e07d907..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ComplexTypeDeserializer.java
+++ /dev/null
@@ -1,83 +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.client.core.op.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.client.core.edm.xml.AbstractComplexType;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.ComplexTypeImpl()
- : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- setAbstractEntityType(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("BaseType".equals(jp.getCurrentName())) {
- ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- setBaseType(jp.nextTextValue());
- } else if ("OpenType".equals(jp.getCurrentName())) {
- ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("Property".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (complexType instanceof org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl) complexType).
- getProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- getProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
- }
- } else if ("NavigationProperty".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- getNavigationProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
- setAnnotation(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return complexType;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityContainerDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityContainerDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityContainerDeserializer.java
deleted file mode 100644
index 5269128..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityContainerDeserializer.java
+++ /dev/null
@@ -1,102 +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.client.core.op.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.client.core.edm.xml.AbstractEntityContainer;
-import org.apache.olingo.client.core.edm.xml.v3.AssociationSetImpl;
-import org.apache.olingo.client.core.edm.xml.v4.ActionImportImpl;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.edm.xml.v4.SingletonImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.EntityContainerImpl()
- : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.EntityContainerImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
- getEntitySets().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.EntitySetImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
- getEntitySets().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl.class));
- }
- } else if ("AssociationSet".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
- getAssociationSets().add(jp.readValueAs(AssociationSetImpl.class));
- } else if ("Singleton".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
- getSingletons().add(jp.readValueAs(SingletonImpl.class));
- } else if ("ActionImport".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
- getActionImports().add(jp.readValueAs(ActionImportImpl.class));
- } else if ("FunctionImport".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (entityContainer instanceof org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
- getFunctionImports().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.FunctionImportImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
- getFunctionImports().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.FunctionImportImpl.class));
- }
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
- setAnnotation(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return entityContainer;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityKeyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityKeyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityKeyDeserializer.java
deleted file mode 100644
index 1f6b415..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityKeyDeserializer.java
+++ /dev/null
@@ -1,50 +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.client.core.op.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.client.core.edm.xml.EntityKeyImpl;
-import org.apache.olingo.client.core.edm.xml.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.readValueAs( PropertyRefImpl.class));
- }
- }
-
- return entityKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntitySetDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntitySetDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntitySetDeserializer.java
deleted file mode 100644
index 7dba1f6..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntitySetDeserializer.java
+++ /dev/null
@@ -1,70 +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.client.core.op.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.client.core.edm.xml.AbstractEntitySet;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyBindingImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.EntitySetImpl()
- : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v4.EntitySetImpl) entitySet).
- setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).
- getNavigationPropertyBindings().add(
- jp.readValueAs(NavigationPropertyBindingImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).
- setAnnotation(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return entitySet;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityTypeDeserializer.java
deleted file mode 100644
index a772b14..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EntityTypeDeserializer.java
+++ /dev/null
@@ -1,92 +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.client.core.op.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.client.core.edm.xml.AbstractEntityType;
-import org.apache.olingo.client.core.edm.xml.EntityKeyImpl;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.EntityTypeImpl()
- : new org.apache.olingo.client.core.edm.xml.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.readValueAs(EntityKeyImpl.class));
- } else if ("Property".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (entityType instanceof org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) entityType).
- getProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
- getProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
- }
- } else if ("NavigationProperty".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (entityType instanceof org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) entityType).
- getNavigationProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.NavigationPropertyImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
- getNavigationProperties().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyImpl.class));
- }
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
- setAnnotation(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return entityType;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EnumTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EnumTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EnumTypeDeserializer.java
deleted file mode 100644
index 42d68ba..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/EnumTypeDeserializer.java
+++ /dev/null
@@ -1,73 +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.client.core.op.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.client.core.edm.xml.AbstractEnumType;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.EnumTypeImpl()
- : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.EnumTypeImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.EnumTypeImpl) enumType).
- getMembers().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.MemberImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).
- getMembers().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.MemberImpl.class));
- }
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).
- setAnnotation(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return enumType;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/InjectableSerializerProvider.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/InjectableSerializerProvider.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/InjectableSerializerProvider.java
deleted file mode 100644
index ec9fd29..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/InjectableSerializerProvider.java
+++ /dev/null
@@ -1,43 +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.client.core.op.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;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
deleted file mode 100644
index cc0b388..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
+++ /dev/null
@@ -1,165 +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.client.core.op.impl;
-
-import java.net.URI;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.ODataLinkType;
-import org.apache.olingo.client.api.domain.ODataCollectionValue;
-import org.apache.olingo.client.api.domain.ODataComplexValue;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
-import org.apache.olingo.client.api.domain.ODataInlineEntity;
-import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataObjectFactory;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataProperty;
-
-public class ODataObjectFactoryImpl implements ODataObjectFactory {
-
- private static final long serialVersionUID = -3769695665946919447L;
-
- protected final CommonODataClient client;
-
- public ODataObjectFactoryImpl(final CommonODataClient client) {
- this.client = client;
- }
-
- @Override
- public ODataEntitySet newEntitySet() {
- return new ODataEntitySet();
- }
-
- @Override
- public ODataEntitySet newEntitySet(final URI next) {
- return new ODataEntitySet(next);
- }
-
- @Override
- public ODataEntity newEntity(final String name) {
- return new ODataEntity(name);
- }
-
- @Override
- public ODataEntity newEntity(final String name, final URI link) {
- final ODataEntity result = new ODataEntity(name);
- result.setLink(link);
- return result;
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(client.getServiceVersion(),
- link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(client.getServiceVersion(),
- baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
- return new ODataInlineEntity(client.getServiceVersion(), link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
- final ODataEntity entity) {
-
- return new ODataInlineEntity(client.getServiceVersion(),
- baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
- return new ODataProperty(name, value);
- }
-
- @Override
- public ODataProperty newPrimitiveProperty(final String name, final ODataGeospatialValue value) {
- return new ODataProperty(name, value);
- }
-
- @Override
- public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
- return new ODataProperty(name, value);
- }
-
- @Override
- public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
- return new ODataProperty(name, value);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java
deleted file mode 100644
index 5e95f2b..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java
+++ /dev/null
@@ -1,101 +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.client.core.op.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Collections;
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.op.ODataWriter;
-
-public class ODataWriterImpl implements ODataWriter {
-
- private static final long serialVersionUID = 3265794768412314485L;
-
- protected final CommonODataClient client;
-
- public ODataWriterImpl(final CommonODataClient client) {
- this.client = client;
- }
-
- @Override
- public InputStream writeEntities(final Collection<ODataEntity> entities, final ODataPubFormat format) {
- return writeEntities(entities, format, true);
- }
-
- @Override
- public InputStream writeEntities(
- final Collection<ODataEntity> entities, final ODataPubFormat format, final boolean outputType) {
-
- final ByteArrayOutputStream output = new ByteArrayOutputStream();
- try {
- for (ODataEntity entity : entities) {
- client.getSerializer().entry(client.getBinder().getEntry(
- entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM), outputType), output);
- }
-
- return new ByteArrayInputStream(output.toByteArray());
- } finally {
- IOUtils.closeQuietly(output);
- }
- }
-
- @Override
- public InputStream writeEntity(final ODataEntity entity, final ODataPubFormat format) {
- return writeEntity(entity, format, true);
- }
-
- @Override
- public InputStream writeEntity(final ODataEntity entity, final ODataPubFormat format, final boolean outputType) {
- return writeEntities(Collections.<ODataEntity>singleton(entity), format, outputType);
- }
-
- @Override
- public InputStream writeProperty(final ODataProperty property, final ODataFormat format) {
- final ByteArrayOutputStream output = new ByteArrayOutputStream();
- try {
- client.getSerializer().property(client.getBinder().getProperty(
- property, ResourceFactory.entryClassForFormat(format == ODataFormat.XML), true), output);
-
- return new ByteArrayInputStream(output.toByteArray());
- } finally {
- IOUtils.closeQuietly(output);
- }
- }
-
- @Override
- public InputStream writeLink(final ODataLink link, final ODataFormat format) {
- final ByteArrayOutputStream output = new ByteArrayOutputStream();
- try {
- client.getSerializer().link(client.getBinder().getLink(link, format == ODataFormat.XML), format, output);
-
- return new ByteArrayInputStream(output.toByteArray());
- } finally {
- IOUtils.closeQuietly(output);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ResourceFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ResourceFactory.java
deleted file mode 100644
index 7ee74cd..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ResourceFactory.java
+++ /dev/null
@@ -1,125 +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.client.core.op.impl;
-
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.core.data.AtomEntryImpl;
-import org.apache.olingo.client.core.data.AtomFeedImpl;
-import org.apache.olingo.client.core.data.AtomPropertyImpl;
-import org.apache.olingo.client.core.data.JSONEntryImpl;
-import org.apache.olingo.client.core.data.JSONFeedImpl;
-import org.apache.olingo.client.core.data.JSONPropertyImpl;
-
-public class ResourceFactory {
-
- /**
- * Gets a new instance of <tt>Feed</tt>.
- *
- * @param resourceClass reference class.
- * @return <tt>Feed</tt> object.
- */
- public static Feed newFeed(final Class<? extends Feed> resourceClass) {
- Feed result = null;
-
- if (AtomFeedImpl.class.equals(resourceClass)) {
- result = new AtomFeedImpl();
- }
- if (JSONFeedImpl.class.equals(resourceClass)) {
- result = new JSONFeedImpl();
- }
-
- return result;
- }
-
- /**
- * Gets a new instance of <tt>Entry</tt>.
- *
- * @param resourceClass reference class.
- * @return <tt>Entry</tt> object.
- */
- public static Entry newEntry(final Class<? extends Entry> resourceClass) {
- Entry result = null;
- if (AtomEntryImpl.class.equals(resourceClass)) {
- result = new AtomEntryImpl();
- }
- if (JSONEntryImpl.class.equals(resourceClass)) {
- result = new JSONEntryImpl();
- }
-
- return result;
- }
-
- public static Property newProperty(final Class<? extends Entry> resourceClass) {
- Property result = null;
- if (AtomEntryImpl.class.equals(resourceClass)) {
- result = new AtomPropertyImpl();
- }
- if (JSONEntryImpl.class.equals(resourceClass)) {
- result = new JSONPropertyImpl();
- }
-
- return result;
- }
-
- /**
- * Gets feed reference class from the given format.
- *
- * @param isXML whether it is JSON or XML / Atom
- * @return resource reference class.
- */
- public static Class<? extends Feed> feedClassForFormat(final boolean isXML) {
- return isXML ? AtomFeedImpl.class : JSONFeedImpl.class;
- }
-
- /**
- * Gets entry reference class from the given format.
- *
- * @param isXML whether it is JSON or XML / Atom
- * @return resource reference class.
- */
- public static Class<? extends Entry> entryClassForFormat(final boolean isXML) {
- return isXML ? AtomEntryImpl.class : JSONEntryImpl.class;
- }
-
- /**
- * Gets <tt>Entry</tt> object from feed resource.
- *
- * @param resourceClass feed reference class.
- * @return <tt>Entry</tt> object.
- */
- public static Class<? extends Entry> entryClassForFeed(final Class<? extends Feed> resourceClass) {
- Class<? extends Entry> result = null;
-
- if (AtomFeedImpl.class.equals(resourceClass)) {
- result = AtomEntryImpl.class;
- }
- if (JSONFeedImpl.class.equals(resourceClass)) {
- result = JSONEntryImpl.class;
- }
-
- return result;
- }
-
- public static ODataPubFormat formatForEntryClass(final Class<? extends Entry> reference) {
- return reference.equals(AtomEntryImpl.class) ? ODataPubFormat.ATOM : ODataPubFormat.JSON;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/SchemaDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/SchemaDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/SchemaDeserializer.java
deleted file mode 100644
index ca7eeea..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/SchemaDeserializer.java
+++ /dev/null
@@ -1,149 +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.client.core.op.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.client.core.edm.xml.AbstractSchema;
-import org.apache.olingo.client.core.edm.xml.v3.AssociationImpl;
-import org.apache.olingo.client.core.edm.xml.v3.UsingImpl;
-import org.apache.olingo.client.core.edm.xml.v3.ValueTermImpl;
-import org.apache.olingo.client.core.edm.xml.v4.ActionImpl;
-import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.edm.xml.v4.FunctionImpl;
-import org.apache.olingo.client.core.edm.xml.v4.TypeDefinitionImpl;
-import org.apache.olingo.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.client.core.edm.xml.v3.SchemaImpl()
- : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.SchemaImpl) schema).
- getUsings().add(jp.readValueAs( UsingImpl.class));
- } else if ("Association".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getAssociations().add(jp.readValueAs( AssociationImpl.class));
- } else if ("ComplexType".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getComplexTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
- getComplexTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl.class));
- }
- } else if ("EntityType".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getEntityTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
- getEntityTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl.class));
- }
- } else if ("EnumType".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getEnumTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.EnumTypeImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
- getEnumTypes().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl.class));
- }
- } else if ("ValueTerm".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getValueTerms().add(jp.readValueAs( ValueTermImpl.class));
- } else if ("EntityContainer".equals(jp.getCurrentName())) {
- jp.nextToken();
-
- if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
- getEntityContainers().add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl.class));
- } else {
- org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl entityContainer
- = jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl.class);
- entityContainer.setDefaultEntityContainer(true);
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
- setEntityContainer(entityContainer);
- }
- } else if ("Annotations".equals(jp.getCurrentName())) {
- jp.nextToken();
- if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
- ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).getAnnotationsList().
- add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v3.AnnotationsImpl.class));
- } else {
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotationsList().
- add(jp.readValueAs(
- org.apache.olingo.client.core.edm.xml.v4.AnnotationsImpl.class));
- }
- } else if ("Action".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getActions().
- add(jp.readValueAs( ActionImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotations().
- add(jp.readValueAs( AnnotationImpl.class));
- } else if ("Function".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getFunctions().
- add(jp.readValueAs( FunctionImpl.class));
- } else if ("TypeDefinition".equals(jp.getCurrentName())) {
- jp.nextToken();
- ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
- getTypeDefinitions().add(jp.readValueAs( TypeDefinitionImpl.class));
- }
- }
- }
-
- return schema;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
index f5e5710..ba9f7c2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.op.impl.v3;
import org.apache.olingo.client.api.data.v3.LinkCollection;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.client.api.op.v3.ODataBinder;
-import org.apache.olingo.client.core.op.impl.AbstractODataBinder;
+import org.apache.olingo.client.core.op.AbstractODataBinder;
import org.apache.olingo.client.core.v3.ODataClientImpl;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
index ea28958..edb98a0 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl;
import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
import org.apache.olingo.client.core.edm.xml.v3.EdmxImpl;
import org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl;
-import org.apache.olingo.client.core.op.impl.AbstractODataDeserializer;
+import org.apache.olingo.client.core.op.AbstractODataDeserializer;
public class ODataDeserializerImpl extends AbstractODataDeserializer implements ODataDeserializer {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
index 6649a39..2e8a080 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
@@ -27,7 +27,7 @@ import org.apache.olingo.client.api.op.v3.ODataReader;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.v3.ODataClientImpl;
import org.apache.olingo.client.core.edm.EdmClientImpl;
-import org.apache.olingo.client.core.op.impl.AbstractODataReader;
+import org.apache.olingo.client.core.op.AbstractODataReader;
import org.apache.olingo.commons.api.edm.Edm;
public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
index 5ad5cda..14f5a40 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core.op.impl.v3;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.core.op.impl.AbstractODataSerializer;
+import org.apache.olingo.client.core.op.AbstractODataSerializer;
public class ODataSerializerImpl extends AbstractODataSerializer {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index 9951db2..80863cb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -24,7 +24,7 @@ import org.apache.olingo.client.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.op.v4.ODataBinder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.core.op.impl.AbstractODataBinder;
+import org.apache.olingo.client.core.op.AbstractODataBinder;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
index d947539..95fde77 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
@@ -29,7 +29,7 @@ import org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl;
import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
import org.apache.olingo.client.core.edm.xml.v4.EdmxImpl;
import org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl;
-import org.apache.olingo.client.core.op.impl.AbstractODataDeserializer;
+import org.apache.olingo.client.core.op.AbstractODataDeserializer;
public class ODataDeserializerImpl extends AbstractODataDeserializer implements ODataDeserializer {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
index 8324cca..4260ba8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
@@ -25,7 +25,7 @@ import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.op.v4.ODataReader;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.edm.EdmClientImpl;
-import org.apache.olingo.client.core.op.impl.AbstractODataReader;
+import org.apache.olingo.client.core.op.AbstractODataReader;
import org.apache.olingo.commons.api.edm.Edm;
public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
index 97557a1..d79b8f8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core.op.impl.v4;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.core.op.impl.AbstractODataSerializer;
+import org.apache.olingo.client.core.op.AbstractODataSerializer;
public class ODataSerializerImpl extends AbstractODataSerializer {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
index 6637346..c05eaff 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
@@ -38,7 +38,7 @@ import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.core.op.impl.ResourceFactory;
+import org.apache.olingo.client.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
index 35cc3d6..fa0d60f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
@@ -33,7 +33,7 @@ import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.client.core.op.impl.ResourceFactory;
+import org.apache.olingo.client.core.op.ResourceFactory;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
index 7de99d3..d33da3b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
@@ -27,7 +27,7 @@ import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.op.impl.ResourceFactory;
+import org.apache.olingo.client.core.op.ResourceFactory;
import org.junit.Test;
public class EntitySetTest extends AbstractTest {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 0147fc0..978da52 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -29,7 +29,7 @@ import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.op.impl.ResourceFactory;
+import org.apache.olingo.client.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
[48/52] [abbrv] git commit: [OLINGO-175,
OLINGO-205] provided (V4) next link check
Posted by sk...@apache.org.
[OLINGO-175, OLINGO-205] provided (V4) next link check
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/f0edb508
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/f0edb508
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/f0edb508
Branch: refs/heads/olingo-206-validator
Commit: f0edb5081363d9e9f9ab0192541a943325e12dbb
Parents: 5b5576f
Author: fmartelli <fa...@gmail.com>
Authored: Mon Mar 24 10:38:32 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Mon Mar 24 10:38:32 2014 +0100
----------------------------------------------------------------------
fit/src/main/resources/v4/People/feed.full.json | 3 ++-
fit/src/main/resources/v4/People/feed.xml | 1 +
.../olingo/client/core/it/v4/EntitySetTestITCase.java | 13 ++++++++-----
3 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f0edb508/fit/src/main/resources/v4/People/feed.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/People/feed.full.json b/fit/src/main/resources/v4/People/feed.full.json
index 0c998f6..a0e3db0 100644
--- a/fit/src/main/resources/v4/People/feed.full.json
+++ b/fit/src/main/resources/v4/People/feed.full.json
@@ -328,5 +328,6 @@
"target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
}
}
- ]
+ ],
+ "odata.nextLink": "People?$skiptoken=5"
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f0edb508/fit/src/main/resources/v4/People/feed.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/People/feed.xml b/fit/src/main/resources/v4/People/feed.xml
index f79bb49..609c669 100644
--- a/fit/src/main/resources/v4/People/feed.xml
+++ b/fit/src/main/resources/v4/People/feed.xml
@@ -215,4 +215,5 @@
</m:properties>
</content>
</entry>
+ <link rel="next" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People?$skiptoken=5"/>
</feed>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f0edb508/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index e3e8a1e..8455ecd 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -20,8 +20,10 @@ package org.apache.olingo.client.core.it.v4;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
@@ -29,6 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.core.op.ResourceFactory;
@@ -105,12 +108,12 @@ public class EntitySetTestITCase extends AbstractTestITCase {
ODataPubFormat.ATOM == format)), "Just retrieved feed");
assertEquals(5, feed.getEntities().size());
-// assertNotNull(feed.getNext());
+ assertNotNull(feed.getNext());
-// final URI expected = URI.create(getServiceRoot() + "/Customer?$skiptoken=-9");
-// final URI found = URIUtils.getURI(getServiceRoot(), feed.getNext().toASCIIString());
+ final URI expected = URI.create(getServiceRoot() + "/People?$skiptoken=5");
+ final URI found = URIUtils.getURI(getServiceRoot(), feed.getNext().toASCIIString());
-// assertEquals(expected, found);
+ assertEquals(expected, found);
}
private void readODataEntitySetIterator(final ODataPubFormat format) {
@@ -133,7 +136,7 @@ public class EntitySetTestITCase extends AbstractTestITCase {
count++;
}
assertEquals(5, count);
-// assertTrue(feedIterator.getNext().toASCIIString().endsWith("Customer?$skiptoken=-9"));
+ assertTrue(feedIterator.getNext().toASCIIString().endsWith("People?$skiptoken=5"));
}
private void rawRequest(final ODataPubFormat format) {
[13/52] [abbrv] [OLINGO-65] Geospatial types implemented,
EdmStream mock implemented with URI as backend, V3 pruned types implemented,
EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
index 641fafa..c5e4aee 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
@@ -29,21 +29,21 @@ import java.util.List;
import java.util.UUID;
import org.apache.commons.codec.binary.Base64;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataDuration;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataTimestamp;
import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
import org.junit.Test;
public class PrimitiveValueTest extends AbstractTest {
@@ -56,24 +56,24 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageInt32() {
final int primitive = -10;
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Int32).
+ ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Int32.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Int32.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
assertEquals(Integer.valueOf(primitive), value.asPrimitive().<Integer>toCastValue());
- value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Int32).setText("9").build();
+ value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).setText("9").build();
assertEquals("9", value.asPrimitive().<Integer>toCastValue().toString());
}
@Test
public void manageString() {
final String primitive = UUID.randomUUID().toString();
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.String).
+ ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.String.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
assertEquals(primitive, value.toString());
- value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.String).
+ value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().<String>toCastValue().toString());
}
@@ -81,12 +81,12 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageDecimal() {
final BigDecimal primitive = new BigDecimal("-79228162514264337593543950335");
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Decimal).
+ ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Decimal.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Decimal.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
assertEquals(primitive, value.asPrimitive().<BigDecimal>toCastValue());
- value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Decimal).
+ value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
setText("-79228162514264337593543950335").build();
assertEquals("-79228162514264337593543950335", value.asPrimitive().<BigDecimal>toCastValue().toString());
}
@@ -97,15 +97,15 @@ public class PrimitiveValueTest extends AbstractTest {
final String primitive = "2013-01-10T06:27:51.1667673";
try {
new ODataPrimitiveValue.Builder(ODataClientFactory.getV4()).
- setType(ODataJClientEdmPrimitiveType.DateTime).setText(primitive).build();
+ setType(EdmPrimitiveTypeKind.DateTime).setText(primitive).build();
fail();
} catch (IllegalArgumentException iae) {
// ignore
}
final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.DateTime).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.DateTime).
setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.DateTime.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.DateTime.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
// performed cast to improve the check
assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
}
@@ -116,16 +116,16 @@ public class PrimitiveValueTest extends AbstractTest {
final String primitive = "-P9DT51M10.5063807S";
try {
new ODataPrimitiveValue.Builder(ODataClientFactory.getV4()).
- setType(ODataJClientEdmPrimitiveType.Time).setText(primitive).build();
+ setType(EdmPrimitiveTypeKind.Time).setText(primitive).build();
fail();
} catch (IllegalArgumentException iae) {
// ignore
}
final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Time).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Time).
setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Time.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Time.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
// performed cast to improve the check
assertEquals(primitive, value.asPrimitive().<ODataDuration>toCastValue().toString());
}
@@ -134,8 +134,9 @@ public class PrimitiveValueTest extends AbstractTest {
public void manageDateTimeOffset() {
final String primitive = "2013-01-10T02:00:00";
final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.DateTimeOffset).setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.DateTimeOffset.toString(), value.asPrimitive().getTypeName());
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setText(primitive).build();
+ assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
// performed cast to improve the check
assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
}
@@ -143,12 +144,12 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageGuid() {
final UUID primitive = UUID.fromString("1126a28b-a4af-4bbd-bf0a-2b2c22635565");
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Guid).
+ ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Guid.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Guid.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
assertEquals(primitive, value.asPrimitive().<UUID>toCastValue());
- value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Guid).
+ value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().<UUID>toCastValue().toString());
}
@@ -156,14 +157,14 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageBinary() {
final byte[] primitive = UUID.randomUUID().toString().getBytes();
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Binary).
+ ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Binary.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Binary.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
assertEquals(
Base64.encodeBase64String(primitive),
Base64.encodeBase64String(value.asPrimitive().<byte[]>toCastValue()));
- value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Binary).
+ value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
setText(Base64.encodeBase64String("primitive".getBytes())).build();
assertEquals("primitive", new String(value.asPrimitive().<byte[]>toCastValue()));
}
@@ -175,7 +176,7 @@ public class PrimitiveValueTest extends AbstractTest {
primitive.setY(173.334);
try {
- getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPoint).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(primitive).build();
fail();
} catch (IllegalArgumentException iae) {
@@ -183,10 +184,11 @@ public class PrimitiveValueTest extends AbstractTest {
}
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPoint).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(primitive).
build();
- assertEquals(ODataJClientEdmPrimitiveType.GeographyPoint.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeographyPoint.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
assertEquals(Double.valueOf(primitive.getX()), Double.valueOf(value.asPrimitive().<Point>toCastValue().getX()));
assertEquals(Double.valueOf(primitive.getY()), Double.valueOf(value.asPrimitive().<Point>toCastValue().getY()));
}
@@ -217,8 +219,9 @@ public class PrimitiveValueTest extends AbstractTest {
final LineString primitive = new LineString(Geospatial.Dimension.GEOGRAPHY, null, points);
final ODataValue value = getClient().getGeospatialValueBuilder().
- setType(ODataJClientEdmPrimitiveType.GeographyLineString).setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeographyLineString.toString(), value.asPrimitive().getTypeName());
+ setType(EdmPrimitiveTypeKind.GeographyLineString).setValue(primitive).build();
+ assertEquals(EdmPrimitiveTypeKind.GeographyLineString.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator<Point> iter = value.asPrimitive().<LineString>toCastValue().iterator();
@@ -242,8 +245,9 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiPoint primitive = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
final ODataValue value = getClient().getGeospatialValueBuilder().
- setType(ODataJClientEdmPrimitiveType.GeometryMultiPoint).setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiPoint.toString(), value.asPrimitive().getTypeName());
+ setType(EdmPrimitiveTypeKind.GeometryMultiPoint).setValue(primitive).build();
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator<Point> iter = value.asPrimitive().<MultiPoint>toCastValue().iterator();
point = iter.next();
@@ -302,9 +306,10 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiLineString primitive = new MultiLineString(Geospatial.Dimension.GEOMETRY, null, lines);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiLineString).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiLineString.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator<LineString> lineIter = value.asPrimitive().<MultiLineString>toCastValue().iterator();
@@ -355,9 +360,10 @@ public class PrimitiveValueTest extends AbstractTest {
final Polygon primitive = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, interior, exterior);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPolygon).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeographyPolygon.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeographyPolygon.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
assertTrue(value.asPrimitive().<Polygon>toCastValue().getInterior().isEmpty());
final Iterator<Point> iter = value.asPrimitive().<Polygon>toCastValue().getExterior().iterator();
@@ -461,9 +467,10 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiPolygon primitive = new MultiPolygon(Geospatial.Dimension.GEOMETRY, null, polygons);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiPolygon).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPolygon).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiPolygon.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator<Polygon> iter = value.asPrimitive().<MultiPolygon>toCastValue().iterator();
@@ -507,9 +514,10 @@ public class PrimitiveValueTest extends AbstractTest {
final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOMETRY, null, collection);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryCollection).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryCollection).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeometryCollection.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeometryCollection.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator<Geospatial> iter = value.asPrimitive().<GeospatialCollection>toCastValue().iterator();
iter.next();
@@ -539,9 +547,10 @@ public class PrimitiveValueTest extends AbstractTest {
final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, collection);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyCollection).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeographyCollection.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeographyCollection.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator<Geospatial> iter = value.asPrimitive().<GeospatialCollection>toCastValue().iterator();
iter.next();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
index 3d74f7b..fd2a696 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
@@ -27,6 +27,7 @@ import org.apache.olingo.client.core.edm.EdmEnumTypeImpl;
import org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import static org.junit.Assert.assertEquals;
@@ -49,7 +50,7 @@ public class FilterFactoryTest extends AbstractTest {
@Test
public void has() {
- final EdmEnumType pattern = new EdmEnumTypeImpl(
+ final EdmEnumType pattern = new EdmEnumTypeImpl(ODataServiceVersion.V40,
null, new FullQualifiedName("Sales", "Pattern"), new EnumTypeImpl());
final URIFilter filter = getFilterFactory().has(getFilterArgFactory().property("style"), pattern, "Yellow");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
index afeba92..fb2ba5c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
@@ -50,9 +50,10 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.junit.Test;
public class MetadataTest extends AbstractTest {
@@ -82,7 +83,7 @@ public class MetadataTest extends AbstractTest {
assertNotNull(responseStatus);
assertTrue(responseStatus.getNavigationPropertyNames().isEmpty());
assertEquals("Recipient", responseStatus.getBaseType().getName());
- assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance(),
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset),
responseStatus.getProperty("Time").getType());
// 3. Entity
@@ -106,8 +107,8 @@ public class MetadataTest extends AbstractTest {
assertNotNull(move);
assertTrue(move.isBound());
assertEquals(2, move.getParameterNames().size());
- assertEquals(
- EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), move.getParameter("DestinationId").getType());
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String),
+ move.getParameter("DestinationId").getType());
// 5. EntityContainer
final EdmEntityContainer container = edm.getEntityContainer(
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
index c146fee..d72861d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
@@ -22,13 +22,13 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataDuration;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataTimestamp;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class PrimitiveValueTest extends AbstractTest {
@@ -44,15 +44,15 @@ public class PrimitiveValueTest extends AbstractTest {
final String primitive = "-P9DT51M12.5063807S";
try {
new ODataPrimitiveValue.Builder(ODataClientFactory.getV3()).
- setType(ODataJClientEdmPrimitiveType.TimeOfDay).setText(primitive).build();
+ setType(EdmPrimitiveTypeKind.TimeOfDay).setText(primitive).build();
fail();
} catch (IllegalArgumentException iae) {
// ignore
}
final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.TimeOfDay).setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.TimeOfDay.toString(), value.asPrimitive().getTypeName());
+ setType(EdmPrimitiveTypeKind.TimeOfDay).setText(primitive).build();
+ assertEquals(EdmPrimitiveTypeKind.TimeOfDay.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
// performed cast to improve the check
assertEquals(primitive, value.asPrimitive().<ODataDuration>toCastValue().toString());
}
@@ -63,15 +63,15 @@ public class PrimitiveValueTest extends AbstractTest {
final String primitive = "2013-01-10";
try {
new ODataPrimitiveValue.Builder(ODataClientFactory.getV3()).
- setType(ODataJClientEdmPrimitiveType.Date).setText(primitive).build();
+ setType(EdmPrimitiveTypeKind.Date).setText(primitive).build();
fail();
} catch (IllegalArgumentException iae) {
// ignore
}
final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Date).setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Date.toString(), value.asPrimitive().getTypeName());
+ setType(EdmPrimitiveTypeKind.Date).setText(primitive).build();
+ assertEquals(EdmPrimitiveTypeKind.Date.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
// performed cast to improve the check
assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/commons-api/pom.xml b/lib/commons-api/pom.xml
index 42c42b4..e398eaa 100644
--- a/lib/commons-api/pom.xml
+++ b/lib/commons-api/pom.xml
@@ -33,4 +33,12 @@
<version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ </dependencies>
+
</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java
new file mode 100644
index 0000000..898b6b2
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.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.commons.api.edm;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+
+public interface EdmGeospatialType extends EdmType {
+
+ String EDM_NAMESPACE = EdmPrimitiveType.EDM_NAMESPACE;
+
+ /**
+ * Returns the Java type for this EDM geospatial type.
+ *
+ * @return the geospatial Java type
+ */
+ Class<? extends Geospatial> getJavaType();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java
new file mode 100644
index 0000000..069d9e5
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.edm;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public enum EdmPrimitiveTypeKind {
+
+ Binary,
+ Boolean,
+ Byte,
+ SByte,
+ Date(new ODataServiceVersion[] {ODataServiceVersion.V40}),
+ DateTime(new ODataServiceVersion[] {ODataServiceVersion.V30}),
+ DateTimeOffset,
+ Time(new ODataServiceVersion[] {ODataServiceVersion.V30}),
+ TimeOfDay(new ODataServiceVersion[] {ODataServiceVersion.V40}),
+ Duration(new ODataServiceVersion[] {ODataServiceVersion.V40}),
+ Decimal,
+ Single,
+ Double,
+ Guid,
+ Int16,
+ Int32,
+ Int64,
+ String,
+ Stream,
+ Geography,
+ GeographyPoint,
+ GeographyLineString,
+ GeographyPolygon,
+ GeographyMultiPoint,
+ GeographyMultiLineString,
+ GeographyMultiPolygon,
+ GeographyCollection,
+ Geometry,
+ GeometryPoint,
+ GeometryLineString,
+ GeometryPolygon,
+ GeometryMultiPoint,
+ GeometryMultiLineString,
+ GeometryMultiPolygon,
+ GeometryCollection;
+
+ private final List<ODataServiceVersion> versions;
+
+ EdmPrimitiveTypeKind() {
+ this.versions = Collections.unmodifiableList(
+ Arrays.asList(new ODataServiceVersion[] {ODataServiceVersion.V30, ODataServiceVersion.V40}));
+ }
+
+ EdmPrimitiveTypeKind(final ODataServiceVersion[] versions) {
+ this.versions = Collections.unmodifiableList(Arrays.asList(versions.clone()));
+ }
+
+ public List<ODataServiceVersion> getSupportedVersions() {
+ return this.versions;
+ }
+
+ /**
+ * 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");
+ }
+
+ /**
+ * Returns the {@link FullQualifiedName} for this type kind.
+ *
+ * @return {@link FullQualifiedName}
+ */
+ public FullQualifiedName getFullQualifiedName() {
+ return new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, toString());
+ }
+
+ public static EdmPrimitiveTypeKind valueOf(final ODataServiceVersion version, final String name) {
+ final EdmPrimitiveTypeKind kind = valueOf(name);
+ if (!kind.versions.contains(version)) {
+ throw new IllegalArgumentException(kind + " not allowed in " + version);
+ }
+ return kind;
+ }
+
+ /**
+ * Gets <tt>EdmPrimitiveTypeKind</tt> from a full-qualified type name, for the given OData protocol version.
+ *
+ * @param version OData protocol version.
+ * @param fqn full-qualified type name.
+ * @return <tt>EdmPrimitiveTypeKind</tt> object.
+ */
+ public static EdmPrimitiveTypeKind valueOfFQN(final ODataServiceVersion version, final FullQualifiedName fqn) {
+ return valueOfFQN(version, fqn.toString());
+ }
+
+ /**
+ * Gets <tt>EdmPrimitiveTypeKind</tt> from a full type expression (as <tt>Edm.Int32</tt>), for the given OData
+ * protocol version.
+ *
+ * @param version OData protocol version.
+ * @param fqn string value type.
+ * @return <tt>EdmPrimitiveTypeKind</tt> object.
+ */
+ public static EdmPrimitiveTypeKind valueOfFQN(final ODataServiceVersion version, final String fqn) {
+ if (version == null) {
+ throw new IllegalArgumentException("No OData protocol version provided");
+ }
+ if (!fqn.startsWith(EdmPrimitiveType.EDM_NAMESPACE + ".")) {
+ throw new IllegalArgumentException(fqn + " does not look like an Edm primitive type");
+ }
+
+ final EdmPrimitiveTypeKind kind = valueOf(fqn.substring(4));
+ if (!kind.versions.contains(version)) {
+ throw new IllegalArgumentException(kind + " not allowed in " + version);
+ }
+ return kind;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
new file mode 100644
index 0000000..82a13fe
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.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.commons.api.edm.geo;
+
+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 crs crs.
+ * @param geospatials geospatials info.
+ */
+ protected ComposedGeospatial(final Dimension dimension, final Type type, final String crs,
+ final List<T> geospatials) {
+
+ super(dimension, type, crs);
+ 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/olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
new file mode 100644
index 0000000..62de5ec
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.edm.geo;
+
+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.commons.api.edm.EdmPrimitiveTypeKind;
+
+/**
+ * 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;
+
+ protected String crs;
+
+ /**
+ * 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, final String crs) {
+ this.dimension = dimension;
+ this.type = type;
+ this.crs = crs;
+ }
+
+ /**
+ * Gets dimension.
+ *
+ * @return dimension.
+ * @see Dimension
+ */
+ public Dimension getDimension() {
+ return dimension;
+ }
+
+ /**
+ * Gets type.
+ *
+ * @return type.
+ * @see Type
+ */
+ public Type getType() {
+ return type;
+ }
+
+ /**
+ * Gets CRS.
+ *
+ * @return CRS
+ */
+ public String getCrs() {
+ return crs;
+ }
+
+ /**
+ * 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 EdmPrimitiveTypeKind getEdmPrimitiveTypeKind();
+
+ /**
+ * {@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/olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java
new file mode 100644
index 0000000..b3e3f9f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.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.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+/**
+ * Wrapper for a collection of geospatials info.
+ */
+public class GeospatialCollection extends ComposedGeospatial<Geospatial> {
+
+ private static final long serialVersionUID = -9181547636133878977L;
+
+ /**
+ * Constructor.
+ *
+ * @param dimension dimension.
+ * @param crs crs.
+ * @param geospatials geospatials info.
+ */
+ public GeospatialCollection(final Dimension dimension, final String crs, final List<Geospatial> geospatials) {
+ super(dimension, Type.GEOSPATIALCOLLECTION, crs, geospatials);
+ }
+
+ @Override
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyCollection
+ : EdmPrimitiveTypeKind.GeometryCollection;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
new file mode 100644
index 0000000..297a962
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/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.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+public class LineString extends ComposedGeospatial<Point> {
+
+ private static final long serialVersionUID = 3207958185407535907L;
+
+ public LineString(final Dimension dimension, final String crs, final List<Point> points) {
+ super(dimension, Type.LINESTRING, crs, points);
+ }
+
+ @Override
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyLineString
+ : EdmPrimitiveTypeKind.GeometryLineString;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java
new file mode 100644
index 0000000..2f98d63
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.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.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+public class MultiLineString extends ComposedGeospatial<LineString> {
+
+ private static final long serialVersionUID = -5042414471218124125L;
+
+ public MultiLineString(final Dimension dimension, final String crs, final List<LineString> lineStrings) {
+ super(dimension, Type.MULTILINESTRING, crs, lineStrings);
+ }
+
+ @Override
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyMultiLineString
+ : EdmPrimitiveTypeKind.GeometryMultiLineString;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java
new file mode 100644
index 0000000..999f24b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.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.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+public class MultiPoint extends ComposedGeospatial<Point> {
+
+ private static final long serialVersionUID = 4951011255142116129L;
+
+ public MultiPoint(final Dimension dimension, final String crs, final List<Point> points) {
+ super(dimension, Type.MULTIPOINT, crs, points);
+ }
+
+ @Override
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyMultiPoint
+ : EdmPrimitiveTypeKind.GeometryMultiPoint;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
new file mode 100644
index 0000000..fd0fdae
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/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.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+public class MultiPolygon extends ComposedGeospatial<Polygon> {
+
+ private static final long serialVersionUID = -160184788048512883L;
+
+ public MultiPolygon(final Dimension dimension, final String crs, final List<Polygon> polygons) {
+ super(dimension, Type.MULTIPOLYGON, crs, polygons);
+ }
+
+ @Override
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyMultiPolygon
+ : EdmPrimitiveTypeKind.GeometryMultiPolygon;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java
new file mode 100644
index 0000000..a9e0c39
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/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.commons.api.edm.geo;
+
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+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, final String crs) {
+ super(dimension, Type.POINT, crs);
+ }
+
+ 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 EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyPoint
+ : EdmPrimitiveTypeKind.GeometryPoint;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java
new file mode 100644
index 0000000..2501d4e
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.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.commons.api.edm.geo;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+/**
+ * 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 crs crs.
+ * @param interior interior points.
+ * @param exterior exterior points.
+ */
+ public Polygon(final Dimension dimension, final String crs, final List<Point> interior, final List<Point> exterior) {
+ super(dimension, Type.POLYGON, crs);
+ this.interior = new MultiPoint(dimension, crs, interior);
+ this.exterior = new MultiPoint(dimension, crs, 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 EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
+ return dimension == Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyPolygon
+ : EdmPrimitiveTypeKind.GeometryPolygon;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
index b1d551b..09bd8ce 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
@@ -23,9 +23,10 @@ import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmMapping;
import org.apache.olingo.commons.api.edm.EdmParameter;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
public abstract class AbstractEdmParameter extends EdmElementImpl implements EdmParameter {
@@ -43,7 +44,7 @@ public abstract class AbstractEdmParameter extends EdmElementImpl implements Edm
if (typeImpl == null) {
if (EdmPrimitiveType.EDM_NAMESPACE.equals(paramType.getNamespace())) {
try {
- typeImpl = EdmPrimitiveTypeKind.valueOf(paramType.getName()).getEdmPrimitiveTypeInstance();
+ typeImpl = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.valueOf(paramType.getName()));
} catch (IllegalArgumentException e) {
throw new EdmException("Cannot find type with name: " + paramType, e);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java
index 11e0365..c54239f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java
@@ -21,10 +21,11 @@ package org.apache.olingo.commons.core.edm;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
public abstract class AbstractEdmProperty extends EdmElementImpl implements EdmProperty {
@@ -47,7 +48,7 @@ public abstract class AbstractEdmProperty extends EdmElementImpl implements EdmP
final FullQualifiedName typeName = getTypeFQN();
if (isPrimitive()) {
try {
- propertyType = EdmPrimitiveTypeKind.valueOf(typeName.getName()).getEdmPrimitiveTypeInstance();
+ propertyType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.valueOf(typeName.getName()));
} catch (IllegalArgumentException e) {
throw new EdmException("Cannot find type with name: " + typeName, e);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java
index a6a6a84..532f666 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java
@@ -21,10 +21,11 @@ package org.apache.olingo.commons.core.edm;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmReturnType;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
public abstract class AbstractEdmReturnType implements EdmReturnType {
@@ -44,7 +45,7 @@ public abstract class AbstractEdmReturnType implements EdmReturnType {
if (typeImpl == null) {
if (EdmPrimitiveType.EDM_NAMESPACE.equals(typeName.getNamespace())) {
try {
- typeImpl = EdmPrimitiveTypeKind.valueOf(typeName.getName()).getEdmPrimitiveTypeInstance();
+ typeImpl = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.valueOf(typeName.getName()));
} catch (IllegalArgumentException e) {
throw new EdmException("Cannot find type with name: " + typeName, e);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java
new file mode 100644
index 0000000..8e5cb6f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.EdmGeospatialType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+
+public abstract class AbstractEdmGeospatialType<T extends Geospatial> implements EdmGeospatialType {
+
+ private final Class<T> reference;
+
+ protected final Dimension dimension;
+
+ protected final Type type;
+
+ protected AbstractEdmGeospatialType(final Class<T> reference, final Dimension dimension, final Type type) {
+ this.reference = reference;
+ this.dimension = dimension;
+ this.type = type;
+ }
+
+ @Override
+ public Class<? extends Geospatial> getJavaType() {
+ return reference;
+ }
+
+ @Override
+ public String getNamespace() {
+ return EDM_NAMESPACE;
+ }
+
+ @Override
+ public String getName() {
+ return getClass().getSimpleName().substring(3);
+ }
+
+ @Override
+ public EdmTypeKind getKind() {
+ return EdmTypeKind.PRIMITIVE;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return this == obj || obj != null && getClass() == obj.getClass();
+ }
+
+ @Override
+ public int hashCode() {
+ return getClass().hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return new FullQualifiedName(getNamespace(), getName()).getFullQualifiedNameAsString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java
index 5f141c0..9aa660e 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java
@@ -64,10 +64,11 @@ public final class EdmDate extends SingletonPrimitiveType {
try {
return EdmDateTimeOffset.convertDateTime(dateTimeValue, returnType);
} catch (final IllegalArgumentException e) {
- throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value), e");
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
} catch (final ClassCastException e) {
throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType), e");
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)", e);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
new file mode 100644
index 0000000..e061388
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+
+/**
+ * Implementation of the EDM primitive type DateTime.
+ */
+public final class EdmDateTime extends SingletonPrimitiveType {
+
+ public static final ThreadLocal<SimpleDateFormat> DATE_FORMAT = new ThreadLocal<SimpleDateFormat>() {
+ @Override
+ protected SimpleDateFormat initialValue() {
+ return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+ }
+ };
+
+ private static final EdmDateTime INSTANCE = new EdmDateTime();
+
+ public static EdmDateTime getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public Class<?> getDefaultType() {
+ return Calendar.class;
+ }
+
+ @Override
+ protected <T> T internalValueOfString(final String value,
+ final Boolean isNullable, final Integer maxLength, final Integer precision,
+ final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ Calendar calendar = null;
+ Timestamp timestamp = null;
+
+ final String[] dateParts = value.split("\\.");
+ try {
+ final Date date = DATE_FORMAT.get().parse(dateParts[0]);
+ if (dateParts.length > 1) {
+ int idx = dateParts[1].indexOf('+');
+ if (idx == -1) {
+ idx = dateParts[1].indexOf('-');
+ }
+ if (idx == -1) {
+ calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ calendar.setTime(date);
+
+ timestamp = new Timestamp(calendar.getTimeInMillis());
+ timestamp.setNanos(Integer.parseInt(dateParts[1]));
+ } else {
+ calendar = Calendar.getInstance(TimeZone.getTimeZone(dateParts[1].substring(idx)));
+ calendar.setTime(date);
+
+ timestamp = new Timestamp(calendar.getTimeInMillis());
+ timestamp.setNanos(Integer.parseInt(dateParts[1].substring(0, idx)));
+ }
+ } else {
+ timestamp = new Timestamp(date.getTime());
+ }
+ } catch (Exception e) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
+ }
+
+ if (returnType.isAssignableFrom(Calendar.class)) {
+ return returnType.cast(calendar);
+ } else if (returnType.isAssignableFrom(Timestamp.class)) {
+ return returnType.cast(timestamp);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.LITERAL_UNCONVERTIBLE_TO_VALUE_TYPE.addContent(value, returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value,
+ final Boolean isNullable, final Integer maxLength, final Integer precision,
+ final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof Calendar) {
+ final Calendar calendar = (Calendar) value;
+
+ final StringBuilder formatted = new StringBuilder().append(DATE_FORMAT.get().format(calendar.getTime()));
+ formatted.append(calendar.getTimeZone());
+
+ return formatted.toString();
+ } else if (value instanceof Timestamp) {
+ final Timestamp timestamp = (Timestamp) value;
+
+ final StringBuilder formatted = new StringBuilder().append(DATE_FORMAT.get().format(timestamp));
+ if (timestamp.getNanos() > 0) {
+ formatted.append('.').append(String.valueOf(timestamp.getNanos()));
+ }
+
+ return formatted.toString();
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java
new file mode 100644
index 0000000..f5951cb
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+
+public final class EdmGeography extends AbstractEdmGeospatialType<Geospatial> {
+
+ private static final EdmGeography INSTANCE = new EdmGeography();
+
+ public static EdmGeography getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeography() {
+ super(Geospatial.class, Dimension.GEOGRAPHY, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java
new file mode 100644
index 0000000..aab7210
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyCollection extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeographyCollection INSTANCE = new EdmGeographyCollection();
+
+ public static EdmGeographyCollection getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyCollection() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.GEOSPATIALCOLLECTION);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java
new file mode 100644
index 0000000..23c92cc
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyLineString extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeographyLineString INSTANCE = new EdmGeographyLineString();
+
+ public static EdmGeographyLineString getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyLineString() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.LINESTRING);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java
new file mode 100644
index 0000000..9b5901d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyMultiLineString extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeographyMultiLineString INSTANCE = new EdmGeographyMultiLineString();
+
+ public static EdmGeographyMultiLineString getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyMultiLineString() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.MULTILINESTRING);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
new file mode 100644
index 0000000..db66041
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyMultiPoint extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeographyMultiPoint INSTANCE = new EdmGeographyMultiPoint();
+
+ public static EdmGeographyMultiPoint getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyMultiPoint() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.MULTIPOINT);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java
new file mode 100644
index 0000000..4b53a30
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyMultiPolygon extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeographyMultiPolygon INSTANCE = new EdmGeographyMultiPolygon();
+
+ public static EdmGeographyMultiPolygon getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyMultiPolygon() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.MULTIPOLYGON);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java
new file mode 100644
index 0000000..61abce3
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyPoint extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeographyPoint INSTANCE = new EdmGeographyPoint();
+
+ public static EdmGeographyPoint getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyPoint() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.POINT);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java
new file mode 100644
index 0000000..a7a1a6c
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyPolygon extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeographyPolygon INSTANCE = new EdmGeographyPolygon();
+
+ public static EdmGeographyPolygon getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyPolygon() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.POLYGON);
+ }
+
+}
[36/52] [abbrv] [OLINGO-200] Moving Atom and JSON (de)serializer to
commons
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java
deleted file mode 100644
index 348015e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java
+++ /dev/null
@@ -1,120 +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.client.core.data;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-
-/**
- * Writes out JSON string from an entry.
- */
-public class JSONEntrySerializer extends AbstractJsonSerializer<JSONEntryImpl> {
-
- @Override
- protected void doSerialize(final JSONEntryImpl entry, final JsonGenerator jgen, final SerializerProvider provider)
- throws IOException, JsonProcessingException {
-
- jgen.writeStartObject();
-
- if (entry.getMetadata() != null) {
- jgen.writeStringField(Constants.JSON_METADATA, entry.getMetadata().toASCIIString());
- }
- if (entry.getId() != null) {
- jgen.writeStringField(Constants.JSON_ID, entry.getId());
- }
-
- final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
-
- for (Link link : entry.getNavigationLinks()) {
- ODataLinkType type = null;
- try {
- type = ODataLinkType.fromString(client.getServiceVersion(), link.getRel(), link.getType());
- } catch (IllegalArgumentException e) {
- // ignore
- }
-
- if (type == ODataLinkType.ENTITY_SET_NAVIGATION) {
- final List<String> uris;
- if (entitySetLinks.containsKey(link.getTitle())) {
- uris = entitySetLinks.get(link.getTitle());
- } else {
- uris = new ArrayList<String>();
- entitySetLinks.put(link.getTitle(), uris);
- }
- uris.add(link.getHref());
- } else {
- if (StringUtils.isNotBlank(link.getHref())) {
- jgen.writeStringField(link.getTitle() + Constants.JSON_BIND_LINK_SUFFIX, link.getHref());
- }
- }
-
- if (link.getInlineEntry() != null) {
- jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
- } else if (link.getInlineFeed() != null) {
- jgen.writeArrayFieldStart(link.getTitle());
- for (Entry subEntry : link.getInlineFeed().getEntries()) {
- jgen.writeObject(subEntry);
- }
- jgen.writeEndArray();
- }
- }
- for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) {
- jgen.writeArrayFieldStart(entitySetLink.getKey() + Constants.JSON_BIND_LINK_SUFFIX);
- for (String uri : entitySetLink.getValue()) {
- jgen.writeString(uri);
- }
- jgen.writeEndArray();
- }
-
- for (Link link : entry.getMediaEditLinks()) {
- if (link.getTitle() == null) {
- jgen.writeStringField(Constants.JSON_MEDIAEDIT_LINK, link.getHref());
- }
-
- if (link.getInlineEntry() != null) {
- jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
- }
- if (link.getInlineFeed() != null) {
- jgen.writeArrayFieldStart(link.getTitle());
- for (Entry subEntry : link.getInlineFeed().getEntries()) {
- jgen.writeObject(subEntry);
- }
- jgen.writeEndArray();
- }
- }
-
- for (Property property : entry.getProperties()) {
- property(jgen, property, property.getName());
- }
-
- jgen.writeEndObject();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorBundle.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorBundle.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorBundle.java
deleted file mode 100644
index a73fb05..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorBundle.java
+++ /dev/null
@@ -1,50 +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.client.core.data;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * This class represents a bundle for an OData error returned as JSON.
- */
-public class JSONErrorBundle extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -4784910226259754450L;
-
- @JsonProperty("odata.error")
- private JSONErrorImpl error;
-
- /**
- * Gets error.
- *
- * @return OData error object.
- */
- public JSONErrorImpl getError() {
- return error;
- }
-
- /**
- * Sets error.
- *
- * @param error OData error object.
- */
- public void setError(final JSONErrorImpl error) {
- this.error = error;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java
deleted file mode 100644
index 5305695..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java
+++ /dev/null
@@ -1,237 +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.client.core.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.olingo.commons.api.domain.ODataError;
-
-/**
- * This class represents an OData error returned as JSON.
- */
-public class JSONErrorImpl extends AbstractPayloadObject implements ODataError {
-
- private static final long serialVersionUID = -3476499168507242932L;
-
- /**
- * Error message.
- */
- public static class Message extends AbstractPayloadObject {
-
- private static final long serialVersionUID = 2577818040815637859L;
-
- private String lang;
-
- private String value;
-
- /**
- * Gets language.
- *
- * @return language.
- */
- public String getLang() {
- return lang;
- }
-
- /**
- * Sets language.
- *
- * @param lang language.
- */
- public void setLang(final String lang) {
- this.lang = lang;
- }
-
- /**
- * Gets message.
- *
- * @return message.
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets message.
- *
- * @param value message.
- */
- public void setValue(final String value) {
- this.value = value;
- }
- }
-
- /**
- * Inner error.
- */
- static class InnerError extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -3920947476143537640L;
-
- private String message;
-
- private String type;
-
- private String stacktrace;
-
- private InnerError internalexception;
-
- /**
- * Gets inner message.
- *
- * @return message.
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Sets inner message.
- *
- * @param message message.
- */
- public void setMessage(final String message) {
- this.message = message;
- }
-
- /**
- * Gets type.
- *
- * @return type.
- */
- public String getType() {
- return type;
- }
-
- /**
- * Sets type.
- *
- * @param type type.
- */
- public void setType(final String type) {
- this.type = type;
- }
-
- /**
- * Gets stack-trace.
- *
- * @return stack-trace.
- */
- public String getStacktrace() {
- return stacktrace;
- }
-
- /**
- * Sets stack-trace.
- *
- * @param stacktrace stack-trace.
- */
- public void setStacktrace(final String stacktrace) {
- this.stacktrace = stacktrace;
- }
-
- public InnerError getInternalexception() {
- return internalexception;
- }
-
- public void setInternalexception(final InnerError internalexception) {
- this.internalexception = internalexception;
- }
- }
-
- private String code;
-
- @JsonProperty(value = "message")
- private Message message;
-
- @JsonProperty(value = "innererror", required = false)
- private InnerError innererror;
-
- /**
- * {@inheritDoc }
- */
- @Override
- public String getCode() {
- return code;
- }
-
- /**
- * Sets error code.
- *
- * @param code error code.
- */
- public void setCode(final String code) {
- this.code = code;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getMessageLang() {
- return this.message == null ? null : this.message.getLang();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getMessageValue() {
- return this.message == null ? null : this.message.getValue();
- }
-
- /**
- * Sets the value of the message property.
- *
- * @param value allowed object is {@link Error.Message }
- *
- */
- public void setMessage(final Message value) {
- this.message = value;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorMessage() {
- return this.innererror == null ? null : this.innererror.getMessage();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorType() {
- return this.innererror == null ? null : this.innererror.getType();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorStacktrace() {
- return this.innererror == null ? null : this.innererror.getStacktrace();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedDeserializer.java
deleted file mode 100644
index 3667fea..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedDeserializer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Iterator;
-import org.apache.olingo.client.api.Constants;
-
-/**
- * Reads JSON string into a feed.
- * <br/>
- * If metadata information is available, the corresponding entry fields and content will be populated.
- */
-public class JSONFeedDeserializer extends AbstractJsonDeserializer<JSONFeedImpl> {
-
- @Override
- protected JSONFeedImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
-
- if (!tree.has(Constants.JSON_VALUE)) {
- return null;
- }
-
- final JSONFeedImpl feed = new JSONFeedImpl();
-
- if (tree.hasNonNull(Constants.JSON_METADATA)) {
- feed.setMetadata(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
- }
- if (tree.hasNonNull(Constants.JSON_COUNT)) {
- feed.setCount(tree.get(Constants.JSON_COUNT).asInt());
- }
- if (tree.hasNonNull(Constants.JSON_NEXT_LINK)) {
- feed.setNext(URI.create(tree.get(Constants.JSON_NEXT_LINK).textValue()));
- }
-
- if (tree.hasNonNull(Constants.JSON_VALUE)) {
- for (final Iterator<JsonNode> itor = tree.get(Constants.JSON_VALUE).iterator(); itor.hasNext();) {
- feed.getEntries().add(itor.next().traverse(parser.getCodec()).readValueAs(JSONEntryImpl.class));
- }
- }
-
- return feed;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedImpl.java
deleted file mode 100644
index 271ef3d..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedImpl.java
+++ /dev/null
@@ -1,113 +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.client.core.data;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.uri.SegmentType;
-
-/**
- * List of entries, represented via JSON.
- *
- * @see JSONEntry
- */
-@JsonDeserialize(using = JSONFeedDeserializer.class)
-@JsonSerialize(using = JSONFeedSerializer.class)
-public class JSONFeedImpl extends AbstractPayloadObject implements Feed {
-
- private static final long serialVersionUID = -3576372289800799417L;
-
- private String id;
-
- private URI metadata;
-
- private Integer count;
-
- private final List<Entry> entries = new ArrayList<Entry>();
-
- private String next;
-
- @Override
- public URI getBaseURI() {
- URI baseURI = null;
- if (metadata != null) {
- final String metadataURI = getMetadata().toASCIIString();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(SegmentType.METADATA.getValue())));
- }
-
- return baseURI;
- }
-
- /**
- * Gets the metadata URI.
- *
- * @return the metadata URI
- */
- public URI getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the metadata URI.
- *
- * @param metadata metadata URI.
- */
- public void setMetadata(final URI metadata) {
- this.metadata = metadata;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-
- @Override
- public Integer getCount() {
- return count;
- }
-
- @Override
- public void setCount(final Integer count) {
- this.count = count;
- }
-
- @Override
- public List<Entry> getEntries() {
- return entries;
- }
-
- @Override
- public void setNext(final URI next) {
- this.next = next.toASCIIString();
- }
-
- @Override
- public URI getNext() {
- return next == null ? null : URI.create(next);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedSerializer.java
deleted file mode 100644
index f89303e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedSerializer.java
+++ /dev/null
@@ -1,57 +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.client.core.data;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import java.io.IOException;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.Entry;
-
-public class JSONFeedSerializer extends AbstractJsonSerializer<JSONFeedImpl> {
-
- @Override
- protected void doSerialize(final JSONFeedImpl feed, final JsonGenerator jgen, final SerializerProvider provider)
- throws IOException, JsonProcessingException {
-
- jgen.writeStartObject();
-
- if (feed.getMetadata() != null) {
- jgen.writeStringField(Constants.JSON_METADATA, feed.getMetadata().toASCIIString());
- }
- if (feed.getId() != null) {
- jgen.writeStringField(Constants.JSON_ID, feed.getId());
- }
- if (feed.getCount() != null) {
- jgen.writeNumberField(Constants.JSON_COUNT, feed.getCount());
- }
- if (feed.getNext() != null) {
- jgen.writeStringField(Constants.JSON_NEXT_LINK, feed.getNext().toASCIIString());
- }
-
- jgen.writeArrayFieldStart(Constants.JSON_VALUE);
- for (Entry entry : feed.getEntries()) {
- jgen.writeObject(entry);
- }
-
- jgen.writeEndArray();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
deleted file mode 100644
index c58ff66..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
+++ /dev/null
@@ -1,274 +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.client.core.data;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.GeoUtils;
-import org.apache.olingo.client.core.edm.EdmTypeInfo;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-import org.apache.olingo.commons.api.edm.geo.LineString;
-import org.apache.olingo.commons.api.edm.geo.MultiLineString;
-import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
-import org.apache.olingo.commons.api.edm.geo.Point;
-import org.apache.olingo.commons.api.edm.geo.Polygon;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
-
-class JSONGeoValueDeserializer {
-
- private final ODataServiceVersion version;
-
- public JSONGeoValueDeserializer(final ODataServiceVersion version) {
- this.version = version;
- }
-
- private Point point(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final String crs) {
- Point point = null;
-
- if (itor.hasNext()) {
- point = new Point(GeoUtils.getDimension(type), crs);
- try {
- point.setX(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
- point.setY(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException("While deserializing point coordinates as double", e);
- }
- }
-
- return point;
- }
-
- private MultiPoint multipoint(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- MultiPoint multiPoint = null;
-
- if (itor.hasNext()) {
- final List<Point> points = new ArrayList<Point>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mpItor = itor.next().elements();
- points.add(point(mpItor, type, crs));
- }
- multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, points);
- } else {
- multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, Collections.<Point>emptyList());
- }
-
- return multiPoint;
- }
-
- private LineString lineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- LineString lineString = null;
-
- if (itor.hasNext()) {
- final List<Point> points = new ArrayList<Point>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mpItor = itor.next().elements();
- points.add(point(mpItor, type, crs));
- }
- lineString = new LineString(GeoUtils.getDimension(type), crs, points);
- } else {
- lineString = new LineString(GeoUtils.getDimension(type), crs, Collections.<Point>emptyList());
- }
-
- return lineString;
- }
-
- private MultiLineString multiLineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- MultiLineString multiLineString = null;
-
- if (itor.hasNext()) {
- final List<LineString> lineStrings = new ArrayList<LineString>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mlsItor = itor.next().elements();
- lineStrings.add(lineString(mlsItor, type, crs));
- }
- multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, lineStrings);
- } else {
- multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, Collections.<LineString>emptyList());
- }
-
- return multiLineString;
- }
-
- private Polygon polygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- List<Point> extPoints = null;
- if (itor.hasNext()) {
- final Iterator<JsonNode> extItor = itor.next().elements();
- if (extItor.hasNext()) {
- extPoints = new ArrayList<Point>();
- while (extItor.hasNext()) {
- final Iterator<JsonNode> mpItor = extItor.next().elements();
- extPoints.add(point(mpItor, type, crs));
- }
- }
- }
-
- List<Point> intPoints = null;
- if (itor.hasNext()) {
- final Iterator<JsonNode> intItor = itor.next().elements();
- if (intItor.hasNext()) {
- intPoints = new ArrayList<Point>();
- while (intItor.hasNext()) {
- final Iterator<JsonNode> mpItor = intItor.next().elements();
- intPoints.add(point(mpItor, type, crs));
- }
- }
- }
-
- return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints);
- }
-
- private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- MultiPolygon multiPolygon = null;
-
- if (itor.hasNext()) {
- final List<Polygon> polygons = new ArrayList<Polygon>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mpItor = itor.next().elements();
- polygons.add(polygon(mpItor, type, crs));
- }
- multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, polygons);
- } else {
- multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, Collections.<Polygon>emptyList());
- }
-
- return multiPolygon;
- }
-
- private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- GeospatialCollection collection = null;
-
- if (itor.hasNext()) {
- final List<Geospatial> geospatials = new ArrayList<Geospatial>();
-
- while (itor.hasNext()) {
- final JsonNode geo = itor.next();
- final String collItemType = geo.get(Constants.ATTR_TYPE).asText();
- final String callAsType;
- if (EdmPrimitiveTypeKind.GeographyCollection.name().equals(collItemType)
- || EdmPrimitiveTypeKind.GeometryCollection.name().equals(collItemType)) {
-
- callAsType = collItemType;
- } else {
- callAsType = (type == EdmPrimitiveTypeKind.GeographyCollection ? "Geography" : "Geometry")
- + collItemType;
- }
-
- geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build()));
- }
-
- collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials);
- } else {
- collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, Collections.<Geospatial>emptyList());
- }
-
- return collection;
- }
-
- public Geospatial deserialize(final JsonNode node, final EdmTypeInfo typeInfo) {
- final EdmPrimitiveTypeKind actualType;
- if ((typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geography
- || typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geometry)
- && node.has(Constants.ATTR_TYPE)) {
-
- String nodeType = node.get(Constants.ATTR_TYPE).asText();
- if (nodeType.startsWith("Geo")) {
- final int yIdx = nodeType.indexOf('y');
- nodeType = nodeType.substring(yIdx + 1);
- }
- actualType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getFullQualifiedName().toString() + nodeType);
- } else {
- actualType = typeInfo.getPrimitiveTypeKind();
- }
-
- final Iterator<JsonNode> cooItor = node.has(Constants.JSON_COORDINATES)
- ? node.get(Constants.JSON_COORDINATES).elements()
- : Collections.<JsonNode>emptyList().iterator();
-
- String crs = null;
- if (node.has(Constants.JSON_CRS)) {
- crs = node.get(Constants.JSON_CRS).get(Constants.PROPERTIES).get(Constants.JSON_NAME).asText().split(":")[1];
- }
-
- Geospatial value = null;
- switch (actualType) {
- case GeographyPoint:
- case GeometryPoint:
- value = point(cooItor, actualType, crs);
- break;
-
- case GeographyMultiPoint:
- case GeometryMultiPoint:
- value = multipoint(cooItor, actualType, crs);
- break;
-
- case GeographyLineString:
- case GeometryLineString:
- value = lineString(cooItor, actualType, crs);
- break;
-
- case GeographyMultiLineString:
- case GeometryMultiLineString:
- value = multiLineString(cooItor, actualType, crs);
- break;
-
- case GeographyPolygon:
- case GeometryPolygon:
- value = polygon(cooItor, actualType, crs);
- break;
-
- case GeographyMultiPolygon:
- case GeometryMultiPolygon:
- value = multiPolygon(cooItor, actualType, crs);
- break;
-
- case GeographyCollection:
- case GeometryCollection:
- value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, crs);
- break;
-
- default:
- }
-
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
deleted file mode 100644
index 4794b01..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
+++ /dev/null
@@ -1,183 +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.client.core.data;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import java.io.IOException;
-import java.util.Iterator;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.ComposedGeospatial;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-import org.apache.olingo.commons.api.edm.geo.LineString;
-import org.apache.olingo.commons.api.edm.geo.MultiLineString;
-import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
-import org.apache.olingo.commons.api.edm.geo.Point;
-import org.apache.olingo.commons.api.edm.geo.Polygon;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
-
-class JSONGeoValueSerializer {
-
- private void crs(final JsonGenerator jgen, final String crs) throws IOException {
- jgen.writeObjectFieldStart(Constants.JSON_CRS);
- jgen.writeStringField(Constants.ATTR_TYPE, Constants.JSON_NAME);
- jgen.writeObjectFieldStart(Constants.PROPERTIES);
- jgen.writeStringField(Constants.JSON_NAME, "EPSG:" + crs);
- jgen.writeEndObject();
- jgen.writeEndObject();
- }
-
- private void point(final JsonGenerator jgen, final Point point) throws IOException {
- try {
- jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getX(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
- jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getY(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException("While serializing point coordinates as double", e);
- }
- }
-
- private void multipoint(final JsonGenerator jgen, final MultiPoint multiPoint) throws IOException {
- for (final Iterator<Point> itor = multiPoint.iterator(); itor.hasNext();) {
- jgen.writeStartArray();
- point(jgen, itor.next());
- jgen.writeEndArray();
- }
- }
-
- private void lineString(final JsonGenerator jgen, final ComposedGeospatial<Point> lineString) throws IOException {
- for (final Iterator<Point> itor = lineString.iterator(); itor.hasNext();) {
- jgen.writeStartArray();
- point(jgen, itor.next());
- jgen.writeEndArray();
- }
- }
-
- private void multiLineString(final JsonGenerator jgen, final MultiLineString multiLineString) throws IOException {
- for (final Iterator<LineString> itor = multiLineString.iterator(); itor.hasNext();) {
- jgen.writeStartArray();
- lineString(jgen, itor.next());
- jgen.writeEndArray();
- }
- }
-
- private void polygon(final JsonGenerator jgen, final Polygon polygon) throws IOException {
- if (!polygon.getExterior().isEmpty()) {
- jgen.writeStartArray();
- lineString(jgen, polygon.getExterior());
- jgen.writeEndArray();
- }
- if (!polygon.getInterior().isEmpty()) {
- jgen.writeStartArray();
- lineString(jgen, polygon.getInterior());
- jgen.writeEndArray();
- }
- }
-
- private void multiPolygon(final JsonGenerator jgen, final MultiPolygon multiPolygon) throws IOException {
- for (final Iterator<Polygon> itor = multiPolygon.iterator(); itor.hasNext();) {
- final Polygon polygon = itor.next();
- jgen.writeStartArray();
- polygon(jgen, polygon);
- jgen.writeEndArray();
- }
- }
-
- private void collection(final JsonGenerator jgen, final GeospatialCollection collection) throws IOException {
- jgen.writeArrayFieldStart(Constants.JSON_GEOMETRIES);
- for (final Iterator<Geospatial> itor = collection.iterator(); itor.hasNext();) {
- jgen.writeStartObject();
- serialize(jgen, itor.next());
- jgen.writeEndObject();
- }
- jgen.writeEndArray();
- }
-
- public void serialize(final JsonGenerator jgen, final Geospatial value) throws IOException {
- if (value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeographyCollection)
- || value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) {
-
- jgen.writeStringField(Constants.ATTR_TYPE, EdmPrimitiveTypeKind.GeometryCollection.name());
- } else {
- final int yIdx = value.getEdmPrimitiveTypeKind().name().indexOf('y');
- final String itemType = value.getEdmPrimitiveTypeKind().name().substring(yIdx + 1);
- jgen.writeStringField(Constants.ATTR_TYPE, itemType);
- }
-
- switch (value.getEdmPrimitiveTypeKind()) {
- case GeographyPoint:
- case GeometryPoint:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- point(jgen, (Point) value);
- jgen.writeEndArray();
- break;
-
- case GeographyMultiPoint:
- case GeometryMultiPoint:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- multipoint(jgen, (MultiPoint) value);
- jgen.writeEndArray();
- break;
-
- case GeographyLineString:
- case GeometryLineString:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- lineString(jgen, (LineString) value);
- jgen.writeEndArray();
- break;
-
- case GeographyMultiLineString:
- case GeometryMultiLineString:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- multiLineString(jgen, (MultiLineString) value);
- jgen.writeEndArray();
- break;
-
- case GeographyPolygon:
- case GeometryPolygon:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- polygon(jgen, (Polygon) value);
- jgen.writeEndArray();
- break;
-
- case GeographyMultiPolygon:
- case GeometryMultiPolygon:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- multiPolygon(jgen, (MultiPolygon) value);
- jgen.writeEndArray();
- break;
-
- case GeographyCollection:
- case GeometryCollection:
- collection(jgen, (GeospatialCollection) value);
- break;
-
- default:
- }
-
- if (value.getCrs() != null) {
- crs(jgen, value.getCrs());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyDeserializer.java
deleted file mode 100644
index 172498a..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyDeserializer.java
+++ /dev/null
@@ -1,71 +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.client.core.data;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.io.IOException;
-import java.net.URI;
-import org.apache.olingo.client.api.Constants;
-
-/**
- * Parse JSON string into <tt>JSONPropertyImpl</tt>.
- *
- * @see JSONPropertyImpl
- */
-public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPropertyImpl> {
-
- @Override
- protected JSONPropertyImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
-
- final JSONPropertyImpl property = new JSONPropertyImpl();
-
- if (tree.hasNonNull(Constants.JSON_METADATA)) {
- property.setMetadata(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
- tree.remove(Constants.JSON_METADATA);
- }
-
- if (property.getMetadata() != null) {
- final String metadataURI = property.getMetadata().toASCIIString();
- final int dashIdx = metadataURI.lastIndexOf('#');
- if (dashIdx != -1) {
- property.setType(metadataURI.substring(dashIdx + 1));
- }
- }
-
- if (tree.has(Constants.JSON_TYPE) && property.getType() == null) {
- property.setType(tree.get(Constants.JSON_TYPE).asText());
- }
-
- if (tree.has(Constants.JSON_NULL) && tree.get(Constants.JSON_NULL).asBoolean()) {
- property.setValue(new NullValueImpl());
- }
-
- if (property.getValue() == null) {
- value(property, tree.has(Constants.JSON_VALUE) ? tree.get(Constants.JSON_VALUE) : tree);
- }
-
- return property;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyImpl.java
deleted file mode 100644
index 1002d3b..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyImpl.java
+++ /dev/null
@@ -1,53 +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.client.core.data;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import java.net.URI;
-
-/**
- * A single property (primitive, complex or collection) represented via JSON.
- */
-@JsonSerialize(using = JSONPropertySerializer.class)
-@JsonDeserialize(using = JSONPropertyDeserializer.class)
-public class JSONPropertyImpl extends AbstractPropertyImpl {
-
- private static final long serialVersionUID = 553414431536637434L;
-
- private URI metadata;
-
- /**
- * Gets metadata URI.
- *
- * @return metadata URI.
- */
- public URI getMetadata() {
- return metadata;
- }
-
- /**
- * Sets metadata URI.
- *
- * @param metadata metadata URI.
- */
- public void setMetadata(final URI metadata) {
- this.metadata = metadata;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertySerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertySerializer.java
deleted file mode 100644
index 21e017b..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertySerializer.java
+++ /dev/null
@@ -1,59 +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.client.core.data;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import java.io.IOException;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.Property;
-
-/**
- * Writes out JSON string from <tt>JSONPropertyImpl</tt>.
- *
- * @see JSONPropertyImpl
- */
-public class JSONPropertySerializer extends AbstractJsonSerializer<JSONPropertyImpl> {
-
- @Override
- protected void doSerialize(final JSONPropertyImpl property, final JsonGenerator jgen,
- final SerializerProvider provider) throws IOException, JsonProcessingException {
-
- jgen.writeStartObject();
-
- if (property.getMetadata() != null) {
- jgen.writeStringField(Constants.JSON_METADATA, property.getMetadata().toASCIIString());
- }
-
- if (property.getValue().isNull()) {
- jgen.writeBooleanField(Constants.JSON_NULL, true);
- } else if (property.getValue().isSimple()) {
- jgen.writeStringField(Constants.JSON_VALUE, property.getValue().asSimple().get());
- } else if (property.getValue().isGeospatial() || property.getValue().isCollection()) {
- property(jgen, property, Constants.JSON_VALUE);
- } else if (property.getValue().isComplex()) {
- for (Property cproperty : property.getValue().asComplex().get()) {
- property(jgen, cproperty, cproperty.getName());
- }
- }
-
- jgen.writeEndObject();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
index 4a6ebc0..143aed8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
@@ -28,8 +28,9 @@ import java.io.IOException;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.data.ODataJacksonDeserializer;
public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<AbstractServiceDocument> {
@@ -39,7 +40,7 @@ public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<Ab
final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
- final AbstractServiceDocument serviceDocument = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractServiceDocument serviceDocument = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl()
: new org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/LinkImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/LinkImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/LinkImpl.java
deleted file mode 100644
index 2bba504..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/LinkImpl.java
+++ /dev/null
@@ -1,112 +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.client.core.data;
-
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Link;
-
-public class LinkImpl extends AbstractPayloadObject implements Link {
-
- private static final long serialVersionUID = -3449344217160035501L;
-
- private String title;
-
- private String rel;
-
- private String href;
-
- private String type;
-
- private String mediaETag;
-
- private Entry entry;
-
- private Feed feed;
-
- @Override
- public String getTitle() {
- return title;
- }
-
- @Override
- public void setTitle(final String title) {
- this.title = title;
- }
-
- @Override
- public String getRel() {
- return rel;
- }
-
- @Override
- public void setRel(final String rel) {
- this.rel = rel;
- }
-
- @Override
- public String getHref() {
- return href;
- }
-
- @Override
- public void setHref(final String href) {
- this.href = href;
- }
-
- @Override
- public String getType() {
- return type;
- }
-
- @Override
- public void setType(final String type) {
- this.type = type;
- }
-
- @Override
- public String getMediaETag() {
- return mediaETag;
- }
-
- @Override
- public void setMediaETag(final String mediaETag) {
- this.mediaETag = mediaETag;
- }
-
- @Override
- public Entry getInlineEntry() {
- return entry;
- }
-
- @Override
- public void setInlineEntry(final Entry entry) {
- this.entry = entry;
- }
-
- @Override
- public Feed getInlineFeed() {
- return feed;
- }
-
- @Override
- public void setInlineFeed(final Feed feed) {
- this.feed = feed;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/NullValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/NullValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/NullValueImpl.java
deleted file mode 100644
index 83e6785..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/NullValueImpl.java
+++ /dev/null
@@ -1,35 +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.client.core.data;
-
-import org.apache.olingo.client.api.data.NullValue;
-
-public class NullValueImpl extends AbstractValue implements NullValue {
-
- @Override
- public boolean isNull() {
- return true;
- }
-
- @Override
- public Void get() {
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
deleted file mode 100644
index 49c85fb..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-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 java.io.IOException;
-
-import org.apache.olingo.client.api.CommonODataClient;
-
-abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
-
- protected CommonODataClient client;
-
- 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 = (CommonODataClient) ctxt.findInjectableValue(CommonODataClient.class.getName(), null, null);
- return doDeserialize(jp, ctxt);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
deleted file mode 100644
index 4638c18..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-
-import java.io.IOException;
-
-import org.apache.olingo.client.api.CommonODataClient;
-
-abstract class ODataJacksonSerializer<T> extends JsonSerializer<T> {
-
- protected CommonODataClient client;
-
- protected abstract void doSerialize(T value, JsonGenerator jgen, SerializerProvider provider)
- throws IOException, JsonProcessingException;
-
- @Override
- public void serialize(final T value, final JsonGenerator jgen, final SerializerProvider provider)
- throws IOException, JsonProcessingException {
-
- client = (CommonODataClient) provider.getAttribute(CommonODataClient.class);
- doSerialize(value, jgen, provider);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/PrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/PrimitiveValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/PrimitiveValueImpl.java
deleted file mode 100644
index 6d61cf4..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/PrimitiveValueImpl.java
+++ /dev/null
@@ -1,41 +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.client.core.data;
-
-import org.apache.olingo.client.api.data.PrimitiveValue;
-
-public class PrimitiveValueImpl extends AbstractValue implements PrimitiveValue {
-
- private final String value;
-
- public PrimitiveValueImpl(final String value) {
- this.value = value;
- }
-
- @Override
- public boolean isSimple() {
- return true;
- }
-
- @Override
- public String get() {
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java
deleted file mode 100644
index 9e5b3c8..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java
+++ /dev/null
@@ -1,213 +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.client.core.data;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;
-import java.util.Map;
-import org.apache.olingo.commons.api.domain.ODataError;
-
-/**
- * This class represents an OData error returned as JSON.
- */
-public class XMLErrorImpl extends AbstractPayloadObject implements ODataError {
-
- private static final long serialVersionUID = -3476499168507242932L;
-
- @JacksonXmlText(false)
- private String code;
-
- @JsonProperty
- private Message message;
-
- @JsonProperty(required = false)
- private InnerError innererror;
-
- @Override
- public String getCode() {
- return code;
- }
-
- /**
- * Sets error code.
- *
- * @param code error code.
- */
- public void setCode(final String code) {
- this.code = code;
- }
-
- @JsonIgnore
- @Override
- public String getMessageLang() {
- return this.message == null ? null : this.message.getLang();
- }
-
- @JsonIgnore
- @Override
- public String getMessageValue() {
- return this.message == null ? null : this.message.getValue();
- }
-
- /**
- * Sets the value of the message property.
- *
- * @param value allowed object is {@link Error.Message }
- *
- */
- public void setMessage(final Message value) {
- this.message = value;
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorMessage() {
- return this.innererror == null ? null : this.innererror.getMessage().getValue();
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorType() {
- return this.innererror == null ? null : this.innererror.getType().getValue();
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorStacktrace() {
- return this.innererror == null ? null : this.innererror.getStacktrace().getValue();
- }
-
- static class TextChildContainer extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -8908394095210115904L;
-
- public TextChildContainer() {
- super();
- }
-
- public TextChildContainer(final String value) {
- super();
- this.value = value;
- }
-
- @JsonCreator
- public TextChildContainer(final Map<String, Object> props) {
- super();
- this.value = (String) props.get("");
- }
-
- private String value;
-
- public String getValue() {
- return value;
- }
-
- public void setValue(final String value) {
- this.value = value;
- }
- }
-
- /**
- * Error message.
- */
- public static class Message extends TextChildContainer {
-
- private static final long serialVersionUID = 2577818040815637859L;
-
- private String lang;
-
- public Message() {
- super();
- }
-
- @JsonCreator
- public Message(final Map<String, Object> props) {
- super(props);
- this.lang = (String) props.get("lang");
- }
-
- /**
- * Gets language.
- *
- * @return language.
- */
- public String getLang() {
- return lang;
- }
-
- /**
- * Sets language.
- *
- * @param lang language.
- */
- public void setLang(final String lang) {
- this.lang = lang;
- }
- }
-
- /**
- * Inner error.
- */
- static class InnerError extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -3920947476143537640L;
-
- private TextChildContainer message;
-
- private TextChildContainer type;
-
- private TextChildContainer stacktrace;
-
- private InnerError internalexception;
-
- public TextChildContainer getMessage() {
- return message;
- }
-
- public void setMessage(final TextChildContainer message) {
- this.message = message;
- }
-
- public TextChildContainer getType() {
- return type;
- }
-
- public void setType(final TextChildContainer type) {
- this.type = type;
- }
-
- public TextChildContainer getStacktrace() {
- return stacktrace;
- }
-
- public void setStacktrace(final TextChildContainer stacktrace) {
- this.stacktrace = stacktrace;
- }
-
- public InnerError getInternalexception() {
- return internalexception;
- }
-
- public void setInternalexception(final InnerError internalexception) {
- this.internalexception = internalexception;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
index da2017f..ef62f13 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.data;
+import org.apache.olingo.commons.core.data.ODataJacksonDeserializer;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
@@ -69,7 +70,7 @@ public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer<Ser
protected ServiceDocument doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractServiceDocument sdoc = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractServiceDocument sdoc = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.data.v3.XMLServiceDocumentImpl()
: new org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java
deleted file mode 100644
index 00b8361..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java
+++ /dev/null
@@ -1,118 +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.client.core.data.v3;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.client.api.data.v3.LinkCollection;
-import org.apache.olingo.client.core.data.AbstractPayloadObject;
-
-/**
- * Link from an entry, represented via JSON.
- */
-public class JSONLinkCollectionImpl extends AbstractPayloadObject implements LinkCollection {
-
- private static final long serialVersionUID = -5006368367235783907L;
-
- /**
- * JSON link URL representation.
- */
- static class JSONLinkURL extends AbstractPayloadObject {
-
- private static final long serialVersionUID = 5365055617973271468L;
-
- private URI url;
-
- public URI getUrl() {
- return url;
- }
-
- public void setUrl(final URI url) {
- this.url = url;
- }
- }
-
- @JsonProperty(value = "odata.metadata", required = false)
- private URI metadata;
-
- @JsonProperty(required = false)
- private URI url;
-
- @JsonProperty(value = "value", required = false)
- private final List<JSONLinkURL> links = new ArrayList<JSONLinkURL>();
-
- @JsonProperty(value = "odata.nextLink", required = false)
- private String next;
-
- /**
- * Gets the metadata URI.
- */
- public URI getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the metadata URI.
- *
- * @param metadata metadata URI.
- */
- public void setMetadata(final URI metadata) {
- this.metadata = metadata;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public List<URI> getLinks() {
- final List<URI> result = new ArrayList<URI>();
-
- if (this.url == null) {
- for (JSONLinkURL link : links) {
- result.add(link.getUrl());
- }
- } else {
- result.add(this.url);
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public void setNext(final URI next) {
- this.next = next == null ? null : next.toASCIIString();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public URI getNext() {
- return next == null ? null : URI.create(next);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
index 659e91c..ace5487 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
@@ -22,9 +22,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.net.URI;
-import org.apache.olingo.client.api.uri.SegmentType;
import org.apache.olingo.client.core.data.AbstractServiceDocument;
import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
+import org.apache.olingo.commons.api.Constants;
/**
* Service document, represented via JSON.
@@ -41,7 +41,7 @@ public class JSONServiceDocumentImpl extends AbstractServiceDocument {
URI baseURI = null;
if (metadata != null) {
final String metadataURI = getMetadata();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(SegmentType.METADATA.getValue())));
+ baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
}
return baseURI;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.java
deleted file mode 100644
index d5dc442..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.java
+++ /dev/null
@@ -1,70 +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.client.core.data.v3;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.client.api.data.v3.LinkCollection;
-
-public class XMLLinkCollectionImpl implements LinkCollection {
-
- private final List<URI> links = new ArrayList<URI>();
-
- private URI next;
-
- /**
- * Constructor.
- */
- public XMLLinkCollectionImpl() {
- }
-
- /**
- * Constructor.
- *
- * @param next next page link.
- */
- public XMLLinkCollectionImpl(final URI next) {
- this.next = next;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public List<URI> getLinks() {
- return links;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public void setNext(final URI next) {
- this.next = next;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public URI getNext() {
- return next;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
index 23ed64c..b5c352b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
@@ -19,12 +19,12 @@
package org.apache.olingo.client.core.data.v4;
import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.uri.SegmentType;
import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.net.URI;
+import org.apache.olingo.commons.api.Constants;
@JsonDeserialize(using = JSONServiceDocumentDeserializer.class)
public class JSONServiceDocumentImpl extends AbstractServiceDocument implements ServiceDocument {
@@ -34,7 +34,7 @@ public class JSONServiceDocumentImpl extends AbstractServiceDocument implements
URI baseURI = null;
if (getMetadataContext() != null) {
final String metadataURI = getMetadataContext();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(SegmentType.METADATA.getValue())));
+ baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
}
return baseURI;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
index aac8ee3..a15dd76 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
@@ -22,7 +22,7 @@ import java.sql.Timestamp;
import java.util.Calendar;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.domain.AbstractODataValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
index 3827418..ae64d31 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core.edm;
import org.apache.olingo.client.api.edm.xml.v4.ActionImport;
-import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmActionImport;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
index 948a930..573e2bc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
index 43f5357..9ecc511 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.Map;
import org.apache.olingo.client.api.edm.xml.ComplexType;
import org.apache.olingo.commons.api.edm.Edm;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
index 03385f8..635b752 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.List;
import org.apache.olingo.client.api.v3.UnsupportedInV3Exception;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
index 914ad1c..c5637e7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java
index 27d6d10..138c2ac 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.List;
import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
index 19df620..44e723e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.List;
import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmParameterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmParameterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmParameterImpl.java
index e912ecb..6c71709 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmParameterImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmParameterImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.client.api.edm.xml.CommonParameter;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmMapping;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmPropertyImpl.java
index 8e3eba6..9c9b4f6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmPropertyImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmPropertyImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.client.api.edm.xml.CommonProperty;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmMapping;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmReturnTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmReturnTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmReturnTypeImpl.java
index b559c71..71a1009 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmReturnTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmReturnTypeImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.client.api.edm.xml.v4.ReturnType;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.core.edm.AbstractEdmReturnType;
[26/52] [abbrv] git commit: Moving some classes to more appropriate
packages
Posted by sk...@apache.org.
Moving some classes to more appropriate packages
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/9b3e4ebf
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/9b3e4ebf
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/9b3e4ebf
Branch: refs/heads/olingo-206-validator
Commit: 9b3e4ebfc966ccac244f0e01d96c95931708b98d
Parents: c876e67
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 24 08:24:39 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 24 08:24:39 2014 +0100
----------------------------------------------------------------------
.../olingo/client/core/data/JSONEntryImpl.java | 4 +-
.../core/edm/xml/AbstractComplexType.java | 1 -
.../core/edm/xml/AbstractEdmDeserializer.java | 71 +++++++++
.../core/edm/xml/AbstractEntityContainer.java | 1 -
.../client/core/edm/xml/AbstractEntitySet.java | 1 -
.../client/core/edm/xml/AbstractEntityType.java | 1 -
.../client/core/edm/xml/AbstractEnumType.java | 1 -
.../client/core/edm/xml/AbstractSchema.java | 1 -
.../core/edm/xml/ComplexTypeDeserializer.java | 82 ++++++++++
.../core/edm/xml/DataServicesDeserializer.java | 1 -
.../client/core/edm/xml/EdmxDeserializer.java | 1 -
.../edm/xml/EntityContainerDeserializer.java | 101 +++++++++++++
.../core/edm/xml/EntityKeyDeserializer.java | 47 ++++++
.../client/core/edm/xml/EntityKeyImpl.java | 1 -
.../core/edm/xml/EntitySetDeserializer.java | 69 +++++++++
.../core/edm/xml/EntityTypeDeserializer.java | 90 +++++++++++
.../core/edm/xml/EnumTypeDeserializer.java | 72 +++++++++
.../core/edm/xml/ParameterDeserializer.java | 1 -
.../core/edm/xml/PropertyDeserializer.java | 1 -
.../client/core/edm/xml/SchemaDeserializer.java | 148 ++++++++++++++++++
.../edm/xml/v3/AnnotationsDeserializer.java | 2 +-
.../edm/xml/v3/AssociationDeserializer.java | 2 +-
.../edm/xml/v3/AssociationSetDeserializer.java | 2 +-
.../edm/xml/v3/FunctionImportDeserializer.java | 2 +-
.../ReferentialConstraintRoleDeserializer.java | 2 +-
.../edm/xml/v3/TypeAnnotationDeserializer.java | 2 +-
.../core/edm/xml/v4/ActionDeserializer.java | 2 +-
.../core/edm/xml/v4/AnnotationDeserializer.java | 2 +-
.../edm/xml/v4/AnnotationsDeserializer.java | 2 +-
.../core/edm/xml/v4/FunctionDeserializer.java | 2 +-
.../xml/v4/NavigationPropertyDeserializer.java | 2 +-
.../core/edm/xml/v4/ReferenceDeserializer.java | 2 +-
.../core/edm/xml/v4/ReturnTypeDeserializer.java | 2 +-
.../core/edm/xml/v4/SingletonDeserializer.java | 2 +-
.../core/edm/xml/v4/TermDeserializer.java | 2 +-
.../edm/xml/v4/TypeDefinitionDeserializer.java | 2 +-
.../xml/v4/annotation/ApplyDeserializer.java | 2 +-
.../edm/xml/v4/annotation/CastDeserializer.java | 2 +-
.../v4/annotation/CollectionDeserializer.java | 2 +-
.../DynExprConstructDeserializer.java | 2 +-
.../edm/xml/v4/annotation/IsOfDeserializer.java | 2 +-
.../annotation/LabeledElementDeserializer.java | 2 +-
.../edm/xml/v4/annotation/NullDeserializer.java | 2 +-
.../annotation/PropertyValueDeserializer.java | 2 +-
.../xml/v4/annotation/RecordDeserializer.java | 2 +-
.../xml/v4/annotation/UrlRefDeserializer.java | 2 +-
.../client/core/op/AbstractEdmDeserializer.java | 71 ---------
.../client/core/op/ComplexTypeDeserializer.java | 83 -----------
.../core/op/EntityContainerDeserializer.java | 102 -------------
.../client/core/op/EntityKeyDeserializer.java | 50 -------
.../client/core/op/EntitySetDeserializer.java | 70 ---------
.../client/core/op/EntityTypeDeserializer.java | 92 ------------
.../client/core/op/EnumTypeDeserializer.java | 73 ---------
.../client/core/op/SchemaDeserializer.java | 149 -------------------
54 files changed, 707 insertions(+), 730 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryImpl.java
index f82ac12..cafe289 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryImpl.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.client.core.data;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.net.URI;
@@ -38,11 +37,10 @@ public class JSONEntryImpl extends AbstractEntry {
private String mediaETag;
- public void setId(String id) throws ParseException {
+ public void setId(final String id) throws ParseException {
this.setCommonProperty("id", id);
}
- @JsonIgnore
@Override
public URI getBaseURI() {
URI baseURI = null;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractComplexType.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractComplexType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractComplexType.java
index 0630a59..e09250c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractComplexType.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractComplexType.java
@@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.apache.olingo.client.api.edm.xml.CommonNavigationProperty;
import org.apache.olingo.client.api.edm.xml.CommonProperty;
import org.apache.olingo.client.api.edm.xml.ComplexType;
-import org.apache.olingo.client.core.op.ComplexTypeDeserializer;
@JsonDeserialize(using = ComplexTypeDeserializer.class)
public abstract class AbstractComplexType extends AbstractEdmItem implements ComplexType {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java
new file mode 100644
index 0000000..c3ff9c4
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.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.client.core.edm.xml;
+
+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.client.api.CommonODataClient;
+import org.apache.olingo.client.core.edm.xml.v4.ReturnTypeImpl;
+import org.apache.olingo.client.core.edm.xml.v4.annotation.ConstExprConstructImpl;
+
+public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
+
+ protected CommonODataClient client;
+
+ protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
+ return ConstExprConstructImpl.Type.fromString(jp.getCurrentName()) != null;
+ }
+
+ protected ConstExprConstructImpl parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
+ final ConstExprConstructImpl constExpr = new ConstExprConstructImpl();
+ constExpr.setType(ConstExprConstructImpl.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.readValueAs( 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 = (CommonODataClient) ctxt.findInjectableValue(CommonODataClient.class.getName(), null, null);
+ return doDeserialize(jp, ctxt);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityContainer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityContainer.java
index c15266e..fb6b229 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityContainer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityContainer.java
@@ -25,7 +25,6 @@ import java.util.List;
import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
import org.apache.olingo.client.api.edm.xml.EntityContainer;
import org.apache.olingo.client.api.edm.xml.EntitySet;
-import org.apache.olingo.client.core.op.EntityContainerDeserializer;
@JsonDeserialize(using = EntityContainerDeserializer.class)
public abstract class AbstractEntityContainer extends AbstractEdmItem implements EntityContainer {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntitySet.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntitySet.java
index 65650f3..d2762ad 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntitySet.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntitySet.java
@@ -21,7 +21,6 @@ package org.apache.olingo.client.core.edm.xml;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.apache.olingo.client.api.edm.xml.EntitySet;
-import org.apache.olingo.client.core.op.EntitySetDeserializer;
@JsonDeserialize(using = EntitySetDeserializer.class)
public abstract class AbstractEntitySet extends AbstractEdmItem implements EntitySet {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityType.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityType.java
index e375323..649dbe8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityType.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityType.java
@@ -22,7 +22,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.apache.olingo.client.api.edm.xml.EntityKey;
import org.apache.olingo.client.api.edm.xml.EntityType;
-import org.apache.olingo.client.core.op.EntityTypeDeserializer;
@JsonDeserialize(using = EntityTypeDeserializer.class)
public abstract class AbstractEntityType extends AbstractComplexType implements EntityType {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEnumType.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEnumType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEnumType.java
index 3730fad..d84bfbd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEnumType.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEnumType.java
@@ -25,7 +25,6 @@ import java.util.List;
import org.apache.olingo.client.api.edm.xml.EnumType;
import org.apache.olingo.client.api.edm.xml.Member;
-import org.apache.olingo.client.core.op.EnumTypeDeserializer;
@JsonDeserialize(using = EnumTypeDeserializer.class)
public abstract class AbstractEnumType extends AbstractEdmItem implements EnumType {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractSchema.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractSchema.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractSchema.java
index 6cc2915..83ac0ac 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractSchema.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractSchema.java
@@ -24,7 +24,6 @@ import org.apache.olingo.client.api.edm.xml.ComplexType;
import org.apache.olingo.client.api.edm.xml.EntityType;
import org.apache.olingo.client.api.edm.xml.EnumType;
import org.apache.olingo.client.api.edm.xml.Schema;
-import org.apache.olingo.client.core.op.SchemaDeserializer;
@JsonDeserialize(using = SchemaDeserializer.class)
public abstract class AbstractSchema extends AbstractEdmItem implements Schema {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeDeserializer.java
new file mode 100644
index 0000000..c9730cb
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeDeserializer.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+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.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.ComplexTypeImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ setAbstractEntityType(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("BaseType".equals(jp.getCurrentName())) {
+ ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ setBaseType(jp.nextTextValue());
+ } else if ("OpenType".equals(jp.getCurrentName())) {
+ ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Property".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (complexType instanceof org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl) complexType).
+ getProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ getProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
+ }
+ } else if ("NavigationProperty".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ getNavigationProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return complexType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
index 94ec6bb..ef2e201 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.client.core.edm.xml;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import com.fasterxml.jackson.core.JsonParser;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
index a3041f0..f617d5b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
@@ -19,7 +19,6 @@
package org.apache.olingo.client.core.edm.xml;
import org.apache.olingo.client.core.edm.xml.v4.ReferenceImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import com.fasterxml.jackson.core.JsonParser;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerDeserializer.java
new file mode 100644
index 0000000..67735a8
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerDeserializer.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+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.client.core.edm.xml.v3.AssociationSetImpl;
+import org.apache.olingo.client.core.edm.xml.v4.ActionImportImpl;
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.client.core.edm.xml.v4.SingletonImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.EntityContainerImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.EntityContainerImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
+ getEntitySets().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.EntitySetImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
+ getEntitySets().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl.class));
+ }
+ } else if ("AssociationSet".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
+ getAssociationSets().add(jp.readValueAs(AssociationSetImpl.class));
+ } else if ("Singleton".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
+ getSingletons().add(jp.readValueAs(SingletonImpl.class));
+ } else if ("ActionImport".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
+ getActionImports().add(jp.readValueAs(ActionImportImpl.class));
+ } else if ("FunctionImport".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (entityContainer instanceof org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
+ getFunctionImports().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.FunctionImportImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
+ getFunctionImports().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.FunctionImportImpl.class));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
+ setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return entityContainer;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyDeserializer.java
new file mode 100644
index 0000000..4e5435d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyDeserializer.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.client.core.edm.xml;
+
+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;
+
+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.readValueAs( PropertyRefImpl.class));
+ }
+ }
+
+ return entityKey;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java
index 8074e69..b47e0fc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java
@@ -25,7 +25,6 @@ import java.util.List;
import org.apache.olingo.client.api.edm.xml.EntityKey;
import org.apache.olingo.client.api.edm.xml.PropertyRef;
-import org.apache.olingo.client.core.op.EntityKeyDeserializer;
@JsonDeserialize(using = EntityKeyDeserializer.class)
public class EntityKeyImpl extends AbstractEdmItem implements EntityKey {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetDeserializer.java
new file mode 100644
index 0000000..861ea2f
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetDeserializer.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.client.core.edm.xml;
+
+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.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyBindingImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.EntitySetImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v4.EntitySetImpl) entitySet).
+ setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).
+ getNavigationPropertyBindings().add(
+ jp.readValueAs(NavigationPropertyBindingImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).
+ setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return entitySet;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeDeserializer.java
new file mode 100644
index 0000000..8f3c60d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/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.client.core.edm.xml;
+
+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.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.EntityTypeImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.readValueAs(EntityKeyImpl.class));
+ } else if ("Property".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (entityType instanceof org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) entityType).
+ getProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
+ getProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
+ }
+ } else if ("NavigationProperty".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (entityType instanceof org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) entityType).
+ getNavigationProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.NavigationPropertyImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
+ getNavigationProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyImpl.class));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
+ setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return entityType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeDeserializer.java
new file mode 100644
index 0000000..9c99ea2
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeDeserializer.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.client.core.edm.xml;
+
+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.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.EnumTypeImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.EnumTypeImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.EnumTypeImpl) enumType).
+ getMembers().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.MemberImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).
+ getMembers().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.MemberImpl.class));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).
+ setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return enumType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
index cb0178d..2aa3cdd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
@@ -27,7 +27,6 @@ import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.olingo.client.api.edm.xml.v3.ParameterMode;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ParameterDeserializer extends AbstractEdmDeserializer<AbstractParameter> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
index ec40746..8815e44 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
@@ -24,7 +24,6 @@ import org.apache.commons.lang3.BooleanUtils;
import org.apache.olingo.client.api.edm.ConcurrencyMode;
import org.apache.olingo.client.api.edm.StoreGeneratedPattern;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaDeserializer.java
new file mode 100644
index 0000000..afa0a84
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaDeserializer.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+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.client.core.edm.xml.v3.AssociationImpl;
+import org.apache.olingo.client.core.edm.xml.v3.UsingImpl;
+import org.apache.olingo.client.core.edm.xml.v3.ValueTermImpl;
+import org.apache.olingo.client.core.edm.xml.v4.ActionImpl;
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.client.core.edm.xml.v4.FunctionImpl;
+import org.apache.olingo.client.core.edm.xml.v4.TypeDefinitionImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.SchemaImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.SchemaImpl) schema).
+ getUsings().add(jp.readValueAs( UsingImpl.class));
+ } else if ("Association".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getAssociations().add(jp.readValueAs( AssociationImpl.class));
+ } else if ("ComplexType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getComplexTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
+ getComplexTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl.class));
+ }
+ } else if ("EntityType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getEntityTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
+ getEntityTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl.class));
+ }
+ } else if ("EnumType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getEnumTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.EnumTypeImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
+ getEnumTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl.class));
+ }
+ } else if ("ValueTerm".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getValueTerms().add(jp.readValueAs( ValueTermImpl.class));
+ } else if ("EntityContainer".equals(jp.getCurrentName())) {
+ jp.nextToken();
+
+ if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getEntityContainers().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl.class));
+ } else {
+ org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl entityContainer
+ = jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl.class);
+ entityContainer.setDefaultEntityContainer(true);
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
+ setEntityContainer(entityContainer);
+ }
+ } else if ("Annotations".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).getAnnotationsList().
+ add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.AnnotationsImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotationsList().
+ add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.AnnotationsImpl.class));
+ }
+ } else if ("Action".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getActions().
+ add(jp.readValueAs( ActionImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotations().
+ add(jp.readValueAs( AnnotationImpl.class));
+ } else if ("Function".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getFunctions().
+ add(jp.readValueAs( FunctionImpl.class));
+ } else if ("TypeDefinition".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
+ getTypeDefinitions().add(jp.readValueAs( TypeDefinitionImpl.class));
+ }
+ }
+ }
+
+ return schema;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AnnotationsDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AnnotationsDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AnnotationsDeserializer.java
index b1e7624..a8a88eb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AnnotationsDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AnnotationsDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class AnnotationsDeserializer extends AbstractEdmDeserializer<AnnotationsImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationDeserializer.java
index 7031453..c1d422d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class AssociationDeserializer extends AbstractEdmDeserializer<AssociationImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationSetDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationSetDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationSetDeserializer.java
index 1f74893..f7268c2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationSetDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationSetDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class AssociationSetDeserializer extends AbstractEdmDeserializer<AssociationSetImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/FunctionImportDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/FunctionImportDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/FunctionImportDeserializer.java
index e0539f5..3b7c4c7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/FunctionImportDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/FunctionImportDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class FunctionImportDeserializer extends AbstractEdmDeserializer<FunctionImportImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/ReferentialConstraintRoleDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/ReferentialConstraintRoleDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/ReferentialConstraintRoleDeserializer.java
index 7212767..4bd4e1a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/ReferentialConstraintRoleDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/ReferentialConstraintRoleDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.PropertyRefImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class ReferentialConstraintRoleDeserializer extends AbstractEdmDeserializer<ReferentialConstraintRoleImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/TypeAnnotationDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/TypeAnnotationDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/TypeAnnotationDeserializer.java
index e111a3c..fd2aac3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/TypeAnnotationDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/TypeAnnotationDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class TypeAnnotationDeserializer extends AbstractEdmDeserializer<TypeAnnotationImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ActionDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ActionDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ActionDeserializer.java
index e3d0b6a..fd0c214 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ActionDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ActionDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class ActionDeserializer extends AbstractEdmDeserializer<ActionImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationDeserializer.java
index a12b396..129926d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.annotation.DynExprConstructImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class AnnotationDeserializer extends AbstractEdmDeserializer<AnnotationImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationsDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationsDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationsDeserializer.java
index 9ff511b..6c8a4f6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationsDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationsDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class AnnotationsDeserializer extends AbstractEdmDeserializer<AnnotationsImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/FunctionDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/FunctionDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/FunctionDeserializer.java
index cd55f1d..e1e0707 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/FunctionDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/FunctionDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class FunctionDeserializer extends AbstractEdmDeserializer<FunctionImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/NavigationPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/NavigationPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/NavigationPropertyDeserializer.java
index d864361..8ed9669 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/NavigationPropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/NavigationPropertyDeserializer.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core.edm.xml.v4;
import org.apache.olingo.client.core.edm.xml.OnDeleteImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReferenceDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReferenceDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReferenceDeserializer.java
index 1b9f971..94f1ed7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReferenceDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReferenceDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import java.net.URI;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class ReferenceDeserializer extends AbstractEdmDeserializer<ReferenceImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReturnTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReturnTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReturnTypeDeserializer.java
index 24ef200..85ecc6c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReturnTypeDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReturnTypeDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class ReturnTypeDeserializer extends AbstractEdmDeserializer<ReturnTypeImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/SingletonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/SingletonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/SingletonDeserializer.java
index cfd4324..d79bd22 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/SingletonDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/SingletonDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class SingletonDeserializer extends AbstractEdmDeserializer<SingletonImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TermDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TermDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TermDeserializer.java
index 4e3d89b..feb85e5 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TermDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TermDeserializer.java
@@ -28,7 +28,7 @@ import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.edm.xml.v4.CSDLElement;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class TermDeserializer extends AbstractEdmDeserializer<TermImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TypeDefinitionDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TypeDefinitionDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TypeDefinitionDeserializer.java
index c270cae..8fe9025 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TypeDefinitionDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TypeDefinitionDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class TypeDefinitionDeserializer extends AbstractEdmDeserializer<TypeDefinitionImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ApplyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ApplyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ApplyDeserializer.java
index 68aec7d..56251a3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ApplyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ApplyDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class ApplyDeserializer extends AbstractEdmDeserializer<Apply> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CastDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CastDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CastDeserializer.java
index d2ba56c..25ea594 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CastDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CastDeserializer.java
@@ -27,7 +27,7 @@ import java.io.IOException;
import java.math.BigInteger;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class CastDeserializer extends AbstractEdmDeserializer<Cast> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CollectionDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CollectionDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CollectionDeserializer.java
index 52ad3c1..8ef4018 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CollectionDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CollectionDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class CollectionDeserializer extends AbstractEdmDeserializer<Collection> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java
index b7b7c66..59266a5 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java
@@ -28,7 +28,7 @@ import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.ClassUtils;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class DynExprConstructDeserializer extends AbstractEdmDeserializer<DynExprConstructImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java
index a929563..160ce63 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java
@@ -27,7 +27,7 @@ import java.io.IOException;
import java.math.BigInteger;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class IsOfDeserializer extends AbstractEdmDeserializer<IsOf> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java
index 7f3615f..df3f747 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class LabeledElementDeserializer extends AbstractEdmDeserializer<LabeledElement> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java
index 2bdb288..36c6791 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class NullDeserializer extends AbstractEdmDeserializer<Null> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
index a329658..6841c6e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class PropertyValueDeserializer extends AbstractEdmDeserializer<PropertyValue> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java
index 32ae5ba..279eb8c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class RecordDeserializer extends AbstractEdmDeserializer<Record> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
index 804a08d..e2fcfbb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
public class UrlRefDeserializer extends AbstractEdmDeserializer<UrlRef> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9b3e4ebf/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractEdmDeserializer.java
deleted file mode 100644
index ac00cf3..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractEdmDeserializer.java
+++ /dev/null
@@ -1,71 +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.client.core.op;
-
-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.client.api.CommonODataClient;
-import org.apache.olingo.client.core.edm.xml.v4.ReturnTypeImpl;
-import org.apache.olingo.client.core.edm.xml.v4.annotation.ConstExprConstructImpl;
-
-public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
-
- protected CommonODataClient client;
-
- protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
- return ConstExprConstructImpl.Type.fromString(jp.getCurrentName()) != null;
- }
-
- protected ConstExprConstructImpl parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
- final ConstExprConstructImpl constExpr = new ConstExprConstructImpl();
- constExpr.setType(ConstExprConstructImpl.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.readValueAs( 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 = (CommonODataClient) ctxt.findInjectableValue(CommonODataClient.class.getName(), null, null);
- return doDeserialize(jp, ctxt);
- }
-
-}
[34/52] [abbrv] [OLINGO-200] Moving Atom and JSON (de)serializer to
commons
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java
new file mode 100644
index 0000000..f0a35a5
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.data;
+
+public interface Link {
+
+ /**
+ * Gets rel info.
+ *
+ * @return rel info.
+ */
+ String getRel();
+
+ /**
+ * Sets rel info.
+ *
+ * @param rel rel info.
+ */
+ void setRel(String rel);
+
+ /**
+ * Gets type.
+ *
+ * @return type.
+ */
+ String getType();
+
+ /**
+ * Sets type.
+ *
+ * @param type type.
+ */
+ void setType(String type);
+
+ /**
+ * Gets title.
+ *
+ * @return title.
+ */
+ String getTitle();
+
+ /**
+ * Sets title.
+ *
+ * @param title title.
+ */
+ void setTitle(String title);
+
+ /**
+ * Gets href.
+ *
+ * @return href.
+ */
+ String getHref();
+
+ /**
+ * Sets href.
+ *
+ * @param href href.
+ */
+ void setHref(String href);
+
+ /**
+ * Gets Media ETag.
+ *
+ * @return media ETag
+ */
+ String getMediaETag();
+
+ /**
+ * Sets Media ETag.
+ *
+ * @param etag media ETag
+ */
+ void setMediaETag(String etag);
+
+ /**
+ * Gets in-line entry.
+ *
+ * @return in-line entry.
+ */
+ Entry getInlineEntry();
+
+ /**
+ * Sets in-line entry.
+ *
+ * @param entry entry.
+ */
+ void setInlineEntry(Entry entry);
+
+ /**
+ * Gets in-line feed.
+ *
+ * @return in-line feed.
+ */
+ Feed getInlineFeed();
+
+ /**
+ * Sets in-line feed.
+ *
+ * @param feed feed.
+ */
+ void setInlineFeed(Feed feed);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/NullValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/NullValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/NullValue.java
new file mode 100644
index 0000000..2fed975
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/NullValue.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.commons.api.data;
+
+public interface NullValue extends Value {
+
+ @Override
+ Void get();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/PrimitiveValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/PrimitiveValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/PrimitiveValue.java
new file mode 100644
index 0000000..dabbc47
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/PrimitiveValue.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.commons.api.data;
+
+public interface PrimitiveValue extends Value {
+
+ @Override
+ String get();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
new file mode 100644
index 0000000..feb8f71
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.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.commons.api.data;
+
+public interface Property {
+
+ String getName();
+
+ void setName(String name);
+
+ String getType();
+
+ void setType(String type);
+
+ Value getValue();
+
+ void setValue(Value value);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java
new file mode 100644
index 0000000..045751d
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.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.commons.api.data;
+
+public interface Value {
+
+ boolean isNull();
+
+ boolean isSimple();
+
+ boolean isGeospatial();
+
+ boolean isComplex();
+
+ boolean isCollection();
+
+ Object get();
+
+ NullValue asNull();
+
+ PrimitiveValue asSimple();
+
+ GeospatialValue asGeospatial();
+
+ ComplexValue asComplex();
+
+ CollectionValue asCollection();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/v3/LinkCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/v3/LinkCollection.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/v3/LinkCollection.java
new file mode 100644
index 0000000..72186fc
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/v3/LinkCollection.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.commons.api.data.v3;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * REST resource for an <tt>ODataLinkCollection</tt>.
+ *
+ * @see org.apache.olingo.client.api.domain.ODataLinkCollection
+ */
+public interface LinkCollection {
+
+ /**
+ * Smart management of different JSON format produced by OData services when
+ * <tt>$links</tt> is a single or a collection property.
+ *
+ * @return list of URIs for <tt>$links</tt>
+ */
+ List<URI> getLinks();
+
+ /**
+ * Sets next link.
+ *
+ * @param next next link.
+ */
+ void setNext(final URI next);
+
+ /**
+ * Gets next link if exists.
+ *
+ * @return next link if exists; null otherwise.
+ */
+ URI getNext();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/pom.xml
----------------------------------------------------------------------
diff --git a/lib/commons-core/pom.xml b/lib/commons-core/pom.xml
index a767566..f025fd0 100644
--- a/lib/commons-core/pom.xml
+++ b/lib/commons-core/pom.xml
@@ -46,6 +46,27 @@
</dependency>
<dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <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>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
new file mode 100644
index 0000000..940d8a5
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.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.commons.core.data;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+abstract class AbstractAtomDealer {
+
+ protected static final String TYPE_TEXT = "text";
+
+ protected final ODataServiceVersion version;
+
+ protected final QName etagQName;
+
+ protected final QName inlineQName;
+
+ protected final QName actionQName;
+
+ protected final QName propertiesQName;
+
+ protected final QName typeQName;
+
+ protected final QName nullQName;
+
+ protected final QName elementQName;
+
+ protected final QName countQName;
+
+ protected final QName uriQName;
+ protected final QName nextQName;
+
+ public AbstractAtomDealer(final ODataServiceVersion version) {
+ this.version = version;
+
+ this.etagQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ATTR_ETAG);
+ this.inlineQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_INLINE);
+ this.actionQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_ACTION);
+ this.propertiesQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.PROPERTIES);
+ this.typeQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATTR_TYPE);
+ this.nullQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATTR_NULL);
+ this.elementQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_ELEMENT);
+ this.countQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_COUNT);
+ this.uriQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_URI);
+ this.nextQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.NEXT_LINK_REL);
+ }
+
+ protected void namespaces(final XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeNamespace(StringUtils.EMPTY, Constants.NS_ATOM);
+ writer.writeNamespace(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI);
+ writer.writeNamespace(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
+ writer.writeNamespace(
+ Constants.PREFIX_DATASERVICES, version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
+ writer.writeNamespace(Constants.PREFIX_GML, Constants.NS_GML);
+ writer.writeNamespace(Constants.PREFIX_GEORSS, Constants.NS_GEORSS);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomObject.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomObject.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomObject.java
new file mode 100644
index 0000000..f09de40
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomObject.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.commons.core.data;
+
+import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
+import java.net.URI;
+import java.text.ParseException;
+import java.util.Date;
+
+abstract class AbstractAtomObject extends AbstractPayloadObject {
+
+ private static final long serialVersionUID = -4391162864875546927L;
+
+ private static final ISO8601DateFormat ISO_DATEFORMAT = new ISO8601DateFormat();
+
+ private URI baseURI;
+
+ private String id;
+
+ private String title;
+
+ private String summary;
+
+ private Date updated;
+
+ public URI getBaseURI() {
+ return baseURI;
+ }
+
+ public void setBaseURI(final String baseURI) {
+ this.baseURI = URI.create(baseURI);
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public String getSummary() {
+ return summary;
+ }
+
+ public Date getUpdated() {
+ return updated;
+ }
+
+ public void setCommonProperty(final String key, final String value) throws ParseException {
+ if ("id".equals(key)) {
+ this.id = value;
+ } else if ("title".equals(key)) {
+ this.title = value;
+ } else if ("summary".equals(key)) {
+ this.summary = value;
+ } else if ("updated".equals(key)) {
+ this.updated = ISO_DATEFORMAT.parse(value);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
new file mode 100644
index 0000000..29a4a75
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.ODataOperation;
+
+/**
+ * Abstract base for classes implementing an OData entry in Atom and JSON.
+ */
+public abstract class AbstractEntry extends AbstractAtomObject implements Entry {
+
+ private static final long serialVersionUID = 2127764552600969783L;
+
+ private String eTag;
+
+ private String type;
+
+ private Link readLink;
+
+ private Link editLink;
+
+ private final List<Link> associationLinks = new ArrayList<Link>();
+
+ private final List<Link> navigationLinks = new ArrayList<Link>();
+
+ private final List<Link> mediaEditLinks = new ArrayList<Link>();
+
+ private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
+
+ private final List<Property> properties = new ArrayList<Property>();
+
+ private String mediaContentSource;
+
+ private String mediaContentType;
+
+ @Override
+ public String getETag() {
+ return eTag;
+ }
+
+ public void setETag(final String eTag) {
+ this.eTag = eTag;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public Link getSelfLink() {
+ return readLink;
+ }
+
+ @Override
+ public void setSelfLink(final Link readLink) {
+ this.readLink = readLink;
+ }
+
+ @Override
+ public Link getEditLink() {
+ return editLink;
+ }
+
+ @Override
+ public void setEditLink(final Link editLink) {
+ this.editLink = editLink;
+ }
+
+ @Override
+ public List<Link> getAssociationLinks() {
+ return associationLinks;
+ }
+
+ @Override
+ public List<Link> getNavigationLinks() {
+ return navigationLinks;
+ }
+
+ @Override
+ public List<Link> getMediaEditLinks() {
+ return mediaEditLinks;
+ }
+
+ @Override
+ public List<ODataOperation> getOperations() {
+ return operations;
+ }
+
+ @Override
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public Property getProperty(final String name) {
+ Property result = null;
+
+ for (Property property : properties) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public String getMediaContentType() {
+ return this.mediaContentType;
+ }
+
+ @Override
+ public void setMediaContentType(final String mediaContentType) {
+ this.mediaContentType = mediaContentType;
+ }
+
+ @Override
+ public String getMediaContentSource() {
+ return this.mediaContentSource;
+ }
+
+ @Override
+ public void setMediaContentSource(final String mediaContentSource) {
+ this.mediaContentSource = mediaContentSource;
+ }
+
+ @Override
+ public boolean isMediaEntry() {
+ return StringUtils.isNotBlank(this.mediaContentSource);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
new file mode 100644
index 0000000..2d865ce
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.CollectionValue;
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.Value;
+import org.apache.olingo.commons.api.domain.ODataPropertyType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
+
+ private JSONGeoValueDeserializer geoDeserializer;
+
+ private JSONGeoValueDeserializer getGeoDeserializer() {
+ if (geoDeserializer == null) {
+ geoDeserializer = new JSONGeoValueDeserializer(version);
+ }
+ return geoDeserializer;
+ }
+
+ protected EdmPrimitiveTypeKind getPrimitiveType(final JsonNode node) {
+ EdmPrimitiveTypeKind result = EdmPrimitiveTypeKind.String;
+
+ if (node.isIntegralNumber()) {
+ result = EdmPrimitiveTypeKind.Int32;
+ } else if (node.isBoolean()) {
+ result = EdmPrimitiveTypeKind.Boolean;
+ } else if (node.isFloatingPointNumber()) {
+ result = EdmPrimitiveTypeKind.Double;
+ }
+
+ return result;
+ }
+
+ private ODataPropertyType guessPropertyType(final JsonNode node) {
+ ODataPropertyType type = null;
+
+ if (node.isValueNode() || node.isNull()) {
+ type = ODataPropertyType.PRIMITIVE;
+ } else if (node.isArray()) {
+ type = ODataPropertyType.COLLECTION;
+ } else if (node.isObject()) {
+ type = ODataPropertyType.COMPLEX;
+ } else {
+ type = ODataPropertyType.EMPTY;
+ }
+
+ return type;
+ }
+
+ private Value fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) {
+ Value value = null;
+
+ if (node.isNull()) {
+ value = new NullValueImpl();
+ } else {
+ if (typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+ value = new GeospatialValueImpl(getGeoDeserializer().deserialize(node, typeInfo));
+ } else {
+ value = new PrimitiveValueImpl(node.asText());
+ }
+ }
+
+ return value;
+ }
+
+ private ComplexValue fromComplex(final JsonNode node) {
+ final ComplexValue value = new ComplexValueImpl();
+
+ String type = null;
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+
+ if (type == null && field.getKey().endsWith(Constants.JSON_TYPE_SUFFIX)) {
+ type = field.getValue().asText();
+ } else {
+ final JSONPropertyImpl property = new JSONPropertyImpl();
+ property.setName(field.getKey());
+ property.setType(type);
+ type = null;
+
+ value(property, field.getValue());
+ value.get().add(property);
+ }
+ }
+
+ return value;
+ }
+
+ private CollectionValue fromCollection(final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo) {
+ final CollectionValueImpl value = new CollectionValueImpl();
+
+ final EdmTypeInfo type = typeInfo == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
+
+ while (nodeItor.hasNext()) {
+ final JsonNode child = nodeItor.next();
+
+ if (child.isValueNode()) {
+ value.get().add(fromPrimitive(child, type));
+ } else if (child.isContainerNode()) {
+ if (child.has(Constants.JSON_TYPE)) {
+ ((ObjectNode) child).remove(Constants.JSON_TYPE);
+ }
+ value.get().add(fromComplex(child));
+ }
+ }
+
+ return value;
+ }
+
+ protected void value(final JSONPropertyImpl property, final JsonNode node) {
+ final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
+
+ final ODataPropertyType propType = typeInfo == null
+ ? guessPropertyType(node)
+ : typeInfo.isCollection()
+ ? ODataPropertyType.COLLECTION
+ : typeInfo.isPrimitiveType()
+ ? ODataPropertyType.PRIMITIVE
+ : ODataPropertyType.COMPLEX;
+
+ switch (propType) {
+ case COLLECTION:
+ property.setValue(fromCollection(node.elements(), typeInfo));
+ break;
+
+ case COMPLEX:
+ if (node.has(Constants.JSON_TYPE)) {
+ property.setType(node.get(Constants.JSON_TYPE).asText());
+ ((ObjectNode) node).remove(Constants.JSON_TYPE);
+ }
+ property.setValue(fromComplex(node));
+ break;
+
+ case PRIMITIVE:
+ if (property.getType() == null) {
+ property.setType(getPrimitiveType(node).getFullQualifiedName().toString());
+ }
+ property.setValue(fromPrimitive(node, typeInfo));
+ break;
+
+ case EMPTY:
+ default:
+ property.setValue(new PrimitiveValueImpl(StringUtils.EMPTY));
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
new file mode 100644
index 0000000..1380dd5
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.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.commons.core.data;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import java.io.IOException;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.math.NumberUtils;
+import org.apache.olingo.commons.api.data.CollectionValue;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Value;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
+
+ private static final EdmPrimitiveTypeKind[] NUMBER_TYPES = {
+ EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte,
+ EdmPrimitiveTypeKind.Single, EdmPrimitiveTypeKind.Double,
+ EdmPrimitiveTypeKind.Int16, EdmPrimitiveTypeKind.Int32, EdmPrimitiveTypeKind.Int64
+ };
+
+ private final JSONGeoValueSerializer geoSerializer = new JSONGeoValueSerializer();
+
+ private void collection(final JsonGenerator jgen, final String itemType, final CollectionValue value)
+ throws IOException {
+
+ jgen.writeStartArray();
+ for (Value item : value.get()) {
+ value(jgen, itemType, item);
+ }
+ jgen.writeEndArray();
+ }
+
+ private void value(final JsonGenerator jgen, final String type, final Value value) throws IOException {
+ final EdmTypeInfo typeInfo = type == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(type).build();
+
+ if (value.isNull()) {
+ jgen.writeNull();
+ } else if (value.isSimple()) {
+ final boolean isNumber = typeInfo == null
+ ? NumberUtils.isNumber(value.asSimple().get())
+ : ArrayUtils.contains(NUMBER_TYPES, typeInfo.getPrimitiveTypeKind());
+ final boolean isBoolean = typeInfo == null
+ ? (value.asSimple().get().equalsIgnoreCase(Boolean.TRUE.toString())
+ || value.asSimple().get().equalsIgnoreCase(Boolean.FALSE.toString()))
+ : typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Boolean;
+
+ if (isNumber) {
+ jgen.writeNumber(value.asSimple().get());
+ } else if (isBoolean) {
+ jgen.writeBoolean(BooleanUtils.toBoolean(value.asSimple().get()));
+ } else {
+ jgen.writeString(value.asSimple().get());
+ }
+ } else if (value.isGeospatial()) {
+ jgen.writeStartObject();
+ geoSerializer.serialize(jgen, value.asGeospatial().get());
+ jgen.writeEndObject();
+ } else if (value.isCollection()) {
+ collection(jgen, typeInfo == null ? null : typeInfo.getFullQualifiedName().toString(), value.asCollection());
+ } else if (value.isComplex()) {
+ jgen.writeStartObject();
+ for (Property property : value.asComplex().get()) {
+ property(jgen, property, property.getName());
+ }
+ jgen.writeEndObject();
+ }
+ }
+
+ protected void property(final JsonGenerator jgen, final Property property, final String name) throws IOException {
+ jgen.writeFieldName(name);
+ value(jgen, property.getType(), property.getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPayloadObject.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPayloadObject.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPayloadObject.java
new file mode 100644
index 0000000..bad009d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPayloadObject.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.commons.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 a payload (Atom, JSON) object.
+ */
+public abstract class AbstractPayloadObject implements Serializable {
+
+ private static final long serialVersionUID = 1634654241914156675L;
+
+ @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/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
new file mode 100644
index 0000000..e005f98
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.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.commons.core.data;
+
+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.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Value;
+
+public abstract class AbstractPropertyImpl implements Property {
+
+ private String name;
+
+ private String type;
+
+ private Value value;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public Value getValue() {
+ return value;
+ }
+
+ @Override
+ public void setValue(final Value value) {
+ this.value = value;
+ }
+
+ @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/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java
new file mode 100644
index 0000000..31629e2
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.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.commons.core.data;
+
+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.commons.api.data.CollectionValue;
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.GeospatialValue;
+import org.apache.olingo.commons.api.data.NullValue;
+import org.apache.olingo.commons.api.data.PrimitiveValue;
+import org.apache.olingo.commons.api.data.Value;
+
+public abstract class AbstractValue implements Value {
+
+ @Override
+ public boolean isNull() {
+ return false;
+ }
+
+ @Override
+ public boolean isSimple() {
+ return false;
+ }
+
+ @Override
+ public boolean isGeospatial() {
+ return false;
+ }
+
+ @Override
+ public boolean isComplex() {
+ return false;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ @Override
+ public NullValue asNull() {
+ return isNull() ? (NullValue) this : null;
+ }
+
+ @Override
+ public PrimitiveValue asSimple() {
+ return isSimple() ? (PrimitiveValue) this : null;
+ }
+
+ @Override
+ public GeospatialValue asGeospatial() {
+ return isGeospatial() ? (GeospatialValue) this : null;
+ }
+
+ @Override
+ public ComplexValue asComplex() {
+ return isComplex() ? (ComplexValue) this : null;
+ }
+
+ @Override
+ public CollectionValue asCollection() {
+ return isCollection() ? (CollectionValue) this : null;
+ }
+
+ @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/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
new file mode 100644
index 0000000..f42fe00
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -0,0 +1,370 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.text.ParseException;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.data.v3.XMLLinkCollectionImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AtomDeserializer extends AbstractAtomDealer {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AtomDeserializer.class);
+
+ private static final XMLInputFactory FACTORY = XMLInputFactory.newInstance();
+
+ private final AtomPropertyDeserializer propDeserializer;
+
+ public AtomDeserializer(final ODataServiceVersion version) {
+ super(version);
+ this.propDeserializer = new AtomPropertyDeserializer(version);
+ }
+
+ private AtomPropertyImpl property(final InputStream input) throws XMLStreamException {
+ final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+ return propDeserializer.deserialize(reader, skipBeforeFirstStartElement(reader));
+ }
+
+ private StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
+ StartElement startEvent = null;
+ while (reader.hasNext() && startEvent == null) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ startEvent = event.asStartElement();
+ }
+ }
+ if (startEvent == null) {
+ throw new IllegalArgumentException("Cannot find any XML start element");
+ }
+
+ return startEvent;
+ }
+
+ private void common(final XMLEventReader reader, final StartElement start,
+ final AbstractAtomObject object, final String key) throws XMLStreamException {
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ try {
+ object.setCommonProperty(key, event.asCharacters().getData());
+ } catch (ParseException e) {
+ throw new XMLStreamException("While parsing Atom entry or feed common elements", e);
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private void inline(final XMLEventReader reader, final StartElement start, final LinkImpl link)
+ throws XMLStreamException {
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && inlineQName.equals(event.asStartElement().getName())) {
+ StartElement inline = null;
+ while (reader.hasNext() && inline == null) {
+ final XMLEvent innerEvent = reader.peek();
+ if (innerEvent.isCharacters() && innerEvent.asCharacters().isWhiteSpace()) {
+ reader.nextEvent();
+ } else if (innerEvent.isStartElement()) {
+ inline = innerEvent.asStartElement();
+ }
+ }
+ if (inline != null) {
+ if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(inline.getName())) {
+ link.setInlineEntry(entry(reader, inline));
+ }
+ if (Constants.QNAME_ATOM_ELEM_FEED.equals(inline.getName())) {
+ link.setInlineFeed(feed(reader, inline));
+ }
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private XMLLinkCollectionImpl linkCollection(final InputStream input) throws XMLStreamException {
+ final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+
+ final XMLLinkCollectionImpl linkCollection = new XMLLinkCollectionImpl();
+
+ boolean isURI = false;
+ boolean isNext = false;
+ while (reader.hasNext()) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ isURI = uriQName.equals(event.asStartElement().getName());
+ isNext = nextQName.equals(event.asStartElement().getName());
+ }
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ if (isURI) {
+ linkCollection.getLinks().add(URI.create(event.asCharacters().getData()));
+ isURI = false;
+ } else if (isNext) {
+ linkCollection.setNext(URI.create(event.asCharacters().getData()));
+ isNext = false;
+ }
+ }
+ }
+
+ return linkCollection;
+ }
+
+ private void properties(final XMLEventReader reader, final StartElement start, final AtomEntryImpl entry)
+ throws XMLStreamException {
+
+ boolean foundEndProperties = false;
+ while (reader.hasNext() && !foundEndProperties) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ entry.getProperties().add(propDeserializer.deserialize(reader, event.asStartElement()));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperties = true;
+ }
+ }
+ }
+
+ private AtomEntryImpl entry(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
+ if (!Constants.QNAME_ATOM_ELEM_ENTRY.equals(start.getName())) {
+ return null;
+ }
+
+ final AtomEntryImpl entry = new AtomEntryImpl();
+ final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
+ if (xmlBase != null) {
+ entry.setBaseURI(xmlBase.getValue());
+ }
+ final Attribute etag = start.getAttributeByName(etagQName);
+ if (etag != null) {
+ entry.setETag(etag.getValue());
+ }
+
+ boolean foundEndEntry = false;
+ while (reader.hasNext() && !foundEndEntry) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entry, "id");
+ } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entry, "title");
+ } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entry, "summary");
+ } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entry, "updated");
+ } else if (Constants.QNAME_ATOM_ELEM_CATEGORY.equals(event.asStartElement().getName())) {
+ final Attribute term = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_TERM));
+ if (term != null) {
+ entry.setType(term.getValue());
+ }
+ } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
+ final LinkImpl link = new LinkImpl();
+ final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
+ if (rel != null) {
+ link.setRel(rel.getValue());
+ }
+ final Attribute title = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TITLE));
+ if (title != null) {
+ link.setTitle(title.getValue());
+ }
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ link.setHref(href.getValue());
+ }
+ final Attribute type = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE));
+ if (type != null) {
+ link.setType(type.getValue());
+ }
+
+ if (Constants.SELF_LINK_REL.equals(link.getRel())) {
+ entry.setSelfLink(link);
+ } else if (Constants.EDIT_LINK_REL.equals(link.getRel())) {
+ entry.setEditLink(link);
+ } else if (link.getRel().startsWith(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL))) {
+ entry.getNavigationLinks().add(link);
+ inline(reader, event.asStartElement(), link);
+ } else if (link.getRel().startsWith(
+ version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL))) {
+
+ entry.getAssociationLinks().add(link);
+ } else if (link.getRel().startsWith(
+ version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL))) {
+
+ final Attribute metag = event.asStartElement().getAttributeByName(etagQName);
+ if (metag != null) {
+ link.setMediaETag(metag.getValue());
+ }
+ entry.getMediaEditLinks().add(link);
+ }
+ } else if (actionQName.equals(event.asStartElement().getName())) {
+ final ODataOperation operation = new ODataOperation();
+ final Attribute metadata = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_METADATA));
+ if (metadata != null) {
+ operation.setMetadataAnchor(metadata.getValue());
+ }
+ final Attribute title = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TITLE));
+ if (title != null) {
+ operation.setTitle(title.getValue());
+ }
+ final Attribute target = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TARGET));
+ if (target != null) {
+ operation.setTarget(URI.create(target.getValue()));
+ }
+
+ entry.getOperations().add(operation);
+ } else if (Constants.QNAME_ATOM_ELEM_CONTENT.equals(event.asStartElement().getName())) {
+ final Attribute type = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE));
+ if (type == null || ContentType.APPLICATION_XML.equals(type.getValue())) {
+ properties(reader, skipBeforeFirstStartElement(reader), entry);
+ } else {
+ entry.setMediaContentType(type.getValue());
+ final Attribute src = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_SRC));
+ if (src != null) {
+ entry.setMediaContentSource(src.getValue());
+ }
+ }
+ } else if (propertiesQName.equals(event.asStartElement().getName())) {
+ properties(reader, event.asStartElement(), entry);
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndEntry = true;
+ }
+ }
+
+ return entry;
+ }
+
+ private AtomEntryImpl entry(final InputStream input) throws XMLStreamException {
+ final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+ return entry(reader, skipBeforeFirstStartElement(reader));
+ }
+
+ private void count(final XMLEventReader reader, final StartElement start, final AtomFeedImpl feed)
+ throws XMLStreamException {
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ feed.setCount(Integer.valueOf(event.asCharacters().getData()));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private AtomFeedImpl feed(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
+ if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) {
+ return null;
+ }
+
+ final AtomFeedImpl feed = new AtomFeedImpl();
+ final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
+ if (xmlBase != null) {
+ feed.setBaseURI(xmlBase.getValue());
+ }
+
+ boolean foundEndFeed = false;
+ while (reader.hasNext() && !foundEndFeed) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (countQName.equals(event.asStartElement().getName())) {
+ count(reader, event.asStartElement(), feed);
+ } else if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), feed, "id");
+ } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), feed, "title");
+ } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), feed, "summary");
+ } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), feed, "updated");
+ } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
+ final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
+ if (rel != null && Constants.NEXT_LINK_REL.equals(rel.getValue())) {
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ feed.setNext(URI.create(href.getValue()));
+ }
+ }
+ } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(event.asStartElement().getName())) {
+ feed.getEntries().add(entry(reader, event.asStartElement()));
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndFeed = true;
+ }
+ }
+
+ return feed;
+ }
+
+ private AtomFeedImpl feed(final InputStream input) throws XMLStreamException {
+ final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+ return feed(reader, skipBeforeFirstStartElement(reader));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T read(final InputStream input, final Class<T> reference) throws XMLStreamException {
+ if (AtomFeedImpl.class.equals(reference)) {
+ return (T) feed(input);
+ } else if (AtomEntryImpl.class.equals(reference)) {
+ return (T) entry(input);
+ } else if (AtomPropertyImpl.class.equals(reference)) {
+ return (T) property(input);
+ } else if (XMLLinkCollectionImpl.class.equals(reference)) {
+ return (T) linkCollection(input);
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomEntryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomEntryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomEntryImpl.java
new file mode 100644
index 0000000..8eef97a
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomEntryImpl.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.commons.core.data;
+
+public class AtomEntryImpl extends AbstractEntry {
+
+ private static final long serialVersionUID = 6973729343868293279L;
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java
new file mode 100644
index 0000000..d40f945
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+
+/**
+ * List of entries, represented via Atom.
+ *
+ * @see AtomEntry
+ */
+public class AtomFeedImpl extends AbstractAtomObject implements Feed {
+
+ private static final long serialVersionUID = 5466590540021319153L;
+
+ private Integer count;
+
+ private final List<Entry> entries = new ArrayList<Entry>();
+
+ private URI next;
+
+ @Override
+ public void setCount(final Integer count) {
+ this.count = count;
+ }
+
+ @Override
+ public Integer getCount() {
+ return count;
+ }
+
+ @Override
+ public List<Entry> getEntries() {
+ return entries;
+ }
+
+ @Override
+ public void setNext(final URI next) {
+ this.next = next;
+ }
+
+ @Override
+ public URI getNext() {
+ return next;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java
new file mode 100644
index 0000000..458e4cc
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java
@@ -0,0 +1,261 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.GeoUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
+
+class AtomGeoValueDeserializer {
+
+ private List<Point> points(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+
+ final List<Point> result = new ArrayList<Point>();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ final String[] pointInfo = event.asCharacters().getData().split(" ");
+
+ final Point point = new Point(GeoUtils.getDimension(type), crs);
+ try {
+ point.setX(EdmDouble.getInstance().valueOfString(pointInfo[0], null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ point.setY(EdmDouble.getInstance().valueOfString(pointInfo[1], null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new XMLStreamException("While deserializing point coordinates as double", e);
+ }
+ result.add(point);
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return result;
+ }
+
+ private MultiPoint multipoint(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+
+ List<Point> points = Collections.<Point>emptyList();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_POINTMEMBERS)) {
+ points = points(reader, event.asStartElement(), type, null);
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return new MultiPoint(GeoUtils.getDimension(type), crs, points);
+ }
+
+ private LineString lineString(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+
+ return new LineString(GeoUtils.getDimension(type), crs, points(reader, start, type, null));
+ }
+
+ private Polygon polygon(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+
+ List<Point> extPoints = null;
+ List<Point> intPoints = null;
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (event.asStartElement().getName().equals(Constants.QNAME_POLYGON_EXTERIOR)) {
+ extPoints = points(reader, event.asStartElement(), type, null);
+ }
+ if (event.asStartElement().getName().equals(Constants.QNAME_POLYGON_INTERIOR)) {
+ intPoints = points(reader, event.asStartElement(), type, null);
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints);
+ }
+
+ private MultiLineString multiLineString(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+
+ final List<LineString> lineStrings = new ArrayList<LineString>();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_LINESTRING)) {
+ lineStrings.add(lineString(reader, event.asStartElement(), type, null));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return new MultiLineString(GeoUtils.getDimension(type), crs, lineStrings);
+ }
+
+ private MultiPolygon multiPolygon(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+
+ final List<Polygon> polygons = new ArrayList<Polygon>();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_POLYGON)) {
+ polygons.add(polygon(reader, event.asStartElement(), type, null));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return new MultiPolygon(GeoUtils.getDimension(type), crs, polygons);
+ }
+
+ private GeospatialCollection collection(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+
+ final List<Geospatial> geospatials = new ArrayList<Geospatial>();
+
+ boolean foundEndCollection = false;
+ while (reader.hasNext() && !foundEndCollection) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_GEOMEMBERS)) {
+ boolean foundEndMembers = false;
+ while (reader.hasNext() && !foundEndMembers) {
+ final XMLEvent subevent = reader.nextEvent();
+
+ if (subevent.isStartElement()) {
+ geospatials.add(deserialize(reader, subevent.asStartElement(),
+ GeoUtils.getType(GeoUtils.getDimension(type), subevent.asStartElement().getName().getLocalPart())));
+ }
+
+ if (subevent.isEndElement() && Constants.QNAME_GEOMEMBERS.equals(subevent.asEndElement().getName())) {
+ foundEndMembers = true;
+ }
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndCollection = true;
+ }
+ }
+
+ return new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials);
+ }
+
+ public Geospatial deserialize(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type) throws XMLStreamException {
+
+ String crs = null;
+ final Attribute srsName = start.getAttributeByName(Constants.QNAME_ATTR_SRSNAME);
+ if (srsName != null) {
+ crs = StringUtils.substringAfterLast(srsName.getValue(), "/");
+ }
+
+ Geospatial value;
+
+ switch (type) {
+ case GeographyPoint:
+ case GeometryPoint:
+ value = points(reader, start, type, crs).get(0);
+ break;
+
+ case GeographyMultiPoint:
+ case GeometryMultiPoint:
+ value = multipoint(reader, start, type, crs);
+ break;
+
+ case GeographyLineString:
+ case GeometryLineString:
+ value = lineString(reader, start, type, crs);
+ break;
+
+ case GeographyMultiLineString:
+ case GeometryMultiLineString:
+ value = multiLineString(reader, start, type, crs);
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ value = polygon(reader, start, type, crs);
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ value = multiPolygon(reader, start, type, crs);
+ break;
+
+ case GeographyCollection:
+ case GeometryCollection:
+ value = collection(reader, start, type, crs);
+ break;
+
+ default:
+ value = null;
+ }
+
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java
new file mode 100644
index 0000000..624bcfa
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import java.util.Collections;
+import java.util.Iterator;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
+
+class AtomGeoValueSerializer {
+
+ private void points(final XMLStreamWriter writer, final Iterator<Point> itor, final boolean wrap)
+ throws XMLStreamException {
+
+ while (itor.hasNext()) {
+ final Point point = itor.next();
+
+ if (wrap) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINT, Constants.NS_GML);
+ }
+
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POS, Constants.NS_GML);
+ try {
+ writer.writeCharacters(EdmDouble.getInstance().valueToString(point.getX(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ + " "
+ + EdmDouble.getInstance().valueToString(point.getY(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new XMLStreamException("While serializing point coordinates as double", e);
+ }
+ writer.writeEndElement();
+
+ if (wrap) {
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ private void lineStrings(final XMLStreamWriter writer, final Iterator<LineString> itor, final boolean wrap)
+ throws XMLStreamException {
+
+ while (itor.hasNext()) {
+ final LineString lineString = itor.next();
+
+ if (wrap) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRING, Constants.NS_GML);
+ }
+
+ points(writer, lineString.iterator(), false);
+
+ if (wrap) {
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ private void polygons(final XMLStreamWriter writer, final Iterator<Polygon> itor, final boolean wrap)
+ throws XMLStreamException {
+
+ while (itor.hasNext()) {
+ final Polygon polygon = itor.next();
+
+ if (wrap) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON, Constants.NS_GML);
+ }
+
+ if (!polygon.getExterior().isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_EXTERIOR, Constants.NS_GML);
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_LINEARRING, Constants.NS_GML);
+
+ points(writer, polygon.getExterior().iterator(), false);
+
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+ if (!polygon.getInterior().isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_INTERIOR, Constants.NS_GML);
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_LINEARRING, Constants.NS_GML);
+
+ points(writer, polygon.getInterior().iterator(), false);
+
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+
+ if (wrap) {
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ private void writeSrsName(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
+ if (value.getCrs() != null) {
+ writer.writeAttribute(Constants.PREFIX_GML, Constants.NS_GML, Constants.ATTR_SRSNAME,
+ Constants.SRS_URLPREFIX + value.getCrs());
+ }
+ }
+
+ public void serialize(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
+ switch (value.getEdmPrimitiveTypeKind()) {
+ case GeographyPoint:
+ case GeometryPoint:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINT, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ points(writer, Collections.singleton((Point) value).iterator(), false);
+
+ writer.writeEndElement();
+ break;
+
+ case GeometryMultiPoint:
+ case GeographyMultiPoint:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTIPOINT, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ if (!((MultiPoint) value).isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINTMEMBERS, Constants.NS_GML);
+ points(writer, ((MultiPoint) value).iterator(), true);
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ break;
+
+ case GeometryLineString:
+ case GeographyLineString:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRING, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ lineStrings(writer, Collections.singleton((LineString) value).iterator(), false);
+
+ writer.writeEndElement();
+ break;
+
+ case GeometryMultiLineString:
+ case GeographyMultiLineString:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTILINESTRING, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ if (!((MultiLineString) value).isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRINGMEMBERS, Constants.NS_GML);
+ lineStrings(writer, ((MultiLineString) value).iterator(), true);
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ polygons(writer, Collections.singleton(((Polygon) value)).iterator(), false);
+
+ writer.writeEndElement();
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTIPOLYGON, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ if (!((MultiPolygon) value).isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_SURFACEMEMBERS, Constants.NS_GML);
+ polygons(writer, ((MultiPolygon) value).iterator(), true);
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ break;
+
+ case GeographyCollection:
+ case GeometryCollection:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_GEOCOLLECTION, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ if (!((GeospatialCollection) value).isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_GEOMEMBERS, Constants.NS_GML);
+ for (final Iterator<Geospatial> itor = ((GeospatialCollection) value).iterator(); itor.hasNext();) {
+ serialize(writer, itor.next());
+ }
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ break;
+
+ default:
+ }
+ }
+
+}
[49/52] [abbrv] git commit: Setting UTF-8 encoding for running unit
tests
Posted by sk...@apache.org.
Setting UTF-8 encoding for running unit tests
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/dfb1ea05
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/dfb1ea05
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/dfb1ea05
Branch: refs/heads/olingo-206-validator
Commit: dfb1ea0596021e4a668224e59fa3f5047baeb2db
Parents: f0edb50
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 24 12:47:11 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 24 12:47:11 2014 +0100
----------------------------------------------------------------------
pom.xml | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dfb1ea05/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5915d5e..ee34da5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -296,6 +296,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.16</version>
+ <configuration>
+ <encoding>utf-8</encoding>
+ <runOrder>alphabetical</runOrder>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.16</version>
<configuration>
[50/52] [abbrv] git commit: Adding sourceEncoding to POM
Posted by sk...@apache.org.
Adding sourceEncoding to POM
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/81da510e
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/81da510e
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/81da510e
Branch: refs/heads/olingo-206-validator
Commit: 81da510e6a67d561b81909efb4c48ff85ad88cb9
Parents: dfb1ea0
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 24 12:52:07 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 24 12:52:07 2014 +0100
----------------------------------------------------------------------
pom.xml | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/81da510e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ee34da5..82a3967 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,6 +89,8 @@
<cargo.log>${log.directory}/cargo.log</cargo.log>
<cargo.output>${log.directory}/cargo-output.log</cargo.output>
<tomcat.version>7.0.52</tomcat.version>
+
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
[09/52] [abbrv] git commit: Consistently using package name to
differentiate V3 and V4
Posted by sk...@apache.org.
Consistently using package name to differentiate V3 and V4
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/bab03624
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/bab03624
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/bab03624
Branch: refs/heads/olingo-206-validator
Commit: bab0362401a2b76724b483942c705c986f5570e6
Parents: be73bf6
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Mar 20 14:37:37 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Mar 20 14:37:37 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/CommonConfiguration.java | 184 +++++++++++++++
.../olingo/client/api/CommonODataClient.java | 76 +++++++
.../apache/olingo/client/api/Configuration.java | 184 ---------------
.../apache/olingo/client/api/ODataClient.java | 76 -------
.../apache/olingo/client/api/ODataV3Client.java | 58 -----
.../apache/olingo/client/api/ODataV4Client.java | 58 -----
.../client/api/UnsupportedInV3Exception.java | 31 ---
.../olingo/client/api/V3Configuration.java | 44 ----
.../olingo/client/api/V4Configuration.java | 24 --
.../request/batch/BatchRequestFactory.java | 35 ---
.../batch/CommonBatchRequestFactory.java | 35 +++
.../request/batch/V3BatchRequestFactory.java | 22 --
.../request/batch/V4BatchRequestFactory.java | 22 --
.../request/batch/v3/BatchRequestFactory.java | 24 ++
.../request/batch/v4/BatchRequestFactory.java | 24 ++
.../request/cud/CUDRequestFactory.java | 145 ------------
.../request/cud/CommonCUDRequestFactory.java | 145 ++++++++++++
.../request/cud/V3CUDRequestFactory.java | 22 --
.../request/cud/V4CUDRequestFactory.java | 22 --
.../request/cud/v3/CUDRequestFactory.java | 24 ++
.../request/cud/v4/CUDRequestFactory.java | 24 ++
.../invoke/CommonInvokeRequestFactory.java | 58 +++++
.../request/invoke/InvokeRequestFactory.java | 58 -----
.../request/invoke/V3InvokeRequestFactory.java | 24 --
.../request/invoke/V4InvokeRequestFactory.java | 24 --
.../request/invoke/v3/InvokeRequestFactory.java | 25 +++
.../request/invoke/v4/InvokeRequestFactory.java | 25 +++
.../retrieve/CommonRetrieveRequestFactory.java | 105 +++++++++
.../retrieve/ODataLinkCollectionRequest.java | 28 ---
.../retrieve/RetrieveRequestFactory.java | 105 ---------
.../retrieve/V3RetrieveRequestFactory.java | 33 ---
.../retrieve/V4RetrieveRequestFactory.java | 22 --
.../retrieve/v3/ODataLinkCollectionRequest.java | 29 +++
.../retrieve/v3/RetrieveRequestFactory.java | 34 +++
.../retrieve/v4/RetrieveRequestFactory.java | 24 ++
.../streamed/CommonStreamedRequestFactory.java | 62 +++++
.../streamed/StreamedRequestFactory.java | 62 -----
.../streamed/V3StreamedRequestFactory.java | 22 --
.../streamed/V4StreamedRequestFactory.java | 22 --
.../streamed/v3/StreamedRequestFactory.java | 24 ++
.../streamed/v4/StreamedRequestFactory.java | 24 ++
.../olingo/client/api/data/LinkCollection.java | 52 -----
.../client/api/data/v3/LinkCollection.java | 52 +++++
.../api/domain/ODataEntitySetIterator.java | 8 +-
.../client/api/domain/ODataGeospatialValue.java | 6 +-
.../client/api/domain/ODataLinkCollection.java | 100 ---------
.../client/api/domain/ODataPrimitiveValue.java | 12 +-
.../api/domain/v3/ODataLinkCollection.java | 100 +++++++++
.../olingo/client/api/op/CommonODataBinder.java | 132 +++++++++++
.../client/api/op/CommonODataDeserializer.java | 84 +++++++
.../olingo/client/api/op/CommonODataReader.java | 104 +++++++++
.../olingo/client/api/op/ODataBinder.java | 142 ------------
.../olingo/client/api/op/ODataDeserializer.java | 94 --------
.../olingo/client/api/op/ODataReader.java | 114 ----------
.../client/api/op/ODataV3Deserializer.java | 31 ---
.../client/api/op/ODataV4Deserializer.java | 30 ---
.../olingo/client/api/op/v3/ODataBinder.java | 35 +++
.../client/api/op/v3/ODataDeserializer.java | 37 +++
.../olingo/client/api/op/v3/ODataReader.java | 37 +++
.../olingo/client/api/op/v4/ODataBinder.java | 25 +++
.../client/api/op/v4/ODataDeserializer.java | 31 +++
.../olingo/client/api/op/v4/ODataReader.java | 25 +++
.../client/api/uri/CommonFilterArgFactory.java | 83 +++++++
.../client/api/uri/CommonFilterFactory.java | 61 +++++
.../olingo/client/api/uri/CommonURIBuilder.java | 224 ++++++++++++++++++
.../apache/olingo/client/api/uri/FilterArg.java | 30 +++
.../olingo/client/api/uri/URIBuilder.java | 225 -------------------
.../apache/olingo/client/api/uri/URIFilter.java | 32 +++
.../olingo/client/api/uri/V3URIBuilder.java | 47 ----
.../olingo/client/api/uri/V4URIBuilder.java | 87 -------
.../olingo/client/api/uri/filter/FilterArg.java | 30 ---
.../client/api/uri/filter/FilterArgFactory.java | 83 -------
.../client/api/uri/filter/FilterFactory.java | 61 -----
.../olingo/client/api/uri/filter/URIFilter.java | 32 ---
.../api/uri/filter/V3FilterArgFactory.java | 25 ---
.../client/api/uri/filter/V3FilterFactory.java | 26 ---
.../api/uri/filter/V4FilterArgFactory.java | 55 -----
.../client/api/uri/filter/V4FilterFactory.java | 32 ---
.../client/api/uri/v3/FilterArgFactory.java | 28 +++
.../olingo/client/api/uri/v3/FilterFactory.java | 28 +++
.../olingo/client/api/uri/v3/URIBuilder.java | 49 ++++
.../client/api/uri/v4/FilterArgFactory.java | 59 +++++
.../olingo/client/api/uri/v4/FilterFactory.java | 35 +++
.../olingo/client/api/uri/v4/URIBuilder.java | 89 ++++++++
.../olingo/client/api/utils/URIUtils.java | 4 +-
.../olingo/client/api/v3/Configuration.java | 46 ++++
.../olingo/client/api/v3/ODataClient.java | 67 ++++++
.../client/api/v3/UnsupportedInV3Exception.java | 31 +++
.../olingo/client/api/v4/Configuration.java | 26 +++
.../olingo/client/api/v4/ODataClient.java | 67 ++++++
.../client/core/AbstractConfiguration.java | 4 +-
.../olingo/client/core/AbstractODataClient.java | 4 +-
.../olingo/client/core/ODataClientFactory.java | 11 +-
.../olingo/client/core/ODataV3ClientImpl.java | 149 ------------
.../olingo/client/core/ODataV4ClientImpl.java | 148 ------------
.../olingo/client/core/V3ConfigurationImpl.java | 57 -----
.../olingo/client/core/V4ConfigurationImpl.java | 31 ---
.../org/apache/olingo/client/core/Wrapper.java | 41 ----
.../request/AbstractODataBasicRequest.java | 4 +-
.../request/AbstractODataStreamManager.java | 1 -
.../communication/request/ODataRequestImpl.java | 10 +-
.../core/communication/request/Wrapper.java | 41 ++++
.../batch/AbstractBatchRequestFactory.java | 10 +-
.../request/batch/ODataBatchRequestImpl.java | 4 +-
.../batch/V3BatchRequestFactoryImpl.java | 32 ---
.../batch/V4BatchRequestFactoryImpl.java | 32 ---
.../batch/v3/BatchRequestFactoryImpl.java | 33 +++
.../batch/v4/BatchRequestFactoryImpl.java | 33 +++
.../request/cud/AbstractCUDRequestFactory.java | 10 +-
.../request/cud/ODataDeleteRequestImpl.java | 4 +-
.../cud/ODataEntityCreateRequestImpl.java | 4 +-
.../cud/ODataEntityUpdateRequestImpl.java | 4 +-
.../request/cud/ODataLinkCreateRequestImpl.java | 4 +-
.../request/cud/ODataLinkUpdateRequestImpl.java | 4 +-
.../cud/ODataPropertyUpdateRequestImpl.java | 4 +-
.../cud/ODataValueUpdateRequestImpl.java | 4 +-
.../request/cud/V3CUDRequestFactoryImpl.java | 32 ---
.../request/cud/V4CUDRequestFactoryImpl.java | 32 ---
.../request/cud/v3/CUDRequestFactoryImpl.java | 33 +++
.../request/cud/v4/CUDRequestFactoryImpl.java | 33 +++
.../invoke/AbstractInvokeRequestFactory.java | 11 +-
.../request/invoke/ODataInvokeRequestImpl.java | 6 +-
.../invoke/V3InvokeRequestFactoryImpl.java | 89 --------
.../invoke/V4InvokeRequestFactoryImpl.java | 43 ----
.../invoke/v3/InvokeRequestFactoryImpl.java | 91 ++++++++
.../invoke/v4/InvokeRequestFactoryImpl.java | 44 ++++
.../retrieve/AbstractODataRetrieveRequest.java | 9 +-
.../AbstractRetrieveRequestFactory.java | 10 +-
.../retrieve/ODataEntityRequestImpl.java | 4 +-
.../ODataEntitySetIteratorRequestImpl.java | 4 +-
.../retrieve/ODataEntitySetRequestImpl.java | 4 +-
.../ODataLinkCollectionRequestImpl.java | 98 --------
.../request/retrieve/ODataMediaRequestImpl.java | 4 +-
.../retrieve/ODataMetadataRequestImpl.java | 4 +-
.../retrieve/ODataPropertyRequestImpl.java | 4 +-
.../request/retrieve/ODataRawRequestImpl.java | 4 +-
.../ODataServiceDocumentRequestImpl.java | 4 +-
.../request/retrieve/ODataValueRequestImpl.java | 4 +-
.../retrieve/V3RetrieveRequestFactoryImpl.java | 39 ----
.../retrieve/V4RetrieveRequestFactoryImpl.java | 32 ---
.../v3/ODataLinkCollectionRequestImpl.java | 99 ++++++++
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 41 ++++
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 33 +++
.../AbstractODataStreamedEntityRequest.java | 4 +-
.../streamed/AbstractODataStreamedRequest.java | 6 +-
.../AbstractStreamedRequestFactory.java | 10 +-
.../ODataMediaEntityCreateRequestImpl.java | 4 +-
.../ODataMediaEntityUpdateRequestImpl.java | 4 +-
.../streamed/ODataStreamUpdateRequestImpl.java | 4 +-
.../streamed/V3StreamedRequestFactoryImpl.java | 32 ---
.../streamed/V4StreamedRequestFactoryImpl.java | 32 ---
.../streamed/v3/StreamedRequestFactoryImpl.java | 33 +++
.../streamed/v4/StreamedRequestFactoryImpl.java | 33 +++
.../client/core/data/AtomDeserializer.java | 1 +
.../core/data/JSONLinkCollectionImpl.java | 117 ----------
.../core/data/ODataJacksonDeserializer.java | 6 +-
.../core/data/ODataJacksonSerializer.java | 6 +-
.../client/core/data/XMLLinkCollectionImpl.java | 70 ------
.../core/data/v3/JSONLinkCollectionImpl.java | 118 ++++++++++
.../core/data/v3/XMLLinkCollectionImpl.java | 70 ++++++
.../olingo/client/core/edm/EdmClientImpl.java | 12 +-
.../client/core/edm/EdmEntityContainerImpl.java | 2 +-
.../core/edm/v3/EdmServiceMetadataImpl.java | 6 +-
.../client/core/edm/v3/FunctionImportUtils.java | 36 +++
.../core/edm/v3/V3FunctionImportUtils.java | 36 ---
.../core/op/impl/AbstractEdmDeserializer.java | 6 +-
.../core/op/impl/AbstractJacksonTool.java | 12 +-
.../core/op/impl/AbstractODataBinder.java | 19 +-
.../core/op/impl/AbstractODataDeserializer.java | 18 +-
.../core/op/impl/AbstractODataReader.java | 19 +-
.../core/op/impl/AbstractODataSerializer.java | 4 +-
.../core/op/impl/ODataObjectFactoryImpl.java | 6 +-
.../client/core/op/impl/ODataV3BinderImpl.java | 30 ---
.../core/op/impl/ODataV3DeserializerImpl.java | 56 -----
.../client/core/op/impl/ODataV3ReaderImpl.java | 47 ----
.../core/op/impl/ODataV3SerializerImpl.java | 31 ---
.../client/core/op/impl/ODataV4BinderImpl.java | 57 -----
.../core/op/impl/ODataV4DeserializerImpl.java | 57 -----
.../client/core/op/impl/ODataV4ReaderImpl.java | 47 ----
.../core/op/impl/ODataV4SerializerImpl.java | 31 ---
.../client/core/op/impl/ODataWriterImpl.java | 6 +-
.../client/core/op/impl/v3/ODataBinderImpl.java | 42 ++++
.../core/op/impl/v3/ODataDeserializerImpl.java | 67 ++++++
.../client/core/op/impl/v3/ODataReaderImpl.java | 66 ++++++
.../core/op/impl/v3/ODataSerializerImpl.java | 32 +++
.../client/core/op/impl/v4/ODataBinderImpl.java | 59 +++++
.../core/op/impl/v4/ODataDeserializerImpl.java | 58 +++++
.../client/core/op/impl/v4/ODataReaderImpl.java | 49 ++++
.../core/op/impl/v4/ODataSerializerImpl.java | 32 +++
.../core/uri/AbstractComparingFilter.java | 45 ++++
.../core/uri/AbstractFilterArgFactory.java | 178 +++++++++++++++
.../client/core/uri/AbstractFilterFactory.java | 108 +++++++++
.../client/core/uri/AbstractURIBuilder.java | 8 +-
.../olingo/client/core/uri/AndFilter.java | 42 ++++
.../apache/olingo/client/core/uri/EqFilter.java | 33 +++
.../olingo/client/core/uri/FilterConst.java | 40 ++++
.../olingo/client/core/uri/FilterFunction.java | 48 ++++
.../olingo/client/core/uri/FilterLambda.java | 46 ++++
.../olingo/client/core/uri/FilterLiteral.java | 41 ++++
.../apache/olingo/client/core/uri/FilterOp.java | 45 ++++
.../olingo/client/core/uri/FilterProperty.java | 40 ++++
.../apache/olingo/client/core/uri/GeFilter.java | 33 +++
.../apache/olingo/client/core/uri/GtFilter.java | 33 +++
.../olingo/client/core/uri/HasFilter.java | 34 +++
.../apache/olingo/client/core/uri/LeFilter.java | 33 +++
.../apache/olingo/client/core/uri/LtFilter.java | 33 +++
.../olingo/client/core/uri/MatchFilter.java | 36 +++
.../apache/olingo/client/core/uri/NeFilter.java | 33 +++
.../olingo/client/core/uri/NotFilter.java | 35 +++
.../apache/olingo/client/core/uri/OrFilter.java | 42 ++++
.../client/core/uri/V3URIBuilderImpl.java | 95 --------
.../client/core/uri/V4URIBuilderImpl.java | 101 ---------
.../uri/filter/AbstractComparingFilter.java | 45 ----
.../uri/filter/AbstractFilterArgFactory.java | 178 ---------------
.../core/uri/filter/AbstractFilterFactory.java | 108 ---------
.../client/core/uri/filter/AndFilter.java | 42 ----
.../olingo/client/core/uri/filter/EqFilter.java | 33 ---
.../client/core/uri/filter/FilterConst.java | 40 ----
.../client/core/uri/filter/FilterFunction.java | 48 ----
.../client/core/uri/filter/FilterLambda.java | 46 ----
.../client/core/uri/filter/FilterLiteral.java | 41 ----
.../olingo/client/core/uri/filter/FilterOp.java | 45 ----
.../client/core/uri/filter/FilterProperty.java | 40 ----
.../olingo/client/core/uri/filter/GeFilter.java | 33 ---
.../olingo/client/core/uri/filter/GtFilter.java | 33 ---
.../client/core/uri/filter/HasFilter.java | 34 ---
.../olingo/client/core/uri/filter/LeFilter.java | 33 ---
.../olingo/client/core/uri/filter/LtFilter.java | 33 ---
.../client/core/uri/filter/MatchFilter.java | 36 ---
.../olingo/client/core/uri/filter/NeFilter.java | 33 ---
.../client/core/uri/filter/NotFilter.java | 35 ---
.../olingo/client/core/uri/filter/OrFilter.java | 42 ----
.../core/uri/filter/V3FilterArgFactoryImpl.java | 31 ---
.../core/uri/filter/V3FilterFactoryImpl.java | 33 ---
.../core/uri/filter/V4FilterArgFactoryImpl.java | 107 ---------
.../core/uri/filter/V4FilterFactoryImpl.java | 46 ----
.../core/uri/v3/FilterArgFactoryImpl.java | 33 +++
.../client/core/uri/v3/FilterFactoryImpl.java | 34 +++
.../client/core/uri/v3/URIBuilderImpl.java | 96 ++++++++
.../core/uri/v4/FilterArgFactoryImpl.java | 110 +++++++++
.../client/core/uri/v4/FilterFactoryImpl.java | 49 ++++
.../client/core/uri/v4/URIBuilderImpl.java | 102 +++++++++
.../client/core/v3/ConfigurationImpl.java | 58 +++++
.../olingo/client/core/v3/ODataClientImpl.java | 150 +++++++++++++
.../client/core/v4/ConfigurationImpl.java | 32 +++
.../olingo/client/core/v4/ODataClientImpl.java | 149 ++++++++++++
.../apache/olingo/client/core/AbstractTest.java | 10 +-
.../olingo/client/core/ODataClientTest.java | 4 +-
.../core/it/AbstractMetadataTestITCase.java | 4 +-
.../client/core/it/AbstractTestITCase.java | 11 +-
.../client/core/it/v3/AbstractTestITCase.java | 52 +++++
.../client/core/it/v3/AbstractV3TestITCase.java | 53 -----
.../core/it/v3/ActionOverloadingTestITCase.java | 2 +-
.../client/core/it/v3/AsyncTestITCase.java | 8 +-
.../client/core/it/v3/BatchTestITCase.java | 2 +-
.../client/core/it/v3/CountTestITCase.java | 8 +-
.../core/it/v3/EntityCreateTestITCase.java | 12 +-
.../core/it/v3/EntityRetrieveTestITCase.java | 16 +-
.../client/core/it/v3/EntitySetTestITCase.java | 10 +-
.../core/it/v3/EntityUpdateTestITCase.java | 2 +-
.../client/core/it/v3/ErrorTestITCase.java | 16 +-
.../core/it/v3/FilterFactoryTestITCase.java | 16 +-
.../client/core/it/v3/FilterTestITCase.java | 6 +-
.../client/core/it/v3/InvokeTestITCase.java | 2 +-
.../core/it/v3/KeyAsSegmentTestITCase.java | 6 +-
.../client/core/it/v3/LinkTestITCase.java | 16 +-
.../core/it/v3/MediaEntityTestITCase.java | 16 +-
.../client/core/it/v3/MetadataTestITCase.java | 4 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 12 +-
.../client/core/it/v3/OpenTypeTestITCase.java | 6 +-
.../core/it/v3/PrimitiveKeysTestITCase.java | 2 +-
.../core/it/v3/PropertyRetrieveTestITCase.java | 12 +-
.../client/core/it/v3/PropertyTestITCase.java | 16 +-
.../core/it/v3/PropertyValueTestITCase.java | 24 +-
.../core/it/v3/QueryOptionsTestITCase.java | 18 +-
.../v3/ServiceDocumentRetrieveTestITCase.java | 2 +-
.../core/it/v3/ServiceDocumentTestITCase.java | 2 +-
.../client/core/it/v4/AbstractTestITCase.java | 52 +++++
.../client/core/it/v4/AbstractV4TestITCase.java | 53 -----
.../client/core/it/v4/MetadataTestITCase.java | 4 +-
.../apache/olingo/client/core/v3/AtomTest.java | 4 +-
.../olingo/client/core/v3/EntitySetTest.java | 4 +-
.../olingo/client/core/v3/EntityTest.java | 4 +-
.../apache/olingo/client/core/v3/ErrorTest.java | 4 +-
.../client/core/v3/FilterFactoryTest.java | 14 +-
.../olingo/client/core/v3/MetadataTest.java | 4 +-
.../client/core/v3/PrimitiveValueTest.java | 4 +-
.../client/core/v3/ServiceDocumentTest.java | 4 +-
.../olingo/client/core/v3/URIBuilderTest.java | 18 +-
.../client/core/v4/FilterFactoryTest.java | 14 +-
.../olingo/client/core/v4/MetadataTest.java | 4 +-
.../client/core/v4/PrimitiveValueTest.java | 4 +-
.../client/core/v4/ServiceDocumentTest.java | 4 +-
.../olingo/client/core/v4/URIBuilderTest.java | 22 +-
294 files changed, 5983 insertions(+), 5783 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java
new file mode 100644
index 0000000..48f2614
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api;
+
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.format.ODataMediaFormat;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.client.api.http.HttpClientFactory;
+import org.apache.olingo.client.api.http.HttpUriRequestFactory;
+
+import java.io.Serializable;
+import java.util.concurrent.ExecutorService;
+
+/**
+ * Configuration wrapper.
+ */
+public interface CommonConfiguration 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 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/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
new file mode 100644
index 0000000..d0aef17
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.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.client.api;
+
+import org.apache.olingo.client.api.communication.header.ODataHeaders;
+import org.apache.olingo.client.api.communication.request.batch.CommonBatchRequestFactory;
+import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory;
+import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
+import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
+import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
+import org.apache.olingo.client.api.domain.ODataGeospatialValue;
+import org.apache.olingo.client.api.domain.ODataObjectFactory;
+import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.client.api.op.CommonODataBinder;
+import org.apache.olingo.client.api.op.CommonODataDeserializer;
+import org.apache.olingo.client.api.op.CommonODataReader;
+import org.apache.olingo.client.api.op.ODataSerializer;
+import org.apache.olingo.client.api.op.ODataWriter;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.api.uri.CommonFilterFactory;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public interface CommonODataClient {
+
+ ODataServiceVersion getServiceVersion();
+
+ ODataHeaders getVersionHeaders();
+
+ CommonConfiguration getConfiguration();
+
+ CommonURIBuilder<?> getURIBuilder(String serviceRoot);
+
+ CommonFilterFactory getFilterFactory();
+
+ ODataPrimitiveValue.Builder getPrimitiveValueBuilder();
+
+ ODataGeospatialValue.Builder getGeospatialValueBuilder();
+
+ ODataSerializer getSerializer();
+
+ CommonODataDeserializer getDeserializer();
+
+ CommonODataReader getReader();
+
+ ODataWriter getWriter();
+
+ CommonODataBinder getBinder();
+
+ ODataObjectFactory getObjectFactory();
+
+ CommonRetrieveRequestFactory getRetrieveRequestFactory();
+
+ CommonCUDRequestFactory getCUDRequestFactory();
+
+ CommonStreamedRequestFactory getStreamedRequestFactory();
+
+ CommonInvokeRequestFactory<?> getInvokeRequestFactory();
+
+ CommonBatchRequestFactory getBatchRequestFactory();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/Configuration.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/Configuration.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/Configuration.java
deleted file mode 100644
index 20d1fa6..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/Configuration.java
+++ /dev/null
@@ -1,184 +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.client.api;
-
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataMediaFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.format.ODataValueFormat;
-import org.apache.olingo.client.api.http.HttpClientFactory;
-import org.apache.olingo.client.api.http.HttpUriRequestFactory;
-
-import java.io.Serializable;
-import java.util.concurrent.ExecutorService;
-
-/**
- * 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 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/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java
deleted file mode 100644
index 459ee10..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java
+++ /dev/null
@@ -1,76 +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.client.api;
-
-import org.apache.olingo.client.api.communication.header.ODataHeaders;
-import org.apache.olingo.client.api.communication.request.batch.BatchRequestFactory;
-import org.apache.olingo.client.api.communication.request.cud.CUDRequestFactory;
-import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory;
-import org.apache.olingo.client.api.communication.request.retrieve.RetrieveRequestFactory;
-import org.apache.olingo.client.api.communication.request.streamed.StreamedRequestFactory;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
-import org.apache.olingo.client.api.domain.ODataObjectFactory;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.op.ODataBinder;
-import org.apache.olingo.client.api.op.ODataDeserializer;
-import org.apache.olingo.client.api.op.ODataReader;
-import org.apache.olingo.client.api.op.ODataSerializer;
-import org.apache.olingo.client.api.op.ODataWriter;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.api.uri.filter.FilterFactory;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-public interface ODataClient {
-
- ODataServiceVersion getServiceVersion();
-
- ODataHeaders getVersionHeaders();
-
- Configuration getConfiguration();
-
- URIBuilder<?> getURIBuilder(String serviceRoot);
-
- FilterFactory getFilterFactory();
-
- ODataPrimitiveValue.Builder getPrimitiveValueBuilder();
-
- ODataGeospatialValue.Builder getGeospatialValueBuilder();
-
- ODataSerializer getSerializer();
-
- ODataDeserializer getDeserializer();
-
- 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/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataV3Client.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataV3Client.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataV3Client.java
deleted file mode 100644
index b63617d..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataV3Client.java
+++ /dev/null
@@ -1,58 +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.client.api;
-
-import org.apache.olingo.client.api.communication.request.batch.V3BatchRequestFactory;
-import org.apache.olingo.client.api.communication.request.cud.V3CUDRequestFactory;
-import org.apache.olingo.client.api.communication.request.invoke.V3InvokeRequestFactory;
-import org.apache.olingo.client.api.communication.request.retrieve.V3RetrieveRequestFactory;
-import org.apache.olingo.client.api.communication.request.streamed.V3StreamedRequestFactory;
-import org.apache.olingo.client.api.op.ODataV3Deserializer;
-import org.apache.olingo.client.api.uri.V3URIBuilder;
-import org.apache.olingo.client.api.uri.filter.V3FilterFactory;
-
-public interface ODataV3Client extends ODataClient {
-
- @Override
- V3Configuration getConfiguration();
-
- @Override
- V3URIBuilder getURIBuilder(String serviceRoot);
-
- @Override
- V3FilterFactory getFilterFactory();
-
- @Override
- ODataV3Deserializer getDeserializer();
-
- @Override
- V3RetrieveRequestFactory getRetrieveRequestFactory();
-
- @Override
- V3CUDRequestFactory getCUDRequestFactory();
-
- @Override
- V3StreamedRequestFactory getStreamedRequestFactory();
-
- @Override
- V3InvokeRequestFactory getInvokeRequestFactory();
-
- @Override
- V3BatchRequestFactory getBatchRequestFactory();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataV4Client.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataV4Client.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataV4Client.java
deleted file mode 100644
index fac0f00..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataV4Client.java
+++ /dev/null
@@ -1,58 +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.client.api;
-
-import org.apache.olingo.client.api.communication.request.batch.V4BatchRequestFactory;
-import org.apache.olingo.client.api.communication.request.cud.V4CUDRequestFactory;
-import org.apache.olingo.client.api.communication.request.invoke.V4InvokeRequestFactory;
-import org.apache.olingo.client.api.communication.request.retrieve.V4RetrieveRequestFactory;
-import org.apache.olingo.client.api.communication.request.streamed.V4StreamedRequestFactory;
-import org.apache.olingo.client.api.op.ODataV4Deserializer;
-import org.apache.olingo.client.api.uri.V4URIBuilder;
-import org.apache.olingo.client.api.uri.filter.V4FilterFactory;
-
-public interface ODataV4Client extends ODataClient {
-
- @Override
- V4Configuration getConfiguration();
-
- @Override
- V4URIBuilder getURIBuilder(String serviceRoot);
-
- @Override
- V4FilterFactory getFilterFactory();
-
- @Override
- ODataV4Deserializer getDeserializer();
-
- @Override
- V4RetrieveRequestFactory getRetrieveRequestFactory();
-
- @Override
- V4CUDRequestFactory getCUDRequestFactory();
-
- @Override
- V4StreamedRequestFactory getStreamedRequestFactory();
-
- @Override
- V4InvokeRequestFactory getInvokeRequestFactory();
-
- @Override
- V4BatchRequestFactory getBatchRequestFactory();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/UnsupportedInV3Exception.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/UnsupportedInV3Exception.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/UnsupportedInV3Exception.java
deleted file mode 100644
index 8c29c2d..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/UnsupportedInV3Exception.java
+++ /dev/null
@@ -1,31 +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.client.api;
-
-import org.apache.olingo.commons.api.edm.EdmException;
-
-public class UnsupportedInV3Exception extends EdmException {
-
- private static final long serialVersionUID = 4773734640262424651L;
-
- public UnsupportedInV3Exception() {
- super("Not supported in OData 3.0");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/V3Configuration.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/V3Configuration.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/V3Configuration.java
deleted file mode 100644
index b7f1065..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/V3Configuration.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api;
-
-public interface V3Configuration extends Configuration {
-
- /**
- * Checks whether URIs contain entity key between parentheses (standard) or instead as additional segment.
- * <br/>
- * 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.
- * <br/>
- * 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);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/V4Configuration.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/V4Configuration.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/V4Configuration.java
deleted file mode 100644
index ef6d4ab..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/V4Configuration.java
+++ /dev/null
@@ -1,24 +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.client.api;
-
-public interface V4Configuration extends Configuration {
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchRequestFactory.java
deleted file mode 100644
index 065f3c8..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/BatchRequestFactory.java
+++ /dev/null
@@ -1,35 +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.client.api.communication.request.batch;
-
-import java.io.Serializable;
-
-/**
- * OData batch request factory class.
- */
-public interface BatchRequestFactory extends Serializable {
-
- /**
- * Gets a batch request object instance.
- *
- * @param serviceRoot service root.
- * @return new ODataBatchRequest instance.
- */
- ODataBatchRequest getBatchRequest(String serviceRoot);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonBatchRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonBatchRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonBatchRequestFactory.java
new file mode 100644
index 0000000..4519264
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/CommonBatchRequestFactory.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.client.api.communication.request.batch;
+
+import java.io.Serializable;
+
+/**
+ * OData batch request factory class.
+ */
+public interface CommonBatchRequestFactory extends Serializable {
+
+ /**
+ * Gets a batch request object instance.
+ *
+ * @param serviceRoot service root.
+ * @return new ODataBatchRequest instance.
+ */
+ ODataBatchRequest getBatchRequest(String serviceRoot);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/V3BatchRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/V3BatchRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/V3BatchRequestFactory.java
deleted file mode 100644
index a55e4fa..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/V3BatchRequestFactory.java
+++ /dev/null
@@ -1,22 +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.client.api.communication.request.batch;
-
-public interface V3BatchRequestFactory extends BatchRequestFactory {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/V4BatchRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/V4BatchRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/V4BatchRequestFactory.java
deleted file mode 100644
index 8ec13cf..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/V4BatchRequestFactory.java
+++ /dev/null
@@ -1,22 +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.client.api.communication.request.batch;
-
-public interface V4BatchRequestFactory extends BatchRequestFactory {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/BatchRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/BatchRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/BatchRequestFactory.java
new file mode 100644
index 0000000..f5b5dd5
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v3/BatchRequestFactory.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.client.api.communication.request.batch.v3;
+
+import org.apache.olingo.client.api.communication.request.batch.CommonBatchRequestFactory;
+
+public interface BatchRequestFactory extends CommonBatchRequestFactory {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/BatchRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/BatchRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/BatchRequestFactory.java
new file mode 100644
index 0000000..1ba0b06
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/batch/v4/BatchRequestFactory.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.client.api.communication.request.batch.v4;
+
+import org.apache.olingo.client.api.communication.request.batch.CommonBatchRequestFactory;
+
+public interface BatchRequestFactory extends CommonBatchRequestFactory {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java
deleted file mode 100644
index c7d6bc6..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java
+++ /dev/null
@@ -1,145 +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.client.api.communication.request.cud;
-
-import java.io.Serializable;
-import java.net.URI;
-import org.apache.olingo.client.api.communication.request.UpdateType;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataProperty;
-
-/**
- * OData request factory class.
- */
-public interface CUDRequestFactory extends Serializable {
-
- /**
- * Gets a create request object instance.
- * <br/>
- * Use this kind of request to create a new entity.
- *
- * @param targetURI entity set URI.
- * @param entity entity to be created.
- * @return new ODataEntityCreateRequest instance.
- */
- ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, ODataEntity entity);
-
- /**
- * Gets an update request object instance.
- *
- * @param targetURI edit link of the object to be updated.
- * @param type type of update to be performed.
- * @param changes changes to be applied.
- * @return new ODataEntityUpdateRequest instance.
- */
- ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UpdateType type, ODataEntity changes);
-
- /**
- * Gets an update request object instance; uses entity's edit link as endpoint.
- *
- * @param type type of update to be performed.
- * @param entity changes to be applied.
- * @return new ODataEntityUpdateRequest instance.
- */
- ODataEntityUpdateRequest getEntityUpdateRequest(UpdateType type, ODataEntity entity);
-
- /**
- * Gets a create request object instance.
- * <br/>
- * Use this kind of request to create a new value (e.g. http://Northwind.svc/Customer(1)/Picture/$value).
- *
- * @param targetURI entity set or entity or entity property URI.
- * @param type type of update to be performed.
- * @param value value to be created.
- * @return new ODataValueUpdateRequest instance.
- */
- ODataValueUpdateRequest getValueUpdateRequest(URI targetURI, UpdateType type, ODataPrimitiveValue value);
-
- /**
- * Gets an update request object instance.
- * <br/>
- * Use this kind of request to update a primitive property value.
- *
- * @param targetURI entity set or entity or entity property URI.
- * @param property value to be update.
- * @return new ODataPropertyUpdateRequest instance.
- */
- ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(URI targetURI, ODataProperty property);
-
- /**
- * Gets an update request object instance.
- * <br/>
- * Use this kind of request to update a complex property value.
- *
- * @param targetURI entity set or entity or entity property URI.
- * @param type type of update to be performed.
- * @param property value to be update.
- * @return new ODataPropertyUpdateRequest instance.
- */
- ODataPropertyUpdateRequest getPropertyComplexValueUpdateRequest(
- URI targetURI, UpdateType type, ODataProperty property);
-
- /**
- * Gets an update request object instance.
- * <br/>
- * Use this kind of request to update a collection property value.
- *
- * @param targetURI entity set or entity or entity property URI.
- * @param property value to be update.
- * @return new ODataPropertyUpdateRequest instance.
- */
- ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(URI targetURI, ODataProperty property);
-
- /**
- * Gets an add link request object instance.
- * <br/>
- * Use this kind of request to create a navigation link between existing entities.
- *
- * @param targetURI navigation property's link collection.
- * @param link navigation link to be added.
- * @return new ODataLinkCreateRequest instance.
- */
- ODataLinkCreateRequest getLinkCreateRequest(URI targetURI, ODataLink link);
-
- /**
- * Gets a link update request object instance.
- * <br/>
- * Use this kind of request to update a navigation link between existing entities.
- * <br/>
- * In case of the old navigation link doesn't exist the new one will be added as well.
- *
- * @param targetURI navigation property's link collection.
- * @param type type of update to be performed.
- * @param link URL that identifies the entity to be linked.
- * @return new ODataLinkUpdateRequest instance.
- */
- ODataLinkUpdateRequest getLinkUpdateRequest(URI targetURI, UpdateType type, ODataLink link);
-
- /**
- * Gets a delete request object instance.
- * <br/>
- * Use this kind of request to delete an entity and media entity as well.
- *
- * @param targetURI edit link of the object to be removed.
- * @return new ODataDeleteRequest instance.
- */
- ODataDeleteRequest getDeleteRequest(URI targetURI);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
new file mode 100644
index 0000000..c0f5b2e
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.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.client.api.communication.request.cud;
+
+import java.io.Serializable;
+import java.net.URI;
+import org.apache.olingo.client.api.communication.request.UpdateType;
+import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.client.api.domain.ODataLink;
+import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.client.api.domain.ODataProperty;
+
+/**
+ * OData request factory class.
+ */
+public interface CommonCUDRequestFactory extends Serializable {
+
+ /**
+ * Gets a create request object instance.
+ * <br/>
+ * Use this kind of request to create a new entity.
+ *
+ * @param targetURI entity set URI.
+ * @param entity entity to be created.
+ * @return new ODataEntityCreateRequest instance.
+ */
+ ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, ODataEntity entity);
+
+ /**
+ * Gets an update request object instance.
+ *
+ * @param targetURI edit link of the object to be updated.
+ * @param type type of update to be performed.
+ * @param changes changes to be applied.
+ * @return new ODataEntityUpdateRequest instance.
+ */
+ ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UpdateType type, ODataEntity changes);
+
+ /**
+ * Gets an update request object instance; uses entity's edit link as endpoint.
+ *
+ * @param type type of update to be performed.
+ * @param entity changes to be applied.
+ * @return new ODataEntityUpdateRequest instance.
+ */
+ ODataEntityUpdateRequest getEntityUpdateRequest(UpdateType type, ODataEntity entity);
+
+ /**
+ * Gets a create request object instance.
+ * <br/>
+ * Use this kind of request to create a new value (e.g. http://Northwind.svc/Customer(1)/Picture/$value).
+ *
+ * @param targetURI entity set or entity or entity property URI.
+ * @param type type of update to be performed.
+ * @param value value to be created.
+ * @return new ODataValueUpdateRequest instance.
+ */
+ ODataValueUpdateRequest getValueUpdateRequest(URI targetURI, UpdateType type, ODataPrimitiveValue value);
+
+ /**
+ * Gets an update request object instance.
+ * <br/>
+ * Use this kind of request to update a primitive property value.
+ *
+ * @param targetURI entity set or entity or entity property URI.
+ * @param property value to be update.
+ * @return new ODataPropertyUpdateRequest instance.
+ */
+ ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(URI targetURI, ODataProperty property);
+
+ /**
+ * Gets an update request object instance.
+ * <br/>
+ * Use this kind of request to update a complex property value.
+ *
+ * @param targetURI entity set or entity or entity property URI.
+ * @param type type of update to be performed.
+ * @param property value to be update.
+ * @return new ODataPropertyUpdateRequest instance.
+ */
+ ODataPropertyUpdateRequest getPropertyComplexValueUpdateRequest(
+ URI targetURI, UpdateType type, ODataProperty property);
+
+ /**
+ * Gets an update request object instance.
+ * <br/>
+ * Use this kind of request to update a collection property value.
+ *
+ * @param targetURI entity set or entity or entity property URI.
+ * @param property value to be update.
+ * @return new ODataPropertyUpdateRequest instance.
+ */
+ ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(URI targetURI, ODataProperty property);
+
+ /**
+ * Gets an add link request object instance.
+ * <br/>
+ * Use this kind of request to create a navigation link between existing entities.
+ *
+ * @param targetURI navigation property's link collection.
+ * @param link navigation link to be added.
+ * @return new ODataLinkCreateRequest instance.
+ */
+ ODataLinkCreateRequest getLinkCreateRequest(URI targetURI, ODataLink link);
+
+ /**
+ * Gets a link update request object instance.
+ * <br/>
+ * Use this kind of request to update a navigation link between existing entities.
+ * <br/>
+ * In case of the old navigation link doesn't exist the new one will be added as well.
+ *
+ * @param targetURI navigation property's link collection.
+ * @param type type of update to be performed.
+ * @param link URL that identifies the entity to be linked.
+ * @return new ODataLinkUpdateRequest instance.
+ */
+ ODataLinkUpdateRequest getLinkUpdateRequest(URI targetURI, UpdateType type, ODataLink link);
+
+ /**
+ * Gets a delete request object instance.
+ * <br/>
+ * Use this kind of request to delete an entity and media entity as well.
+ *
+ * @param targetURI edit link of the object to be removed.
+ * @return new ODataDeleteRequest instance.
+ */
+ ODataDeleteRequest getDeleteRequest(URI targetURI);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/V3CUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/V3CUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/V3CUDRequestFactory.java
deleted file mode 100644
index 85e5dbf..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/V3CUDRequestFactory.java
+++ /dev/null
@@ -1,22 +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.client.api.communication.request.cud;
-
-public interface V3CUDRequestFactory extends CUDRequestFactory {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/V4CUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/V4CUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/V4CUDRequestFactory.java
deleted file mode 100644
index 5896c59..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/V4CUDRequestFactory.java
+++ /dev/null
@@ -1,22 +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.client.api.communication.request.cud;
-
-public interface V4CUDRequestFactory extends CUDRequestFactory {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v3/CUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v3/CUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v3/CUDRequestFactory.java
new file mode 100644
index 0000000..4250728
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v3/CUDRequestFactory.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.client.api.communication.request.cud.v3;
+
+import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory;
+
+public interface CUDRequestFactory extends CommonCUDRequestFactory {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java
new file mode 100644
index 0000000..5d68983
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.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.client.api.communication.request.cud.v4;
+
+import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory;
+
+public interface CUDRequestFactory extends CommonCUDRequestFactory {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
new file mode 100644
index 0000000..8449798
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.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.client.api.communication.request.invoke;
+
+import java.io.Serializable;
+import java.net.URI;
+import java.util.Map;
+import org.apache.olingo.client.api.domain.ODataInvokeResult;
+import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+
+/**
+ * OData request factory class.
+ */
+public interface CommonInvokeRequestFactory<FI extends CommonFunctionImport> extends Serializable {
+
+ /**
+ * Gets an invoke request instance.
+ *
+ * @param <RES> OData domain object result, derived from return type defined in the function import
+ * @param uri URI that identifies the function import
+ * @param metadata Edm metadata
+ * @param functionImport function import to be invoked
+ * @return new ODataInvokeRequest instance.
+ */
+ <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
+ URI uri, XMLMetadata metadata, FI functionImport);
+
+ /**
+ * Gets an invoke request instance.
+ *
+ * @param <RES> OData domain object result, derived from return type defined in the function import
+ * @param uri URI that identifies the function import
+ * @param metadata Edm metadata
+ * @param functionImport function import to be invoked
+ * @param parameters parameters to pass to function import invocation
+ * @return new ODataInvokeRequest instance.
+ */
+ <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
+ URI uri, XMLMetadata metadata, FI functionImport, Map<String, ODataValue> parameters);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java
deleted file mode 100644
index f786602..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java
+++ /dev/null
@@ -1,58 +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.client.api.communication.request.invoke;
-
-import java.io.Serializable;
-import java.net.URI;
-import java.util.Map;
-import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-
-/**
- * OData request factory class.
- */
-public interface InvokeRequestFactory<FI extends CommonFunctionImport> extends Serializable {
-
- /**
- * Gets an invoke request instance.
- *
- * @param <RES> OData domain object result, derived from return type defined in the function import
- * @param uri URI that identifies the function import
- * @param metadata Edm metadata
- * @param functionImport function import to be invoked
- * @return new ODataInvokeRequest instance.
- */
- <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
- URI uri, XMLMetadata metadata, FI functionImport);
-
- /**
- * Gets an invoke request instance.
- *
- * @param <RES> OData domain object result, derived from return type defined in the function import
- * @param uri URI that identifies the function import
- * @param metadata Edm metadata
- * @param functionImport function import to be invoked
- * @param parameters parameters to pass to function import invocation
- * @return new ODataInvokeRequest instance.
- */
- <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
- URI uri, XMLMetadata metadata, FI functionImport, Map<String, ODataValue> parameters);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/V3InvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/V3InvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/V3InvokeRequestFactory.java
deleted file mode 100644
index cfa8aca..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/V3InvokeRequestFactory.java
+++ /dev/null
@@ -1,24 +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.client.api.communication.request.invoke;
-
-import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
-
-public interface V3InvokeRequestFactory extends InvokeRequestFactory<FunctionImport> {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/V4InvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/V4InvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/V4InvokeRequestFactory.java
deleted file mode 100644
index 3740a1e..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/V4InvokeRequestFactory.java
+++ /dev/null
@@ -1,24 +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.client.api.communication.request.invoke;
-
-import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
-
-public interface V4InvokeRequestFactory extends InvokeRequestFactory<FunctionImport> {
-}
[32/52] [abbrv] [OLINGO-200] Moving Atom and JSON (de)serializer to
commons
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
new file mode 100644
index 0000000..027eac3
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.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.commons.core.data;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import java.net.URI;
+
+/**
+ * A single property (primitive, complex or collection) represented via JSON.
+ */
+@JsonSerialize(using = JSONPropertySerializer.class)
+@JsonDeserialize(using = JSONPropertyDeserializer.class)
+public class JSONPropertyImpl extends AbstractPropertyImpl {
+
+ private static final long serialVersionUID = 553414431536637434L;
+
+ private URI metadata;
+
+ /**
+ * Gets metadata URI.
+ *
+ * @return metadata URI.
+ */
+ public URI getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets metadata URI.
+ *
+ * @param metadata metadata URI.
+ */
+ public void setMetadata(final URI metadata) {
+ this.metadata = metadata;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
new file mode 100644
index 0000000..104083b
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.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.commons.core.data;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import java.io.IOException;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Property;
+
+/**
+ * Writes out JSON string from <tt>JSONPropertyImpl</tt>.
+ *
+ * @see JSONPropertyImpl
+ */
+public class JSONPropertySerializer extends AbstractJsonSerializer<JSONPropertyImpl> {
+
+ @Override
+ protected void doSerialize(final JSONPropertyImpl property, final JsonGenerator jgen,
+ final SerializerProvider provider) throws IOException, JsonProcessingException {
+
+ jgen.writeStartObject();
+
+ if (property.getMetadata() != null) {
+ jgen.writeStringField(Constants.JSON_METADATA, property.getMetadata().toASCIIString());
+ }
+
+ if (property.getValue().isNull()) {
+ jgen.writeBooleanField(Constants.JSON_NULL, true);
+ } else if (property.getValue().isSimple()) {
+ jgen.writeStringField(Constants.JSON_VALUE, property.getValue().asSimple().get());
+ } else if (property.getValue().isGeospatial() || property.getValue().isCollection()) {
+ property(jgen, property, Constants.JSON_VALUE);
+ } else if (property.getValue().isComplex()) {
+ for (Property cproperty : property.getValue().asComplex().get()) {
+ property(jgen, cproperty, cproperty.getName());
+ }
+ }
+
+ jgen.writeEndObject();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java
new file mode 100644
index 0000000..85fabdc
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Link;
+
+public class LinkImpl extends AbstractPayloadObject implements Link {
+
+ private static final long serialVersionUID = -3449344217160035501L;
+
+ private String title;
+
+ private String rel;
+
+ private String href;
+
+ private String type;
+
+ private String mediaETag;
+
+ private Entry entry;
+
+ private Feed feed;
+
+ @Override
+ public String getTitle() {
+ return title;
+ }
+
+ @Override
+ public void setTitle(final String title) {
+ this.title = title;
+ }
+
+ @Override
+ public String getRel() {
+ return rel;
+ }
+
+ @Override
+ public void setRel(final String rel) {
+ this.rel = rel;
+ }
+
+ @Override
+ public String getHref() {
+ return href;
+ }
+
+ @Override
+ public void setHref(final String href) {
+ this.href = href;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String getMediaETag() {
+ return mediaETag;
+ }
+
+ @Override
+ public void setMediaETag(final String mediaETag) {
+ this.mediaETag = mediaETag;
+ }
+
+ @Override
+ public Entry getInlineEntry() {
+ return entry;
+ }
+
+ @Override
+ public void setInlineEntry(final Entry entry) {
+ this.entry = entry;
+ }
+
+ @Override
+ public Feed getInlineFeed() {
+ return feed;
+ }
+
+ @Override
+ public void setInlineFeed(final Feed feed) {
+ this.feed = feed;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/NullValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/NullValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/NullValueImpl.java
new file mode 100644
index 0000000..1fca329
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/NullValueImpl.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.commons.core.data;
+
+import org.apache.olingo.commons.api.data.NullValue;
+
+public class NullValueImpl extends AbstractValue implements NullValue {
+
+ @Override
+ public boolean isNull() {
+ return true;
+ }
+
+ @Override
+ public Void get() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
new file mode 100644
index 0000000..e882be2
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.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.commons.core.data;
+
+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 java.io.IOException;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
+
+ protected ODataServiceVersion version;
+
+ protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt)
+ throws IOException, JsonProcessingException;
+
+ @Override
+ public T deserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ version = (ODataServiceVersion) ctxt.findInjectableValue(ODataServiceVersion.class.getName(), null, null);
+ return doDeserialize(jp, ctxt);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonSerializer.java
new file mode 100644
index 0000000..31ed332
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonSerializer.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+import java.io.IOException;
+
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public abstract class ODataJacksonSerializer<T> extends JsonSerializer<T> {
+
+ protected ODataServiceVersion version;
+
+ protected abstract void doSerialize(T value, JsonGenerator jgen, SerializerProvider provider)
+ throws IOException, JsonProcessingException;
+
+ @Override
+ public void serialize(final T value, final JsonGenerator jgen, final SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+
+ version = (ODataServiceVersion) provider.getAttribute(ODataServiceVersion.class);
+ doSerialize(value, jgen, provider);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java
new file mode 100644
index 0000000..2d0a6bc
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.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.commons.core.data;
+
+import org.apache.olingo.commons.api.data.PrimitiveValue;
+
+public class PrimitiveValueImpl extends AbstractValue implements PrimitiveValue {
+
+ private final String value;
+
+ public PrimitiveValueImpl(final String value) {
+ this.value = value;
+ }
+
+ @Override
+ public boolean isSimple() {
+ return true;
+ }
+
+ @Override
+ public String get() {
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
new file mode 100644
index 0000000..a8c3d84
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;
+import java.util.Map;
+import org.apache.olingo.commons.api.domain.ODataError;
+
+/**
+ * This class represents an OData error returned as JSON.
+ */
+public class XMLErrorImpl extends AbstractPayloadObject implements ODataError {
+
+ private static final long serialVersionUID = -3476499168507242932L;
+
+ @JacksonXmlText(false)
+ private String code;
+
+ @JsonProperty
+ private Message message;
+
+ @JsonProperty(required = false)
+ private InnerError innererror;
+
+ @Override
+ public String getCode() {
+ return code;
+ }
+
+ /**
+ * Sets error code.
+ *
+ * @param code error code.
+ */
+ public void setCode(final String code) {
+ this.code = code;
+ }
+
+ @JsonIgnore
+ @Override
+ public String getMessageLang() {
+ return this.message == null ? null : this.message.getLang();
+ }
+
+ @JsonIgnore
+ @Override
+ public String getMessageValue() {
+ return this.message == null ? null : this.message.getValue();
+ }
+
+ /**
+ * Sets the value of the message property.
+ *
+ * @param value allowed object is {@link Error.Message }
+ *
+ */
+ public void setMessage(final Message value) {
+ this.message = value;
+ }
+
+ @JsonIgnore
+ @Override
+ public String getInnerErrorMessage() {
+ return this.innererror == null ? null : this.innererror.getMessage().getValue();
+ }
+
+ @JsonIgnore
+ @Override
+ public String getInnerErrorType() {
+ return this.innererror == null ? null : this.innererror.getType().getValue();
+ }
+
+ @JsonIgnore
+ @Override
+ public String getInnerErrorStacktrace() {
+ return this.innererror == null ? null : this.innererror.getStacktrace().getValue();
+ }
+
+ static class TextChildContainer extends AbstractPayloadObject {
+
+ private static final long serialVersionUID = -8908394095210115904L;
+
+ public TextChildContainer() {
+ super();
+ }
+
+ public TextChildContainer(final String value) {
+ super();
+ this.value = value;
+ }
+
+ @JsonCreator
+ public TextChildContainer(final Map<String, Object> props) {
+ super();
+ this.value = (String) props.get("");
+ }
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(final String value) {
+ this.value = value;
+ }
+ }
+
+ /**
+ * Error message.
+ */
+ public static class Message extends TextChildContainer {
+
+ private static final long serialVersionUID = 2577818040815637859L;
+
+ private String lang;
+
+ public Message() {
+ super();
+ }
+
+ @JsonCreator
+ public Message(final Map<String, Object> props) {
+ super(props);
+ this.lang = (String) props.get("lang");
+ }
+
+ /**
+ * Gets language.
+ *
+ * @return language.
+ */
+ public String getLang() {
+ return lang;
+ }
+
+ /**
+ * Sets language.
+ *
+ * @param lang language.
+ */
+ public void setLang(final String lang) {
+ this.lang = lang;
+ }
+ }
+
+ /**
+ * Inner error.
+ */
+ static class InnerError extends AbstractPayloadObject {
+
+ private static final long serialVersionUID = -3920947476143537640L;
+
+ private TextChildContainer message;
+
+ private TextChildContainer type;
+
+ private TextChildContainer stacktrace;
+
+ private InnerError internalexception;
+
+ public TextChildContainer getMessage() {
+ return message;
+ }
+
+ public void setMessage(final TextChildContainer message) {
+ this.message = message;
+ }
+
+ public TextChildContainer getType() {
+ return type;
+ }
+
+ public void setType(final TextChildContainer type) {
+ this.type = type;
+ }
+
+ public TextChildContainer getStacktrace() {
+ return stacktrace;
+ }
+
+ public void setStacktrace(final TextChildContainer stacktrace) {
+ this.stacktrace = stacktrace;
+ }
+
+ public InnerError getInternalexception() {
+ return internalexception;
+ }
+
+ public void setInternalexception(final InnerError internalexception) {
+ this.internalexception = internalexception;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/JSONLinkCollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/JSONLinkCollectionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/JSONLinkCollectionImpl.java
new file mode 100644
index 0000000..b0bd6e0
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/JSONLinkCollectionImpl.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data.v3;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.data.v3.LinkCollection;
+import org.apache.olingo.commons.core.data.AbstractPayloadObject;
+
+/**
+ * Link from an entry, represented via JSON.
+ */
+public class JSONLinkCollectionImpl extends AbstractPayloadObject implements LinkCollection {
+
+ private static final long serialVersionUID = -5006368367235783907L;
+
+ /**
+ * JSON link URL representation.
+ */
+ static class JSONLinkURL extends AbstractPayloadObject {
+
+ private static final long serialVersionUID = 5365055617973271468L;
+
+ private URI url;
+
+ public URI getUrl() {
+ return url;
+ }
+
+ public void setUrl(final URI url) {
+ this.url = url;
+ }
+ }
+
+ @JsonProperty(value = "odata.metadata", required = false)
+ private URI metadata;
+
+ @JsonProperty(required = false)
+ private URI url;
+
+ @JsonProperty(value = "value", required = false)
+ private final List<JSONLinkURL> links = new ArrayList<JSONLinkURL>();
+
+ @JsonProperty(value = "odata.nextLink", required = false)
+ private String next;
+
+ /**
+ * Gets the metadata URI.
+ */
+ public URI getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata URI.
+ *
+ * @param metadata metadata URI.
+ */
+ public void setMetadata(final URI metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @JsonIgnore
+ @Override
+ public List<URI> getLinks() {
+ final List<URI> result = new ArrayList<URI>();
+
+ if (this.url == null) {
+ for (JSONLinkURL link : links) {
+ result.add(link.getUrl());
+ }
+ } else {
+ result.add(this.url);
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @JsonIgnore
+ @Override
+ public void setNext(final URI next) {
+ this.next = next == null ? null : next.toASCIIString();
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @JsonIgnore
+ @Override
+ public URI getNext() {
+ return next == null ? null : URI.create(next);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/XMLLinkCollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/XMLLinkCollectionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/XMLLinkCollectionImpl.java
new file mode 100644
index 0000000..8d9001c
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v3/XMLLinkCollectionImpl.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.commons.core.data.v3;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.data.v3.LinkCollection;
+
+public class XMLLinkCollectionImpl implements LinkCollection {
+
+ private final List<URI> links = new ArrayList<URI>();
+
+ private URI next;
+
+ /**
+ * Constructor.
+ */
+ public XMLLinkCollectionImpl() {
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param next next page link.
+ */
+ public XMLLinkCollectionImpl(final URI next) {
+ this.next = next;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public List<URI> getLinks() {
+ return links;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public void setNext(final URI next) {
+ this.next = next;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public URI getNext() {
+ return next;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
new file mode 100644
index 0000000..567950d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class EdmTypeInfo {
+
+ private static final Logger LOG = LoggerFactory.getLogger(EdmTypeInfo.class);
+
+ public static class Builder {
+
+ private String typeExpression;
+
+ private String defaultNamespace;
+
+ private Edm edm;
+
+ public Builder setTypeExpression(final String typeExpression) {
+ this.typeExpression = typeExpression;
+ return this;
+ }
+
+ public Builder setDefaultNamespace(final String defaultNamespace) {
+ this.defaultNamespace = defaultNamespace;
+ return this;
+ }
+
+ public Builder setEdm(final Edm edm) {
+ this.edm = edm;
+ return this;
+ }
+
+ public EdmTypeInfo build() {
+ return new EdmTypeInfo(edm, typeExpression.indexOf('.') == -1
+ ? defaultNamespace + "." + typeExpression
+ : typeExpression);
+ }
+ }
+
+ private final Edm edm;
+
+ private final String typeExpression;
+
+ private final boolean collection;
+
+ private final FullQualifiedName fullQualifiedName;
+
+ private EdmPrimitiveTypeKind primitiveType;
+
+ private EdmEnumType enumType;
+
+ private EdmComplexType complexType;
+
+ private EdmEntityType entityType;
+
+ private EdmTypeInfo(final Edm edm, final String typeExpression) {
+ this.edm = edm;
+ this.typeExpression = typeExpression;
+
+ String baseType;
+ final int collStartIdx = typeExpression.indexOf("Collection(");
+ final int collEndIdx = typeExpression.lastIndexOf(')');
+ if (collStartIdx == -1) {
+ baseType = typeExpression;
+ this.collection = false;
+ } else {
+ if (collEndIdx == -1) {
+ throw new IllegalArgumentException("Malformed type: " + typeExpression);
+ }
+
+ this.collection = true;
+ baseType = typeExpression.substring(collStartIdx + 11, collEndIdx);
+ }
+
+ final int lastDotIdx = baseType.lastIndexOf('.');
+ if (lastDotIdx == -1) {
+ throw new IllegalArgumentException("Cannot find namespace or alias in " + typeExpression);
+ }
+ final String namespace = baseType.substring(0, lastDotIdx);
+ final String typeName = baseType.substring(lastDotIdx + 1);
+ if (StringUtils.isBlank(typeName)) {
+ throw new IllegalArgumentException("Null or empty type name in " + typeExpression);
+ }
+
+ this.fullQualifiedName = new FullQualifiedName(namespace, typeName);
+
+ try {
+ this.primitiveType = EdmPrimitiveTypeKind.valueOf(this.fullQualifiedName.getName());
+ } catch (IllegalArgumentException e) {
+ LOG.debug("{} does not appear to refer to an Edm primitive type", this.fullQualifiedName);
+ }
+ if (this.primitiveType == null && this.edm != null) {
+ this.enumType = this.edm.getEnumType(this.fullQualifiedName);
+ if (this.enumType == null) {
+ this.complexType = this.edm.getComplexType(this.fullQualifiedName);
+ if (this.complexType == null) {
+ this.entityType = this.edm.getEntityType(this.fullQualifiedName);
+ }
+ }
+ }
+ }
+
+ public String getTypeExpression() {
+ return typeExpression;
+ }
+
+ public boolean isCollection() {
+ return collection;
+ }
+
+ public FullQualifiedName getFullQualifiedName() {
+ return fullQualifiedName;
+ }
+
+ public boolean isPrimitiveType() {
+ return this.primitiveType != null;
+ }
+
+ public EdmPrimitiveTypeKind getPrimitiveTypeKind() {
+ return primitiveType;
+ }
+
+ public boolean isEnumType() {
+ return this.enumType != null;
+ }
+
+ public EdmEnumType getEnumType() {
+ return enumType;
+ }
+
+ public boolean isComplexType() {
+ return this.complexType != null;
+ }
+
+ public EdmComplexType getComplexType() {
+ return complexType;
+ }
+
+ public boolean isEntityType() {
+ return this.entityType != null;
+ }
+
+ public EdmEntityType getEntityType() {
+ return entityType;
+ }
+
+}
[41/52] [abbrv] [OLINGO-205,
OLINGO-200] provided atom v4 deserialization for entity type/set +
entity set request
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
index d48fda4..a807052 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
@@ -34,96 +34,99 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements EdmStructuredType {
- protected EdmStructuredType baseType;
+ protected EdmStructuredType baseType;
- private List<String> propertyNames;
+ private List<String> propertyNames;
- private List<String> navigationPropertyNames;
+ private List<String> navigationPropertyNames;
- public AbstractEdmStructuredType(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind,
- final FullQualifiedName baseTypeName) {
+ public AbstractEdmStructuredType(
+ final Edm edm,
+ final FullQualifiedName fqn,
+ final EdmTypeKind kind,
+ final FullQualifiedName baseTypeName) {
- super(edm, fqn, kind);
- }
+ super(edm, fqn, kind);
+ }
- protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
+ protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
- protected abstract Map<String, EdmProperty> getProperties();
+ protected abstract Map<String, EdmProperty> getProperties();
- protected abstract Map<String, EdmNavigationProperty> getNavigationProperties();
+ protected abstract Map<String, EdmNavigationProperty> getNavigationProperties();
- @Override
- public List<String> getPropertyNames() {
- if (propertyNames == null) {
- propertyNames = new ArrayList<String>();
- if (baseType != null) {
- propertyNames.addAll(baseType.getPropertyNames());
- }
- propertyNames.addAll(getProperties().keySet());
- }
- return propertyNames;
- }
-
- @Override
- public List<String> getNavigationPropertyNames() {
- if (navigationPropertyNames == null) {
- navigationPropertyNames = new ArrayList<String>();
- if (baseType != null) {
- navigationPropertyNames.addAll(baseType.getNavigationPropertyNames());
- }
- navigationPropertyNames.addAll(getNavigationProperties().keySet());
- }
- return navigationPropertyNames;
- }
-
- @Override
- public EdmElement getProperty(final String name) {
- EdmElement property = getStructuralProperty(name);
- if (property == null) {
- property = getNavigationProperty(name);
- }
- return property;
- }
-
- @Override
- public EdmProperty getStructuralProperty(final String name) {
- EdmProperty property = null;
- if (baseType != null) {
- property = baseType.getStructuralProperty(name);
- }
- if (property == null) {
- property = getProperties().get(name);
+ @Override
+ public List<String> getPropertyNames() {
+ if (propertyNames == null) {
+ propertyNames = new ArrayList<String>();
+ if (baseType != null) {
+ propertyNames.addAll(baseType.getPropertyNames());
+ }
+ propertyNames.addAll(getProperties().keySet());
+ }
+ return propertyNames;
}
- return property;
- }
-
- @Override
- public EdmNavigationProperty getNavigationProperty(final String name) {
- EdmNavigationProperty property = null;
- if (baseType != null) {
- property = baseType.getNavigationProperty(name);
+
+ @Override
+ public List<String> getNavigationPropertyNames() {
+ if (navigationPropertyNames == null) {
+ navigationPropertyNames = new ArrayList<String>();
+ if (baseType != null) {
+ navigationPropertyNames.addAll(baseType.getNavigationPropertyNames());
+ }
+ navigationPropertyNames.addAll(getNavigationProperties().keySet());
+ }
+ return navigationPropertyNames;
}
- if (property == null) {
- property = getNavigationProperties().get(name);
+
+ @Override
+ public EdmElement getProperty(final String name) {
+ EdmElement property = getStructuralProperty(name);
+ if (property == null) {
+ property = getNavigationProperty(name);
+ }
+ return property;
}
- return property;
- }
-
- @Override
- public boolean compatibleTo(final EdmType targetType) {
- EdmStructuredType sourceType = this;
- if (targetType == null) {
- throw new EdmException("Target type must not be null");
+
+ @Override
+ public EdmProperty getStructuralProperty(final String name) {
+ EdmProperty property = null;
+ if (baseType != null) {
+ property = baseType.getStructuralProperty(name);
+ }
+ if (property == null) {
+ property = getProperties().get(name);
+ }
+ return property;
}
- while (!sourceType.getName().equals(targetType.getName())
- || !sourceType.getNamespace().equals(targetType.getNamespace())) {
-
- sourceType = sourceType.getBaseType();
- if (sourceType == null) {
- return false;
- }
+
+ @Override
+ public EdmNavigationProperty getNavigationProperty(final String name) {
+ EdmNavigationProperty property = null;
+ if (baseType != null) {
+ property = baseType.getNavigationProperty(name);
+ }
+ if (property == null) {
+ property = getNavigationProperties().get(name);
+ }
+ return property;
}
- return true;
- }
+ @Override
+ public boolean compatibleTo(final EdmType targetType) {
+ EdmStructuredType sourceType = this;
+ if (targetType == null) {
+ throw new EdmException("Target type must not be null");
+ }
+ while (!sourceType.getName().equals(targetType.getName())
+ || !sourceType.getNamespace().equals(targetType.getNamespace())) {
+
+ sourceType = sourceType.getBaseType();
+ if (sourceType == null) {
+ return false;
+ }
+ }
+
+ return true;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNamedImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNamedImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNamedImpl.java
index 8f82d56..0f0bd5d 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNamedImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNamedImpl.java
@@ -23,18 +23,17 @@ import org.apache.olingo.commons.api.edm.EdmNamed;
public abstract class EdmNamedImpl implements EdmNamed {
- protected final Edm edm;
+ protected final Edm edm;
- private final String name;
+ private final String name;
- public EdmNamedImpl(final Edm edm, final String name) {
- this.edm = edm;
- this.name = name;
- }
-
- @Override
- public String getName() {
- return name;
- }
+ public EdmNamedImpl(final Edm edm, final String name) {
+ this.edm = edm;
+ this.name = name;
+ }
+ @Override
+ public String getName() {
+ return name;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
index 7fc2808..ed20afa 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
@@ -25,24 +25,23 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
public class EdmTypeImpl extends EdmNamedImpl implements EdmType {
- protected final FullQualifiedName fqn;
+ protected final FullQualifiedName fqn;
- protected final EdmTypeKind kind;
+ protected final EdmTypeKind kind;
- public EdmTypeImpl(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind) {
- super(edm, fqn.getName());
- this.fqn = fqn;
- this.kind = kind;
- }
+ public EdmTypeImpl(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind) {
+ super(edm, fqn.getName());
+ this.fqn = fqn;
+ this.kind = kind;
+ }
- @Override
- public String getNamespace() {
- return fqn.getNamespace();
- }
-
- @Override
- public EdmTypeKind getKind() {
- return kind;
- }
+ @Override
+ public String getNamespace() {
+ return fqn.getNamespace();
+ }
+ @Override
+ public EdmTypeKind getKind() {
+ return kind;
+ }
}
[28/52] [abbrv] [OLINGO-200] Moving domain objects to commons-api
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
index 5563a74..efd0cf2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
@@ -34,7 +34,7 @@ import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
import org.apache.olingo.client.api.communication.request.ODataStreamer;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
import org.apache.olingo.client.api.communication.response.ODataResponse;
-import org.apache.olingo.client.api.format.ODataMediaFormat;
+import org.apache.olingo.commons.api.format.ODataMediaFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.Wrapper;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
index b69a35a..f8487bc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityCreateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
index f6dc09b..4f0edce 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityUpdateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractEntry.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractEntry.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractEntry.java
index f92c44b..8b513bf 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractEntry.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractEntry.java
@@ -24,7 +24,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.data.Link;
import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.domain.ODataOperation;
/**
* Abstract base for classes implementing an OData entry in Atom and JSON.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
index 74b29fb..4b0ee0e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
@@ -27,7 +27,7 @@ import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.CollectionValue;
import org.apache.olingo.client.api.data.ComplexValue;
import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataPropertyType;
+import org.apache.olingo.commons.api.domain.ODataPropertyType;
import org.apache.olingo.client.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
index 8893b91..74d98a6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
@@ -31,7 +31,7 @@ import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import org.apache.http.entity.ContentType;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
index 884d815..736d791 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.CollectionValue;
import org.apache.olingo.client.api.data.ComplexValue;
import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataPropertyType;
+import org.apache.olingo.commons.api.domain.ODataPropertyType;
import org.apache.olingo.client.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryDeserializer.java
index 378d676..2626a95 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryDeserializer.java
@@ -36,8 +36,8 @@ import java.util.Map;
import java.util.Set;
import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.domain.ODataLinkType;
-import org.apache.olingo.client.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java
index 2e48f73..348015e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.data.Link;
import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
/**
* Writes out JSON string from an entry.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
index 43ef056..daa63a3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
@@ -20,8 +20,8 @@ package org.apache.olingo.client.core.domain;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.olingo.client.api.domain.AbstractODataValue;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
import org.apache.olingo.commons.api.edm.EdmGeospatialType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
index e6a0408..aac8ee3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
@@ -23,8 +23,8 @@ import java.util.Calendar;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.AbstractODataValue;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index a7f9a44..4e53ce3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -31,18 +31,18 @@ import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataCollectionValue;
-import org.apache.olingo.client.api.domain.ODataComplexValue;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInlineEntity;
-import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataOperation;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.op.CommonODataBinder;
import org.apache.olingo.client.core.data.CollectionValueImpl;
import org.apache.olingo.client.core.data.ComplexValueImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
index 483dc7b..2b4385e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
@@ -24,8 +24,8 @@ import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.data.ODataError;
import org.apache.olingo.client.api.data.Feed;
import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.op.CommonODataDeserializer;
import org.apache.olingo.client.core.data.AtomDeserializer;
import org.apache.olingo.client.core.data.AtomEntryImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
index 031eb50..b0869cf 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -23,16 +23,16 @@ import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.data.ODataError;
import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.op.CommonODataReader;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
index 48a0b8d..7a1a015 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
@@ -30,7 +30,7 @@ import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.data.Feed;
import org.apache.olingo.client.api.data.Link;
import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.ODataSerializer;
import org.apache.olingo.client.core.data.AtomEntryImpl;
import org.apache.olingo.client.core.data.AtomFeedImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
index 0b71abc..a7bf76d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
@@ -20,18 +20,18 @@ package org.apache.olingo.client.core.op;
import java.net.URI;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.ODataLinkType;
-import org.apache.olingo.client.api.domain.ODataCollectionValue;
-import org.apache.olingo.client.api.domain.ODataComplexValue;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
-import org.apache.olingo.client.api.domain.ODataInlineEntity;
-import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataObjectFactory;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
public class ODataObjectFactoryImpl implements ODataObjectFactory {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
index 7e5c9b4..80f4f11 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
@@ -25,11 +25,11 @@ import java.util.Collection;
import java.util.Collections;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.op.ODataWriter;
public class ODataWriterImpl implements ODataWriter {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
index da3ead2..8b44e2b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.op;
import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.data.Feed;
import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.data.AtomEntryImpl;
import org.apache.olingo.client.core.data.AtomFeedImpl;
import org.apache.olingo.client.core.data.AtomPropertyImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
index edb98a0..0baf403 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
@@ -22,7 +22,7 @@ import java.io.InputStream;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.v3.LinkCollection;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.v3.ODataDeserializer;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.data.v3.JSONLinkCollectionImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
index 2e8a080..2c5a7d1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
@@ -20,9 +20,9 @@ package org.apache.olingo.client.core.op.impl.v3;
import java.io.InputStream;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.v3.ODataReader;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.v3.ODataClientImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index 80863cb..9c81baf 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.core.op.impl.v4;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.op.v4.ODataBinder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.api.v4.ODataClient;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
index 95fde77..3b825e2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
@@ -22,7 +22,7 @@ import java.io.InputStream;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.v4.ODataDeserializer;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
index 4260ba8..1a93ce1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
@@ -20,8 +20,8 @@ package org.apache.olingo.client.core.op.impl.v4;
import java.io.InputStream;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.v4.ODataReader;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.edm.EdmClientImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
index df66603..fe3f098 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
@@ -29,10 +29,10 @@ import java.util.List;
import java.util.UUID;
import org.apache.commons.codec.binary.Base64;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
index a67f8b8..37f2688 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
@@ -27,12 +27,12 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.domain.ODataCollectionValue;
-import org.apache.olingo.client.api.domain.ODataComplexValue;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
index 9133b0e..b579962 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
@@ -21,8 +21,8 @@ package org.apache.olingo.client.core;
import java.util.Locale;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.BeforeClass;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index 1a30ef7..5e7ea2f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -52,16 +52,16 @@ import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResp
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.domain.ODataCollectionValue;
-import org.apache.olingo.client.api.domain.ODataComplexValue;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInlineEntity;
-import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index 294d190..21d3717 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -35,8 +35,8 @@ import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEnt
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Ignore;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
index 455d376..f004c26 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
@@ -23,8 +23,8 @@ import org.junit.Test;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
public class CountTestITCase extends AbstractTestITCase {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index d16f060..8146830 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -39,12 +39,12 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.NoContentException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
index c05eaff..609bd9a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
@@ -30,13 +30,13 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInlineEntity;
-import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
index fa0d60f..aaa9ed7 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
@@ -28,9 +28,9 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.op.ResourceFactory;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index 6e918e9..129f086 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -31,8 +31,8 @@ import org.apache.olingo.client.api.communication.request.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
index a61b853..ed8a776 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
@@ -32,8 +32,8 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
index ece7364..28c354d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.it.v3;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.uri.URIFilter;
import org.apache.olingo.client.api.uri.v3.FilterArgFactory;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
index a2d9a90..cbcf046 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.it.v3;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
index 1a3123b..9c2a9f5 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
@@ -21,8 +21,8 @@ package org.apache.olingo.client.core.it.v3;
import org.apache.olingo.client.api.communication.request.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
index a296f94..b56dde6 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
@@ -32,9 +32,9 @@ import org.apache.olingo.client.api.communication.request.cud.ODataLinkUpdateReq
import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkCollectionRequest;
import org.apache.olingo.client.api.communication.response.ODataLinkOperationResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.uri.v3.URIBuilder;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
index 33446cf..3350204 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
@@ -36,10 +36,10 @@ import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreat
import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.communication.response.ODataStreamUpdateResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataMediaFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataMediaFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index a1a90f9..b1e385d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -38,16 +38,16 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataCollectionValue;
-import org.apache.olingo.client.api.domain.ODataComplexValue;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInlineEntity;
-import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index 2d06ba0..091d0af 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -28,9 +28,9 @@ import java.util.UUID;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.client.api.domain.ODataComplexValue;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
index d69fb68..c6763e9 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
@@ -25,8 +25,8 @@ import java.math.BigDecimal;
import java.util.UUID;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.junit.Test;
public class PrimitiveKeysTestITCase extends AbstractTestITCase {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
index 331c73b..314e934 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
@@ -29,13 +29,13 @@ import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataCollectionValue;
-import org.apache.olingo.client.api.domain.ODataComplexValue;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index 56eb4fb..28d487f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -35,11 +35,11 @@ import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateRe
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
-import org.apache.olingo.client.api.domain.ODataCollectionValue;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
index 1acb6be..b8dd0a8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
@@ -24,9 +24,9 @@ import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
index 3501482..d34da88 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
@@ -29,10 +29,10 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.uri.v3.URIBuilder.InlineCount;
import org.apache.olingo.client.core.data.AtomEntryImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
index 40a7ecf..f5a9fa9 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
@@ -23,8 +23,8 @@ import java.net.URI;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.junit.Test;
public class ServiceDocumentRetrieveTestITCase extends AbstractTestITCase {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentTestITCase.java
index 820b3a0..0a5aefc 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentTestITCase.java
@@ -23,8 +23,8 @@ import static org.junit.Assert.assertEquals;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.junit.Test;
public class ServiceDocumentTestITCase extends AbstractTestITCase {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
index 6963cee..755b44b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
@@ -29,8 +29,8 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.client.core.AtomLinksQualifier;
import org.custommonkey.xmlunit.Diff;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
index d33da3b..792ddb7 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
@@ -24,8 +24,8 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.InputStream;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.client.core.op.ResourceFactory;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 978da52..d8f02a6 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -24,10 +24,10 @@ import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.client.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
index b76c453..57f3516 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertNull;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.data.ODataError;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
index 83c7d05..d57c561 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
@@ -30,8 +30,8 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
public class JSONTest extends AtomTest {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
index d950d2e..e3cbd7e 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
@@ -32,7 +32,7 @@ import java.util.TimeZone;
import java.util.UUID;
import javax.xml.datatype.Duration;
import org.apache.commons.codec.binary.Base64;
-import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java
index b42b513..dd49fec 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java
@@ -19,8 +19,8 @@
package org.apache.olingo.client.core.v3;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.core.AbstractTest;
import static org.junit.Assert.assertNotNull;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
index d879e5b..0fc9b18 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
@@ -22,7 +22,7 @@ import java.util.Calendar;
import static org.junit.Assert.assertEquals;
import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
index 7945692..4dc4fae 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
@@ -25,8 +25,8 @@ import static org.junit.Assert.assertTrue;
import java.net.URI;
import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/commons-api/pom.xml b/lib/commons-api/pom.xml
index e398eaa..4b75469 100644
--- a/lib/commons-api/pom.xml
+++ b/lib/commons-api/pom.xml
@@ -39,6 +39,11 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
new file mode 100644
index 0000000..ab77d7f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.domain;
+
+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 AbstractODataValue implements ODataValue {
+
+ private static final long serialVersionUID = 7445422004232581877L;
+
+ /**
+ * Check is is a primitive value.
+ *
+ * @return 'TRUE' if primitive; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isPrimitive() {
+ return (this instanceof ODataPrimitiveValue);
+ }
+
+ /**
+ * Casts to primitive value.
+ *
+ * @return primitive value.
+ */
+ @Override
+ public ODataPrimitiveValue asPrimitive() {
+ return isPrimitive() ? (ODataPrimitiveValue) this : null;
+ }
+
+ /**
+ * Check is is a geospatail value.
+ *
+ * @return 'TRUE' if geospatail; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isGeospatial() {
+ return (this instanceof ODataGeospatialValue);
+ }
+
+ /**
+ * Casts to geospatail value.
+ *
+ * @return geospatail value.
+ */
+ @Override
+ public ODataGeospatialValue asGeospatial() {
+ return isGeospatial() ? (ODataGeospatialValue) this : null;
+ }
+
+ /**
+ * Check is is a complex value.
+ *
+ * @return 'TRUE' if complex; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isComplex() {
+ return (this instanceof ODataComplexValue);
+ }
+
+ /**
+ * Casts to complex value.
+ *
+ * @return complex value.
+ */
+ @Override
+ public ODataComplexValue asComplex() {
+ return isComplex() ? (ODataComplexValue) this : null;
+ }
+
+ /**
+ * Check is is a collection value.
+ *
+ * @return 'TRUE' if collection; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isCollection() {
+ return (this instanceof ODataCollectionValue);
+ }
+
+ /**
+ * Casts to collection value.
+ *
+ * @return collection value.
+ */
+ @Override
+ public ODataCollectionValue asCollection() {
+ return isCollection() ? (ODataCollectionValue) this : null;
+ }
+
+ @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/olingo-odata4/blob/0b4b86c0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
new file mode 100644
index 0000000..f583187
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/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.commons.api.domain;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * OData collection property value.
+ */
+public class ODataCollectionValue extends AbstractODataValue 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 getType() {
+ 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();
+ }
+}
[23/52] [abbrv] Package rename
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ComplexTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ComplexTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ComplexTypeDeserializer.java
new file mode 100644
index 0000000..754bad4
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ComplexTypeDeserializer.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.client.core.op;
+
+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.client.core.edm.xml.AbstractComplexType;
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.ComplexTypeImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ setAbstractEntityType(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("BaseType".equals(jp.getCurrentName())) {
+ ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ setBaseType(jp.nextTextValue());
+ } else if ("OpenType".equals(jp.getCurrentName())) {
+ ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Property".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (complexType instanceof org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl) complexType).
+ getProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ getProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
+ }
+ } else if ("NavigationProperty".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ getNavigationProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
+ setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return complexType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityContainerDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityContainerDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityContainerDeserializer.java
new file mode 100644
index 0000000..131ba9e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityContainerDeserializer.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.client.core.op;
+
+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.client.core.edm.xml.AbstractEntityContainer;
+import org.apache.olingo.client.core.edm.xml.v3.AssociationSetImpl;
+import org.apache.olingo.client.core.edm.xml.v4.ActionImportImpl;
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.client.core.edm.xml.v4.SingletonImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.EntityContainerImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.EntityContainerImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
+ getEntitySets().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.EntitySetImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
+ getEntitySets().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl.class));
+ }
+ } else if ("AssociationSet".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
+ getAssociationSets().add(jp.readValueAs(AssociationSetImpl.class));
+ } else if ("Singleton".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
+ getSingletons().add(jp.readValueAs(SingletonImpl.class));
+ } else if ("ActionImport".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
+ getActionImports().add(jp.readValueAs(ActionImportImpl.class));
+ } else if ("FunctionImport".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (entityContainer instanceof org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl) entityContainer).
+ getFunctionImports().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.FunctionImportImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
+ getFunctionImports().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.FunctionImportImpl.class));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
+ setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return entityContainer;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityKeyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityKeyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityKeyDeserializer.java
new file mode 100644
index 0000000..8462f4a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityKeyDeserializer.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.client.core.op;
+
+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.client.core.edm.xml.EntityKeyImpl;
+import org.apache.olingo.client.core.edm.xml.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.readValueAs( PropertyRefImpl.class));
+ }
+ }
+
+ return entityKey;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntitySetDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntitySetDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntitySetDeserializer.java
new file mode 100644
index 0000000..d11206e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntitySetDeserializer.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.client.core.op;
+
+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.client.core.edm.xml.AbstractEntitySet;
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyBindingImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.EntitySetImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v4.EntitySetImpl) entitySet).
+ setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).
+ getNavigationPropertyBindings().add(
+ jp.readValueAs(NavigationPropertyBindingImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).
+ setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return entitySet;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityTypeDeserializer.java
new file mode 100644
index 0000000..b2775e5
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EntityTypeDeserializer.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.op;
+
+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.client.core.edm.xml.AbstractEntityType;
+import org.apache.olingo.client.core.edm.xml.EntityKeyImpl;
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.EntityTypeImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.readValueAs(EntityKeyImpl.class));
+ } else if ("Property".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (entityType instanceof org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) entityType).
+ getProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
+ getProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
+ }
+ } else if ("NavigationProperty".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (entityType instanceof org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) entityType).
+ getNavigationProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.NavigationPropertyImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
+ getNavigationProperties().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyImpl.class));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
+ setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return entityType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EnumTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EnumTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EnumTypeDeserializer.java
new file mode 100644
index 0000000..f2b891c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/EnumTypeDeserializer.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.client.core.op;
+
+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.client.core.edm.xml.AbstractEnumType;
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.EnumTypeImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.EnumTypeImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.EnumTypeImpl) enumType).
+ getMembers().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.MemberImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).
+ getMembers().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.MemberImpl.class));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).
+ setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return enumType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/InjectableSerializerProvider.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/InjectableSerializerProvider.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/InjectableSerializerProvider.java
new file mode 100644
index 0000000..b9b5374
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/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.client.core.op;
+
+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;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
new file mode 100644
index 0000000..0b71abc
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.op;
+
+import java.net.URI;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.domain.ODataLinkType;
+import org.apache.olingo.client.api.domain.ODataCollectionValue;
+import org.apache.olingo.client.api.domain.ODataComplexValue;
+import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.domain.ODataGeospatialValue;
+import org.apache.olingo.client.api.domain.ODataInlineEntity;
+import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.client.api.domain.ODataLink;
+import org.apache.olingo.client.api.domain.ODataObjectFactory;
+import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.client.api.domain.ODataProperty;
+
+public class ODataObjectFactoryImpl implements ODataObjectFactory {
+
+ private static final long serialVersionUID = -3769695665946919447L;
+
+ protected final CommonODataClient client;
+
+ public ODataObjectFactoryImpl(final CommonODataClient client) {
+ this.client = client;
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet() {
+ return new ODataEntitySet();
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet(final URI next) {
+ return new ODataEntitySet(next);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name) {
+ return new ODataEntity(name);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name, final URI link) {
+ final ODataEntity result = new ODataEntity(name);
+ result.setLink(link);
+ return result;
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
+ final ODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(client.getServiceVersion(),
+ link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
+ final ODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(client.getServiceVersion(),
+ baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
+ return new ODataInlineEntity(client.getServiceVersion(), link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
+ final ODataEntity entity) {
+
+ return new ODataInlineEntity(client.getServiceVersion(),
+ baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
+ return new ODataProperty(name, value);
+ }
+
+ @Override
+ public ODataProperty newPrimitiveProperty(final String name, final ODataGeospatialValue value) {
+ return new ODataProperty(name, value);
+ }
+
+ @Override
+ public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ return new ODataProperty(name, value);
+ }
+
+ @Override
+ public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ return new ODataProperty(name, value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
new file mode 100644
index 0000000..7e5c9b4
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.op;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Collections;
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.client.api.domain.ODataLink;
+import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.api.op.ODataWriter;
+
+public class ODataWriterImpl implements ODataWriter {
+
+ private static final long serialVersionUID = 3265794768412314485L;
+
+ protected final CommonODataClient client;
+
+ public ODataWriterImpl(final CommonODataClient client) {
+ this.client = client;
+ }
+
+ @Override
+ public InputStream writeEntities(final Collection<ODataEntity> entities, final ODataPubFormat format) {
+ return writeEntities(entities, format, true);
+ }
+
+ @Override
+ public InputStream writeEntities(
+ final Collection<ODataEntity> entities, final ODataPubFormat format, final boolean outputType) {
+
+ final ByteArrayOutputStream output = new ByteArrayOutputStream();
+ try {
+ for (ODataEntity entity : entities) {
+ client.getSerializer().entry(client.getBinder().getEntry(
+ entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM), outputType), output);
+ }
+
+ return new ByteArrayInputStream(output.toByteArray());
+ } finally {
+ IOUtils.closeQuietly(output);
+ }
+ }
+
+ @Override
+ public InputStream writeEntity(final ODataEntity entity, final ODataPubFormat format) {
+ return writeEntity(entity, format, true);
+ }
+
+ @Override
+ public InputStream writeEntity(final ODataEntity entity, final ODataPubFormat format, final boolean outputType) {
+ return writeEntities(Collections.<ODataEntity>singleton(entity), format, outputType);
+ }
+
+ @Override
+ public InputStream writeProperty(final ODataProperty property, final ODataFormat format) {
+ final ByteArrayOutputStream output = new ByteArrayOutputStream();
+ try {
+ client.getSerializer().property(client.getBinder().getProperty(
+ property, ResourceFactory.entryClassForFormat(format == ODataFormat.XML), true), output);
+
+ return new ByteArrayInputStream(output.toByteArray());
+ } finally {
+ IOUtils.closeQuietly(output);
+ }
+ }
+
+ @Override
+ public InputStream writeLink(final ODataLink link, final ODataFormat format) {
+ final ByteArrayOutputStream output = new ByteArrayOutputStream();
+ try {
+ client.getSerializer().link(client.getBinder().getLink(link, format == ODataFormat.XML), format, output);
+
+ return new ByteArrayInputStream(output.toByteArray());
+ } finally {
+ IOUtils.closeQuietly(output);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
new file mode 100644
index 0000000..da3ead2
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.op;
+
+import org.apache.olingo.client.api.data.Entry;
+import org.apache.olingo.client.api.data.Feed;
+import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.core.data.AtomEntryImpl;
+import org.apache.olingo.client.core.data.AtomFeedImpl;
+import org.apache.olingo.client.core.data.AtomPropertyImpl;
+import org.apache.olingo.client.core.data.JSONEntryImpl;
+import org.apache.olingo.client.core.data.JSONFeedImpl;
+import org.apache.olingo.client.core.data.JSONPropertyImpl;
+
+public class ResourceFactory {
+
+ /**
+ * Gets a new instance of <tt>Feed</tt>.
+ *
+ * @param resourceClass reference class.
+ * @return <tt>Feed</tt> object.
+ */
+ public static Feed newFeed(final Class<? extends Feed> resourceClass) {
+ Feed result = null;
+
+ if (AtomFeedImpl.class.equals(resourceClass)) {
+ result = new AtomFeedImpl();
+ }
+ if (JSONFeedImpl.class.equals(resourceClass)) {
+ result = new JSONFeedImpl();
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets a new instance of <tt>Entry</tt>.
+ *
+ * @param resourceClass reference class.
+ * @return <tt>Entry</tt> object.
+ */
+ public static Entry newEntry(final Class<? extends Entry> resourceClass) {
+ Entry result = null;
+ if (AtomEntryImpl.class.equals(resourceClass)) {
+ result = new AtomEntryImpl();
+ }
+ if (JSONEntryImpl.class.equals(resourceClass)) {
+ result = new JSONEntryImpl();
+ }
+
+ return result;
+ }
+
+ public static Property newProperty(final Class<? extends Entry> resourceClass) {
+ Property result = null;
+ if (AtomEntryImpl.class.equals(resourceClass)) {
+ result = new AtomPropertyImpl();
+ }
+ if (JSONEntryImpl.class.equals(resourceClass)) {
+ result = new JSONPropertyImpl();
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets feed reference class from the given format.
+ *
+ * @param isXML whether it is JSON or XML / Atom
+ * @return resource reference class.
+ */
+ public static Class<? extends Feed> feedClassForFormat(final boolean isXML) {
+ return isXML ? AtomFeedImpl.class : JSONFeedImpl.class;
+ }
+
+ /**
+ * Gets entry reference class from the given format.
+ *
+ * @param isXML whether it is JSON or XML / Atom
+ * @return resource reference class.
+ */
+ public static Class<? extends Entry> entryClassForFormat(final boolean isXML) {
+ return isXML ? AtomEntryImpl.class : JSONEntryImpl.class;
+ }
+
+ /**
+ * Gets <tt>Entry</tt> object from feed resource.
+ *
+ * @param resourceClass feed reference class.
+ * @return <tt>Entry</tt> object.
+ */
+ public static Class<? extends Entry> entryClassForFeed(final Class<? extends Feed> resourceClass) {
+ Class<? extends Entry> result = null;
+
+ if (AtomFeedImpl.class.equals(resourceClass)) {
+ result = AtomEntryImpl.class;
+ }
+ if (JSONFeedImpl.class.equals(resourceClass)) {
+ result = JSONEntryImpl.class;
+ }
+
+ return result;
+ }
+
+ public static ODataPubFormat formatForEntryClass(final Class<? extends Entry> reference) {
+ return reference.equals(AtomEntryImpl.class) ? ODataPubFormat.ATOM : ODataPubFormat.JSON;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/SchemaDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/SchemaDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/SchemaDeserializer.java
new file mode 100644
index 0000000..47eb195
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/SchemaDeserializer.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.op;
+
+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.client.core.edm.xml.AbstractSchema;
+import org.apache.olingo.client.core.edm.xml.v3.AssociationImpl;
+import org.apache.olingo.client.core.edm.xml.v3.UsingImpl;
+import org.apache.olingo.client.core.edm.xml.v3.ValueTermImpl;
+import org.apache.olingo.client.core.edm.xml.v4.ActionImpl;
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.client.core.edm.xml.v4.FunctionImpl;
+import org.apache.olingo.client.core.edm.xml.v4.TypeDefinitionImpl;
+import org.apache.olingo.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.client.core.edm.xml.v3.SchemaImpl()
+ : new org.apache.olingo.client.core.edm.xml.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.client.core.edm.xml.v3.SchemaImpl) schema).
+ getUsings().add(jp.readValueAs( UsingImpl.class));
+ } else if ("Association".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getAssociations().add(jp.readValueAs( AssociationImpl.class));
+ } else if ("ComplexType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getComplexTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.ComplexTypeImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
+ getComplexTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl.class));
+ }
+ } else if ("EntityType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getEntityTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
+ getEntityTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl.class));
+ }
+ } else if ("EnumType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getEnumTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.EnumTypeImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
+ getEnumTypes().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl.class));
+ }
+ } else if ("ValueTerm".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getValueTerms().add(jp.readValueAs( ValueTermImpl.class));
+ } else if ("EntityContainer".equals(jp.getCurrentName())) {
+ jp.nextToken();
+
+ if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).
+ getEntityContainers().add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl.class));
+ } else {
+ org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl entityContainer
+ = jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl.class);
+ entityContainer.setDefaultEntityContainer(true);
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
+ setEntityContainer(entityContainer);
+ }
+ } else if ("Annotations".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
+ ((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).getAnnotationsList().
+ add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v3.AnnotationsImpl.class));
+ } else {
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotationsList().
+ add(jp.readValueAs(
+ org.apache.olingo.client.core.edm.xml.v4.AnnotationsImpl.class));
+ }
+ } else if ("Action".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getActions().
+ add(jp.readValueAs( ActionImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotations().
+ add(jp.readValueAs( AnnotationImpl.class));
+ } else if ("Function".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getFunctions().
+ add(jp.readValueAs( FunctionImpl.class));
+ } else if ("TypeDefinition".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
+ getTypeDefinitions().add(jp.readValueAs( TypeDefinitionImpl.class));
+ }
+ }
+ }
+
+ return schema;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java
deleted file mode 100644
index 5850a2d..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java
+++ /dev/null
@@ -1,71 +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.client.core.op.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.client.api.CommonODataClient;
-import org.apache.olingo.client.core.edm.xml.v4.ReturnTypeImpl;
-import org.apache.olingo.client.core.edm.xml.v4.annotation.ConstExprConstructImpl;
-
-public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
-
- protected CommonODataClient client;
-
- protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
- return ConstExprConstructImpl.Type.fromString(jp.getCurrentName()) != null;
- }
-
- protected ConstExprConstructImpl parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
- final ConstExprConstructImpl constExpr = new ConstExprConstructImpl();
- constExpr.setType(ConstExprConstructImpl.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.readValueAs( 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 = (CommonODataClient) ctxt.findInjectableValue(CommonODataClient.class.getName(), null, null);
- return doDeserialize(jp, ctxt);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java
deleted file mode 100644
index eb26d95..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java
+++ /dev/null
@@ -1,85 +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.client.core.op.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.client.api.CommonODataClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-abstract class AbstractJacksonTool {
-
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractJacksonTool.class);
-
- protected final CommonODataClient client;
-
- protected AbstractJacksonTool(final CommonODataClient client) {
- this.client = client;
- }
-
- protected ObjectMapper getObjectMapper() {
- final ObjectMapper mapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
-
- mapper.setInjectableValues(new InjectableValues.Std().addValue(CommonODataClient.class, client));
-
- mapper.setSerializerProvider(new InjectableSerializerProvider(mapper.getSerializerProvider(),
- mapper.getSerializationConfig().withAttribute(CommonODataClient.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(CommonODataClient.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/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
deleted file mode 100644
index 2c2cdea..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
+++ /dev/null
@@ -1,404 +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.client.core.op.impl;
-
-import java.io.StringWriter;
-import java.net.URI;
-import java.util.Iterator;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.data.ServiceDocumentItem;
-import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataCollectionValue;
-import org.apache.olingo.client.api.domain.ODataComplexValue;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInlineEntity;
-import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataOperation;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.op.CommonODataBinder;
-import org.apache.olingo.client.core.data.CollectionValueImpl;
-import org.apache.olingo.client.core.data.ComplexValueImpl;
-import org.apache.olingo.client.core.data.GeospatialValueImpl;
-import org.apache.olingo.client.core.data.JSONPropertyImpl;
-import org.apache.olingo.client.core.data.LinkImpl;
-import org.apache.olingo.client.core.data.NullValueImpl;
-import org.apache.olingo.client.core.data.PrimitiveValueImpl;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractODataBinder implements CommonODataBinder {
-
- private static final long serialVersionUID = 454285889193689536L;
-
- /**
- * Logger.
- */
- protected final Logger LOG = LoggerFactory.getLogger(AbstractODataBinder.class);
-
- protected final CommonODataClient client;
-
- protected AbstractODataBinder(final CommonODataClient client) {
- this.client = client;
- }
-
- @Override
- public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
- final ODataServiceDocument serviceDocument = new ODataServiceDocument();
-
- for (ServiceDocumentItem entitySet : resource.getEntitySets()) {
- // handles V3 JSON format oddities, where title is not contained
- serviceDocument.getEntitySets().put(StringUtils.isBlank(entitySet.getTitle())
- ? entitySet.getName() : entitySet.getTitle(),
- URIUtils.getURI(resource.getBaseURI(), entitySet.getHref()));
- }
-
- return serviceDocument;
- }
-
- @Override
- public Feed getFeed(final ODataEntitySet feed, final Class<? extends Feed> reference) {
- final Feed feedResource = ResourceFactory.newFeed(reference);
-
- feedResource.setCount(feed.getCount());
-
- final URI next = feed.getNext();
- if (next != null) {
- feedResource.setNext(next);
- }
-
- for (ODataEntity entity : feed.getEntities()) {
- feedResource.getEntries().add(getEntry(entity, ResourceFactory.entryClassForFeed(reference)));
- }
-
- return feedResource;
- }
-
- @Override
- public Entry getEntry(final ODataEntity entity, final Class<? extends Entry> reference) {
- return getEntry(entity, reference, true);
- }
-
- @Override
- public Entry getEntry(final ODataEntity entity, final Class<? extends Entry> reference, final boolean setType) {
- final Entry entry = ResourceFactory.newEntry(reference);
- entry.setType(entity.getName());
-
- // -------------------------------------------------------------
- // Add edit and self link
- // -------------------------------------------------------------
- final URI editLink = entity.getEditLink();
- if (editLink != null) {
- final LinkImpl entryEditLink = new LinkImpl();
- entryEditLink.setTitle(entity.getName());
- entryEditLink.setHref(editLink.toASCIIString());
- entryEditLink.setRel(Constants.EDIT_LINK_REL);
- entry.setEditLink(entryEditLink);
- }
-
- if (entity.isReadOnly()) {
- final LinkImpl entrySelfLink = new LinkImpl();
- entrySelfLink.setTitle(entity.getName());
- entrySelfLink.setHref(entity.getLink().toASCIIString());
- entrySelfLink.setRel(Constants.SELF_LINK_REL);
- entry.setSelfLink(entrySelfLink);
- }
- // -------------------------------------------------------------
-
- // -------------------------------------------------------------
- // Append navigation links (handling inline entry / feed as well)
- // -------------------------------------------------------------
- // handle navigation links
- for (ODataLink link : entity.getNavigationLinks()) {
- // append link
- LOG.debug("Append navigation link\n{}", link);
- entry.getNavigationLinks().add(getLink(link,
- ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
- }
- // -------------------------------------------------------------
-
- // -------------------------------------------------------------
- // Append edit-media links
- // -------------------------------------------------------------
- for (ODataLink link : entity.getEditMediaLinks()) {
- LOG.debug("Append edit-media link\n{}", link);
- entry.getMediaEditLinks().add(getLink(link,
- ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
- }
- // -------------------------------------------------------------
-
- // -------------------------------------------------------------
- // Append association links
- // -------------------------------------------------------------
- for (ODataLink link : entity.getAssociationLinks()) {
- LOG.debug("Append association link\n{}", link);
- entry.getAssociationLinks().add(getLink(link,
- ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
- }
- // -------------------------------------------------------------
-
- if (entity.isMediaEntity()) {
- entry.setMediaContentSource(entity.getMediaContentSource());
- entry.setMediaContentType(entity.getMediaContentType());
- }
-
- for (ODataProperty property : entity.getProperties()) {
- entry.getProperties().add(getProperty(property, reference, setType));
- }
-
- return entry;
- }
-
- @Override
- public Link getLink(final ODataLink link, boolean isXML) {
- final Link linkResource = new LinkImpl();
- linkResource.setRel(link.getRel());
- linkResource.setTitle(link.getName());
- linkResource.setHref(link.getLink() == null ? null : link.getLink().toASCIIString());
- linkResource.setType(link.getType().toString());
- linkResource.setMediaETag(link.getMediaETag());
-
- if (link instanceof ODataInlineEntity) {
- // append inline entity
- final ODataEntity inlineEntity = ((ODataInlineEntity) link).getEntity();
- LOG.debug("Append in-line entity\n{}", inlineEntity);
-
- linkResource.setInlineEntry(getEntry(inlineEntity, ResourceFactory.entryClassForFormat(isXML)));
- } else if (link instanceof ODataInlineEntitySet) {
- // append inline feed
- final ODataEntitySet InlineFeed = ((ODataInlineEntitySet) link).getEntitySet();
- LOG.debug("Append in-line feed\n{}", InlineFeed);
-
- linkResource.setInlineFeed(getFeed(InlineFeed, ResourceFactory.feedClassForFormat(isXML)));
- }
-
- return linkResource;
- }
-
- @Override
- public Property getProperty(final ODataProperty property, final Class<? extends Entry> reference,
- final boolean setType) {
-
- final Property propertyResource = ResourceFactory.newProperty(reference);
- propertyResource.setName(property.getName());
- propertyResource.setValue(getValue(property.getValue(), reference, setType));
-
- if (setType) {
- if (property.hasPrimitiveValue()) {
- propertyResource.setType(property.getPrimitiveValue().getType().toString());
- } else if (property.hasComplexValue()) {
- propertyResource.setType(property.getComplexValue().getType());
- } else if (property.hasCollectionValue()) {
- propertyResource.setType(property.getCollectionValue().getType());
- }
- }
-
- return propertyResource;
- }
-
- private Value getValue(final ODataValue value, final Class<? extends Entry> reference, final boolean setType) {
- Value valueResource = null;
-
- if (value == null) {
- valueResource = new NullValueImpl();
- } else if (value.isPrimitive()) {
- valueResource = new PrimitiveValueImpl(value.asPrimitive().toString());
- } else if (value.isGeospatial()) {
- valueResource = new GeospatialValueImpl(value.asGeospatial().toValue());
- } else if (value.isComplex()) {
- final ODataComplexValue _value = value.asComplex();
- valueResource = new ComplexValueImpl();
-
- for (final Iterator<ODataProperty> itor = _value.iterator(); itor.hasNext();) {
- valueResource.asComplex().get().add(getProperty(itor.next(), reference, setType));
- }
- } else if (value.isCollection()) {
- final ODataCollectionValue _value = value.asCollection();
- valueResource = new CollectionValueImpl();
-
- for (final Iterator<ODataValue> itor = _value.iterator(); itor.hasNext();) {
- valueResource.asCollection().get().add(getValue(itor.next(), reference, setType));
- }
- }
-
- return valueResource;
- }
-
- @Override
- public ODataEntitySet getODataEntitySet(final Feed resource) {
- return getODataEntitySet(resource, null);
- }
-
- @Override
- public ODataEntitySet getODataEntitySet(final Feed resource, final URI defaultBaseURI) {
- if (LOG.isDebugEnabled()) {
- final StringWriter writer = new StringWriter();
- client.getSerializer().feed(resource, writer);
- writer.flush();
- LOG.debug("Feed -> ODataEntitySet:\n{}", writer.toString());
- }
-
- final URI base = defaultBaseURI == null ? resource.getBaseURI() : defaultBaseURI;
-
- final URI next = resource.getNext();
-
- final ODataEntitySet entitySet = next == null
- ? client.getObjectFactory().newEntitySet()
- : client.getObjectFactory().newEntitySet(URIUtils.getURI(base, next.toASCIIString()));
-
- if (resource.getCount() != null) {
- entitySet.setCount(resource.getCount());
- }
-
- for (Entry entryResource : resource.getEntries()) {
- entitySet.addEntity(getODataEntity(entryResource));
- }
-
- return entitySet;
- }
-
- @Override
- public ODataEntity getODataEntity(final Entry resource) {
- return getODataEntity(resource, null);
- }
-
- @Override
- public ODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
- if (LOG.isDebugEnabled()) {
- final StringWriter writer = new StringWriter();
- client.getSerializer().entry(resource, writer);
- writer.flush();
- LOG.debug("EntryResource -> ODataEntity:\n{}", writer.toString());
- }
-
- final URI base = defaultBaseURI == null ? resource.getBaseURI() : defaultBaseURI;
-
- final ODataEntity entity = resource.getSelfLink() == null
- ? client.getObjectFactory().newEntity(resource.getType())
- : client.getObjectFactory().newEntity(resource.getType(),
- URIUtils.getURI(base, resource.getSelfLink().getHref()));
-
- if (StringUtils.isNotBlank(resource.getETag())) {
- entity.setETag(resource.getETag());
- }
-
- if (resource.getEditLink() != null) {
- entity.setEditLink(URIUtils.getURI(base, resource.getEditLink().getHref()));
- }
-
- for (Link link : resource.getAssociationLinks()) {
- entity.addLink(client.getObjectFactory().newAssociationLink(link.getTitle(), base, link.getHref()));
- }
-
- for (Link link : resource.getNavigationLinks()) {
- final Entry inlineEntry = link.getInlineEntry();
- final Feed inlineFeed = link.getInlineFeed();
-
- if (inlineEntry == null && inlineFeed == null) {
- entity.addLink(
- client.getObjectFactory().newEntityNavigationLink(link.getTitle(), base, link.getHref()));
- } else if (inlineFeed == null) {
- entity.addLink(client.getObjectFactory().newInlineEntity(
- link.getTitle(), base, link.getHref(),
- getODataEntity(inlineEntry,
- inlineEntry.getBaseURI() == null ? base : inlineEntry.getBaseURI())));
- } else {
- entity.addLink(client.getObjectFactory().newInlineEntitySet(
- link.getTitle(), base, link.getHref(),
- getODataEntitySet(inlineFeed,
- inlineFeed.getBaseURI() == null ? base : inlineFeed.getBaseURI())));
- }
- }
-
- for (Link link : resource.getMediaEditLinks()) {
- entity.addLink(client.getObjectFactory().newMediaEditLink(link.getTitle(), base, link.getHref()));
- }
-
- for (ODataOperation operation : resource.getOperations()) {
- operation.setTarget(URIUtils.getURI(base, operation.getTarget()));
- entity.getOperations().add(operation);
- }
-
- if (resource.isMediaEntry()) {
- entity.setMediaEntity(true);
- entity.setMediaContentSource(resource.getMediaContentSource());
- entity.setMediaContentType(resource.getMediaContentType());
- }
-
- for (Property property : resource.getProperties()) {
- entity.getProperties().add(getODataProperty(property));
- }
-
- return entity;
- }
-
- @Override
- public ODataProperty getODataProperty(final Property property) {
- return new ODataProperty(property.getName(), getODataValue(property));
- }
-
- private ODataValue getODataValue(final Property resource) {
- ODataValue value = null;
-
- if (resource.getValue().isSimple()) {
- value = client.getPrimitiveValueBuilder().
- setText(resource.getValue().asSimple().get()).
- setType(resource.getType() == null
- ? null
- : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
- } else if (resource.getValue().isGeospatial()) {
- value = client.getGeospatialValueBuilder().
- setValue(resource.getValue().asGeospatial().get()).
- setType(resource.getType() == null
- || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
- || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().toString().equals(resource.getType())
- ? null
- : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
- } else if (resource.getValue().isComplex()) {
- value = new ODataComplexValue(resource.getType());
-
- for (Property property : resource.getValue().asComplex().get()) {
- value.asComplex().add(getODataProperty(property));
- }
- } else if (resource.getValue().isCollection()) {
- value = new ODataCollectionValue(resource.getType());
-
- for (Value _value : resource.getValue().asCollection().get()) {
- final JSONPropertyImpl fake = new JSONPropertyImpl();
- fake.setValue(_value);
- value.asCollection().add(getODataValue(fake));
- }
- }
-
- return value;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java
deleted file mode 100644
index 67acc09..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java
+++ /dev/null
@@ -1,107 +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.client.core.op.impl;
-
-import java.io.InputStream;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.ODataError;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.op.CommonODataDeserializer;
-import org.apache.olingo.client.core.data.AtomDeserializer;
-import org.apache.olingo.client.core.data.AtomEntryImpl;
-import org.apache.olingo.client.core.data.AtomFeedImpl;
-import org.apache.olingo.client.core.data.AtomPropertyImpl;
-import org.apache.olingo.client.core.data.JSONEntryImpl;
-import org.apache.olingo.client.core.data.JSONErrorBundle;
-import org.apache.olingo.client.core.data.JSONFeedImpl;
-import org.apache.olingo.client.core.data.JSONPropertyImpl;
-import org.apache.olingo.client.core.data.XMLErrorImpl;
-
-public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements CommonODataDeserializer {
-
- private static final long serialVersionUID = -4244158979195609909L;
-
- private final AtomDeserializer atomDeserializer;
-
- public AbstractODataDeserializer(final CommonODataClient client) {
- super(client);
-
- this.atomDeserializer = new AtomDeserializer(client.getServiceVersion());
- }
-
- @Override
- public Feed toFeed(final InputStream input, final ODataPubFormat format) {
- return format == ODataPubFormat.ATOM
- ? atom(input, AtomFeedImpl.class)
- : json(input, JSONFeedImpl.class);
- }
-
- @Override
- public Entry toEntry(final InputStream input, final ODataPubFormat format) {
- return format == ODataPubFormat.ATOM
- ? atom(input, AtomEntryImpl.class)
- : json(input, JSONEntryImpl.class);
- }
-
- @Override
- public Property toProperty(final InputStream input, final ODataFormat format) {
- return format == ODataFormat.XML
- ? atom(input, AtomPropertyImpl.class)
- : json(input, JSONPropertyImpl.class);
- }
-
- @Override
- public ODataError toError(final InputStream input, final boolean isXML) {
- return isXML
- ? xml(input, XMLErrorImpl.class)
- : json(input, JSONErrorBundle.class).getError();
- }
-
- /*
- * ------------------ Protected methods ------------------
- */
- protected <T> T xml(final InputStream input, final Class<T> reference) {
- try {
- return getXmlMapper().readValue(input, reference);
- } catch (Exception e) {
- throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
- }
- }
-
- protected <T> T atom(final InputStream input, final Class<T> reference) {
- try {
- return atomDeserializer.read(input, reference);
- } catch (Exception e) {
- throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
- }
- }
-
- protected <T> T json(final InputStream input, final Class<T> reference) {
- try {
- return getObjectMapper().readValue(input, reference);
- } catch (Exception e) {
- throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
deleted file mode 100644
index 596e8fd..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
+++ /dev/null
@@ -1,117 +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.client.core.op.impl;
-
-import java.io.InputStream;
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.data.ODataError;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.format.ODataValueFormat;
-import org.apache.olingo.client.api.op.CommonODataReader;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractODataReader implements CommonODataReader {
-
- private static final long serialVersionUID = -1988865870981207079L;
-
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractODataReader.class);
-
- protected final CommonODataClient client;
-
- protected AbstractODataReader(final CommonODataClient client) {
- this.client = client;
- }
-
- @Override
- public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
- return client.getBinder().getODataEntitySet(client.getDeserializer().toFeed(input, format));
- }
-
- @Override
- public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
- return client.getBinder().getODataEntity(client.getDeserializer().toEntry(input, format));
- }
-
- @Override
- public ODataProperty readProperty(final InputStream input, final ODataFormat format) {
- final Property property = client.getDeserializer().toProperty(input, format);
- return client.getBinder().getODataProperty(property);
- }
-
- @Override
- public ODataError readError(final InputStream inputStream, final boolean isXML) {
- return client.getDeserializer().toError(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 (ODataValue.class.isAssignableFrom(reference)) {
- res = client.getPrimitiveValueBuilder().
- setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT
- ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
- setText(IOUtils.toString(src)).
- build();
- } else if (XMLMetadata.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;
- }
-}
[12/52] [abbrv] [OLINGO-65] Geospatial types implemented,
EdmStream mock implemented with URI as backend, V3 pruned types implemented,
EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java
new file mode 100644
index 0000000..2f16e24
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+
+public final class EdmGeometry extends AbstractEdmGeospatialType<Geospatial> {
+
+ private static final EdmGeometry INSTANCE = new EdmGeometry();
+
+ public static EdmGeometry getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometry() {
+ super(Geospatial.class, Dimension.GEOMETRY, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
new file mode 100644
index 0000000..12c6c01
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryCollection extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeometryCollection INSTANCE = new EdmGeometryCollection();
+
+ public static EdmGeometryCollection getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryCollection() {
+ super(Point.class, Dimension.GEOMETRY, Type.GEOSPATIALCOLLECTION);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java
new file mode 100644
index 0000000..db8cfb0
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryLineString extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeometryLineString INSTANCE = new EdmGeometryLineString();
+
+ public static EdmGeometryLineString getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryLineString() {
+ super(Point.class, Dimension.GEOMETRY, Type.LINESTRING);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java
new file mode 100644
index 0000000..7bf89e6
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryMultiLineString extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeometryMultiLineString INSTANCE = new EdmGeometryMultiLineString();
+
+ public static EdmGeometryMultiLineString getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryMultiLineString() {
+ super(Point.class, Dimension.GEOMETRY, Type.MULTILINESTRING);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java
new file mode 100644
index 0000000..9311d8d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryMultiPoint extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeometryMultiPoint INSTANCE = new EdmGeometryMultiPoint();
+
+ public static EdmGeometryMultiPoint getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryMultiPoint() {
+ super(Point.class, Dimension.GEOMETRY, Type.MULTIPOINT);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java
new file mode 100644
index 0000000..f64ed87
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryMultiPolygon extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeometryMultiPolygon INSTANCE = new EdmGeometryMultiPolygon();
+
+ public static EdmGeometryMultiPolygon getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryMultiPolygon() {
+ super(Point.class, Dimension.GEOMETRY, Type.MULTIPOLYGON);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java
new file mode 100644
index 0000000..ba8e5d2
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryPoint extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeometryPoint INSTANCE = new EdmGeometryPoint();
+
+ public static EdmGeometryPoint getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryPoint() {
+ super(Point.class, Dimension.GEOMETRY, Type.POINT);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java
new file mode 100644
index 0000000..12f8cf1
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryPolygon extends AbstractEdmGeospatialType<Point> {
+
+ private static final EdmGeometryPolygon INSTANCE = new EdmGeometryPolygon();
+
+ public static EdmGeometryPolygon getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryPolygon() {
+ super(Point.class, Dimension.GEOMETRY, Type.POLYGON);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNull.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNull.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNull.java
deleted file mode 100644
index 57b1218..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNull.java
+++ /dev/null
@@ -1,75 +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.commons.core.edm.primitivetype;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-
-//TODO: Is this class still necessary?
-/**
- * Implementation of the simple type Null.
- */
-public final class EdmNull extends SingletonPrimitiveType {
-
- private static final EdmNull INSTANCE = new EdmNull();
-
- public static EdmNull getInstance() {
- return INSTANCE;
- }
-
- @Override
- public boolean equals(final Object obj) {
- return this == obj || obj == null;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- @Override
- public Class<?> getDefaultType() {
- return null;
- }
-
- @Override
- protected <T> T internalValueOfString(final String value,
- final Boolean isNullable, final Integer maxLength, final Integer precision,
- final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
-
- return null;
- }
-
- @Override
- protected <T> String internalValueToString(final T value,
- final Boolean isNullable, final Integer maxLength, final Integer precision,
- final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
-
- return null;
- }
-
- @Override
- public String toUriLiteral(final String literal) {
- return "null";
- }
-
- @Override
- public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java
new file mode 100644
index 0000000..83a257d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.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.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.EdmGeospatialType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmType;
+
+public final class EdmPrimitiveTypeFactory {
+
+ public static EdmType getInstance(final EdmPrimitiveTypeKind kind) {
+ return kind.isGeospatial()
+ ? getGeoInstance(kind)
+ : getNonGeoInstance(kind);
+ }
+
+ /**
+ * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmPrimitiveType} (for
+ * non-geospatial types).
+ *
+ * @param kind EdmPrimitiveTypeKind
+ * @return {@link EdmPrimitiveType} instance
+ */
+ public static EdmPrimitiveType getNonGeoInstance(final EdmPrimitiveTypeKind kind) {
+ switch (kind) {
+ case Binary:
+ return EdmBinary.getInstance();
+ case Boolean:
+ return EdmBoolean.getInstance();
+ case Byte:
+ return EdmByte.getInstance();
+ case SByte:
+ return EdmSByte.getInstance();
+ case Date:
+ return EdmDate.getInstance();
+ case DateTime:
+ return EdmDateTime.getInstance();
+ case DateTimeOffset:
+ return EdmDateTimeOffset.getInstance();
+ case Time:
+ return EdmTime.getInstance();
+ case TimeOfDay:
+ return EdmTimeOfDay.getInstance();
+ case Duration:
+ return EdmDuration.getInstance();
+ case Decimal:
+ return EdmDecimal.getInstance();
+ case Single:
+ return EdmSingle.getInstance();
+ case Double:
+ return EdmDouble.getInstance();
+ case Guid:
+ return EdmGuid.getInstance();
+ case Int16:
+ return EdmInt16.getInstance();
+ case Int32:
+ return EdmInt32.getInstance();
+ case Int64:
+ return EdmInt64.getInstance();
+ case String:
+ return EdmString.getInstance();
+ case Stream:
+ return EdmStream.getInstance();
+
+ default:
+ throw new IllegalArgumentException("Wrong type: " + kind);
+ }
+ }
+
+ /**
+ * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmGeospatialType}.
+ *
+ * @param kind EdmPrimitiveTypeKind
+ * @return {@link EdmGeospatialType} instance
+ */
+ public static EdmGeospatialType getGeoInstance(final EdmPrimitiveTypeKind kind) {
+ switch (kind) {
+ case Geography:
+ return EdmGeography.getInstance();
+ case GeographyPoint:
+ return EdmGeographyPoint.getInstance();
+ case GeographyLineString:
+ return EdmGeographyLineString.getInstance();
+ case GeographyPolygon:
+ return EdmGeographyPolygon.getInstance();
+ case GeographyMultiPoint:
+ return EdmGeographyMultiPoint.getInstance();
+ case GeographyMultiLineString:
+ return EdmGeographyMultiLineString.getInstance();
+ case GeographyMultiPolygon:
+ return EdmGeographyMultiPolygon.getInstance();
+ case GeographyCollection:
+ return EdmGeographyCollection.getInstance();
+ case Geometry:
+ return EdmGeometry.getInstance();
+ case GeometryPoint:
+ return EdmGeometry.getInstance();
+ case GeometryLineString:
+ return EdmGeometryLineString.getInstance();
+ case GeometryPolygon:
+ return EdmGeometryPolygon.getInstance();
+ case GeometryMultiPoint:
+ return EdmGeometryMultiPoint.getInstance();
+ case GeometryMultiLineString:
+ return EdmGeographyMultiLineString.getInstance();
+ case GeometryMultiPolygon:
+ return EdmGeometryMultiPolygon.getInstance();
+ case GeometryCollection:
+ return EdmGeometryCollection.getInstance();
+
+ default:
+ throw new IllegalArgumentException("Wrong type: " + kind);
+
+ }
+ }
+
+ private EdmPrimitiveTypeFactory() {
+ // empty constructor for static utility class
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
deleted file mode 100644
index e368607..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
+++ /dev/null
@@ -1,95 +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.commons.core.edm.primitivetype;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-//TODO: Should we delete this typekind and use a facade?
-public enum EdmPrimitiveTypeKind {
-
- Binary, Boolean, Byte, Date, DateTimeOffset, Decimal, Double, Duration, Guid,
- Int16, Int32, Int64, SByte, Single, String, TimeOfDay;
-
- /**
- * Returns the {@link FullQualifiedName} for this type kind.
- *
- * @return {@link FullQualifiedName}
- */
- public FullQualifiedName getFullQualifiedName() {
- return new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, toString());
- }
-
- /**
- * Returns an instance for this {@link EdmPrimitiveTypeKind} in the form of {@link EdmPrimitiveType}.
- *
- * @return {@link EdmPrimitiveType} instance
- */
- public EdmPrimitiveType getEdmPrimitiveTypeInstance() {
- switch (this) {
- case Binary:
- return EdmBinary.getInstance();
- case Boolean:
- return EdmBoolean.getInstance();
- case Byte:
- return EdmByte.getInstance();
- case Date:
- return EdmDate.getInstance();
- case DateTimeOffset:
- return EdmDateTimeOffset.getInstance();
- case Decimal:
- return EdmDecimal.getInstance();
- case Double:
- return EdmDouble.getInstance();
- case Duration:
- return EdmDuration.getInstance();
- case Guid:
- return EdmGuid.getInstance();
- case Int16:
- return EdmInt16.getInstance();
- case Int32:
- return EdmInt32.getInstance();
- case Int64:
- return EdmInt64.getInstance();
- case SByte:
- return EdmSByte.getInstance();
- case Single:
- return EdmSingle.getInstance();
- case String:
- return EdmString.getInstance();
- case TimeOfDay:
- return EdmTimeOfDay.getInstance();
- default:
- throw new RuntimeException("Wrong type:" + this);
- }
- }
-
- /**
- * Gets <tt>EdmPrimitiveTypeKind</tt> from a full string (e.g. 'Edm.Int32').
- *
- * @param value string value type.
- * @return <tt>EdmPrimitiveTypeKind</tt> object.
- */
- public static EdmPrimitiveTypeKind valueOfFQN(final String value) {
- if (!value.startsWith(EdmPrimitiveType.EDM_NAMESPACE + ".")) {
- throw new IllegalArgumentException(value + " does not look like an Edm primitive type");
- }
- return valueOf(value.substring(4));
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java
new file mode 100644
index 0000000..75b6291
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.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.commons.core.edm.primitivetype;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+
+/**
+ * Implementation of the EDM primitive type Stream as URI.
+ */
+public final class EdmStream extends SingletonPrimitiveType {
+
+ private static final EdmStream INSTANCE = new EdmStream();
+
+ public static EdmStream getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public Class<?> getDefaultType() {
+ return URI.class;
+ }
+
+ @Override
+ public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) {
+
+ if (value == null) {
+ return isNullable == null || isNullable;
+ }
+
+ try {
+ new URI(value);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ @Override
+ protected <T> T internalValueOfString(final String value,
+ final Boolean isNullable, final Integer maxLength, final Integer precision,
+ final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ URI stream = null;
+ try {
+ stream = new URI(value);
+ } catch (Exception e) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
+ }
+
+ if (returnType.isAssignableFrom(URI.class)) {
+ return returnType.cast(stream);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value,
+ final Boolean isNullable, final Integer maxLength, final Integer precision,
+ final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof URI) {
+ return ((URI) value).toASCIIString();
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java
new file mode 100644
index 0000000..75e80cf
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.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.commons.core.edm.primitivetype;
+
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+
+/**
+ * Implementation of the EDM primitive type Time.
+ */
+public final class EdmTime extends SingletonPrimitiveType {
+
+ private static final EdmTime INSTANCE = new EdmTime();
+
+ public static EdmTime getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public Class<?> getDefaultType() {
+ return Duration.class;
+ }
+
+ @Override
+ protected <T> T internalValueOfString(final String value,
+ final Boolean isNullable, final Integer maxLength, final Integer precision,
+ final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ Duration duration = null;
+ try {
+ final DatatypeFactory dtFactory = DatatypeFactory.newInstance();
+ duration = dtFactory.newDuration(value);
+ } catch (Exception e) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
+ }
+
+ if (returnType.isAssignableFrom(Duration.class)) {
+ return returnType.cast(duration);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.LITERAL_UNCONVERTIBLE_TO_VALUE_TYPE.addContent(value, returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value,
+ final Boolean isNullable, final Integer maxLength, final Integer precision,
+ final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof Duration) {
+ final Duration duration = (Duration) value;
+ return duration.toString();
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
index 18b0dc6..dba916b 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
@@ -28,10 +28,9 @@ import java.util.Calendar;
import java.util.UUID;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmNull;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
import org.junit.Test;
public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
@@ -40,9 +39,11 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
public void nameSpace() throws Exception {
assertEquals(EdmPrimitiveType.SYSTEM_NAMESPACE, Uint7.getInstance().getNamespace());
- assertEquals(EdmPrimitiveType.EDM_NAMESPACE, EdmNull.getInstance().getNamespace());
+ assertEquals(EdmPrimitiveType.EDM_NAMESPACE, EdmInt32.getInstance().getNamespace());
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
+ final EdmType instance = kind.isGeospatial()
+ ? EdmPrimitiveTypeFactory.getGeoInstance(kind)
+ : EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
assertEquals(EdmPrimitiveType.EDM_NAMESPACE, instance.getNamespace());
}
}
@@ -51,29 +52,33 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
public void names() throws Exception {
assertEquals("Uint7", Uint7.getInstance().getName());
- assertEquals("Null", EdmNull.getInstance().getName());
- assertEquals("Binary", EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Boolean", EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Byte", EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Date", EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance().getName());
- assertEquals("DateTimeOffset", EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Decimal", EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Double", EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Duration", EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Guid", EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Int16", EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Int32", EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Int64", EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance().getName());
- assertEquals("SByte", EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Single", EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance().getName());
- assertEquals("String", EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance().getName());
- assertEquals("TimeOfDay", EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance().getName());
+ assertEquals("Binary", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).getName());
+ assertEquals("Boolean", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).getName());
+ assertEquals("Byte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).getName());
+ assertEquals("Date", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).getName());
+ assertEquals("DateTimeOffset",
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).getName());
+ assertEquals("Decimal", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).getName());
+ assertEquals("Double", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).getName());
+ assertEquals("Duration", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).getName());
+ assertEquals("Guid", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).getName());
+ assertEquals("Int16", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).getName());
+ assertEquals("Int32", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).getName());
+ assertEquals("Int64", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).getName());
+ assertEquals("SByte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).getName());
+ assertEquals("Single", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).getName());
+ assertEquals("String", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).getName());
+ assertEquals("TimeOfDay", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).getName());
}
@Test
public void kind() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- assertEquals(EdmTypeKind.PRIMITIVE, kind.getEdmPrimitiveTypeInstance().getKind());
+ if (kind.isGeospatial()) {
+ assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getGeoInstance(kind).getKind());
+ } else {
+ assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getNonGeoInstance(kind).getKind());
+ }
}
}
@@ -81,95 +86,113 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
public void toStringAll() throws Exception {
assertEquals("System.Uint7", Uint7.getInstance().toString());
- assertEquals("Edm.Null", EdmNull.getInstance().toString());
- assertEquals("Edm.Binary", EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Boolean", EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Byte", EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Date", EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.DateTimeOffset", EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Decimal", EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Double", EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Duration", EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Guid", EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Int16", EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Int32", EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Int64", EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.SByte", EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Single", EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.String", EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.TimeOfDay", EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance().toString());
+ assertEquals("Edm.Binary", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).toString());
+ assertEquals("Edm.Boolean", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).toString());
+ assertEquals("Edm.Byte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).toString());
+ assertEquals("Edm.Date", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).toString());
+ assertEquals("Edm.DateTimeOffset",
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).toString());
+ assertEquals("Edm.Decimal", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).toString());
+ assertEquals("Edm.Double", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).toString());
+ assertEquals("Edm.Duration", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).toString());
+ assertEquals("Edm.Guid", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).toString());
+ assertEquals("Edm.Int16", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).toString());
+ assertEquals("Edm.Int32", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).toString());
+ assertEquals("Edm.Int64", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).toString());
+ assertEquals("Edm.SByte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).toString());
+ assertEquals("Edm.Single", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).toString());
+ assertEquals("Edm.String", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).toString());
+ assertEquals("Edm.TimeOfDay", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).toString());
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertEquals(instance.toString(), kind.getFullQualifiedName().toString());
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertEquals(instance.toString(), kind.getFullQualifiedName().toString());
+ }
}
}
@Test
public void compatibility() {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertTrue(instance.isCompatible(instance));
- assertFalse(instance.isCompatible(
- (kind == EdmPrimitiveTypeKind.String ? EdmPrimitiveTypeKind.Binary : EdmPrimitiveTypeKind.String)
- .getEdmPrimitiveTypeInstance()));
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertTrue(instance.isCompatible(instance));
+ assertFalse(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(
+ (kind == EdmPrimitiveTypeKind.String ? EdmPrimitiveTypeKind.Binary : EdmPrimitiveTypeKind.String))));
+ }
}
}
@Test
public void defaultType() throws Exception {
assertEquals(Byte.class, Uint7.getInstance().getDefaultType());
- assertNull(EdmNull.getInstance().getDefaultType());
-
- assertEquals(byte[].class, EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Boolean.class, EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Short.class, EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Calendar.class, EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Calendar.class, EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(BigDecimal.class, EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Double.class, EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(BigDecimal.class, EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(UUID.class, EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Short.class, EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Integer.class, EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Long.class, EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Byte.class, EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Float.class, EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(String.class, EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Calendar.class, EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance().getDefaultType());
+
+ assertEquals(byte[].class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).getDefaultType());
+ assertEquals(Boolean.class,
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).getDefaultType());
+ assertEquals(Short.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).getDefaultType());
+ assertEquals(Calendar.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).getDefaultType());
+ assertEquals(Calendar.class,
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).getDefaultType());
+ assertEquals(BigDecimal.class,
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).getDefaultType());
+ assertEquals(Double.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).getDefaultType());
+ assertEquals(BigDecimal.class,
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).getDefaultType());
+ assertEquals(UUID.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).getDefaultType());
+ assertEquals(Short.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).getDefaultType());
+ assertEquals(Integer.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).getDefaultType());
+ assertEquals(Long.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).getDefaultType());
+ assertEquals(Byte.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).getDefaultType());
+ assertEquals(Float.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).getDefaultType());
+ assertEquals(String.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).getDefaultType());
+ assertEquals(Calendar.class,
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).getDefaultType());
}
@Test
public void validate() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertTrue(instance.validate(null, null, null, null, null, null));
- assertTrue(instance.validate(null, true, null, null, null, null));
- assertFalse(instance.validate(null, false, null, null, null, null));
- assertFalse(instance.validate("ä", null, null, null, null, false));
- if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Binary) {
- assertFalse(instance.validate("", null, null, null, null, null));
- }
- if (kind != EdmPrimitiveTypeKind.String) {
- assertFalse(instance.validate("ä", null, null, null, null, null));
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertTrue(instance.validate(null, null, null, null, null, null));
+ assertTrue(instance.validate(null, true, null, null, null, null));
+ assertFalse(instance.validate(null, false, null, null, null, null));
+ if (kind != EdmPrimitiveTypeKind.Stream) {
+ assertFalse(instance.validate("ä", null, null, null, null, false));
+ }
+ if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Binary
+ && kind != EdmPrimitiveTypeKind.Stream) {
+
+ assertFalse(instance.validate("", null, null, null, null, null));
+ }
+ if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Stream) {
+ assertFalse(instance.validate("ä", null, null, null, null, null));
+ }
}
}
- assertTrue(EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().validate("abcd", null, 3, null, null, null));
- assertFalse(EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().validate("abcd", null, 2, null, null, null));
+ assertTrue(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).
+ validate("abcd", null, 3, null, null, null));
+ assertFalse(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).
+ validate("abcd", null, 2, null, null, null));
- assertTrue(EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().validate("1", null, null, null, null,
- null));
- assertFalse(EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().validate("1.2", null, null, null, 0, null));
+ assertTrue(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).
+ validate("1", null, null, null, null, null));
+ assertFalse(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).
+ validate("1.2", null, null, null, 0, null));
}
@Test
public void uriLiteral() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertEquals("test", instance.fromUriLiteral(instance.toUriLiteral("test")));
- assertNull(instance.toUriLiteral(null));
- assertNull(instance.fromUriLiteral(null));
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertEquals("test", instance.fromUriLiteral(instance.toUriLiteral("test")));
+ assertNull(instance.toUriLiteral(null));
+ assertNull(instance.fromUriLiteral(null));
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
index 39fd38c..c3ff01c 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
@@ -25,12 +25,12 @@ import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmBinaryTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary);
@Test
public void validate() throws Exception {
@@ -64,14 +64,14 @@ public class EdmBinaryTest extends PrimitiveTypeBaseTest {
@Test
public void valueToString() throws Exception {
- final byte[] binary = new byte[] { (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF };
+ final byte[] binary = new byte[]{(byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF};
assertEquals("qrvM3e7_", instance.valueToString(binary, null, null, null, null, null));
assertEquals("qrvM3e7_", instance.valueToString(binary, null, 6, null, null, null));
assertEquals("qrvM3e7_", instance.valueToString(binary, null, Integer.MAX_VALUE, null, null, null));
- assertEquals("qg", instance.valueToString(new Byte[] { new Byte((byte) 170) }, null, null, null, null, null));
+ assertEquals("qg", instance.valueToString(new Byte[]{new Byte((byte) 170)}, null, null, null, null, null));
expectFacetsErrorInValueToString(instance, binary, null, 3, null, null, null);
@@ -80,23 +80,23 @@ public class EdmBinaryTest extends PrimitiveTypeBaseTest {
@Test
public void valueOfString() throws Exception {
- final byte[] binary = new byte[] { (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF };
+ final byte[] binary = new byte[]{(byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF};
assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, null, null, null, null, byte[].class)));
- assertTrue(Arrays.equals(new Byte[] { binary[0], binary[1], binary[2] }, instance.valueOfString("qrvM", null, null,
- null, null, null, Byte[].class)));
+ assertTrue(Arrays.equals(new Byte[]{binary[0], binary[1], binary[2]}, instance.valueOfString("qrvM", null, null,
+ null, null, null, Byte[].class)));
assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, 6, null, null, null, byte[].class)));
- assertTrue(Arrays.equals(new byte[] { 42 }, instance.valueOfString("Kg==", null, 1, null, null, null,
- byte[].class)));
- assertTrue(Arrays.equals(new byte[] { 42 }, instance.valueOfString("Kg", null, 1, null, null, null,
- byte[].class)));
- assertTrue(Arrays.equals(new byte[] { 1, 2 }, instance.valueOfString("AQI=", null, 2, null, null, null,
- byte[].class)));
+ assertTrue(Arrays.equals(new byte[]{42}, instance.valueOfString("Kg==", null, 1, null, null, null,
+ byte[].class)));
+ assertTrue(Arrays.equals(new byte[]{42}, instance.valueOfString("Kg", null, 1, null, null, null,
+ byte[].class)));
+ assertTrue(Arrays.equals(new byte[]{1, 2}, instance.valueOfString("AQI=", null, 2, null, null, null,
+ byte[].class)));
assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, 6, null, null, null,
- byte[].class)));
+ byte[].class)));
assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, Integer.MAX_VALUE, null, null, null,
- byte[].class)));
+ byte[].class)));
expectFacetsErrorInValueOfString(instance, "qrvM3e7_", null, 3, null, null, null);
expectContentErrorInValueOfString(instance, "@");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
index 1abca66..d1e6580 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
@@ -21,12 +21,12 @@ package org.apache.olingo.commons.core.edm.primitivetype;
import static org.junit.Assert.assertEquals;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmBooleanTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean);
@Test
public void toUriLiteral() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
index ddf819f..c560c39 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
@@ -24,13 +24,12 @@ import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmByteTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte);
@Test
public void compatibility() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
index 3d966bc..6cc3d19 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
@@ -25,12 +25,12 @@ import java.util.Date;
import java.util.TimeZone;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmDateTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date);
@Test
public void toUriLiteral() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
index f92fbec..bcc0123 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
@@ -26,12 +26,12 @@ import java.util.Date;
import java.util.TimeZone;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmDateTimeOffsetTest extends PrimitiveTypeBaseTest {
- final EdmPrimitiveType instance = EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance();
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset);
@Test
public void toUriLiteral() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
index 9f987a7..35917af 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
@@ -25,24 +25,23 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmDecimalTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
index abb3a6b..57403ce 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
@@ -25,23 +25,22 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmDoubleTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
index 7b97f7e..85745b4 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
@@ -24,12 +24,12 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmDurationTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration);
@Test
public void toUriLiteral() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
index c6d73ca..f69eddc 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
@@ -23,12 +23,12 @@ import static org.junit.Assert.assertEquals;
import java.util.UUID;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmGuidTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid);
@Test
public void toUriLiteral() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
index 458e1d4..55c12bb 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
@@ -24,19 +24,18 @@ import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmInt16Test extends PrimitiveTypeBaseTest {
- final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance();
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16);
@Test
public void testInt16Compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
index f0ada7e..e3410d7 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
@@ -24,20 +24,19 @@ import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmInt32Test extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
index d704770..f45ab49 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
@@ -24,21 +24,20 @@ import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmInt64Test extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
index 3a9daaf..5450be8 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
@@ -21,7 +21,7 @@ package org.apache.olingo.commons.core.edm.primitivetype;
import static org.junit.Assert.assertNull;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmNullTest extends PrimitiveTypeBaseTest {
@@ -29,22 +29,26 @@ public class EdmNullTest extends PrimitiveTypeBaseTest {
@Test
public void checkNull() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertNull(instance.valueToString(null, null, null, null, null, null));
- assertNull(instance.valueToString(null, true, null, null, null, null));
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertNull(instance.valueToString(null, null, null, null, null, null));
+ assertNull(instance.valueToString(null, true, null, null, null, null));
- expectNullErrorInValueToString(instance);
+ expectNullErrorInValueToString(instance);
+ }
}
}
@Test
public void checkValueOfNull() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertNull(instance.valueOfString(null, null, null, null, null, null, instance.getDefaultType()));
- assertNull(instance.valueOfString(null, true, null, null, null, null, instance.getDefaultType()));
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertNull(instance.valueOfString(null, null, null, null, null, null, instance.getDefaultType()));
+ assertNull(instance.valueOfString(null, true, null, null, null, null, instance.getDefaultType()));
- expectNullErrorInValueOfString(instance);
+ expectNullErrorInValueOfString(instance);
+ }
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
index 0ebb342..88835e9 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
@@ -24,13 +24,12 @@ import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmSByteTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte);
@Test
public void compatibility() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
index 67847c7..9e90f22 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
@@ -25,22 +25,21 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmSingleTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
index 993c943..bba0f91 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
@@ -21,12 +21,12 @@ package org.apache.olingo.commons.core.edm.primitivetype;
import static org.junit.Assert.assertEquals;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmStringTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String);
@Test
public void toUriLiteral() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
index 8979df9..ee9b2b8 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
@@ -24,12 +24,12 @@ import java.util.Calendar;
import java.util.TimeZone;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmTimeOfDayTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay);
@Test
public void toUriLiteral() throws Exception {
[38/52] [abbrv] git commit: [OLINGO-200] Moving Atom and JSON
(de)serializer to commons
Posted by sk...@apache.org.
[OLINGO-200] Moving Atom and JSON (de)serializer to commons
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/fac84b3e
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/fac84b3e
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/fac84b3e
Branch: refs/heads/olingo-206-validator
Commit: fac84b3eb6a9c84c6133095dfb0d3cd73da6b579
Parents: fa7a9ab
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 24 09:36:44 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 24 09:36:44 2014 +0100
----------------------------------------------------------------------
.../org/apache/olingo/client/api/Constants.java | 241 ------------
.../olingo/client/api/data/CollectionValue.java | 27 --
.../olingo/client/api/data/ComplexValue.java | 27 --
.../apache/olingo/client/api/data/Entry.java | 167 ---------
.../org/apache/olingo/client/api/data/Feed.java | 75 ----
.../apache/olingo/client/api/data/GeoUtils.java | 90 -----
.../olingo/client/api/data/GeospatialValue.java | 28 --
.../org/apache/olingo/client/api/data/Link.java | 121 ------
.../olingo/client/api/data/NullValue.java | 26 --
.../olingo/client/api/data/PrimitiveValue.java | 25 --
.../apache/olingo/client/api/data/Property.java | 34 --
.../apache/olingo/client/api/data/Value.java | 44 ---
.../client/api/data/v3/LinkCollection.java | 52 ---
.../api/domain/ODataEntitySetIterator.java | 4 +-
.../olingo/client/api/op/CommonODataBinder.java | 8 +-
.../client/api/op/CommonODataDeserializer.java | 6 +-
.../olingo/client/api/op/ODataSerializer.java | 8 +-
.../olingo/client/api/op/v3/ODataBinder.java | 2 +-
.../client/api/op/v3/ODataDeserializer.java | 2 +-
lib/client-core/pom.xml | 21 --
.../olingo/client/core/AbstractODataClient.java | 2 +-
.../communication/request/ODataRequestImpl.java | 4 +-
.../request/batch/ODataBatchUtilities.java | 2 +-
.../batch/ODataBatchResponseManager.java | 2 +-
.../client/core/data/AbstractAtomDealer.java | 87 -----
.../client/core/data/AbstractAtomObject.java | 78 ----
.../olingo/client/core/data/AbstractEntry.java | 159 --------
.../core/data/AbstractJsonDeserializer.java | 176 ---------
.../core/data/AbstractJsonSerializer.java | 94 -----
.../client/core/data/AbstractPayloadObject.java | 48 ---
.../client/core/data/AbstractPropertyImpl.java | 80 ----
.../olingo/client/core/data/AbstractValue.java | 98 -----
.../client/core/data/AtomDeserializer.java | 370 -------------------
.../olingo/client/core/data/AtomEntryImpl.java | 25 --
.../olingo/client/core/data/AtomFeedImpl.java | 66 ----
.../core/data/AtomGeoValueDeserializer.java | 261 -------------
.../core/data/AtomGeoValueSerializer.java | 221 -----------
.../core/data/AtomPropertyDeserializer.java | 214 -----------
.../client/core/data/AtomPropertyImpl.java | 25 --
.../core/data/AtomPropertySerializer.java | 88 -----
.../olingo/client/core/data/AtomSerializer.java | 264 -------------
.../client/core/data/CollectionValueImpl.java | 40 --
.../client/core/data/ComplexValueImpl.java | 40 --
.../client/core/data/GeospatialValueImpl.java | 42 ---
.../client/core/data/JSONEntryDeserializer.java | 244 ------------
.../olingo/client/core/data/JSONEntryImpl.java | 92 -----
.../client/core/data/JSONEntrySerializer.java | 120 ------
.../client/core/data/JSONErrorBundle.java | 50 ---
.../olingo/client/core/data/JSONErrorImpl.java | 237 ------------
.../client/core/data/JSONFeedDeserializer.java | 68 ----
.../olingo/client/core/data/JSONFeedImpl.java | 113 ------
.../client/core/data/JSONFeedSerializer.java | 57 ---
.../core/data/JSONGeoValueDeserializer.java | 274 --------------
.../core/data/JSONGeoValueSerializer.java | 183 ---------
.../core/data/JSONPropertyDeserializer.java | 71 ----
.../client/core/data/JSONPropertyImpl.java | 53 ---
.../core/data/JSONPropertySerializer.java | 59 ---
.../data/JSONServiceDocumentDeserializer.java | 5 +-
.../olingo/client/core/data/LinkImpl.java | 112 ------
.../olingo/client/core/data/NullValueImpl.java | 35 --
.../core/data/ODataJacksonDeserializer.java | 45 ---
.../core/data/ODataJacksonSerializer.java | 45 ---
.../client/core/data/PrimitiveValueImpl.java | 41 --
.../olingo/client/core/data/XMLErrorImpl.java | 213 -----------
.../data/XMLServiceDocumentDeserializer.java | 3 +-
.../core/data/v3/JSONLinkCollectionImpl.java | 118 ------
.../core/data/v3/JSONServiceDocumentImpl.java | 4 +-
.../core/data/v3/XMLLinkCollectionImpl.java | 70 ----
.../core/data/v4/JSONServiceDocumentImpl.java | 4 +-
.../core/domain/ODataPrimitiveValueImpl.java | 2 +-
.../client/core/edm/EdmActionImportImpl.java | 2 +-
.../olingo/client/core/edm/EdmClientImpl.java | 1 +
.../client/core/edm/EdmComplexTypeImpl.java | 1 +
.../client/core/edm/EdmEntityContainerImpl.java | 1 +
.../client/core/edm/EdmEntityTypeImpl.java | 1 +
.../client/core/edm/EdmFunctionImportImpl.java | 1 +
.../core/edm/EdmNavigationPropertyImpl.java | 1 +
.../client/core/edm/EdmParameterImpl.java | 1 +
.../olingo/client/core/edm/EdmPropertyImpl.java | 1 +
.../client/core/edm/EdmReturnTypeImpl.java | 1 +
.../olingo/client/core/edm/EdmTypeInfo.java | 172 ---------
.../core/edm/v3/EdmActionImportProxy.java | 2 +-
.../core/edm/v3/EdmFunctionImportProxy.java | 2 +-
.../core/edm/xml/AbstractEdmDeserializer.java | 8 +-
.../core/edm/xml/ComplexTypeDeserializer.java | 2 +-
.../core/edm/xml/DataServicesDeserializer.java | 2 +-
.../client/core/edm/xml/EdmxDeserializer.java | 2 +-
.../edm/xml/EntityContainerDeserializer.java | 2 +-
.../core/edm/xml/EntitySetDeserializer.java | 2 +-
.../core/edm/xml/EntityTypeDeserializer.java | 2 +-
.../core/edm/xml/EnumTypeDeserializer.java | 2 +-
.../core/edm/xml/ParameterDeserializer.java | 2 +-
.../core/edm/xml/PropertyDeserializer.java | 2 +-
.../client/core/edm/xml/SchemaDeserializer.java | 20 +-
.../client/core/op/AbstractJacksonTool.java | 16 +-
.../client/core/op/AbstractODataBinder.java | 26 +-
.../core/op/AbstractODataDeserializer.java | 32 +-
.../client/core/op/AbstractODataReader.java | 2 +-
.../client/core/op/AbstractODataSerializer.java | 32 +-
.../client/core/op/ODataObjectFactoryImpl.java | 35 +-
.../olingo/client/core/op/ResourceFactory.java | 18 +-
.../client/core/op/impl/v3/ODataBinderImpl.java | 2 +-
.../core/op/impl/v3/ODataDeserializerImpl.java | 12 +-
.../core/op/impl/v3/ODataSerializerImpl.java | 6 +-
.../core/op/impl/v4/ODataDeserializerImpl.java | 6 +-
.../core/op/impl/v4/ODataSerializerImpl.java | 6 +-
.../apache/olingo/client/core/uri/URIUtils.java | 2 +-
.../olingo/client/core/v3/ODataClientImpl.java | 4 +-
.../olingo/client/core/v4/ODataClientImpl.java | 4 +-
.../client/core/AbstractPrimitiveTest.java | 2 +-
.../olingo/client/core/AtomLinksQualifier.java | 2 +-
.../client/core/it/AbstractTestITCase.java | 8 +-
.../core/it/v3/QueryOptionsTestITCase.java | 4 +-
.../apache/olingo/client/core/v3/JSONTest.java | 2 +-
.../apache/olingo/commons/api/Constants.java | 243 ++++++++++++
.../commons/api/data/CollectionValue.java | 27 ++
.../olingo/commons/api/data/ComplexValue.java | 27 ++
.../apache/olingo/commons/api/data/Entry.java | 167 +++++++++
.../apache/olingo/commons/api/data/Feed.java | 75 ++++
.../olingo/commons/api/data/GeoUtils.java | 90 +++++
.../commons/api/data/GeospatialValue.java | 28 ++
.../apache/olingo/commons/api/data/Link.java | 121 ++++++
.../olingo/commons/api/data/NullValue.java | 26 ++
.../olingo/commons/api/data/PrimitiveValue.java | 25 ++
.../olingo/commons/api/data/Property.java | 34 ++
.../apache/olingo/commons/api/data/Value.java | 44 +++
.../commons/api/data/v3/LinkCollection.java | 52 +++
lib/commons-core/pom.xml | 21 ++
.../commons/core/data/AbstractAtomDealer.java | 87 +++++
.../commons/core/data/AbstractAtomObject.java | 78 ++++
.../olingo/commons/core/data/AbstractEntry.java | 159 ++++++++
.../core/data/AbstractJsonDeserializer.java | 176 +++++++++
.../core/data/AbstractJsonSerializer.java | 94 +++++
.../core/data/AbstractPayloadObject.java | 48 +++
.../commons/core/data/AbstractPropertyImpl.java | 80 ++++
.../olingo/commons/core/data/AbstractValue.java | 98 +++++
.../commons/core/data/AtomDeserializer.java | 370 +++++++++++++++++++
.../olingo/commons/core/data/AtomEntryImpl.java | 25 ++
.../olingo/commons/core/data/AtomFeedImpl.java | 66 ++++
.../core/data/AtomGeoValueDeserializer.java | 261 +++++++++++++
.../core/data/AtomGeoValueSerializer.java | 221 +++++++++++
.../core/data/AtomPropertyDeserializer.java | 214 +++++++++++
.../commons/core/data/AtomPropertyImpl.java | 25 ++
.../core/data/AtomPropertySerializer.java | 88 +++++
.../commons/core/data/AtomSerializer.java | 264 +++++++++++++
.../commons/core/data/CollectionValueImpl.java | 40 ++
.../commons/core/data/ComplexValueImpl.java | 40 ++
.../commons/core/data/GeospatialValueImpl.java | 42 +++
.../core/data/JSONEntryDeserializer.java | 241 ++++++++++++
.../olingo/commons/core/data/JSONEntryImpl.java | 92 +++++
.../commons/core/data/JSONEntrySerializer.java | 120 ++++++
.../commons/core/data/JSONErrorBundle.java | 50 +++
.../olingo/commons/core/data/JSONErrorImpl.java | 237 ++++++++++++
.../commons/core/data/JSONFeedDeserializer.java | 68 ++++
.../olingo/commons/core/data/JSONFeedImpl.java | 113 ++++++
.../commons/core/data/JSONFeedSerializer.java | 57 +++
.../core/data/JSONGeoValueDeserializer.java | 274 ++++++++++++++
.../core/data/JSONGeoValueSerializer.java | 183 +++++++++
.../core/data/JSONPropertyDeserializer.java | 71 ++++
.../commons/core/data/JSONPropertyImpl.java | 53 +++
.../core/data/JSONPropertySerializer.java | 59 +++
.../olingo/commons/core/data/LinkImpl.java | 112 ++++++
.../olingo/commons/core/data/NullValueImpl.java | 35 ++
.../core/data/ODataJacksonDeserializer.java | 44 +++
.../core/data/ODataJacksonSerializer.java | 45 +++
.../commons/core/data/PrimitiveValueImpl.java | 41 ++
.../olingo/commons/core/data/XMLErrorImpl.java | 213 +++++++++++
.../core/data/v3/JSONLinkCollectionImpl.java | 118 ++++++
.../core/data/v3/XMLLinkCollectionImpl.java | 70 ++++
.../olingo/commons/core/edm/EdmTypeInfo.java | 172 +++++++++
170 files changed, 6097 insertions(+), 6093 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java
deleted file mode 100644
index b4c3d6b..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java
+++ /dev/null
@@ -1,241 +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.client.api;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-
-/**
- * Constant values related to the OData protocol.
- */
-public interface Constants {
-
- // Other stuff
- public final static String UTF8 = "UTF-8";
-
- public final static Integer DEFAULT_PRECISION = 40;
-
- public final static Integer DEFAULT_SCALE = 25;
-
- // 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 PREFIX_DATASERVICES = "d";
-
- public static final String PREFIX_METADATA = "m";
-
- public static final String PREFIX_GEORSS = "georss";
-
- public static final String PREFIX_GML = "gml";
-
- public final static String SRS_URLPREFIX = "http://www.opengis.net/def/crs/EPSG/0/";
-
- // Link rel(s)
- public static final String EDIT_LINK_REL = "edit";
-
- public static final String SELF_LINK_REL = "self";
-
- public static final String NEXT_LINK_REL = "next";
-
- // XML elements and attributes
- public static final String PROPERTIES = "properties";
-
- public static final String ELEM_ELEMENT = "element";
-
- public final static String ATTR_TYPE = "type";
-
- public final static String ATTR_NULL = "null";
-
- public static final String ATTR_XML_BASE = "base";
-
- public static final QName QNAME_ATTR_XML_BASE = new QName(XMLConstants.XML_NS_URI, ATTR_XML_BASE);
-
- public static final String ATTR_REL = "rel";
-
- public static final String ATTR_TITLE = "title";
-
- public static final String ATTR_METADATA = "metadata";
-
- public static final String ATTR_HREF = "href";
-
- public static final String ATTR_TARGET = "target";
-
- public static final String ATTR_SRSNAME = "srsName";
-
- public static final QName QNAME_ATTR_SRSNAME = new QName(NS_GML, ATTR_SRSNAME);
-
- public static final String ELEM_POINT = "Point";
-
- public static final String ELEM_MULTIPOINT = "MultiPoint";
-
- public static final String ELEM_POINTMEMBERS = "pointMembers";
-
- public static final QName QNAME_POINTMEMBERS = new QName(NS_GML, ELEM_POINTMEMBERS);
-
- public static final String ELEM_LINESTRING = "LineString";
-
- public static final QName QNAME_LINESTRING = new QName(NS_GML, ELEM_LINESTRING);
-
- public static final String ELEM_MULTILINESTRING = "MultiCurve";
-
- public static final String ELEM_LINESTRINGMEMBERS = "curveMembers";
-
- public static final String ELEM_POLYGON = "Polygon";
-
- public static final QName QNAME_POLYGON = new QName(NS_GML, ELEM_POLYGON);
-
- public static final String ELEM_POLYGON_EXTERIOR = "exterior";
-
- public static final QName QNAME_POLYGON_EXTERIOR = new QName(NS_GML, ELEM_POLYGON_EXTERIOR);
-
- public static final String ELEM_POLYGON_INTERIOR = "interior";
-
- public static final QName QNAME_POLYGON_INTERIOR = new QName(NS_GML, ELEM_POLYGON_INTERIOR);
-
- public static final String ELEM_POLYGON_LINEARRING = "LinearRing";
-
- public static final String ELEM_MULTIPOLYGON = "MultiSurface";
-
- public static final String ELEM_SURFACEMEMBERS = "surfaceMembers";
-
- public static final String ELEM_GEOCOLLECTION = "MultiGeometry";
-
- public static final String ELEM_GEOMEMBERS = "geometryMembers";
-
- public static final QName QNAME_GEOMEMBERS = new QName(NS_GML, ELEM_GEOMEMBERS);
-
- public static final String ELEM_POS = "pos";
-
- public static final String ELEM_PROPERTY = "property";
-
- public static final String ELEM_LINKS = "links";
-
- public static final String ELEM_URI = "uri";
-
- // JSON stuff
- public final static String JSON_CONTEXT = "@odata.context";
-
- public final static String JSON_METADATA = "odata.metadata";
-
- public final static String JSON_TYPE = "odata.type";
-
- public final static String JSON_TYPE_SUFFIX = "@" + JSON_TYPE;
-
- public final static String JSON_ETAG = "odata.etag";
-
- public final static String JSON_MEDIA_ETAG = "odata.mediaETag";
-
- public final static String JSON_MEDIA_ETAG_SUFFIX = "@" + JSON_MEDIA_ETAG;
-
- 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_MEDIAEDIT_LINK_SUFFIX = "@" + JSON_MEDIAEDIT_LINK;
-
- public final static String JSON_MEDIA_CONTENT_TYPE = "odata.mediaContentType";
-
- public final static String JSON_MEDIA_CONTENT_TYPE_SUFFIX = "@" + JSON_MEDIA_CONTENT_TYPE;
-
- 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_NULL = "odata.null";
-
- 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_COUNT = "odata.count";
-
- public final static String JSON_NEXT_LINK = "odata.nextLink";
-
- public final static String JSON_NAME = "name";
-
- // Atom stuff
- public final static String ATOM_ELEM_ENTRY = "entry";
-
- public static final QName QNAME_ATOM_ELEM_ENTRY = new QName(NS_ATOM, ATOM_ELEM_ENTRY);
-
- public final static String ATOM_ELEM_FEED = "feed";
-
- public static final QName QNAME_ATOM_ELEM_FEED = new QName(NS_ATOM, ATOM_ELEM_FEED);
-
- public final static String ATOM_ELEM_CATEGORY = "category";
-
- public static final QName QNAME_ATOM_ELEM_CATEGORY = new QName(NS_ATOM, ATOM_ELEM_CATEGORY);
-
- public static final String ATOM_ELEM_COUNT = "count";
-
- public final static String ATOM_ELEM_ID = "id";
-
- public static final QName QNAME_ATOM_ELEM_ID = new QName(NS_ATOM, ATOM_ELEM_ID);
-
- public static final String ATOM_ELEM_TITLE = "title";
-
- public static final QName QNAME_ATOM_ELEM_TITLE = new QName(NS_ATOM, ATOM_ELEM_TITLE);
-
- public static final String ATOM_ELEM_SUMMARY = "summary";
-
- public static final QName QNAME_ATOM_ELEM_SUMMARY = new QName(NS_ATOM, ATOM_ELEM_SUMMARY);
-
- public static final String ATOM_ELEM_UPDATED = "updated";
-
- public static final QName QNAME_ATOM_ELEM_UPDATED = new QName(NS_ATOM, ATOM_ELEM_UPDATED);
-
- public final static String ATOM_ELEM_LINK = "link";
-
- public static final QName QNAME_ATOM_ELEM_LINK = new QName(NS_ATOM, ATOM_ELEM_LINK);
-
- public final static String ATOM_ELEM_CONTENT = "content";
-
- public static final QName QNAME_ATOM_ELEM_CONTENT = new QName(NS_ATOM, ATOM_ELEM_CONTENT);
-
- public static final String ATOM_ELEM_ACTION = "action";
-
- public static final String ATOM_ELEM_INLINE = "inline";
-
- 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 = "etag";
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/CollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/CollectionValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/CollectionValue.java
deleted file mode 100644
index 072890d..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/CollectionValue.java
+++ /dev/null
@@ -1,27 +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.client.api.data;
-
-import java.util.List;
-
-public interface CollectionValue extends Value {
-
- @Override
- List<Value> get();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ComplexValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ComplexValue.java
deleted file mode 100644
index 80e9c8f..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ComplexValue.java
+++ /dev/null
@@ -1,27 +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.client.api.data;
-
-import java.util.List;
-
-public interface ComplexValue extends Value {
-
- @Override
- List<Property> get();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Entry.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Entry.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Entry.java
deleted file mode 100644
index 0fcf77c..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Entry.java
+++ /dev/null
@@ -1,167 +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.client.api.data;
-
-import org.apache.olingo.commons.api.domain.ODataOperation;
-import java.net.URI;
-import java.util.List;
-
-public interface Entry {
-
- /**
- * Gets ETag.
- *
- * @return ETag.
- */
- String getETag();
-
- /**
- * Gets base URI.
- *
- * @return base URI.
- */
- URI getBaseURI();
-
- /**
- * Gets entry type.
- *
- * @return entry type.
- */
- String getType();
-
- /**
- * Sets entry type.
- *
- * @param type entry type.
- */
- void setType(String type);
-
- /**
- * Gest entry ID.
- *
- * @return entry ID.
- */
- String getId();
-
- /**
- * Gets entry self link.
- *
- * @return self link.
- */
- Link getSelfLink();
-
- /**
- * Sets entry self link.
- *
- * @param selfLink self link.
- */
- void setSelfLink(Link selfLink);
-
- /**
- * Gets entry edit link.
- *
- * @return edit link.
- */
- Link getEditLink();
-
- /**
- * Sets entry edit link.
- *
- * @param editLink edit link.
- */
- void setEditLink(Link editLink);
-
- /**
- * Gets association links.
- *
- * @return association links.
- */
- List<Link> getAssociationLinks();
-
- /**
- * Gets navigation links.
- *
- * @return links.
- */
- List<Link> getNavigationLinks();
-
- /**
- * Gets media entity links.
- *
- * @return links.
- */
- List<Link> getMediaEditLinks();
-
- /**
- * Gets operations.
- *
- * @return operations.
- */
- List<ODataOperation> getOperations();
-
- /**
- * Gets properties.
- *
- * @return properties.
- */
- List<Property> getProperties();
-
- /**
- * Gets property with given name.
- *
- * @param name property name
- * @return property with given name if found, null otherwise
- */
- Property getProperty(String name);
-
- /**
- * Gets media content type.
- *
- * @return media content type.
- */
- String getMediaContentType();
-
- /**
- * Gets media content resource.
- *
- * @return media content resource.
- */
- String getMediaContentSource();
-
- /**
- * Set media content source.
- *
- * @param mediaContentSource media content source.
- */
- void setMediaContentSource(String mediaContentSource);
-
- /**
- * Set media content type.
- *
- * @param mediaContentType media content type.
- */
- void setMediaContentType(String mediaContentType);
-
- /**
- * Checks if the current entry is a media entry.
- *
- * @return 'TRUE' if is a media entry; 'FALSE' otherwise.
- */
- boolean isMediaEntry();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Feed.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Feed.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Feed.java
deleted file mode 100644
index 6c4e2f9..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Feed.java
+++ /dev/null
@@ -1,75 +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.client.api.data;
-
-import java.net.URI;
-import java.util.List;
-
-public interface Feed {
-
- /**
- * Gets base URI.
- *
- * @return base URI.
- */
- URI getBaseURI();
-
- /**
- * Sets number of entries.
- *
- * @param count number of entries
- */
- void setCount(Integer count);
-
- /**
- * Gets number of entries - if it was required.
- *
- * @return number of entries into the feed.
- */
- Integer getCount();
-
- /**
- * Gest feed ID.
- *
- * @return feed ID.
- */
- String getId();
-
- /**
- * Gets entries.
- *
- * @return entries.
- */
- List<Entry> getEntries();
-
- /**
- * Gets next link if exists.
- *
- * @return next link if exists; null otherwise.
- */
- URI getNext();
-
- /**
- * Sets next link.
- *
- * @param next next link.
- */
- void setNext(URI next);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java
deleted file mode 100644
index 083b4e0..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java
+++ /dev/null
@@ -1,90 +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.client.api.data;
-
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-
-public final class GeoUtils {
-
- private GeoUtils() {
- // Empty private constructor for static utility classes
- }
-
- public static Geospatial.Dimension getDimension(final EdmPrimitiveTypeKind type) {
- Geospatial.Dimension dimension;
-
- switch (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;
- }
-
- public static EdmPrimitiveTypeKind getType(final Geospatial.Dimension dimension, final String elementName) {
- EdmPrimitiveTypeKind type = null;
-
- if (Constants.ELEM_POINT.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? EdmPrimitiveTypeKind.GeographyPoint
- : EdmPrimitiveTypeKind.GeometryPoint;
- } else if (Constants.ELEM_MULTIPOINT.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? EdmPrimitiveTypeKind.GeographyMultiPoint
- : EdmPrimitiveTypeKind.GeometryMultiPoint;
- } else if (Constants.ELEM_LINESTRING.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? EdmPrimitiveTypeKind.GeographyLineString
- : EdmPrimitiveTypeKind.GeometryLineString;
- } else if (Constants.ELEM_MULTILINESTRING.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? EdmPrimitiveTypeKind.GeographyMultiLineString
- : EdmPrimitiveTypeKind.GeometryMultiLineString;
- } else if (Constants.ELEM_POLYGON.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? EdmPrimitiveTypeKind.GeographyPolygon
- : EdmPrimitiveTypeKind.GeometryPolygon;
- } else if (Constants.ELEM_MULTIPOLYGON.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? EdmPrimitiveTypeKind.GeographyMultiPolygon
- : EdmPrimitiveTypeKind.GeometryMultiPolygon;
- } else if (Constants.ELEM_GEOCOLLECTION.equals(elementName)
- || Constants.ELEM_GEOMEMBERS.equals(elementName)) {
-
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? EdmPrimitiveTypeKind.GeographyCollection
- : EdmPrimitiveTypeKind.GeometryCollection;
- }
-
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
deleted file mode 100644
index c5d4d2a..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.data;
-
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-
-public interface GeospatialValue extends Value {
-
- @Override
- Geospatial get();
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Link.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Link.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Link.java
deleted file mode 100644
index b707c8b..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Link.java
+++ /dev/null
@@ -1,121 +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.client.api.data;
-
-public interface Link {
-
- /**
- * Gets rel info.
- *
- * @return rel info.
- */
- String getRel();
-
- /**
- * Sets rel info.
- *
- * @param rel rel info.
- */
- void setRel(String rel);
-
- /**
- * Gets type.
- *
- * @return type.
- */
- String getType();
-
- /**
- * Sets type.
- *
- * @param type type.
- */
- void setType(String type);
-
- /**
- * Gets title.
- *
- * @return title.
- */
- String getTitle();
-
- /**
- * Sets title.
- *
- * @param title title.
- */
- void setTitle(String title);
-
- /**
- * Gets href.
- *
- * @return href.
- */
- String getHref();
-
- /**
- * Sets href.
- *
- * @param href href.
- */
- void setHref(String href);
-
- /**
- * Gets Media ETag.
- *
- * @return media ETag
- */
- String getMediaETag();
-
- /**
- * Sets Media ETag.
- *
- * @param etag media ETag
- */
- void setMediaETag(String etag);
-
- /**
- * Gets in-line entry.
- *
- * @return in-line entry.
- */
- Entry getInlineEntry();
-
- /**
- * Sets in-line entry.
- *
- * @param entry entry.
- */
- void setInlineEntry(Entry entry);
-
- /**
- * Gets in-line feed.
- *
- * @return in-line feed.
- */
- Feed getInlineFeed();
-
- /**
- * Sets in-line feed.
- *
- * @param feed feed.
- */
- void setInlineFeed(Feed feed);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/NullValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/NullValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/NullValue.java
deleted file mode 100644
index 5df0509..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/NullValue.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.data;
-
-public interface NullValue extends Value {
-
- @Override
- Void get();
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/PrimitiveValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/PrimitiveValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/PrimitiveValue.java
deleted file mode 100644
index 6d0636b..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/PrimitiveValue.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.client.api.data;
-
-public interface PrimitiveValue extends Value {
-
- @Override
- String get();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Property.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Property.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Property.java
deleted file mode 100644
index d4112d9..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Property.java
+++ /dev/null
@@ -1,34 +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.client.api.data;
-
-public interface Property {
-
- String getName();
-
- void setName(String name);
-
- String getType();
-
- void setType(String type);
-
- Value getValue();
-
- void setValue(Value value);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Value.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Value.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Value.java
deleted file mode 100644
index 275fd9d..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Value.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.data;
-
-public interface Value {
-
- boolean isNull();
-
- boolean isSimple();
-
- boolean isGeospatial();
-
- boolean isComplex();
-
- boolean isCollection();
-
- Object get();
-
- NullValue asNull();
-
- PrimitiveValue asSimple();
-
- GeospatialValue asGeospatial();
-
- ComplexValue asComplex();
-
- CollectionValue asCollection();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/data/v3/LinkCollection.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/v3/LinkCollection.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/v3/LinkCollection.java
deleted file mode 100644
index dfcaa35..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/v3/LinkCollection.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.data.v3;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * REST resource for an <tt>ODataLinkCollection</tt>.
- *
- * @see org.apache.olingo.client.api.domain.ODataLinkCollection
- */
-public interface LinkCollection {
-
- /**
- * Smart management of different JSON format produced by OData services when
- * <tt>$links</tt> is a single or a collection property.
- *
- * @return list of URIs for <tt>$links</tt>
- */
- List<URI> getLinks();
-
- /**
- * Sets next link.
- *
- * @param next next link.
- */
- void setNext(final URI next);
-
- /**
- * Gets next link if exists.
- *
- * @return next link if exists; null otherwise.
- */
- URI getNext();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
index 8c1db4d..9d720bf 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
@@ -29,8 +29,8 @@ import java.util.NoSuchElementException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.Entry;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
index 8dd7232..38fe16f 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
@@ -20,10 +20,10 @@ package org.apache.olingo.client.api.op;
import java.io.Serializable;
import java.net.URI;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
index 6828b44..5b01fa3 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
@@ -20,10 +20,10 @@ package org.apache.olingo.client.api.op;
import java.io.InputStream;
import java.io.Serializable;
-import org.apache.olingo.client.api.data.Entry;
+import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.commons.api.format.ODataFormat;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java
index 0734586..811a07b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java
@@ -21,10 +21,10 @@ package org.apache.olingo.client.api.op;
import java.io.OutputStream;
import java.io.Serializable;
import java.io.Writer;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.format.ODataFormat;
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
index 118a002..6ea90ba 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.op.v3;
-import org.apache.olingo.client.api.data.v3.LinkCollection;
+import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.client.api.op.CommonODataBinder;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
index 99d840d..6c7a2bb 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.api.op.v3;
import java.io.InputStream;
-import org.apache.olingo.client.api.data.v3.LinkCollection;
+import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.CommonODataDeserializer;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/pom.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/pom.xml b/lib/client-core/pom.xml
index 9c52285..6039cfd 100644
--- a/lib/client-core/pom.xml
+++ b/lib/client-core/pom.xml
@@ -45,27 +45,6 @@
<artifactId>olingo-commons-core-incubating</artifactId>
<version>${project.version}</version>
</dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </dependency>
- <dependency>
- <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>junit</groupId>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index 6c889e8..b5603fc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -32,7 +32,7 @@ public abstract class AbstractODataClient implements CommonODataClient {
private final ODataWriter writer = new ODataWriterImpl(this);
- private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(this);
+ private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(getServiceVersion());
@Override
public ODataPrimitiveValueImpl.BuilderImpl getPrimitiveValueBuilder() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
index b77b1b7..bec2f65 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
@@ -48,8 +48,8 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.core.data.JSONErrorImpl;
-import org.apache.olingo.client.core.data.XMLErrorImpl;
+import org.apache.olingo.commons.core.data.JSONErrorImpl;
+import org.apache.olingo.commons.core.data.XMLErrorImpl;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.client.core.communication.header.ODataHeadersImpl;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java
index a33f7cb..7474e13 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java
@@ -32,7 +32,7 @@ import java.util.regex.Pattern;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.LineIterator;
import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.client.api.ODataBatchConstants;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.ODataStreamer;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java
index a8cfd2d..136e1c1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java
@@ -25,7 +25,7 @@ import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchLineIterator;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractAtomDealer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractAtomDealer.java
deleted file mode 100644
index eb62b44..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractAtomDealer.java
+++ /dev/null
@@ -1,87 +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.client.core.data;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-abstract class AbstractAtomDealer {
-
- protected static final String TYPE_TEXT = "text";
-
- protected final ODataServiceVersion version;
-
- protected final QName etagQName;
-
- protected final QName inlineQName;
-
- protected final QName actionQName;
-
- protected final QName propertiesQName;
-
- protected final QName typeQName;
-
- protected final QName nullQName;
-
- protected final QName elementQName;
-
- protected final QName countQName;
-
- protected final QName uriQName;
- protected final QName nextQName;
-
- public AbstractAtomDealer(final ODataServiceVersion version) {
- this.version = version;
-
- this.etagQName =
- new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ATTR_ETAG);
- this.inlineQName =
- new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_INLINE);
- this.actionQName =
- new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_ACTION);
- this.propertiesQName =
- new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.PROPERTIES);
- this.typeQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATTR_TYPE);
- this.nullQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATTR_NULL);
- this.elementQName =
- new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_ELEMENT);
- this.countQName =
- new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_COUNT);
- this.uriQName =
- new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_URI);
- this.nextQName =
- new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.NEXT_LINK_REL);
- }
-
- protected void namespaces(final XMLStreamWriter writer) throws XMLStreamException {
- writer.writeNamespace(StringUtils.EMPTY, Constants.NS_ATOM);
- writer.writeNamespace(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI);
- writer.writeNamespace(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
- writer.writeNamespace(
- Constants.PREFIX_DATASERVICES, version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
- writer.writeNamespace(Constants.PREFIX_GML, Constants.NS_GML);
- writer.writeNamespace(Constants.PREFIX_GEORSS, Constants.NS_GEORSS);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractAtomObject.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractAtomObject.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractAtomObject.java
deleted file mode 100644
index 76004d1..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractAtomObject.java
+++ /dev/null
@@ -1,78 +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.client.core.data;
-
-import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
-import java.net.URI;
-import java.text.ParseException;
-import java.util.Date;
-
-abstract class AbstractAtomObject extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -4391162864875546927L;
-
- private static final ISO8601DateFormat ISO_DATEFORMAT = new ISO8601DateFormat();
-
- private URI baseURI;
-
- private String id;
-
- private String title;
-
- private String summary;
-
- private Date updated;
-
- public URI getBaseURI() {
- return baseURI;
- }
-
- public void setBaseURI(final String baseURI) {
- this.baseURI = URI.create(baseURI);
- }
-
- public String getId() {
- return id;
- }
-
- public String getTitle() {
- return title;
- }
-
- public String getSummary() {
- return summary;
- }
-
- public Date getUpdated() {
- return updated;
- }
-
- public void setCommonProperty(final String key, final String value) throws ParseException {
- if ("id".equals(key)) {
- this.id = value;
- } else if ("title".equals(key)) {
- this.title = value;
- } else if ("summary".equals(key)) {
- this.summary = value;
- } else if ("updated".equals(key)) {
- this.updated = ISO_DATEFORMAT.parse(value);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractEntry.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractEntry.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractEntry.java
deleted file mode 100644
index 8b513bf..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractEntry.java
+++ /dev/null
@@ -1,159 +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.client.core.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.commons.api.domain.ODataOperation;
-
-/**
- * Abstract base for classes implementing an OData entry in Atom and JSON.
- */
-public abstract class AbstractEntry extends AbstractAtomObject implements Entry {
-
- private static final long serialVersionUID = 2127764552600969783L;
-
- private String eTag;
-
- private String type;
-
- private Link readLink;
-
- private Link editLink;
-
- private final List<Link> associationLinks = new ArrayList<Link>();
-
- private final List<Link> navigationLinks = new ArrayList<Link>();
-
- private final List<Link> mediaEditLinks = new ArrayList<Link>();
-
- private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
-
- private final List<Property> properties = new ArrayList<Property>();
-
- private String mediaContentSource;
-
- private String mediaContentType;
-
- @Override
- public String getETag() {
- return eTag;
- }
-
- public void setETag(final String eTag) {
- this.eTag = eTag;
- }
-
- @Override
- public String getType() {
- return type;
- }
-
- @Override
- public void setType(final String type) {
- this.type = type;
- }
-
- @Override
- public Link getSelfLink() {
- return readLink;
- }
-
- @Override
- public void setSelfLink(final Link readLink) {
- this.readLink = readLink;
- }
-
- @Override
- public Link getEditLink() {
- return editLink;
- }
-
- @Override
- public void setEditLink(final Link editLink) {
- this.editLink = editLink;
- }
-
- @Override
- public List<Link> getAssociationLinks() {
- return associationLinks;
- }
-
- @Override
- public List<Link> getNavigationLinks() {
- return navigationLinks;
- }
-
- @Override
- public List<Link> getMediaEditLinks() {
- return mediaEditLinks;
- }
-
- @Override
- public List<ODataOperation> getOperations() {
- return operations;
- }
-
- @Override
- public List<Property> getProperties() {
- return properties;
- }
-
- @Override
- public Property getProperty(final String name) {
- Property result = null;
-
- for (Property property : properties) {
- if (name.equals(property.getName())) {
- result = property;
- }
- }
-
- return result;
- }
-
- @Override
- public String getMediaContentType() {
- return this.mediaContentType;
- }
-
- @Override
- public void setMediaContentType(final String mediaContentType) {
- this.mediaContentType = mediaContentType;
- }
-
- @Override
- public String getMediaContentSource() {
- return this.mediaContentSource;
- }
-
- @Override
- public void setMediaContentSource(final String mediaContentSource) {
- this.mediaContentSource = mediaContentSource;
- }
-
- @Override
- public boolean isMediaEntry() {
- return StringUtils.isNotBlank(this.mediaContentSource);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
deleted file mode 100644
index 4b0ee0e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
+++ /dev/null
@@ -1,176 +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.client.core.data;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.util.Iterator;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.CollectionValue;
-import org.apache.olingo.client.api.data.ComplexValue;
-import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.commons.api.domain.ODataPropertyType;
-import org.apache.olingo.client.core.edm.EdmTypeInfo;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-
-abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
-
- private JSONGeoValueDeserializer geoDeserializer;
-
- private JSONGeoValueDeserializer getGeoDeserializer() {
- if (geoDeserializer == null) {
- geoDeserializer = new JSONGeoValueDeserializer(client.getServiceVersion());
- }
- return geoDeserializer;
- }
-
- protected EdmPrimitiveTypeKind getPrimitiveType(final JsonNode node) {
- EdmPrimitiveTypeKind result = EdmPrimitiveTypeKind.String;
-
- if (node.isIntegralNumber()) {
- result = EdmPrimitiveTypeKind.Int32;
- } else if (node.isBoolean()) {
- result = EdmPrimitiveTypeKind.Boolean;
- } else if (node.isFloatingPointNumber()) {
- result = EdmPrimitiveTypeKind.Double;
- }
-
- return result;
- }
-
- private ODataPropertyType guessPropertyType(final JsonNode node) {
- ODataPropertyType type = null;
-
- if (node.isValueNode() || node.isNull()) {
- type = ODataPropertyType.PRIMITIVE;
- } else if (node.isArray()) {
- type = ODataPropertyType.COLLECTION;
- } else if (node.isObject()) {
- type = ODataPropertyType.COMPLEX;
- } else {
- type = ODataPropertyType.EMPTY;
- }
-
- return type;
- }
-
- private Value fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) {
- Value value = null;
-
- if (node.isNull()) {
- value = new NullValueImpl();
- } else {
- if (typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
- value = new GeospatialValueImpl(getGeoDeserializer().deserialize(node, typeInfo));
- } else {
- value = new PrimitiveValueImpl(node.asText());
- }
- }
-
- return value;
- }
-
- private ComplexValue fromComplex(final JsonNode node) {
- final ComplexValue value = new ComplexValueImpl();
-
- String type = null;
- for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
- final Map.Entry<String, JsonNode> field = itor.next();
-
- if (type == null && field.getKey().endsWith(Constants.JSON_TYPE_SUFFIX)) {
- type = field.getValue().asText();
- } else {
- final JSONPropertyImpl property = new JSONPropertyImpl();
- property.setName(field.getKey());
- property.setType(type);
- type = null;
-
- value(property, field.getValue());
- value.get().add(property);
- }
- }
-
- return value;
- }
-
- private CollectionValue fromCollection(final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo) {
- final CollectionValueImpl value = new CollectionValueImpl();
-
- final EdmTypeInfo type = typeInfo == null
- ? null
- : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
-
- while (nodeItor.hasNext()) {
- final JsonNode child = nodeItor.next();
-
- if (child.isValueNode()) {
- value.get().add(fromPrimitive(child, type));
- } else if (child.isContainerNode()) {
- if (child.has(Constants.JSON_TYPE)) {
- ((ObjectNode) child).remove(Constants.JSON_TYPE);
- }
- value.get().add(fromComplex(child));
- }
- }
-
- return value;
- }
-
- protected void value(final JSONPropertyImpl property, final JsonNode node) {
- final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
- ? null
- : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
-
- final ODataPropertyType propType = typeInfo == null
- ? guessPropertyType(node)
- : typeInfo.isCollection()
- ? ODataPropertyType.COLLECTION
- : typeInfo.isPrimitiveType()
- ? ODataPropertyType.PRIMITIVE
- : ODataPropertyType.COMPLEX;
-
- switch (propType) {
- case COLLECTION:
- property.setValue(fromCollection(node.elements(), typeInfo));
- break;
-
- case COMPLEX:
- if (node.has(Constants.JSON_TYPE)) {
- property.setType(node.get(Constants.JSON_TYPE).asText());
- ((ObjectNode) node).remove(Constants.JSON_TYPE);
- }
- property.setValue(fromComplex(node));
- break;
-
- case PRIMITIVE:
- if (property.getType() == null) {
- property.setType(getPrimitiveType(node).getFullQualifiedName().toString());
- }
- property.setValue(fromPrimitive(node, typeInfo));
- break;
-
- case EMPTY:
- default:
- property.setValue(new PrimitiveValueImpl(StringUtils.EMPTY));
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
deleted file mode 100644
index 7427845..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
+++ /dev/null
@@ -1,94 +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.client.core.data;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import java.io.IOException;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.math.NumberUtils;
-import org.apache.olingo.client.api.data.CollectionValue;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.core.edm.EdmTypeInfo;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-
-abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
-
- private static final EdmPrimitiveTypeKind[] NUMBER_TYPES = {
- EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte,
- EdmPrimitiveTypeKind.Single, EdmPrimitiveTypeKind.Double,
- EdmPrimitiveTypeKind.Int16, EdmPrimitiveTypeKind.Int32, EdmPrimitiveTypeKind.Int64
- };
-
- private final JSONGeoValueSerializer geoSerializer = new JSONGeoValueSerializer();
-
- private void collection(final JsonGenerator jgen, final String itemType, final CollectionValue value)
- throws IOException {
-
- jgen.writeStartArray();
- for (Value item : value.get()) {
- value(jgen, itemType, item);
- }
- jgen.writeEndArray();
- }
-
- private void value(final JsonGenerator jgen, final String type, final Value value) throws IOException {
- final EdmTypeInfo typeInfo = type == null
- ? null
- : new EdmTypeInfo.Builder().setTypeExpression(type).build();
-
- if (value.isNull()) {
- jgen.writeNull();
- } else if (value.isSimple()) {
- final boolean isNumber = typeInfo == null
- ? NumberUtils.isNumber(value.asSimple().get())
- : ArrayUtils.contains(NUMBER_TYPES, typeInfo.getPrimitiveTypeKind());
- final boolean isBoolean = typeInfo == null
- ? (value.asSimple().get().equalsIgnoreCase(Boolean.TRUE.toString())
- || value.asSimple().get().equalsIgnoreCase(Boolean.FALSE.toString()))
- : typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Boolean;
-
- if (isNumber) {
- jgen.writeNumber(value.asSimple().get());
- } else if (isBoolean) {
- jgen.writeBoolean(BooleanUtils.toBoolean(value.asSimple().get()));
- } else {
- jgen.writeString(value.asSimple().get());
- }
- } else if (value.isGeospatial()) {
- jgen.writeStartObject();
- geoSerializer.serialize(jgen, value.asGeospatial().get());
- jgen.writeEndObject();
- } else if (value.isCollection()) {
- collection(jgen, typeInfo == null ? null : typeInfo.getFullQualifiedName().toString(), value.asCollection());
- } else if (value.isComplex()) {
- jgen.writeStartObject();
- for (Property property : value.asComplex().get()) {
- property(jgen, property, property.getName());
- }
- jgen.writeEndObject();
- }
- }
-
- protected void property(final JsonGenerator jgen, final Property property, final String name) throws IOException {
- jgen.writeFieldName(name);
- value(jgen, property.getType(), property.getValue());
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractPayloadObject.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractPayloadObject.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractPayloadObject.java
deleted file mode 100644
index b707c49..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractPayloadObject.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.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 a payload (Atom, JSON) object.
- */
-public abstract class AbstractPayloadObject implements Serializable {
-
- private static final long serialVersionUID = 1634654241914156675L;
-
- @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/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractPropertyImpl.java
deleted file mode 100644
index 3e92ac4..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractPropertyImpl.java
+++ /dev/null
@@ -1,80 +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.client.core.data;
-
-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.client.api.data.Property;
-import org.apache.olingo.client.api.data.Value;
-
-public abstract class AbstractPropertyImpl implements Property {
-
- private String name;
-
- private String type;
-
- private Value value;
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public String getType() {
- return type;
- }
-
- @Override
- public void setType(final String type) {
- this.type = type;
- }
-
- @Override
- public Value getValue() {
- return value;
- }
-
- @Override
- public void setValue(final Value value) {
- this.value = value;
- }
-
- @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);
- }
-}
[39/52] [abbrv] [OLINGO-200] Moving ODataDeserializer and
ODataSerializer (interfaces and impl) to commons
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ResourceFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ResourceFactory.java
new file mode 100644
index 0000000..e585b2d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ResourceFactory.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.op;
+
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.AtomFeedImpl;
+import org.apache.olingo.commons.core.data.AtomPropertyImpl;
+import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.core.data.JSONFeedImpl;
+import org.apache.olingo.commons.core.data.JSONPropertyImpl;
+
+public class ResourceFactory {
+
+ /**
+ * Gets a new instance of <tt>Feed</tt>.
+ *
+ * @param resourceClass reference class.
+ * @return <tt>Feed</tt> object.
+ */
+ public static Feed newFeed(final Class<? extends Feed> resourceClass) {
+ Feed result = null;
+
+ if (AtomFeedImpl.class.equals(resourceClass)) {
+ result = new AtomFeedImpl();
+ }
+ if (JSONFeedImpl.class.equals(resourceClass)) {
+ result = new JSONFeedImpl();
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets a new instance of <tt>Entry</tt>.
+ *
+ * @param resourceClass reference class.
+ * @return <tt>Entry</tt> object.
+ */
+ public static Entry newEntry(final Class<? extends Entry> resourceClass) {
+ Entry result = null;
+ if (AtomEntryImpl.class.equals(resourceClass)) {
+ result = new AtomEntryImpl();
+ }
+ if (JSONEntryImpl.class.equals(resourceClass)) {
+ result = new JSONEntryImpl();
+ }
+
+ return result;
+ }
+
+ public static Property newProperty(final Class<? extends Entry> resourceClass) {
+ Property result = null;
+ if (AtomEntryImpl.class.equals(resourceClass)) {
+ result = new AtomPropertyImpl();
+ }
+ if (JSONEntryImpl.class.equals(resourceClass)) {
+ result = new JSONPropertyImpl();
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets feed reference class from the given format.
+ *
+ * @param isXML whether it is JSON or XML / Atom
+ * @return resource reference class.
+ */
+ public static Class<? extends Feed> feedClassForFormat(final boolean isXML) {
+ return isXML ? AtomFeedImpl.class : JSONFeedImpl.class;
+ }
+
+ /**
+ * Gets entry reference class from the given format.
+ *
+ * @param isXML whether it is JSON or XML / Atom
+ * @return resource reference class.
+ */
+ public static Class<? extends Entry> entryClassForFormat(final boolean isXML) {
+ return isXML ? AtomEntryImpl.class : JSONEntryImpl.class;
+ }
+
+ /**
+ * Gets <tt>Entry</tt> object from feed resource.
+ *
+ * @param resourceClass feed reference class.
+ * @return <tt>Entry</tt> object.
+ */
+ public static Class<? extends Entry> entryClassForFeed(final Class<? extends Feed> resourceClass) {
+ Class<? extends Entry> result = null;
+
+ if (AtomFeedImpl.class.equals(resourceClass)) {
+ result = AtomEntryImpl.class;
+ }
+ if (JSONFeedImpl.class.equals(resourceClass)) {
+ result = JSONEntryImpl.class;
+ }
+
+ return result;
+ }
+
+ public static ODataPubFormat formatForEntryClass(final Class<? extends Entry> reference) {
+ return reference.equals(AtomEntryImpl.class) ? ODataPubFormat.ATOM : ODataPubFormat.JSON;
+ }
+}
[04/52] [abbrv] Consistently using package name to differentiate V3
and V4
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3ReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3ReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3ReaderImpl.java
deleted file mode 100644
index 778458f..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3ReaderImpl.java
+++ /dev/null
@@ -1,47 +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.client.core.op.impl;
-
-import java.io.InputStream;
-
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.core.ODataV3ClientImpl;
-import org.apache.olingo.client.core.edm.EdmClientImpl;
-import org.apache.olingo.commons.api.edm.Edm;
-
-public class ODataV3ReaderImpl extends AbstractODataReader {
-
- private static final long serialVersionUID = -2481293269536406956L;
-
- public ODataV3ReaderImpl(final ODataV3ClientImpl client) {
- super(client);
- }
-
- @Override
- public Edm readMetadata(final InputStream input) {
- return new EdmClientImpl(client.getDeserializer().toMetadata(input));
- }
-
- @Override
- public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
- return ((ODataV3ClientImpl) client).getBinder().getODataServiceDocument(
- ((ODataV3ClientImpl) client).getDeserializer().toServiceDocument(input, format));
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3SerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3SerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3SerializerImpl.java
deleted file mode 100644
index 366f458..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3SerializerImpl.java
+++ /dev/null
@@ -1,31 +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.client.core.op.impl;
-
-import org.apache.olingo.client.api.ODataClient;
-
-public class ODataV3SerializerImpl extends AbstractODataSerializer {
-
- private static final long serialVersionUID = -8861908250297989806L;
-
- public ODataV3SerializerImpl(final ODataClient client) {
- super(client);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4BinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4BinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4BinderImpl.java
deleted file mode 100644
index 36006b5..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4BinderImpl.java
+++ /dev/null
@@ -1,57 +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.client.core.op.impl;
-
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.data.ServiceDocumentItem;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.core.ODataV4ClientImpl;
-import org.apache.olingo.client.api.utils.URIUtils;
-
-public class ODataV4BinderImpl extends AbstractODataBinder {
-
- private static final long serialVersionUID = -6371110655960799393L;
-
- public ODataV4BinderImpl(final ODataV4ClientImpl client) {
- super(client);
- }
-
- @Override
- public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
- final ODataServiceDocument serviceDocument = super.getODataServiceDocument(resource);
-
- serviceDocument.setMetadataContext(URIUtils.getURI(resource.getBaseURI(), resource.getMetadataContext()));
- serviceDocument.setMetadataETag(resource.getMetadataETag());
-
- for (ServiceDocumentItem functionImport : resource.getFunctionImports()) {
- serviceDocument.getFunctionImports().put(functionImport.getTitle(),
- URIUtils.getURI(resource.getBaseURI(), functionImport.getHref()));
- }
- for (ServiceDocumentItem singleton : resource.getSingletons()) {
- serviceDocument.getSingletons().put(singleton.getTitle(),
- URIUtils.getURI(resource.getBaseURI(), singleton.getHref()));
- }
- for (ServiceDocumentItem sdoc : resource.getRelatedServiceDocuments()) {
- serviceDocument.getRelatedServiceDocuments().put(sdoc.getTitle(),
- URIUtils.getURI(resource.getBaseURI(), sdoc.getHref()));
- }
-
- return serviceDocument;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4DeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4DeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4DeserializerImpl.java
deleted file mode 100644
index d3affea..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4DeserializerImpl.java
+++ /dev/null
@@ -1,57 +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.client.core.op.impl;
-
-import java.io.InputStream;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.op.ODataV4Deserializer;
-import org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl;
-import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
-import org.apache.olingo.client.core.edm.xml.v4.EdmxImpl;
-import org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl;
-
-public class ODataV4DeserializerImpl extends AbstractODataDeserializer implements ODataV4Deserializer {
-
- private static final long serialVersionUID = 8593081342440470415L;
-
- public ODataV4DeserializerImpl(final ODataClient client) {
- super(client);
- }
-
- @Override
- public XMLMetadata toMetadata(final InputStream input) {
- try {
- return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not parse as Edmx document", e);
- }
- }
-
- @Override
- public ServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
- return format == ODataFormat.XML
- ? xml(input, XMLServiceDocumentImpl.class)
- : json(input, JSONServiceDocumentImpl.class);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4ReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4ReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4ReaderImpl.java
deleted file mode 100644
index f704eee..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4ReaderImpl.java
+++ /dev/null
@@ -1,47 +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.client.core.op.impl;
-
-import java.io.InputStream;
-
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.core.ODataV4ClientImpl;
-import org.apache.olingo.client.core.edm.EdmClientImpl;
-import org.apache.olingo.commons.api.edm.Edm;
-
-public class ODataV4ReaderImpl extends AbstractODataReader {
-
- private static final long serialVersionUID = -2481293269536406956L;
-
- public ODataV4ReaderImpl(final ODataV4ClientImpl client) {
- super(client);
- }
-
- @Override
- public Edm readMetadata(final InputStream input) {
- return new EdmClientImpl(client.getDeserializer().toMetadata(input));
- }
-
- @Override
- public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
- return ((ODataV4ClientImpl) client).getBinder().getODataServiceDocument(
- ((ODataV4ClientImpl) client).getDeserializer().toServiceDocument(input, format));
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4SerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4SerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4SerializerImpl.java
deleted file mode 100644
index 9e971b4..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4SerializerImpl.java
+++ /dev/null
@@ -1,31 +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.client.core.op.impl;
-
-import org.apache.olingo.client.api.ODataClient;
-
-public class ODataV4SerializerImpl extends AbstractODataSerializer {
-
- private static final long serialVersionUID = 7587265188399685309L;
-
- public ODataV4SerializerImpl(final ODataClient client) {
- super(client);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java
index 40bd2fb..5e95f2b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java
@@ -24,7 +24,7 @@ import java.io.InputStream;
import java.util.Collection;
import java.util.Collections;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
@@ -36,9 +36,9 @@ public class ODataWriterImpl implements ODataWriter {
private static final long serialVersionUID = 3265794768412314485L;
- protected final ODataClient client;
+ protected final CommonODataClient client;
- public ODataWriterImpl(final ODataClient client) {
+ public ODataWriterImpl(final CommonODataClient client) {
this.client = client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
new file mode 100644
index 0000000..f5e5710
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.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.client.core.op.impl.v3;
+
+import org.apache.olingo.client.api.data.v3.LinkCollection;
+import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
+import org.apache.olingo.client.api.op.v3.ODataBinder;
+import org.apache.olingo.client.core.op.impl.AbstractODataBinder;
+import org.apache.olingo.client.core.v3.ODataClientImpl;
+
+public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
+
+ private static final long serialVersionUID = 8970843539708952308L;
+
+ public ODataBinderImpl(final ODataClientImpl client) {
+ super(client);
+ }
+
+ @Override
+ public ODataLinkCollection getLinkCollection(final LinkCollection linkCollection) {
+ final ODataLinkCollection collection = new ODataLinkCollection(linkCollection.getNext());
+ collection.setLinks(linkCollection.getLinks());
+ return collection;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
new file mode 100644
index 0000000..ea28958
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.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.client.core.op.impl.v3;
+
+import java.io.InputStream;
+
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.data.v3.LinkCollection;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.op.v3.ODataDeserializer;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.core.data.v3.JSONLinkCollectionImpl;
+import org.apache.olingo.client.core.data.v3.XMLLinkCollectionImpl;
+import org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl;
+import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
+import org.apache.olingo.client.core.edm.xml.v3.EdmxImpl;
+import org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl;
+import org.apache.olingo.client.core.op.impl.AbstractODataDeserializer;
+
+public class ODataDeserializerImpl extends AbstractODataDeserializer implements ODataDeserializer {
+
+ private static final long serialVersionUID = -8221085862548914611L;
+
+ public ODataDeserializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public XMLMetadataImpl toMetadata(final InputStream input) {
+ try {
+ return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Could not parse as Edmx document", e);
+ }
+ }
+
+ @Override
+ public ServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
+ return format == ODataFormat.XML
+ ? xml(input, XMLServiceDocumentImpl.class)
+ : json(input, JSONServiceDocumentImpl.class);
+ }
+
+ @Override
+ public LinkCollection toLinkCollection(final InputStream input, final ODataFormat format) {
+ return format == ODataFormat.XML
+ ? atom(input, XMLLinkCollectionImpl.class)
+ : json(input, JSONLinkCollectionImpl.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
new file mode 100644
index 0000000..54e4ad0
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.op.impl.v3;
+
+import java.io.InputStream;
+
+import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.op.v3.ODataReader;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.core.v3.ODataClientImpl;
+import org.apache.olingo.client.core.edm.EdmClientImpl;
+import org.apache.olingo.client.core.op.impl.AbstractODataReader;
+import org.apache.olingo.commons.api.edm.Edm;
+
+public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
+
+ private static final long serialVersionUID = -2481293269536406956L;
+
+ public ODataReaderImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public Edm readMetadata(final InputStream input) {
+ return new EdmClientImpl(client.getDeserializer().toMetadata(input));
+ }
+
+ @Override
+ public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
+ return ((ODataClientImpl) client).getBinder().getODataServiceDocument(
+ ((ODataClientImpl) client).getDeserializer().toServiceDocument(input, format));
+ }
+
+ @Override
+ public ODataLinkCollection readLinks(final InputStream input, final ODataFormat format) {
+ return ((ODataClient) client).getBinder().getLinkCollection(
+ ((ODataClient) client).getDeserializer().toLinkCollection(input, format));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T read(final InputStream src, final String format, final Class<T> reference) {
+ return (ODataLinkCollection.class.isAssignableFrom(reference)
+ ? (T) readLinks(src, ODataFormat.fromString(format))
+ : super.read(src, format, reference));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
new file mode 100644
index 0000000..5ad5cda
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/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.client.core.op.impl.v3;
+
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.core.op.impl.AbstractODataSerializer;
+
+public class ODataSerializerImpl extends AbstractODataSerializer {
+
+ private static final long serialVersionUID = -8861908250297989806L;
+
+ public ODataSerializerImpl(final CommonODataClient client) {
+ super(client);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
new file mode 100644
index 0000000..8812129
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.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.client.core.op.impl.v4;
+
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.data.ServiceDocumentItem;
+import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.client.api.op.v4.ODataBinder;
+import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.op.impl.AbstractODataBinder;
+
+public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
+
+ private static final long serialVersionUID = -6371110655960799393L;
+
+ public ODataBinderImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
+ final ODataServiceDocument serviceDocument = super.getODataServiceDocument(resource);
+
+ serviceDocument.setMetadataContext(URIUtils.getURI(resource.getBaseURI(), resource.getMetadataContext()));
+ serviceDocument.setMetadataETag(resource.getMetadataETag());
+
+ for (ServiceDocumentItem functionImport : resource.getFunctionImports()) {
+ serviceDocument.getFunctionImports().put(functionImport.getTitle(),
+ URIUtils.getURI(resource.getBaseURI(), functionImport.getHref()));
+ }
+ for (ServiceDocumentItem singleton : resource.getSingletons()) {
+ serviceDocument.getSingletons().put(singleton.getTitle(),
+ URIUtils.getURI(resource.getBaseURI(), singleton.getHref()));
+ }
+ for (ServiceDocumentItem sdoc : resource.getRelatedServiceDocuments()) {
+ serviceDocument.getRelatedServiceDocuments().put(sdoc.getTitle(),
+ URIUtils.getURI(resource.getBaseURI(), sdoc.getHref()));
+ }
+
+ return serviceDocument;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
new file mode 100644
index 0000000..d947539
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.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.client.core.op.impl.v4;
+
+import java.io.InputStream;
+
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.op.v4.ODataDeserializer;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl;
+import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
+import org.apache.olingo.client.core.edm.xml.v4.EdmxImpl;
+import org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl;
+import org.apache.olingo.client.core.op.impl.AbstractODataDeserializer;
+
+public class ODataDeserializerImpl extends AbstractODataDeserializer implements ODataDeserializer {
+
+ private static final long serialVersionUID = 8593081342440470415L;
+
+ public ODataDeserializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public XMLMetadata toMetadata(final InputStream input) {
+ try {
+ return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Could not parse as Edmx document", e);
+ }
+ }
+
+ @Override
+ public ServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
+ return format == ODataFormat.XML
+ ? xml(input, XMLServiceDocumentImpl.class)
+ : json(input, JSONServiceDocumentImpl.class);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
new file mode 100644
index 0000000..5a64d63
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.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.client.core.op.impl.v4;
+
+import java.io.InputStream;
+
+import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.op.v4.ODataReader;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.edm.EdmClientImpl;
+import org.apache.olingo.client.core.op.impl.AbstractODataReader;
+import org.apache.olingo.commons.api.edm.Edm;
+
+public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
+
+ private static final long serialVersionUID = -2481293269536406956L;
+
+ public ODataReaderImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public Edm readMetadata(final InputStream input) {
+ return new EdmClientImpl(client.getDeserializer().toMetadata(input));
+ }
+
+ @Override
+ public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
+ return ((ODataClient) client).getBinder().getODataServiceDocument(
+ ((ODataClient) client).getDeserializer().toServiceDocument(input, format));
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
new file mode 100644
index 0000000..97557a1
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/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.client.core.op.impl.v4;
+
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.core.op.impl.AbstractODataSerializer;
+
+public class ODataSerializerImpl extends AbstractODataSerializer {
+
+ private static final long serialVersionUID = 7587265188399685309L;
+
+ public ODataSerializerImpl(final CommonODataClient client) {
+ super(client);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractComparingFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractComparingFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractComparingFilter.java
new file mode 100644
index 0000000..f0cc105
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractComparingFilter.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.URIFilter;
+
+abstract class AbstractComparingFilter implements URIFilter {
+
+ private final FilterArg left;
+
+ private final FilterArg right;
+
+ AbstractComparingFilter(final FilterArg left, final FilterArg right) {
+ this.left = left;
+ this.right = right;
+ }
+
+ protected abstract String getOp();
+
+ @Override
+ public String build() {
+ return new StringBuilder().
+ append('(').append(left.build()).
+ append(' ').append(getOp()).append(' ').
+ append(right.build()).append(')').
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java
new file mode 100644
index 0000000..47100e8
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.CommonFilterArgFactory;
+
+/**
+ * OData filter arguments factory.
+ */
+public abstract class AbstractFilterArgFactory implements CommonFilterArgFactory {
+
+ @Override
+ public FilterArg _null() {
+ return new FilterConst("null");
+ }
+
+ @Override
+ public FilterArg property(final String propertyPath) {
+ return new FilterProperty(propertyPath);
+ }
+
+ @Override
+ public FilterArg literal(final Object value) {
+ return new FilterLiteral(value);
+ }
+
+ @Override
+ public FilterArg add(final FilterArg first, final FilterArg second) {
+ return new FilterOp("add", first, second);
+ }
+
+ @Override
+ public FilterArg sub(final FilterArg first, final FilterArg second) {
+ return new FilterOp("add", first, second);
+ }
+
+ @Override
+ public FilterArg mul(final FilterArg first, final FilterArg second) {
+ return new FilterOp("mul", first, second);
+ }
+
+ @Override
+ public FilterArg div(final FilterArg first, final FilterArg second) {
+ return new FilterOp("div", first, second);
+ }
+
+ @Override
+ public FilterArg mod(final FilterArg first, final FilterArg second) {
+ return new FilterOp("mod", first, second);
+ }
+
+ @Override
+ public FilterArg endswith(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("endswith", first, second);
+ }
+
+ @Override
+ public FilterArg startswith(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("startswith", first, second);
+ }
+
+ @Override
+ public FilterArg length(final FilterArg param) {
+ return new FilterFunction("length", param);
+ }
+
+ @Override
+ public FilterArg indexof(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("indexof", first, second);
+ }
+
+ @Override
+ public FilterArg replace(final FilterArg first, final FilterArg second, final FilterArg third) {
+ return new FilterFunction("replace", first, second, third);
+ }
+
+ @Override
+ public FilterArg substring(final FilterArg arg, final FilterArg pos) {
+ return new FilterFunction("substring", arg, pos);
+ }
+
+ @Override
+ public FilterArg substring(final FilterArg arg, final FilterArg pos, final FilterArg length) {
+ return new FilterFunction("substring", arg, pos, length);
+ }
+
+ @Override
+ public FilterArg tolower(final FilterArg param) {
+ return new FilterFunction("tolower", param);
+ }
+
+ @Override
+ public FilterArg toupper(final FilterArg param) {
+ return new FilterFunction("toupper", param);
+ }
+
+ @Override
+ public FilterArg trim(final FilterArg param) {
+ return new FilterFunction("trim", param);
+ }
+
+ @Override
+ public FilterArg concat(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("concat", first, second);
+ }
+
+ @Override
+ public FilterArg day(final FilterArg param) {
+ return new FilterFunction("day", param);
+ }
+
+ @Override
+ public FilterArg hour(final FilterArg param) {
+ return new FilterFunction("hour", param);
+ }
+
+ @Override
+ public FilterArg minute(final FilterArg param) {
+ return new FilterFunction("minute", param);
+ }
+
+ @Override
+ public FilterArg month(final FilterArg param) {
+ return new FilterFunction("month", param);
+ }
+
+ @Override
+ public FilterArg second(final FilterArg param) {
+ return new FilterFunction("second", param);
+ }
+
+ @Override
+ public FilterArg year(final FilterArg param) {
+ return new FilterFunction("year", param);
+ }
+
+ @Override
+ public FilterArg round(final FilterArg param) {
+ return new FilterFunction("round", param);
+ }
+
+ @Override
+ public FilterArg floor(final FilterArg param) {
+ return new FilterFunction("floor", param);
+ }
+
+ @Override
+ public FilterArg ceiling(final FilterArg param) {
+ return new FilterFunction("ceiling", param);
+ }
+
+ @Override
+ public FilterArg isof(final FilterArg type) {
+ return new FilterFunction("isof", type);
+ }
+
+ @Override
+ public FilterArg isof(final FilterArg expression, final FilterArg type) {
+ return new FilterFunction("isof", expression, type);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.java
new file mode 100644
index 0000000..eb6067e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.CommonFilterFactory;
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public abstract class AbstractFilterFactory implements CommonFilterFactory {
+
+ private static final long serialVersionUID = -6141317149802621836L;
+
+ @Override
+ public URIFilter match(final FilterArg arg) {
+ return new MatchFilter(arg);
+ }
+
+ @Override
+ public URIFilter eq(final String key, final Object value) {
+ return new EqFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter eq(final FilterArg left, final FilterArg right) {
+ return new EqFilter(left, right);
+ }
+
+ @Override
+ public URIFilter ne(final String key, final Object value) {
+ return new NeFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter ne(final FilterArg left, final FilterArg right) {
+ return new NeFilter(left, right);
+ }
+
+ @Override
+ public URIFilter gt(final String key, final Object value) {
+ return new GtFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter gt(final FilterArg left, final FilterArg right) {
+ return new GtFilter(left, right);
+ }
+
+ @Override
+ public URIFilter ge(final String key, final Object value) {
+ return new GeFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter ge(final FilterArg left, final FilterArg right) {
+ return new GeFilter(left, right);
+ }
+
+ @Override
+ public URIFilter lt(final String key, final Object value) {
+ return new LtFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter lt(final FilterArg left, final FilterArg right) {
+ return new LtFilter(left, right);
+ }
+
+ @Override
+ public URIFilter le(final String key, final Object value) {
+ return new LeFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter le(final FilterArg left, final FilterArg right) {
+ return new LeFilter(left, right);
+ }
+
+ @Override
+ public URIFilter and(final URIFilter left, final URIFilter right) {
+ return new AndFilter(left, right);
+ }
+
+ @Override
+ public URIFilter or(final URIFilter left, final URIFilter right) {
+ return new OrFilter(left, right);
+ }
+
+ @Override
+ public URIFilter not(final URIFilter filter) {
+ return new NotFilter(filter);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
index 8cc35cb..14f2704 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
@@ -29,19 +29,19 @@ import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.uri.QueryOption;
import org.apache.olingo.client.api.uri.SegmentType;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.api.uri.filter.URIFilter;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.api.uri.URIFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class AbstractURIBuilder<UB extends URIBuilder<?>> implements URIBuilder<UB> {
+public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> implements CommonURIBuilder<UB> {
private static final long serialVersionUID = -3267515371720408124L;
/**
* Logger.
*/
- protected static final Logger LOG = LoggerFactory.getLogger(URIBuilder.class);
+ protected static final Logger LOG = LoggerFactory.getLogger(CommonURIBuilder.class);
protected static class Segment {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AndFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AndFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AndFilter.java
new file mode 100644
index 0000000..07136e0
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AndFilter.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public class AndFilter implements URIFilter {
+
+ private final URIFilter left;
+
+ private final URIFilter right;
+
+ public AndFilter(final URIFilter left, final URIFilter right) {
+ this.left = left;
+ this.right = right;
+ }
+
+ @Override
+ public String build() {
+ return new StringBuilder().
+ append('(').append(left.build()).
+ append(" and ").
+ append(right.build()).append(')').
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/EqFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/EqFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/EqFilter.java
new file mode 100644
index 0000000..43225c6
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/EqFilter.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class EqFilter extends AbstractComparingFilter {
+
+ EqFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "eq";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java
new file mode 100644
index 0000000..650855b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+/**
+ * Filter property path; obtain instances via <tt>FilterArgFactory</tt>.
+ *
+ * @see org.apache.olingo.client.api.uri.filter.FilterArgFactory
+ */
+public class FilterConst implements FilterArg {
+
+ private final String value;
+
+ FilterConst(final String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String build() {
+ return value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.java
new file mode 100644
index 0000000..3360d4a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.commons.lang3.StringUtils;
+
+public class FilterFunction implements FilterArg {
+
+ private final String function;
+
+ private final FilterArg[] params;
+
+ public FilterFunction(final String function, final FilterArg... params) {
+ this.function = function;
+ this.params = params;
+ }
+
+ @Override
+ public String build() {
+ final String[] strParams = params == null || params.length == 0 ? new String[0] : new String[params.length];
+ for (int i = 0; i < strParams.length; i++) {
+ strParams[i] = params[i].build();
+ }
+
+ return new StringBuilder(function).
+ append('(').
+ append(strParams.length == 0 ? StringUtils.EMPTY : StringUtils.join(strParams, ',')).
+ append(')').
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLambda.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLambda.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLambda.java
new file mode 100644
index 0000000..f99ea4e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLambda.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public class FilterLambda implements FilterArg {
+
+ private final FilterArg collection;
+
+ private final String operator;
+
+ private final URIFilter expression;
+
+ public FilterLambda(final FilterArg collection, final String operator, final URIFilter expression) {
+ this.collection = collection;
+ this.operator = operator;
+ this.expression = expression;
+ }
+
+ @Override
+ public String build() {
+ return new StringBuilder(collection.build()).
+ append('/').
+ append(operator).
+ append(expression.build()).
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
new file mode 100644
index 0000000..c7e2d6a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.utils.URIUtils;
+
+/**
+ * Filter value literals; obtain instances via <tt>FilterArgFactory</tt>.
+ *
+ * @see FilterArgFactory
+ */
+public class FilterLiteral implements FilterArg {
+
+ private final Object value;
+
+ FilterLiteral(final Object value) {
+ this.value = value;
+ }
+
+ @Override
+ public String build() {
+ return URIUtils.escape(value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterOp.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterOp.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterOp.java
new file mode 100644
index 0000000..f4deac9
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterOp.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class FilterOp implements FilterArg {
+
+ private final String op;
+
+ private final FilterArg first;
+
+ private final FilterArg second;
+
+ FilterOp(final String op, final FilterArg first, final FilterArg second) {
+ this.op = op;
+ this.first = first;
+ this.second = second;
+ }
+
+ @Override
+ public String build() {
+ return new StringBuilder().
+ append('(').append(first.build()).
+ append(' ').append(op).append(' ').
+ append(second.build()).append(')').
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java
new file mode 100644
index 0000000..5f2fd4e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+/**
+ * Filter property path; obtain instances via <tt>FilterArgFactory</tt>.
+ *
+ * @see FilterArgFactory
+ */
+public class FilterProperty implements FilterArg {
+
+ private final String propertyPath;
+
+ public FilterProperty(final String value) {
+ this.propertyPath = value;
+ }
+
+ @Override
+ public String build() {
+ return propertyPath;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GeFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GeFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GeFilter.java
new file mode 100644
index 0000000..829cd4d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GeFilter.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class GeFilter extends AbstractComparingFilter {
+
+ GeFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "ge";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GtFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GtFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GtFilter.java
new file mode 100644
index 0000000..c9d8311
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GtFilter.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class GtFilter extends AbstractComparingFilter {
+
+ GtFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "gt";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/HasFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/HasFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/HasFilter.java
new file mode 100644
index 0000000..067ec6d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/HasFilter.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class HasFilter extends AbstractComparingFilter {
+
+ public HasFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "has";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LeFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LeFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LeFilter.java
new file mode 100644
index 0000000..cd28f98
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LeFilter.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class LeFilter extends AbstractComparingFilter {
+
+ LeFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "le";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LtFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LtFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LtFilter.java
new file mode 100644
index 0000000..96d3ec5
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LtFilter.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class LtFilter extends AbstractComparingFilter {
+
+ LtFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "lt";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/MatchFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/MatchFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/MatchFilter.java
new file mode 100644
index 0000000..3634e22
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/MatchFilter.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public class MatchFilter implements URIFilter {
+
+ private final FilterArg arg;
+
+ MatchFilter(final FilterArg arg) {
+ this.arg = arg;
+ }
+
+ @Override
+ public String build() {
+ return arg.build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NeFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NeFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NeFilter.java
new file mode 100644
index 0000000..045940c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NeFilter.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class NeFilter extends AbstractComparingFilter {
+
+ NeFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "ne";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NotFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NotFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NotFilter.java
new file mode 100644
index 0000000..afa304b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NotFilter.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public class NotFilter implements URIFilter {
+
+ private final URIFilter filter;
+
+ public NotFilter(final URIFilter left) {
+ this.filter = left;
+ }
+
+ @Override
+ public String build() {
+ return new StringBuilder("not (").append(filter.build()).append(')').toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/OrFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/OrFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/OrFilter.java
new file mode 100644
index 0000000..f81ce87
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/OrFilter.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.client.core.uri;
+
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public class OrFilter implements URIFilter {
+
+ private final URIFilter left;
+
+ private final URIFilter right;
+
+ public OrFilter(final URIFilter left, final URIFilter right) {
+ this.left = left;
+ this.right = right;
+ }
+
+ @Override
+ public String build() {
+ return new StringBuilder().
+ append('(').append(left.build()).
+ append(" or ").
+ append(right.build()).append(')').
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V3URIBuilderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V3URIBuilderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V3URIBuilderImpl.java
deleted file mode 100644
index 3f61660..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V3URIBuilderImpl.java
+++ /dev/null
@@ -1,95 +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.client.core.uri;
-
-import org.apache.olingo.client.api.utils.URIUtils;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.V3Configuration;
-import org.apache.olingo.client.api.uri.QueryOption;
-import org.apache.olingo.client.api.uri.SegmentType;
-import org.apache.olingo.client.api.uri.V3URIBuilder;
-
-public class V3URIBuilderImpl extends AbstractURIBuilder<V3URIBuilder> implements V3URIBuilder {
-
- private static final long serialVersionUID = -3506851722447870532L;
-
- private final V3Configuration configuration;
-
- public V3URIBuilderImpl(final V3Configuration configuration, final String serviceRoot) {
- super(serviceRoot);
- this.configuration = configuration;
- }
-
- @Override
- protected V3URIBuilder getThis() {
- return this;
- }
-
- @Override
- protected char getBoundOperationSeparator() {
- return '/';
- }
-
- @Override
- protected char getDerivedEntityTypeSeparator() {
- return '/';
- }
-
- @Override
- public V3URIBuilder appendLinksSegment(final String segmentValue) {
- segments.add(new Segment(SegmentType.LINKS, SegmentType.LINKS.getValue()));
- segments.add(new Segment(SegmentType.ENTITYSET, segmentValue));
-
- return getThis();
- }
-
- @Override
- protected String noKeysWrapper() {
- return StringUtils.EMPTY;
- }
-
- @Override
- public V3URIBuilder appendKeySegment(final Object val) {
- if (configuration.isKeyAsSegment()) {
- final String segValue = URIUtils.escape(val);
- segments.add(new Segment(SegmentType.KEY_AS_SEGMENT, segValue));
- } else {
- super.appendKeySegment(val);
- }
-
- return getThis();
- }
-
- @Override
- public V3URIBuilder appendKeySegment(final Map<String, Object> segmentValues) {
- if (!configuration.isKeyAsSegment()) {
- super.appendKeySegment(segmentValues);
- }
-
- return getThis();
- }
-
- @Override
- public V3URIBuilder inlineCount(final InlineCount inlineCount) {
- return addQueryOption(QueryOption.INLINECOUNT, inlineCount.name());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V4URIBuilderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V4URIBuilderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V4URIBuilderImpl.java
deleted file mode 100644
index d24df81..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V4URIBuilderImpl.java
+++ /dev/null
@@ -1,101 +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.client.core.uri;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.uri.QueryOption;
-import org.apache.olingo.client.api.uri.SegmentType;
-import org.apache.olingo.client.api.uri.V4URIBuilder;
-
-public class V4URIBuilderImpl extends AbstractURIBuilder<V4URIBuilder> implements V4URIBuilder {
-
- private static final long serialVersionUID = -3506851722447870532L;
-
- public V4URIBuilderImpl(final String serviceRoot) {
- super(serviceRoot);
- }
-
- @Override
- protected V4URIBuilder getThis() {
- return this;
- }
-
- @Override
- protected String noKeysWrapper() {
- return "()";
- }
-
- @Override
- protected char getBoundOperationSeparator() {
- return '.';
- }
-
- @Override
- protected char getDerivedEntityTypeSeparator() {
- return '.';
- }
-
- @Override
- public V4URIBuilder appendSingletonSegment(final String segmentValue) {
- segments.add(new Segment(SegmentType.SINGLETON, segmentValue));
- return getThis();
- }
-
- @Override
- public V4URIBuilder appendEntityIdSegment(final String segmentValue) {
- segments.add(new Segment(SegmentType.ENTITY, null));
- return addQueryOption(QueryOption.ID, segmentValue);
- }
-
- @Override
- public V4URIBuilder appendRefSegment() {
- segments.add(new Segment(SegmentType.REF, SegmentType.REF.getValue()));
- return getThis();
- }
-
- @Override
- public V4URIBuilder appendCrossjoinSegment(final String... segmentValues) {
- StringBuilder segValue = new StringBuilder(SegmentType.CROSS_JOIN.getValue()).
- append('(').append(StringUtils.join(segmentValues, ",")).append(')');
- segments.add(new Segment(SegmentType.CROSS_JOIN, segValue.toString()));
- return getThis();
- }
-
- @Override
- public V4URIBuilder count(final boolean value) {
- return addQueryOption(QueryOption.COUNT, Boolean.toString(value));
- }
-
- @Override
- public V4URIBuilder appendAllSegment() {
- segments.add(new Segment(SegmentType.ALL, SegmentType.ALL.getValue()));
- return getThis();
- }
-
- @Override
- public V4URIBuilder id(final String idValue) {
- return addQueryOption(QueryOption.ID, idValue);
- }
-
- @Override
- public V4URIBuilder search(final String expression) {
- return addQueryOption(QueryOption.SEARCH, expression);
- }
-
-}
[11/52] [abbrv] [OLINGO-65] Geospatial types implemented,
EdmStream mock implemented with URI as backend, V3 pruned types implemented,
EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
index 05807ee..c956789 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
@@ -18,11 +18,10 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
import org.junit.Test;
public class UInt7Test extends PrimitiveTypeBaseTest {
@@ -30,6 +29,7 @@ public class UInt7Test extends PrimitiveTypeBaseTest {
@Test
public void compatibility() {
assertTrue(Uint7.getInstance().isCompatible(Uint7.getInstance()));
- assertFalse(Uint7.getInstance().isCompatible(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance()));
+ assertFalse(Uint7.getInstance().isCompatible(
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String)));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
index faceb0e..9645d93 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
@@ -24,9 +24,10 @@ import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmMember;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.AbstractEdmEnumType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.edm.provider.EnumType;
public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType {
@@ -39,10 +40,10 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType
super(edm, enumName, enumType.isFlags());
if (enumType.getUnderlyingType() == null) {
- this.underlyingType = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+ this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
} else {
- this.underlyingType = EdmPrimitiveTypeKind.valueOf(
- enumType.getUnderlyingType().getName()).getEdmPrimitiveTypeInstance();
+ this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ EdmPrimitiveTypeKind.valueOf(enumType.getUnderlyingType().getName()));
// TODO: Should we validate that the underlying type is of byte, sbyte, in16, int32 or int64?
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
index 1c6fb0b..91b0cde 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
@@ -21,10 +21,11 @@ package org.apache.olingo.server.core.edm.provider;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.AbstractEdmTypeDefinition;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements EdmTypeDefinition {
@@ -34,7 +35,7 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
private EdmPrimitiveType edmPrimitiveTypeInstance;
public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
- final TypeDefinition typeDefinition) {
+ final TypeDefinition typeDefinition) {
super(edm, typeDefinitionName);
this.typeDefinition = typeDefinition;
@@ -44,8 +45,8 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
public EdmPrimitiveType getUnderlyingType() {
if (edmPrimitiveTypeInstance == null) {
try {
- edmPrimitiveTypeInstance = EdmPrimitiveTypeKind.valueOf(
- typeDefinition.getUnderlyingType().getName()).getEdmPrimitiveTypeInstance();
+ edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ EdmPrimitiveTypeKind.valueOf(typeDefinition.getUnderlyingType().getName()));
} catch (IllegalArgumentException e) {
throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
index a5b81af..bb24c64 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
@@ -18,17 +18,21 @@
*/
package org.apache.olingo.server.core.uri;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.uri.UriResourceKind;
import org.apache.olingo.server.api.uri.UriResourceLambdaAll;
import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements UriResourceLambdaAll {
+
protected EdmProperty property;
+
private String lambdaVariable;
+
private ExpressionImpl expression;
public UriResourceLambdaAllImpl() {
@@ -37,7 +41,7 @@ public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements Ur
@Override
public EdmType getType() {
- return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+ return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean);
}
@Override
@@ -53,7 +57,9 @@ public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements Ur
public UriResourceLambdaAllImpl setLamdaVariable(final String lambdaVariable) {
this.lambdaVariable = lambdaVariable;
return this;
- };
+ }
+
+ ;
@Override
public Expression getExpression() {
@@ -63,7 +69,9 @@ public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements Ur
public UriResourceLambdaAllImpl setExpression(final ExpressionImpl expression) {
this.expression = expression;
return this;
- };
+ }
+
+ ;
@Override
public String toString() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
index 65b6a69..1e3143c 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
@@ -18,17 +18,21 @@
*/
package org.apache.olingo.server.core.uri;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.uri.UriResourceKind;
import org.apache.olingo.server.api.uri.UriResourceLambdaAny;
import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements UriResourceLambdaAny {
+
protected EdmProperty property;
+
private String lambdaVariable;
+
private ExpressionImpl expression;
public UriResourceLambdaAnyImpl() {
@@ -37,7 +41,7 @@ public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements Ur
@Override
public EdmType getType() {
- return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+ return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean);
}
@Override
@@ -53,7 +57,9 @@ public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements Ur
public UriResourceLambdaAnyImpl setLamdaVariable(final String lambdaVariable) {
this.lambdaVariable = lambdaVariable;
return this;
- };
+ }
+
+ ;
@Override
public Expression getExpression() {
@@ -68,5 +74,6 @@ public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements Ur
@Override
public String toString() {
return "any";
- };
+ }
+;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
index e6a2256..7d9b0d1 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
@@ -54,7 +54,6 @@ import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.LevelsOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.SkipOptionImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
index 4460760..c7d13cd 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
@@ -22,10 +22,6 @@ import java.util.Stack;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectItemContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectSegmentContext;
import org.apache.olingo.server.core.uri.parser.UriParseTreeVisitor.TypeInformation;
import org.apache.olingo.server.core.uri.queryoption.ExpandItemImpl;
import org.apache.olingo.server.core.uri.queryoption.SelectItemImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
index b3e5d69..47f5cce 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
@@ -23,7 +23,6 @@ import java.util.List;
import org.antlr.v4.runtime.misc.ParseCancellationException;
import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.TerminalNodeImpl;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmActionImport;
@@ -36,12 +35,14 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmSingleton;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.uri.UriInfoKind;
import org.apache.olingo.server.api.uri.UriResource;
import org.apache.olingo.server.api.uri.UriResourcePartTyped;
@@ -70,7 +71,6 @@ import org.apache.olingo.server.core.uri.UriResourceValueImpl;
import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl;
import org.apache.olingo.server.core.uri.antlr.UriLexer;
import org.apache.olingo.server.core.uri.antlr.UriParserBaseVisitor;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AliasAndValueContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllEOFContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltAddContext;
@@ -128,7 +128,6 @@ import org.apache.olingo.server.core.uri.antlr.UriParserParser.NamespaceContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.NaninfinityContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.NowMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.NullruleContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.Number_in_jsonContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.OdataIdentifierContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByEOFContext;
@@ -157,14 +156,11 @@ import org.apache.olingo.server.core.uri.antlr.UriParserParser.TopContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.TotalOffsetMinutesMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.TotalsecondsMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.TrimMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.UnaryContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.YearMethodCallExprContext;
-import org.apache.olingo.server.core.uri.queryoption.AliasQueryOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.CountOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.ExpandItemImpl;
import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.LevelsOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.OrderByItemImpl;
import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
@@ -185,22 +181,22 @@ import org.apache.olingo.server.core.uri.queryoption.expression.TypeLiteralImpl;
/**
* UriVisitor
- *
- * 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.
- *
+ *
+ * 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 somes point more lax than the original ABNF
- * <li> It is more tolerable against additional white spaces
- * Currently not supported
+ * <li> It is more tolerable against additional white spaces Currently not supported
* <li>Parsing the context of $metadata</li>
* <li>Parsing $search</li>
*/
public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
public class TypeInformation {
+
boolean isCollection;
+
EdmType type;
TypeInformation(final EdmType type, final boolean isCollection) {
@@ -213,11 +209,12 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
public UriContext context = null;
+
public Edm edm;
+
public EdmEntityContainer edmEntityContainer;
// --- class ---
-
public UriParseTreeVisitor(final Edm edm, final UriContext context) {
this.edm = edm;
this.context = context;
@@ -281,8 +278,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
public UriResourceTypedImpl readResourcePathSegment(final PathSegmentContext ctx) {
boolean checkFirst = false;
- if (context.contextUriInfo.getLastResourcePart() == null ||
- context.contextUriInfo.getLastResourcePart() instanceof UriResourceRootImpl) {
+ if (context.contextUriInfo.getLastResourcePart() == null
+ || context.contextUriInfo.getLastResourcePart() instanceof UriResourceRootImpl) {
checkFirst = true;
}
@@ -294,7 +291,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
EdmEntitySet edmEntitySet = edmEntityContainer.getEntitySet(odi);
if (edmEntitySet != null) {
UriResourceEntitySetImpl uriResource = new UriResourceEntitySetImpl()
- .setEntitSet(edmEntitySet);
+ .setEntitSet(edmEntitySet);
context.contextUriInfo.addResourcePart(uriResource);
return null;
}
@@ -303,7 +300,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
EdmSingleton edmSingleton = edmEntityContainer.getSingleton(odi);
if (edmSingleton != null) {
UriResourceSingletonImpl uriResource = new UriResourceSingletonImpl()
- .setSingleton(edmSingleton);
+ .setSingleton(edmSingleton);
context.contextUriInfo.addResourcePart(uriResource);
return null;
}
@@ -312,7 +309,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
EdmActionImport edmActionImport = edmEntityContainer.getActionImport(odi);
if (edmActionImport != null) {
UriResourceActionImpl uriResource = new UriResourceActionImpl()
- .setActionImport(edmActionImport);
+ .setActionImport(edmActionImport);
context.contextUriInfo.addResourcePart(uriResource);
return null;
}
@@ -331,7 +328,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
ctx.vlNVO.remove(0);
UriResourceFunctionImpl uriResource = new UriResourceFunctionImpl()
- .setFunctionImport(edmFunctionImport, parameters);
+ .setFunctionImport(edmFunctionImport, parameters);
// collect parameter names
List<String> names = new ArrayList<String>();
@@ -347,7 +344,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
tmp += (tmp.length() != 0 ? "," : "") + name;
}
throw wrap(new UriParserSemanticException("Function of functionimport '" + edmFunctionImport.getName()
- + "' with parameters [" + tmp + "] not found"));
+ + "' with parameters [" + tmp + "] not found"));
}
uriResource.setFunction(edmFunctionImport.getFunction(names));
@@ -362,7 +359,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (lastResourcePart == null) {
if (context.contextTypes.size() == 0) {
throw wrap(new UriParserSemanticException("Resource part '" + odi + "' can only applied on typed "
- + "resource parts"));
+ + "resource parts"));
}
source = context.contextTypes.peek();
} else {
@@ -370,7 +367,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (source.type == null) {
throw wrap(new UriParserSemanticException("Resource part '" + odi + "' can only applied on typed "
- + "resource parts"));
+ + "resource parts"));
}
}
@@ -389,7 +386,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (!(source.type instanceof EdmStructuredType)) {
throw wrap(new UriParserSemanticException("Can not parse'" + odi
- + "'Previous path segment not a structural type."));
+ + "'Previous path segment not a structural type."));
}
EdmStructuredType structType = (EdmStructuredType) source.type;
@@ -397,27 +394,27 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
EdmElement property = structType.getProperty(odi);
if (property == null) {
throw wrap(new UriParserSemanticException("Property '" + odi + "' not found in type '"
- + structType.getNamespace() + "." + structType.getName() + "'"));
+ + structType.getNamespace() + "." + structType.getName() + "'"));
}
if (property instanceof EdmProperty) {
if (((EdmProperty) property).isPrimitive() == true) {
// create simple property
UriResourcePrimitivePropertyImpl simpleResource = new UriResourcePrimitivePropertyImpl()
- .setProperty((EdmProperty) property);
+ .setProperty((EdmProperty) property);
context.contextUriInfo.addResourcePart(simpleResource);
return null;
} else {
// create complex property
UriResourceComplexPropertyImpl complexResource = new UriResourceComplexPropertyImpl()
- .setProperty((EdmProperty) property);
+ .setProperty((EdmProperty) property);
context.contextUriInfo.addResourcePart(complexResource);
return null;
}
} else if (property instanceof EdmNavigationProperty) {
// create navigation property
UriResourceNavigationPropertyImpl navigationResource = new UriResourceNavigationPropertyImpl()
- .setNavigationProperty((EdmNavigationProperty) property);
+ .setNavigationProperty((EdmNavigationProperty) property);
context.contextUriInfo.addResourcePart(navigationResource);
return null;
} else {
@@ -429,7 +426,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
FullQualifiedName fullFilterName = getFullNameFromContext(ctx.vNS, odi);
// EdmType lastType = getLastType(lastTyped);
-
if (source.type instanceof EdmEntityType) {
EdmEntityType filterEntityType = edm.getEntityType(fullFilterName);
@@ -437,14 +433,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
// is entity type cast
if (!(filterEntityType.compatibleTo(source.type))) {
throw wrap(new UriParserSemanticException(
- "Entity typefilter not compatible to previous path segment: " + fullFilterName.toString()));
+ "Entity typefilter not compatible to previous path segment: " + fullFilterName.toString()));
}
if (lastResourcePart == null) {
// this may be the case if a member expression within a filter starts with a typeCast
UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
- .setType(filterEntityType)
- .setCollection(source.isCollection);
+ .setType(filterEntityType)
+ .setCollection(source.isCollection);
if (source.isCollection) {
uriResource.setCollectionTypeFilter(filterEntityType);
} else {
@@ -460,17 +456,17 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (lastPartWithKeys.isCollection() == false) {
if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
- throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '" +
- getName(filterEntityType) + "' behind '" +
- getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
+ throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '"
+ + getName(filterEntityType) + "' behind '"
+ + getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
}
lastPartWithKeys.setEntryTypeFilter(filterEntityType);
return null;
} else {
if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
- throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '" +
- getName(filterEntityType) + "' behind '" +
- getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
+ throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '"
+ + getName(filterEntityType) + "' behind '"
+ + getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
}
lastPartWithKeys.setCollectionTypeFilter(filterEntityType);
return null;
@@ -478,16 +474,16 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
} else if (lastResourcePart instanceof UriResourceTypedImpl) {
UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
if (lastPartTyped.getTypeFilter() != null) {
- throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '" +
- getName(filterEntityType) + "' behind '" +
- getName(lastPartTyped.getTypeFilter()) + "'"));
+ throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '"
+ + getName(filterEntityType) + "' behind '"
+ + getName(lastPartTyped.getTypeFilter()) + "'"));
}
lastPartTyped.setTypeFilter(filterEntityType);
return null;
} else {
throw wrap(new UriParserSemanticException("Path segment before '" + getName(filterEntityType)
- + "' not typed"));
+ + "' not typed"));
}
}
}
@@ -501,7 +497,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
// is complex type cast
if (!(filterComplexType.compatibleTo(source.type))) {
throw wrap(new UriParserSemanticException(
- "Complex typefilter '" + getName(source.type) + "'not compatible type of previous path segment '"
+ "Complex typefilter '" + getName(source.type) + "'not compatible type of previous path segment '"
+ getName(filterComplexType) + "'"));
}
@@ -509,8 +505,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (lastResourcePart == null) {
// this may be the case if a member expression within a filter starts with a typeCast
UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
- .setType(filterComplexType)
- .setCollection(source.isCollection);
+ .setType(filterComplexType)
+ .setCollection(source.isCollection);
if (source.isCollection) {
uriResource.setCollectionTypeFilter(filterComplexType);
@@ -526,17 +522,17 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (lastPartWithKeys.isCollection() == false) {
if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
- throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '" +
- getName(filterComplexType) + "' behind '" +
- getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
+ throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '"
+ + getName(filterComplexType) + "' behind '"
+ + getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
}
lastPartWithKeys.setEntryTypeFilter(filterComplexType);
return null;
} else {
if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
- throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '" +
- getName(filterComplexType) + "' behind '" +
- getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
+ throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '"
+ + getName(filterComplexType) + "' behind '"
+ + getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
}
lastPartWithKeys.setCollectionTypeFilter(filterComplexType);
return null;
@@ -545,16 +541,16 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
} else if (lastResourcePart instanceof UriResourceTypedImpl) {
UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
if (lastPartTyped.getTypeFilter() != null) {
- throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '" +
- getName(filterComplexType) + "' behind '" +
- getName(lastPartTyped.getTypeFilter()) + "'"));
+ throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '"
+ + getName(filterComplexType) + "' behind '"
+ + getName(lastPartTyped.getTypeFilter()) + "'"));
}
lastPartTyped.setTypeFilter(filterComplexType);
return null;
} else {
throw wrap(new UriParserSemanticException("Path segment before '" + getName(filterComplexType)
- + "' not typed"));
+ + "' not typed"));
}
}
}
@@ -574,7 +570,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
// do a check for bound functions (which requires a parameter list)
if (ctx.vlNVO.size() == 0) {
throw wrap(new UriParserSemanticException("Expected function parameters for '" + fullBindingTypeName.toString()
- + "'"));
+ + "'"));
}
context.contextReadingFunctionParameters = true;
@@ -592,8 +588,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (function != null) {
UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl()
- .setFunction(function)
- .setParameters(parameters);
+ .setFunction(function)
+ .setParameters(parameters);
context.contextUriInfo.addResourcePart(pathInfoFunction);
// mark parameters as consumed
@@ -606,8 +602,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (function != null) {
UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl()
- .setFunction(function)
- .setParameters(parameters);
+ .setFunction(function)
+ .setParameters(parameters);
context.contextUriInfo.addResourcePart(pathInfoFunction);
// mark parameters as consumed
@@ -693,20 +689,20 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (segments.size() == 0) {
return null;
}
-
+
UriResource segment = segments.get(0);
if (segment instanceof UriResourceStartingTypeFilterImpl) {
UriResourceStartingTypeFilterImpl startingTypeFilter = (UriResourceStartingTypeFilterImpl) segment;
-
+
EdmType type = null;
- if (startingTypeFilter.getTypeFilterOnEntry()!= null) {
- type =startingTypeFilter.getTypeFilterOnEntry();
- } else if (startingTypeFilter.getTypeFilterOnCollection()!= null) {
- type =startingTypeFilter.getTypeFilterOnCollection();
+ if (startingTypeFilter.getTypeFilterOnEntry() != null) {
+ type = startingTypeFilter.getTypeFilterOnEntry();
+ } else if (startingTypeFilter.getTypeFilterOnCollection() != null) {
+ type = startingTypeFilter.getTypeFilterOnCollection();
} else {
- type =startingTypeFilter.getType();
+ type = startingTypeFilter.getType();
}
-
+
uriInfoImplpath.removeResourcePart(0);
return type;
}
@@ -785,7 +781,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
// @SuppressWarnings("unchecked")
// List<QueryOptionImpl> list = (List<QueryOptionImpl>) ctx.vEO.accept(this);
// uriInfo.setQueryOptions(list);
-
return null;
}
@@ -882,9 +877,11 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
String text = ctx.getText().toLowerCase();
if (text.equals("false")) {
- return new LiteralImpl().setText("false").setType(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance());
+ return new LiteralImpl().setText("false").setType(
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean));
}
- return new LiteralImpl().setText("true").setType(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance());
+ return new LiteralImpl().setText("true").setType(
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean));
}
@Override
@@ -924,9 +921,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
return type;
}
- if (fullName.getNamespace().equals("Edm")) {
- EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOf(fullName.getName());
- type = typeKind.getEdmPrimitiveTypeInstance();
+ if (fullName.getNamespace().equals(EdmPrimitiveType.EDM_NAMESPACE)) {
+ final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOf(fullName.getName());
+ type = EdmPrimitiveTypeFactory.getInstance(typeKind);
if (type != null) {
return type;
}
@@ -939,16 +936,16 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public ExpressionImpl visitCeilingMethodCallExpr(final CeilingMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.CEILING)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.CEILING)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitConcatMethodCallExpr(final ConcatMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.CONCAT)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ .setMethod(MethodKind.CONCAT)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
}
@Override
@@ -1001,9 +998,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public ExpressionImpl visitContainsMethodCallExpr(final ContainsMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.CONTAINS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ .setMethod(MethodKind.CONTAINS)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
}
@Override
@@ -1021,31 +1018,31 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public Object visitDateMethodCallExpr(final DateMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.DATE)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.DATE)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitDayMethodCallExpr(final DayMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.DAY)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.DAY)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitGeoDistanceMethodCallExpr(final GeoDistanceMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.GEODISTANCE)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ .setMethod(MethodKind.GEODISTANCE)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
}
@Override
public Object visitEndsWithMethodCallExpr(final EndsWithMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.ENDSWITH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ .setMethod(MethodKind.ENDSWITH)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
}
@Override
@@ -1127,7 +1124,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
ExpandItemImpl expandItem = new ExpandItemImpl();
// UriResourceItImpl pathInfoIT = new UriResourceItImpl();
-
context.contextUriInfo.getLastResourcePart();
// save context
@@ -1143,7 +1139,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
EdmType startType = this.removeUriResourceStartingTypeFilterImpl(context.contextUriInfo);
expandItem.setResourcePath(context.contextUriInfo);
- if ( startType != null) {
+ if (startType != null) {
expandItem.setTypeFilter(startType);
}
@@ -1223,37 +1219,37 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public ExpressionImpl visitFloorMethodCallExpr(final FloorMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.FLOOR)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.FLOOR)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitFractionalsecondsMethodCallExpr(final FractionalsecondsMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.FRACTIONALSECONDS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.FRACTIONALSECONDS)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitGeoLengthMethodCallExpr(final GeoLengthMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.GEOLENGTH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.GEOLENGTH)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitHourMethodCallExpr(final HourMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.HOUR)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.HOUR)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitIndexOfMethodCallExpr(final IndexOfMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.INDEXOF)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ .setMethod(MethodKind.INDEXOF)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
}
@Override
@@ -1268,9 +1264,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public ExpressionImpl visitGeoIntersectsMethodCallExpr(final GeoIntersectsMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.GEOINTERSECTS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ .setMethod(MethodKind.GEOINTERSECTS)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
}
@Override
@@ -1295,8 +1291,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public ExpressionImpl visitLengthMethodCallExpr(final LengthMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.LENGTH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.LENGTH)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
@@ -1308,11 +1304,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (text.equals("max")) {
levels.setMax();
- } else {
+ } else {
levels.setValue(Integer.parseInt(text));
}
levels.setText(text);
-
return levels;
@@ -1321,7 +1316,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public ExpressionImpl visitMaxDateTimeMethodCallExpr(final MaxDateTimeMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.MAXDATETIME);
+ .setMethod(MethodKind.MAXDATETIME);
}
@Override
@@ -1372,21 +1367,21 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public ExpressionImpl visitMinDateTimeMethodCallExpr(final MinDateTimeMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.MINDATETIME);
+ .setMethod(MethodKind.MINDATETIME);
}
@Override
public ExpressionImpl visitMinuteMethodCallExpr(final MinuteMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.MINUTE)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.MINUTE)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitMonthMethodCallExpr(final MonthMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.MONTH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.MONTH)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
@@ -1424,7 +1419,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
// There are more keys defined in the EDM, but only one is written in the URI. This is allowed only if
// referential constrains are defined on this navigation property which can be used to will up all required
// key.
-
// for using referential constrains the last resource part must be a navigation property
if (!(context.contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
@@ -1499,7 +1493,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
// if not, check if the missing key predicates can be satisfied with help of the defined referential constrains
-
// for using referential constrains the last resource part must be a navigation property
if (!(context.contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
@@ -1557,14 +1550,15 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitNaninfinity(NaninfinityContext ctx) {
- return new LiteralImpl().setType(EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance()).setText(ctx.getText());
+ public Object visitNaninfinity(final NaninfinityContext ctx) {
+ return new LiteralImpl().setType(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal)).
+ setText(ctx.getText());
}
@Override
public ExpressionImpl visitNowMethodCallExpr(final NowMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.NOW);
+ .setMethod(MethodKind.NOW);
}
@Override
@@ -1636,7 +1630,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@SuppressWarnings("unchecked")
List<UriParameterImpl> list = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
((UriResourceWithKeysImpl) pathInfoSegment)
- .setKeyPredicates(list);
+ .setKeyPredicates(list);
} else {
throw wrap(new UriParserSemanticException("Key properties not allowed"));
// throw UriSemanticError.addKrepredicatesNotAllowed();
@@ -1664,10 +1658,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
public Object visitPrimitiveLiteral(final PrimitiveLiteralContext ctx) {
ParseTree child1 = ctx.children.get(0);
- if (child1 instanceof EnumLitContext ||
- child1 instanceof BooleanNonCaseContext ||
- child1 instanceof NullruleContext ||
- child1 instanceof NaninfinityContext) {
+ if (child1 instanceof EnumLitContext
+ || child1 instanceof BooleanNonCaseContext
+ || child1 instanceof NullruleContext
+ || child1 instanceof NaninfinityContext) {
return child1.accept(this);
}
return new LiteralImpl().setText(ctx.getText());
@@ -1699,7 +1693,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
* return contextUriInfo;
* }
*/
-
@Override
public Object visitRootExpr(final RootExprContext ctx) {
@@ -1731,22 +1724,22 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
return new MemberImpl()
- .setResourcePath(uriInfoImplpath);
+ .setResourcePath(uriInfoImplpath);
}
@Override
public ExpressionImpl visitRoundMethodCallExpr(final RoundMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.ROUND)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.ROUND)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitSecondMethodCallExpr(final SecondMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.SECOND)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.SECOND)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
@@ -1808,8 +1801,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
} else {
UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
UriResource last = uriInfo.getLastResourcePart();
-
- prevType = getTypeInformation( last).type;
+
+ prevType = getTypeInformation(last).type;
if (prevType == null) {
throw wrap(new UriParserSemanticException("prev segement not typed"));
}
@@ -2025,9 +2018,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public ExpressionImpl visitStartsWithMethodCallExpr(final StartsWithMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.STARTSWITH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ .setMethod(MethodKind.STARTSWITH)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
}
@Override
@@ -2048,8 +2041,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public ExpressionImpl visitTimeMethodCallExpr(final TimeMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.TIME)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.TIME)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
@@ -2064,44 +2057,43 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public ExpressionImpl visitToLowerMethodCallExpr(final ToLowerMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.TOLOWER)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.TOLOWER)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitTotalOffsetMinutesMethodCallExpr(final TotalOffsetMinutesMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.TOTALOFFSETMINUTES)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.TOTALOFFSETMINUTES)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitTotalsecondsMethodCallExpr(final TotalsecondsMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.TOTALSECONDS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.TOTALSECONDS)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitToUpperMethodCallExpr(final ToUpperMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.TOUPPER)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.TOUPPER)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
@Override
public ExpressionImpl visitTrimMethodCallExpr(final TrimMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.TRIM)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.TRIM)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
-
@Override
public ExpressionImpl visitYearMethodCallExpr(final YearMethodCallExprContext ctx) {
return new MethodImpl()
- .setMethod(MethodKind.YEAR)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ .setMethod(MethodKind.YEAR)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
}
private ParseCancellationException wrap(final UriParserException uriParserException) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java
index 0fa3314..cd4d18d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java
@@ -33,7 +33,6 @@ import org.apache.olingo.server.api.uri.queryoption.SelectOption;
import org.apache.olingo.server.api.uri.queryoption.SkipOption;
import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
import org.apache.olingo.server.api.uri.queryoption.TopOption;
-import org.apache.olingo.server.core.uri.queryoption.expression.MemberImpl;
public class ExpandItemImpl implements ExpandItem {
private LevelsExpandOption levelsExpandOption;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
index 11e610e..366b73c 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
@@ -32,20 +32,19 @@ import java.util.List;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmElement;
import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import org.apache.olingo.server.api.edm.provider.ComplexType;
import org.apache.olingo.server.api.edm.provider.EdmProvider;
import org.apache.olingo.server.api.edm.provider.NavigationProperty;
import org.apache.olingo.server.api.edm.provider.Property;
-import org.apache.olingo.server.core.edm.provider.EdmComplexTypeImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
public class EdmComplexTypeImplTest {
private EdmComplexType baseType;
+
private EdmComplexType type;
@Before
@@ -60,7 +59,7 @@ public class EdmComplexTypeImplTest {
List<NavigationProperty> baseNavigationProperties = new ArrayList<NavigationProperty>();
baseNavigationProperties.add(new NavigationProperty().setName("nav1"));
baseComplexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(baseProperties)
- .setNavigationProperties(baseNavigationProperties);
+ .setNavigationProperties(baseNavigationProperties);
when(provider.getComplexType(baseName)).thenReturn(baseComplexType);
baseType = EdmComplexTypeImpl.getInstance(edm, baseName, baseComplexType);
@@ -72,7 +71,7 @@ public class EdmComplexTypeImplTest {
List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
navigationProperties.add(new NavigationProperty().setName("nav2"));
complexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(properties)
- .setNavigationProperties(navigationProperties);
+ .setNavigationProperties(navigationProperties);
when(provider.getComplexType(name)).thenReturn(complexType);
type = EdmComplexTypeImpl.getInstance(edm, name, complexType);
@@ -156,8 +155,8 @@ public class EdmComplexTypeImplTest {
EdmProvider provider = mock(EdmProvider.class);
EdmProviderImpl edm = new EdmProviderImpl(provider);
FullQualifiedName typeWithNonexistingBaseTypeName = new FullQualifiedName("namespace", "typeName");
- ComplexType complexTypeForNonexistingBaseType =
- new ComplexType().setBaseType(new FullQualifiedName("wrong", "wrong"));
+ ComplexType complexTypeForNonexistingBaseType
+ = new ComplexType().setBaseType(new FullQualifiedName("wrong", "wrong"));
complexTypeForNonexistingBaseType.setName("typeName");
when(provider.getComplexType(typeWithNonexistingBaseTypeName)).thenReturn(complexTypeForNonexistingBaseType);
EdmComplexTypeImpl.getInstance(edm, typeWithNonexistingBaseTypeName, complexTypeForNonexistingBaseType);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
index 6bcc6bd..9e4a947 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
@@ -34,24 +34,24 @@ import org.apache.olingo.commons.api.edm.EdmElement;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import org.apache.olingo.server.api.edm.provider.ComplexType;
import org.apache.olingo.server.api.edm.provider.EdmProvider;
import org.apache.olingo.server.api.edm.provider.EntityType;
import org.apache.olingo.server.api.edm.provider.NavigationProperty;
import org.apache.olingo.server.api.edm.provider.Property;
import org.apache.olingo.server.api.edm.provider.PropertyRef;
-import org.apache.olingo.server.core.edm.provider.EdmEntityTypeImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
public class EdmEntityTypeImplTest {
private EdmEntityType baseType;
+
private EdmEntityType typeWithBaseType;
+
private EdmEntityType typeWithComplexKey;
@Before
@@ -96,21 +96,21 @@ public class EdmEntityTypeImplTest {
typeWithComplexKeyProvider.setName(typeWithComplexKeyName.getName());
List<Property> typeWithComplexKeyProperties = new ArrayList<Property>();
typeWithComplexKeyProperties.add(new Property().setName("Id").setType(
- EdmPrimitiveTypeKind.String.getFullQualifiedName()));
+ EdmPrimitiveTypeKind.String.getFullQualifiedName()));
List<Property> complexTypeProperties = new ArrayList<Property>();
complexTypeProperties.add(new Property().setName("ComplexPropName").setType(
- EdmPrimitiveTypeKind.String.getFullQualifiedName()));
+ EdmPrimitiveTypeKind.String.getFullQualifiedName()));
FullQualifiedName complexTypeName = new FullQualifiedName("namespace", "complexTypeName");
when(provider.getComplexType(complexTypeName)).thenReturn(
- new ComplexType().setName("complexTypeName").setProperties(complexTypeProperties));
+ new ComplexType().setName("complexTypeName").setProperties(complexTypeProperties));
typeWithComplexKeyProperties.add(new Property().setName("Comp").setType(complexTypeName));
typeWithComplexKeyProvider.setProperties(typeWithComplexKeyProperties);
List<PropertyRef> keyForTypeWithComplexKey = new ArrayList<PropertyRef>();
keyForTypeWithComplexKey.add(new PropertyRef().setPropertyName("Id"));
keyForTypeWithComplexKey.add(new PropertyRef().setPropertyName("ComplexPropName").setAlias("alias").setPath(
- "Comp/ComplexPropName"));
+ "Comp/ComplexPropName"));
typeWithComplexKeyProvider.setKey(keyForTypeWithComplexKey);
when(provider.getEntityType(typeWithComplexKeyName)).thenReturn(typeWithComplexKeyProvider);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
index 748bbc2..e58edb7 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
@@ -29,13 +29,12 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.edm.provider.EnumMember;
import org.apache.olingo.server.api.edm.provider.EnumType;
-import org.apache.olingo.server.core.edm.provider.EdmEnumTypeImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
import org.junit.Test;
public class EdmEnumTest extends PrimitiveTypeBaseTest {
@@ -66,7 +65,7 @@ public class EdmEnumTest extends PrimitiveTypeBaseTest {
// when(member2.getName()).thenReturn("second");
// when(member2.getValue()).thenReturn("64");
// instance = new EdmEnumImpl("namespace", "name",
-// EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance(),
+// EdmPrimitiveTypeKind.SByte),
// Arrays.asList(member1, member2),
// true);
}
@@ -106,7 +105,7 @@ public class EdmEnumTest extends PrimitiveTypeBaseTest {
@Test
public void underlyingType() throws Exception {
- assertEquals(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance(), instance.getUnderlyingType());
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte), instance.getUnderlyingType());
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
index 4f4b302..b77f7e9 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
@@ -30,17 +30,15 @@ import java.util.Collections;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.edm.provider.EdmProvider;
import org.apache.olingo.server.api.edm.provider.EntityContainerInfo;
import org.apache.olingo.server.api.edm.provider.Function;
import org.apache.olingo.server.api.edm.provider.FunctionImport;
import org.apache.olingo.server.api.edm.provider.Parameter;
import org.apache.olingo.server.api.edm.provider.ReturnType;
-import org.apache.olingo.server.core.edm.provider.EdmEntityContainerImpl;
-import org.apache.olingo.server.core.edm.provider.EdmFunctionImportImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
import org.junit.Test;
public class EdmFunctionImportImplTest {
@@ -52,11 +50,11 @@ public class EdmFunctionImportImplTest {
final FullQualifiedName functionName = new FullQualifiedName("ns", "function");
final Function functionProvider = new Function()
- .setName(functionName.getName())
- .setParameters(Collections.<Parameter> emptyList())
- .setBound(false)
- .setComposable(false)
- .setReturnType(new ReturnType().setType(EdmPrimitiveTypeKind.Boolean.getFullQualifiedName()));
+ .setName(functionName.getName())
+ .setParameters(Collections.<Parameter>emptyList())
+ .setBound(false)
+ .setComposable(false)
+ .setReturnType(new ReturnType().setType(EdmPrimitiveTypeKind.Boolean.getFullQualifiedName()));
when(provider.getFunctions(functionName)).thenReturn(Arrays.asList(functionProvider));
final FullQualifiedName containerName = new FullQualifiedName("ns", "container");
@@ -66,21 +64,22 @@ public class EdmFunctionImportImplTest {
final String functionImportName = "functionImport";
final FunctionImport functionImportProvider = new FunctionImport()
- .setName(functionImportName)
- .setFunction(functionName)
- .setIncludeInServiceDocument(true);
+ .setName(functionImportName)
+ .setFunction(functionName)
+ .setIncludeInServiceDocument(true);
when(provider.getFunctionImport(containerName, functionImportName)).thenReturn(functionImportProvider);
- final EdmFunctionImport functionImport =
- new EdmFunctionImportImpl(edm, entityContainer, functionImportProvider);
+ final EdmFunctionImport functionImport
+ = new EdmFunctionImportImpl(edm, entityContainer, functionImportProvider);
assertEquals(functionImportName, entityContainer.getFunctionImport(functionImportName).getName());
assertEquals("functionImport", functionImport.getName());
- final EdmFunction function = functionImport.getFunction(Collections.<String> emptyList());
+ final EdmFunction function = functionImport.getFunction(Collections.<String>emptyList());
assertEquals(functionName.getNamespace(), function.getNamespace());
assertEquals(functionName.getName(), function.getName());
assertFalse(function.isBound());
assertFalse(function.isComposable());
- assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), function.getReturnType().getType());
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean),
+ function.getReturnType().getType());
assertEquals(entityContainer, functionImport.getEntityContainer());
assertNull(functionImport.getReturnedEntitySet());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
index d446145..52a377e 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
@@ -27,17 +27,15 @@ import static org.mockito.Mockito.when;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmParameter;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import org.apache.olingo.server.api.edm.provider.ComplexType;
import org.apache.olingo.server.api.edm.provider.EdmProvider;
import org.apache.olingo.server.api.edm.provider.EnumType;
import org.apache.olingo.server.api.edm.provider.Parameter;
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.apache.olingo.server.core.edm.provider.EdmParameterImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
import org.junit.Test;
public class EdmParameterImplTest {
@@ -139,4 +137,4 @@ public class EdmParameterImplTest {
parameter.getType();
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
index fca16d8..11d2d09 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
@@ -28,18 +28,16 @@ import static org.mockito.Mockito.when;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import org.apache.olingo.server.api.edm.provider.ComplexType;
import org.apache.olingo.server.api.edm.provider.EdmProvider;
import org.apache.olingo.server.api.edm.provider.EnumType;
import org.apache.olingo.server.api.edm.provider.Property;
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.apache.olingo.server.core.edm.provider.EdmPropertyImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
import org.junit.Test;
public class EdmPropertyImplTest {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
index 5cb9a67..bd028ba 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
@@ -29,14 +29,13 @@ import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmReturnType;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.edm.provider.ReturnType;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.server.core.edm.provider.EdmReturnTypeImpl;
import org.junit.Test;
public class EdmReturnTypeImplTest {
@@ -47,7 +46,7 @@ public class EdmReturnTypeImplTest {
EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
- assertEquals(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), typeImpl.getType());
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String), typeImpl.getType());
assertFalse(typeImpl.isCollection());
assertNull(typeImpl.getPrecision());
@@ -62,7 +61,7 @@ public class EdmReturnTypeImplTest {
EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
- assertEquals(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), typeImpl.getType());
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String), typeImpl.getType());
assertTrue(typeImpl.isCollection());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
index 9b57bdb..260e77a 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
@@ -24,31 +24,30 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.server.core.edm.provider.EdmTypeDefinitionImpl;
import org.junit.Test;
public class EdmTypeDefinitionImplTest {
@Test
public void typeDefOnStringNoFacets() throws Exception {
- FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name");
- TypeDefinition providerTypeDef =
- new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("Edm", "String"));
- EdmTypeDefinition typeDefImpl =
- new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef);
+ final FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name");
+ final TypeDefinition providerTypeDef=
+ new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("Edm", "String"));
+ final EdmTypeDefinition typeDefImpl =
+ new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef);
assertEquals("name", typeDefImpl.getName());
assertEquals("namespace", typeDefImpl.getNamespace());
assertEquals(String.class, typeDefImpl.getDefaultType());
assertEquals(EdmTypeKind.DEFINITION, typeDefImpl.getKind());
- assertEquals(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), typeDefImpl.getUnderlyingType());
- assertTrue(typeDefImpl.isCompatible(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance()));
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), typeDefImpl.getUnderlyingType());
+ assertTrue(typeDefImpl.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String)));
// String validation
assertEquals("'StringValue'", typeDefImpl.toUriLiteral("StringValue"));
@@ -67,8 +66,8 @@ public class EdmTypeDefinitionImplTest {
@Test(expected = EdmException.class)
public void invalidTypeResultsInEdmException() throws Exception {
FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name");
- TypeDefinition providerTypeDef =
- new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("wrong", "wrong"));
+ TypeDefinition providerTypeDef
+ = new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("wrong", "wrong"));
EdmTypeDefinitionImpl def = new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef);
def.getUnderlyingType();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java
index 741ca3c..7590e71 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechProvider.java
@@ -23,9 +23,9 @@ import java.util.Arrays;
import java.util.List;
import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.Target;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import org.apache.olingo.server.api.edm.provider.Action;
import org.apache.olingo.server.api.edm.provider.ActionImport;
import org.apache.olingo.server.api.edm.provider.AliasInfo;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
index d03345e..f2408ff 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
@@ -32,9 +32,10 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.uri.UriResourceKind;
import org.apache.olingo.server.core.edm.provider.EdmComplexTypeImpl;
import org.apache.olingo.server.core.edm.provider.EdmEntitySetImpl;
@@ -42,30 +43,12 @@ import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
import org.apache.olingo.server.core.edm.provider.EdmSingletonImpl;
import org.apache.olingo.server.core.testutil.EdmTechProvider;
import org.apache.olingo.server.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.server.core.uri.UriParameterImpl;
-import org.apache.olingo.server.core.uri.UriResourceActionImpl;
-import org.apache.olingo.server.core.uri.UriResourceComplexPropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourceCountImpl;
-import org.apache.olingo.server.core.uri.UriResourceEntitySetImpl;
-import org.apache.olingo.server.core.uri.UriResourceFunctionImpl;
-import org.apache.olingo.server.core.uri.UriResourceItImpl;
-import org.apache.olingo.server.core.uri.UriResourceLambdaAllImpl;
-import org.apache.olingo.server.core.uri.UriResourceLambdaAnyImpl;
-import org.apache.olingo.server.core.uri.UriResourceLambdaVarImpl;
-import org.apache.olingo.server.core.uri.UriResourceNavigationPropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourcePrimitivePropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourceRefImpl;
-import org.apache.olingo.server.core.uri.UriResourceRootImpl;
-import org.apache.olingo.server.core.uri.UriResourceSingletonImpl;
-import org.apache.olingo.server.core.uri.UriResourceStartingTypeFilterImpl;
-import org.apache.olingo.server.core.uri.UriResourceTypedImpl;
-import org.apache.olingo.server.core.uri.UriResourceValueImpl;
-import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl;
import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
import org.apache.olingo.server.core.uri.queryoption.expression.LiteralImpl;
import org.junit.Test;
public class UriResourceImplTest {
+
Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
@Test
@@ -119,7 +102,7 @@ public class UriResourceImplTest {
assertEquals(false, impl.isCollection());
assertEquals(expression, impl.getExpression());
assertEquals("A", impl.getLambdaVariable());
- assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean), impl.getType());
assertEquals("all", impl.toString());
}
@@ -135,7 +118,7 @@ public class UriResourceImplTest {
assertEquals(false, impl.isCollection());
assertEquals(expression, impl.getExpression());
assertEquals("A", impl.getLamdaVariable());
- assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean), impl.getType());
assertEquals("any", impl.toString());
}
@@ -155,8 +138,8 @@ public class UriResourceImplTest {
assertEquals(property.getType(), impl.getComplexType());
impl.getComplexType();
- EdmComplexTypeImpl complexTypeImplType =
- (EdmComplexTypeImpl) edm.getComplexType(EdmTechProvider.nameCTBasePrimCompNav);
+ EdmComplexTypeImpl complexTypeImplType
+ = (EdmComplexTypeImpl) edm.getComplexType(EdmTechProvider.nameCTBasePrimCompNav);
impl.setTypeFilter(complexTypeImplType);
assertEquals(complexTypeImplType, impl.getTypeFilter());
@@ -216,15 +199,14 @@ public class UriResourceImplTest {
// function
EdmFunction function = (EdmFunction) edm.getEntityContainer(null).getFunctionImport("FINRTInt16")
- .getFunction(new ArrayList<String>());
+ .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());
+ assertEquals(false, impl.isParameterListFilled());
// function import
impl = new UriResourceFunctionImpl();
@@ -247,12 +229,13 @@ public class UriResourceImplTest {
assertEquals(false, impl.isCollection());
assertEquals(parameter, impl.getParameters().get(0));
- assertEquals(true,impl.isParameterListFilled());
+ assertEquals(true, impl.isParameterListFilled());
}
@Test
public void testUriResourceImplKeyPred() {
class Mock extends UriResourceWithKeysImpl {
+
EdmType type;
public Mock() {
@@ -299,7 +282,7 @@ public class UriResourceImplTest {
assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
assertEquals("mock", impl.toString(false));
assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav/()com.sap.odata.test1.ETTwoBaseTwoKeyNav",
- impl.toString(true));
+ impl.toString(true));
// set entry
impl = new Mock();
@@ -330,6 +313,7 @@ public class UriResourceImplTest {
@Test
public void testUriResourceImplTyped() {
class Mock extends UriResourceTypedImpl {
+
EdmType type;
public Mock() {
@@ -498,7 +482,6 @@ public class UriResourceImplTest {
assertEquals(true, impl.isCollection());
}
-
@Test
public void testUriResourceStartingTypeFilterImpl() {
UriResourceStartingTypeFilterImpl impl = new UriResourceStartingTypeFilterImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java
index 21df8bb..2062c86 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java
@@ -35,7 +35,6 @@ import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.QueryOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.MemberImpl;
public class ExpandValidator implements Validator {
private Edm edm;
[07/52] [abbrv] Consistently using package name to differentiate V3
and V4
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataDeserializer.java
new file mode 100644
index 0000000..425e530
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataDeserializer.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.op.v4;
+
+import java.io.InputStream;
+
+import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
+import org.apache.olingo.client.api.op.CommonODataDeserializer;
+
+public interface ODataDeserializer extends CommonODataDeserializer {
+
+ @Override
+ XMLMetadata toMetadata(InputStream input);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java
new file mode 100644
index 0000000..25d989d
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.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.client.api.op.v4;
+
+import org.apache.olingo.client.api.op.CommonODataReader;
+
+public interface ODataReader extends CommonODataReader {
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonFilterArgFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonFilterArgFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonFilterArgFactory.java
new file mode 100644
index 0000000..dccb051
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonFilterArgFactory.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.client.api.uri;
+
+public interface CommonFilterArgFactory {
+
+ FilterArg _null();
+
+ FilterArg add(FilterArg first, FilterArg second);
+
+ FilterArg ceiling(FilterArg param);
+
+ FilterArg concat(FilterArg first, FilterArg second);
+
+ FilterArg day(FilterArg param);
+
+ FilterArg div(FilterArg first, FilterArg second);
+
+ FilterArg endswith(FilterArg first, FilterArg second);
+
+ FilterArg floor(FilterArg param);
+
+ FilterArg hour(FilterArg param);
+
+ FilterArg indexof(FilterArg first, FilterArg second);
+
+ FilterArg isof(FilterArg type);
+
+ FilterArg isof(FilterArg expression, FilterArg type);
+
+ FilterArg length(FilterArg param);
+
+ FilterArg literal(Object value);
+
+ FilterArg minute(FilterArg param);
+
+ FilterArg mod(FilterArg first, FilterArg second);
+
+ FilterArg month(FilterArg param);
+
+ FilterArg mul(FilterArg first, FilterArg second);
+
+ FilterArg property(String propertyPath);
+
+ FilterArg replace(FilterArg first, FilterArg second, FilterArg third);
+
+ FilterArg round(FilterArg param);
+
+ FilterArg second(FilterArg param);
+
+ FilterArg startswith(FilterArg first, FilterArg second);
+
+ FilterArg sub(FilterArg first, FilterArg second);
+
+ FilterArg substring(FilterArg arg, FilterArg pos);
+
+ FilterArg substring(FilterArg arg, FilterArg pos, FilterArg length);
+
+ FilterArg tolower(FilterArg param);
+
+ FilterArg toupper(FilterArg param);
+
+ FilterArg trim(FilterArg param);
+
+ FilterArg year(FilterArg param);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonFilterFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonFilterFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonFilterFactory.java
new file mode 100644
index 0000000..7304721
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonFilterFactory.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.client.api.uri;
+
+import java.io.Serializable;
+
+/**
+ * OData filter factory.
+ */
+public interface CommonFilterFactory extends Serializable {
+
+ CommonFilterArgFactory getArgFactory();
+
+ URIFilter match(FilterArg arg);
+
+ URIFilter eq(String key, Object value);
+
+ URIFilter eq(FilterArg left, FilterArg right);
+
+ URIFilter ne(String key, Object value);
+
+ URIFilter ne(FilterArg left, FilterArg right);
+
+ URIFilter gt(String key, Object value);
+
+ URIFilter gt(FilterArg left, FilterArg right);
+
+ URIFilter ge(String key, Object value);
+
+ URIFilter ge(FilterArg left, FilterArg right);
+
+ URIFilter lt(String key, Object value);
+
+ URIFilter lt(FilterArg left, FilterArg right);
+
+ URIFilter le(String key, Object value);
+
+ URIFilter le(FilterArg left, FilterArg right);
+
+ URIFilter and(URIFilter left, URIFilter right);
+
+ URIFilter or(URIFilter left, URIFilter right);
+
+ URIFilter not(URIFilter filter);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java
new file mode 100644
index 0000000..3f10262
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.uri;
+
+
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * OData URI builder.
+ */
+public interface CommonURIBuilder<UB extends CommonURIBuilder<?>> {
+
+ /**
+ * Adds the specified query option to the URI.
+ *
+ * @param option query option.
+ * @param value query option value.
+ * @return current URIBuilder instance
+ */
+ UB addQueryOption(QueryOption option, String value);
+
+ /**
+ * Adds the specified (custom) query option to the URI.
+ *
+ * @param option query option.
+ * @param value query option value.
+ * @return current URIBuilder instance
+ */
+ UB addQueryOption(String option, String value);
+
+ /**
+ * Appends EntitySet segment to the URI.
+ *
+ * @param segmentValue segment value.
+ * @return current URIBuilder instance
+ */
+ UB appendEntitySetSegment(String segmentValue);
+
+ /**
+ * Appends key segment to the URI.
+ *
+ * @param val segment value.
+ * @return current URIBuilder instance
+ */
+ UB appendKeySegment(Object val);
+
+ /**
+ * Appends key segment to the URI, for multiple keys.
+ *
+ * @param segmentValues segment values.
+ * @return current URIBuilder instance
+ */
+ UB appendKeySegment(Map<String, Object> segmentValues);
+
+ /**
+ * Appends property segment to the URI.
+ *
+ * @param segmentValue segment value.
+ * @return current URIBuilder instance
+ */
+ UB appendPropertySegment(String segmentValue);
+
+ /**
+ * Appends navigation segment to the URI.
+ *
+ * @param segmentValue segment value.
+ * @return current URIBuilder instance
+ */
+ UB appendNavigationSegment(String segmentValue);
+
+ /**
+ * Appends derived entity type segment to the URI.
+ *
+ * @param segmentValue segment value.
+ * @return current URIBuilder instance
+ */
+ UB appendDerivedEntityTypeSegment(String segmentValue);
+
+ /**
+ * Appends value segment to the URI.
+ *
+ * @return current URIBuilder instance
+ */
+ UB appendValueSegment();
+
+ /**
+ * Appends operation (action or function) segment to the URI.
+ *
+ * @param operation Operation (action or function) name
+ * @param arguments Operation arguments
+ * @return current URIBuilder instance
+ */
+ UB appendOperationCallSegment(String operation, Map<String, Object> arguments);
+
+ /**
+ * Appends metadata segment to the URI.
+ *
+ * @return current URIBuilder instance
+ */
+ UB appendMetadataSegment();
+
+ /**
+ * Appends batch segment to the URI.
+ *
+ * @return current URIBuilder instance
+ */
+ UB appendBatchSegment();
+
+ /**
+ * Adds count query option.
+ *
+ * @return current URIBuilder instance
+ */
+ UB count();
+
+ /**
+ * Adds expand query option.
+ *
+ * @param expandItems items to be expanded in-line
+ * @return current URIBuilder instance
+ * @see QueryOption#EXPAND
+ */
+ UB expand(String... expandItems);
+
+ /**
+ * Adds format query option.
+ *
+ * @param format media type acceptable in a response.
+ * @return current URIBuilder instance
+ * @see QueryOption#FORMAT
+ */
+ UB format(String format);
+
+ /**
+ * Adds filter for filter query option.
+ *
+ * @param filter filter instance (to be obtained via <tt>ODataFilterFactory</tt>): note that <tt>build()</tt> method
+ * will be immediately invoked.
+ * @return current URIBuilder instance
+ * @see QueryOption#FILTER
+ * @see URIFilter
+ * @see org.apache.olingo.client.api.uri.filter.FilterFactory
+ */
+ UB filter(URIFilter filter);
+
+ /**
+ * Adds filter query option.
+ *
+ * @param filter filter string.
+ * @return current URIBuilder instance
+ * @see QueryOption#FILTER
+ */
+ UB filter(String filter);
+
+ /**
+ * Adds select query option.
+ *
+ * @param selectItems select items
+ * @return current URIBuilder instance
+ * @see QueryOption#SELECT
+ */
+ UB select(String... selectItems);
+
+ /**
+ * Adds orderby query option.
+ *
+ * @param order order string.
+ * @return current URIBuilder instance
+ * @see QueryOption#ORDERBY
+ */
+ UB orderBy(String order);
+
+ /**
+ * Adds top query option.
+ *
+ * @param top maximum number of entities to be returned.
+ * @return current URIBuilder instance
+ * @see QueryOption#TOP
+ */
+ UB top(int top);
+
+ /**
+ * Adds skip query option.
+ *
+ * @param skip number of entities to be skipped into the response.
+ * @return current URIBuilder instance
+ * @see QueryOption#SKIP
+ */
+ UB skip(int skip);
+
+ /**
+ * Adds skiptoken query option.
+ *
+ * @param skipToken opaque token.
+ * @return current URIBuilder instance
+ * @see QueryOption#SKIPTOKEN
+ */
+ UB skipToken(String skipToken);
+
+ /**
+ * Build OData URI.
+ *
+ * @return OData URI.
+ */
+ URI build();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/FilterArg.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/FilterArg.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/FilterArg.java
new file mode 100644
index 0000000..0f27f31
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/FilterArg.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.client.api.uri;
+
+/**
+ * Interface for any available filter argument.
+ */
+public interface FilterArg {
+
+ /**
+ * @return String representation of this filter argument.
+ */
+ String build();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java
deleted file mode 100644
index cfb041b..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java
+++ /dev/null
@@ -1,225 +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.client.api.uri;
-
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-
-import java.net.URI;
-import java.util.Map;
-
-/**
- * OData URI builder.
- */
-public interface URIBuilder<UB extends URIBuilder<?>> {
-
- /**
- * Adds the specified query option to the URI.
- *
- * @param option query option.
- * @param value query option value.
- * @return current URIBuilder instance
- */
- UB addQueryOption(QueryOption option, String value);
-
- /**
- * Adds the specified (custom) query option to the URI.
- *
- * @param option query option.
- * @param value query option value.
- * @return current URIBuilder instance
- */
- UB addQueryOption(String option, String value);
-
- /**
- * Appends EntitySet segment to the URI.
- *
- * @param segmentValue segment value.
- * @return current URIBuilder instance
- */
- UB appendEntitySetSegment(String segmentValue);
-
- /**
- * Appends key segment to the URI.
- *
- * @param val segment value.
- * @return current URIBuilder instance
- */
- UB appendKeySegment(Object val);
-
- /**
- * Appends key segment to the URI, for multiple keys.
- *
- * @param segmentValues segment values.
- * @return current URIBuilder instance
- */
- UB appendKeySegment(Map<String, Object> segmentValues);
-
- /**
- * Appends property segment to the URI.
- *
- * @param segmentValue segment value.
- * @return current URIBuilder instance
- */
- UB appendPropertySegment(String segmentValue);
-
- /**
- * Appends navigation segment to the URI.
- *
- * @param segmentValue segment value.
- * @return current URIBuilder instance
- */
- UB appendNavigationSegment(String segmentValue);
-
- /**
- * Appends derived entity type segment to the URI.
- *
- * @param segmentValue segment value.
- * @return current URIBuilder instance
- */
- UB appendDerivedEntityTypeSegment(String segmentValue);
-
- /**
- * Appends value segment to the URI.
- *
- * @return current URIBuilder instance
- */
- UB appendValueSegment();
-
- /**
- * Appends operation (action or function) segment to the URI.
- *
- * @param operation Operation (action or function) name
- * @param arguments Operation arguments
- * @return current URIBuilder instance
- */
- UB appendOperationCallSegment(String operation, Map<String, Object> arguments);
-
- /**
- * Appends metadata segment to the URI.
- *
- * @return current URIBuilder instance
- */
- UB appendMetadataSegment();
-
- /**
- * Appends batch segment to the URI.
- *
- * @return current URIBuilder instance
- */
- UB appendBatchSegment();
-
- /**
- * Adds count query option.
- *
- * @return current URIBuilder instance
- */
- UB count();
-
- /**
- * Adds expand query option.
- *
- * @param expandItems items to be expanded in-line
- * @return current URIBuilder instance
- * @see QueryOption#EXPAND
- */
- UB expand(String... expandItems);
-
- /**
- * Adds format query option.
- *
- * @param format media type acceptable in a response.
- * @return current URIBuilder instance
- * @see QueryOption#FORMAT
- */
- UB format(String format);
-
- /**
- * Adds filter for filter query option.
- *
- * @param filter filter instance (to be obtained via <tt>ODataFilterFactory</tt>): note that <tt>build()</tt> method
- * will be immediately invoked.
- * @return current URIBuilder instance
- * @see QueryOption#FILTER
- * @see URIFilter
- * @see org.apache.olingo.client.api.uri.filter.FilterFactory
- */
- UB filter(URIFilter filter);
-
- /**
- * Adds filter query option.
- *
- * @param filter filter string.
- * @return current URIBuilder instance
- * @see QueryOption#FILTER
- */
- UB filter(String filter);
-
- /**
- * Adds select query option.
- *
- * @param selectItems select items
- * @return current URIBuilder instance
- * @see QueryOption#SELECT
- */
- UB select(String... selectItems);
-
- /**
- * Adds orderby query option.
- *
- * @param order order string.
- * @return current URIBuilder instance
- * @see QueryOption#ORDERBY
- */
- UB orderBy(String order);
-
- /**
- * Adds top query option.
- *
- * @param top maximum number of entities to be returned.
- * @return current URIBuilder instance
- * @see QueryOption#TOP
- */
- UB top(int top);
-
- /**
- * Adds skip query option.
- *
- * @param skip number of entities to be skipped into the response.
- * @return current URIBuilder instance
- * @see QueryOption#SKIP
- */
- UB skip(int skip);
-
- /**
- * Adds skiptoken query option.
- *
- * @param skipToken opaque token.
- * @return current URIBuilder instance
- * @see QueryOption#SKIPTOKEN
- */
- UB skipToken(String skipToken);
-
- /**
- * Build OData URI.
- *
- * @return OData URI.
- */
- URI build();
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java
new file mode 100644
index 0000000..22a0aa7
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.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.client.api.uri;
+
+/**
+ * Interface for any available filter; obtain instances via <tt>FilterFactory</tt>.
+ *
+ * @see FilterFactory
+ */
+public interface URIFilter {
+
+ /**
+ * @return String representation of this filter.
+ */
+ String build();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/V3URIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/V3URIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/V3URIBuilder.java
deleted file mode 100644
index 7d4059b..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/V3URIBuilder.java
+++ /dev/null
@@ -1,47 +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.client.api.uri;
-
-public interface V3URIBuilder extends URIBuilder<V3URIBuilder> {
-
- public enum InlineCount {
-
- allpages,
- none
-
- }
-
- /**
- * Appends links segment to the URI.
- *
- * @param segmentValue segment value
- * @return current URIBuilder instance
- */
- V3URIBuilder appendLinksSegment(String segmentValue);
-
- /**
- * Adds inlinecount query option.
- *
- * @param inlineCount value
- * @return current URIBuilder instance
- * @see QueryOption#INLINECOUNT
- */
- V3URIBuilder inlineCount(InlineCount inlineCount);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/V4URIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/V4URIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/V4URIBuilder.java
deleted file mode 100644
index d98beb3..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/V4URIBuilder.java
+++ /dev/null
@@ -1,87 +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.client.api.uri;
-
-public interface V4URIBuilder extends URIBuilder<V4URIBuilder> {
-
- /**
- * Appends Singleton segment to the URI.
- *
- * @param segmentValue segment value.
- * @return current URIBuilder instance
- */
- V4URIBuilder appendSingletonSegment(String segmentValue);
-
- /**
- * Appends entity-id segment to the URI.
- *
- * @param segmentValue segment value
- * @return current URIBuilder instance
- */
- V4URIBuilder appendEntityIdSegment(String segmentValue);
-
- /**
- * Appends ref segment to the URI.
- *
- * @return current URIBuilder instance
- */
- V4URIBuilder appendRefSegment();
-
- /**
- * Appends cross join segment to the URI.
- *
- * @param segmentValues segment values.
- * @return current URIBuilder instance
- */
- V4URIBuilder appendCrossjoinSegment(String... segmentValues);
-
- /**
- * Appends all segment to the URI.
- *
- * @return current URIBuilder instance
- */
- V4URIBuilder appendAllSegment();
-
- /**
- * Adds id query option.
- *
- * @param idValue opaque token.
- * @return current URIBuilder instance
- * @see QueryOption#ID
- */
- V4URIBuilder id(String idValue);
-
- /**
- * Appends count query option.
- *
- * @param value true or false
- * @return current URIBuilder instance
- * @see QueryOption#COUNT
- */
- V4URIBuilder count(boolean value);
-
- /**
- * Appends search query option.
- *
- * @param expression search expression
- * @return current URIBuilder instance
- * @see QueryOption#SEARCH
- */
- V4URIBuilder search(String expression);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterArg.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterArg.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterArg.java
deleted file mode 100644
index 10ab250..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterArg.java
+++ /dev/null
@@ -1,30 +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.client.api.uri.filter;
-
-/**
- * Interface for any available filter argument.
- */
-public interface FilterArg {
-
- /**
- * @return String representation of this filter argument.
- */
- String build();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterArgFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterArgFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterArgFactory.java
deleted file mode 100644
index f9fad74..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterArgFactory.java
+++ /dev/null
@@ -1,83 +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.client.api.uri.filter;
-
-public interface FilterArgFactory {
-
- FilterArg _null();
-
- FilterArg add(FilterArg first, FilterArg second);
-
- FilterArg ceiling(FilterArg param);
-
- FilterArg concat(FilterArg first, FilterArg second);
-
- FilterArg day(FilterArg param);
-
- FilterArg div(FilterArg first, FilterArg second);
-
- FilterArg endswith(FilterArg first, FilterArg second);
-
- FilterArg floor(FilterArg param);
-
- FilterArg hour(FilterArg param);
-
- FilterArg indexof(FilterArg first, FilterArg second);
-
- FilterArg isof(FilterArg type);
-
- FilterArg isof(FilterArg expression, FilterArg type);
-
- FilterArg length(FilterArg param);
-
- FilterArg literal(Object value);
-
- FilterArg minute(FilterArg param);
-
- FilterArg mod(FilterArg first, FilterArg second);
-
- FilterArg month(FilterArg param);
-
- FilterArg mul(FilterArg first, FilterArg second);
-
- FilterArg property(String propertyPath);
-
- FilterArg replace(FilterArg first, FilterArg second, FilterArg third);
-
- FilterArg round(FilterArg param);
-
- FilterArg second(FilterArg param);
-
- FilterArg startswith(FilterArg first, FilterArg second);
-
- FilterArg sub(FilterArg first, FilterArg second);
-
- FilterArg substring(FilterArg arg, FilterArg pos);
-
- FilterArg substring(FilterArg arg, FilterArg pos, FilterArg length);
-
- FilterArg tolower(FilterArg param);
-
- FilterArg toupper(FilterArg param);
-
- FilterArg trim(FilterArg param);
-
- FilterArg year(FilterArg param);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterFactory.java
deleted file mode 100644
index 0782daa..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/FilterFactory.java
+++ /dev/null
@@ -1,61 +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.client.api.uri.filter;
-
-import java.io.Serializable;
-
-/**
- * OData filter factory.
- */
-public interface FilterFactory extends Serializable {
-
- FilterArgFactory getArgFactory();
-
- URIFilter match(FilterArg arg);
-
- URIFilter eq(String key, Object value);
-
- URIFilter eq(FilterArg left, FilterArg right);
-
- URIFilter ne(String key, Object value);
-
- URIFilter ne(FilterArg left, FilterArg right);
-
- URIFilter gt(String key, Object value);
-
- URIFilter gt(FilterArg left, FilterArg right);
-
- URIFilter ge(String key, Object value);
-
- URIFilter ge(FilterArg left, FilterArg right);
-
- URIFilter lt(String key, Object value);
-
- URIFilter lt(FilterArg left, FilterArg right);
-
- URIFilter le(String key, Object value);
-
- URIFilter le(FilterArg left, FilterArg right);
-
- URIFilter and(URIFilter left, URIFilter right);
-
- URIFilter or(URIFilter left, URIFilter right);
-
- URIFilter not(URIFilter filter);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/URIFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/URIFilter.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/URIFilter.java
deleted file mode 100644
index 0e0737f..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/URIFilter.java
+++ /dev/null
@@ -1,32 +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.client.api.uri.filter;
-
-/**
- * Interface for any available filter; obtain instances via <tt>FilterFactory</tt>.
- *
- * @see FilterFactory
- */
-public interface URIFilter {
-
- /**
- * @return String representation of this filter.
- */
- String build();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V3FilterArgFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V3FilterArgFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V3FilterArgFactory.java
deleted file mode 100644
index 04554f5..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V3FilterArgFactory.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.client.api.uri.filter;
-
-public interface V3FilterArgFactory extends FilterArgFactory {
-
- FilterArg substringof(FilterArg first, FilterArg second);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V3FilterFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V3FilterFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V3FilterFactory.java
deleted file mode 100644
index 7571c98..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V3FilterFactory.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.uri.filter;
-
-public interface V3FilterFactory extends FilterFactory {
-
- @Override
- V3FilterArgFactory getArgFactory();
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V4FilterArgFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V4FilterArgFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V4FilterArgFactory.java
deleted file mode 100644
index b7bca85..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V4FilterArgFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.uri.filter;
-
-public interface V4FilterArgFactory extends FilterArgFactory {
-
- FilterArg contains(FilterArg first, FilterArg second);
-
- FilterArg fractionalseconds(FilterArg param);
-
- FilterArg date(FilterArg param);
-
- FilterArg time(FilterArg param);
-
- FilterArg totaloffsetminutes(FilterArg param);
-
- FilterArg now();
-
- FilterArg mindatetime();
-
- FilterArg maxdatetime();
-
- FilterArg totalseconds(FilterArg param);
-
- FilterArg cast(FilterArg type);
-
- FilterArg cast(FilterArg expression, FilterArg type);
-
- FilterArg geoDistance(FilterArg first, FilterArg second);
-
- FilterArg geoIntersects(FilterArg first, FilterArg second);
-
- FilterArg geoLength(FilterArg first, FilterArg second);
-
- FilterArg any(FilterArg collection, URIFilter expression);
-
- FilterArg all(FilterArg collection, URIFilter expression);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V4FilterFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V4FilterFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V4FilterFactory.java
deleted file mode 100644
index 3050de2..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/filter/V4FilterFactory.java
+++ /dev/null
@@ -1,32 +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.client.api.uri.filter;
-
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-
-public interface V4FilterFactory extends FilterFactory {
-
- @Override
- V4FilterArgFactory getArgFactory();
-
- URIFilter has(String key, EdmEnumType enumType, String memberName);
-
- URIFilter has(FilterArg left, EdmEnumType enumType, String memberName);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/FilterArgFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/FilterArgFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/FilterArgFactory.java
new file mode 100644
index 0000000..1a283f0
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/FilterArgFactory.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.client.api.uri.v3;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.CommonFilterArgFactory;
+
+public interface FilterArgFactory extends CommonFilterArgFactory {
+
+ FilterArg substringof(FilterArg first, FilterArg second);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/FilterFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/FilterFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/FilterFactory.java
new file mode 100644
index 0000000..1dcbac3
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/FilterFactory.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.client.api.uri.v3;
+
+import org.apache.olingo.client.api.uri.CommonFilterFactory;
+
+public interface FilterFactory extends CommonFilterFactory {
+
+ @Override
+ FilterArgFactory getArgFactory();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/URIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/URIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/URIBuilder.java
new file mode 100644
index 0000000..72a0c03
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v3/URIBuilder.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.client.api.uri.v3;
+
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+
+public interface URIBuilder extends CommonURIBuilder<URIBuilder> {
+
+ public enum InlineCount {
+
+ allpages,
+ none
+
+ }
+
+ /**
+ * Appends links segment to the URI.
+ *
+ * @param segmentValue segment value
+ * @return current URIBuilder instance
+ */
+ URIBuilder appendLinksSegment(String segmentValue);
+
+ /**
+ * Adds inlinecount query option.
+ *
+ * @param inlineCount value
+ * @return current URIBuilder instance
+ * @see QueryOption#INLINECOUNT
+ */
+ URIBuilder inlineCount(InlineCount inlineCount);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/FilterArgFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/FilterArgFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/FilterArgFactory.java
new file mode 100644
index 0000000..2222edd
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/FilterArgFactory.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.client.api.uri.v4;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.CommonFilterArgFactory;
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public interface FilterArgFactory extends CommonFilterArgFactory {
+
+ FilterArg contains(FilterArg first, FilterArg second);
+
+ FilterArg fractionalseconds(FilterArg param);
+
+ FilterArg date(FilterArg param);
+
+ FilterArg time(FilterArg param);
+
+ FilterArg totaloffsetminutes(FilterArg param);
+
+ FilterArg now();
+
+ FilterArg mindatetime();
+
+ FilterArg maxdatetime();
+
+ FilterArg totalseconds(FilterArg param);
+
+ FilterArg cast(FilterArg type);
+
+ FilterArg cast(FilterArg expression, FilterArg type);
+
+ FilterArg geoDistance(FilterArg first, FilterArg second);
+
+ FilterArg geoIntersects(FilterArg first, FilterArg second);
+
+ FilterArg geoLength(FilterArg first, FilterArg second);
+
+ FilterArg any(FilterArg collection, URIFilter expression);
+
+ FilterArg all(FilterArg collection, URIFilter expression);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/FilterFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/FilterFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/FilterFactory.java
new file mode 100644
index 0000000..490f4bb
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/FilterFactory.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.client.api.uri.v4;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.CommonFilterFactory;
+import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+
+public interface FilterFactory extends CommonFilterFactory {
+
+ @Override
+ FilterArgFactory getArgFactory();
+
+ URIFilter has(String key, EdmEnumType enumType, String memberName);
+
+ URIFilter has(FilterArg left, EdmEnumType enumType, String memberName);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java
new file mode 100644
index 0000000..5fc8a1d
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.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.client.api.uri.v4;
+
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+
+public interface URIBuilder extends CommonURIBuilder<URIBuilder> {
+
+ /**
+ * Appends Singleton segment to the URI.
+ *
+ * @param segmentValue segment value.
+ * @return current URIBuilder instance
+ */
+ URIBuilder appendSingletonSegment(String segmentValue);
+
+ /**
+ * Appends entity-id segment to the URI.
+ *
+ * @param segmentValue segment value
+ * @return current URIBuilder instance
+ */
+ URIBuilder appendEntityIdSegment(String segmentValue);
+
+ /**
+ * Appends ref segment to the URI.
+ *
+ * @return current URIBuilder instance
+ */
+ URIBuilder appendRefSegment();
+
+ /**
+ * Appends cross join segment to the URI.
+ *
+ * @param segmentValues segment values.
+ * @return current URIBuilder instance
+ */
+ URIBuilder appendCrossjoinSegment(String... segmentValues);
+
+ /**
+ * Appends all segment to the URI.
+ *
+ * @return current URIBuilder instance
+ */
+ URIBuilder appendAllSegment();
+
+ /**
+ * Adds id query option.
+ *
+ * @param idValue opaque token.
+ * @return current URIBuilder instance
+ * @see QueryOption#ID
+ */
+ URIBuilder id(String idValue);
+
+ /**
+ * Appends count query option.
+ *
+ * @param value true or false
+ * @return current URIBuilder instance
+ * @see QueryOption#COUNT
+ */
+ URIBuilder count(boolean value);
+
+ /**
+ * Appends search query option.
+ *
+ * @param expression search expression
+ * @return current URIBuilder instance
+ * @see QueryOption#SEARCH
+ */
+ URIBuilder search(String expression);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
index f5c79dd..3885ead 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
@@ -31,7 +31,7 @@ import org.apache.commons.codec.binary.Hex;
import org.apache.commons.io.IOUtils;
import org.apache.http.entity.InputStreamEntity;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataDuration;
import org.apache.olingo.client.api.domain.ODataTimestamp;
@@ -176,7 +176,7 @@ public final class URIUtils {
return value;
}
- public static InputStreamEntity buildInputStreamEntity(final ODataClient client, final InputStream input) {
+ public static InputStreamEntity buildInputStreamEntity(final CommonODataClient client, final InputStream input) {
InputStreamEntity entity;
if (client.getConfiguration().isUseChuncked()) {
entity = new InputStreamEntity(input, -1);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/Configuration.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/Configuration.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/Configuration.java
new file mode 100644
index 0000000..d51d334
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/Configuration.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.client.api.v3;
+
+import org.apache.olingo.client.api.CommonConfiguration;
+
+public interface Configuration extends CommonConfiguration {
+
+ /**
+ * Checks whether URIs contain entity key between parentheses (standard) or instead as additional segment.
+ * <br/>
+ * 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.
+ * <br/>
+ * 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);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java
new file mode 100644
index 0000000..5959796
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.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.client.api.v3;
+
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory;
+import org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory;
+import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
+import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
+import org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory;
+import org.apache.olingo.client.api.op.v3.ODataBinder;
+import org.apache.olingo.client.api.op.v3.ODataDeserializer;
+import org.apache.olingo.client.api.op.v3.ODataReader;
+import org.apache.olingo.client.api.uri.v3.URIBuilder;
+import org.apache.olingo.client.api.uri.v3.FilterFactory;
+
+public interface ODataClient extends CommonODataClient {
+
+ @Override
+ ODataDeserializer getDeserializer();
+
+ @Override
+ ODataReader getReader();
+
+ @Override
+ ODataBinder getBinder();
+
+ @Override
+ Configuration getConfiguration();
+
+ @Override
+ URIBuilder getURIBuilder(String serviceRoot);
+
+ @Override
+ FilterFactory getFilterFactory();
+
+ @Override
+ RetrieveRequestFactory getRetrieveRequestFactory();
+
+ @Override
+ CUDRequestFactory getCUDRequestFactory();
+
+ @Override
+ StreamedRequestFactory getStreamedRequestFactory();
+
+ @Override
+ InvokeRequestFactory getInvokeRequestFactory();
+
+ @Override
+ BatchRequestFactory getBatchRequestFactory();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/UnsupportedInV3Exception.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/UnsupportedInV3Exception.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/UnsupportedInV3Exception.java
new file mode 100644
index 0000000..d30398a
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/UnsupportedInV3Exception.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.v3;
+
+import org.apache.olingo.commons.api.edm.EdmException;
+
+public class UnsupportedInV3Exception extends EdmException {
+
+ private static final long serialVersionUID = 4773734640262424651L;
+
+ public UnsupportedInV3Exception() {
+ super("Not supported in OData 3.0");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/Configuration.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/Configuration.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/Configuration.java
new file mode 100644
index 0000000..f7daa91
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/Configuration.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.client.api.v4;
+
+import org.apache.olingo.client.api.CommonConfiguration;
+
+public interface Configuration extends CommonConfiguration {
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
new file mode 100644
index 0000000..afe3c70
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.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.client.api.v4;
+
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.communication.request.batch.v4.BatchRequestFactory;
+import org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory;
+import org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory;
+import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRequestFactory;
+import org.apache.olingo.client.api.communication.request.streamed.v4.StreamedRequestFactory;
+import org.apache.olingo.client.api.op.v4.ODataBinder;
+import org.apache.olingo.client.api.op.v4.ODataDeserializer;
+import org.apache.olingo.client.api.op.v4.ODataReader;
+import org.apache.olingo.client.api.uri.v4.URIBuilder;
+import org.apache.olingo.client.api.uri.v4.FilterFactory;
+
+public interface ODataClient extends CommonODataClient {
+
+ @Override
+ ODataDeserializer getDeserializer();
+
+ @Override
+ ODataReader getReader();
+
+ @Override
+ ODataBinder getBinder();
+
+ @Override
+ Configuration getConfiguration();
+
+ @Override
+ URIBuilder getURIBuilder(String serviceRoot);
+
+ @Override
+ FilterFactory getFilterFactory();
+
+ @Override
+ RetrieveRequestFactory getRetrieveRequestFactory();
+
+ @Override
+ CUDRequestFactory getCUDRequestFactory();
+
+ @Override
+ StreamedRequestFactory getStreamedRequestFactory();
+
+ @Override
+ InvokeRequestFactory getInvokeRequestFactory();
+
+ @Override
+ BatchRequestFactory getBatchRequestFactory();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java
index eba44e3..5c32aec 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java
@@ -23,7 +23,7 @@ import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import org.apache.olingo.client.api.Configuration;
+import org.apache.olingo.client.api.CommonConfiguration;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.format.ODataMediaFormat;
import org.apache.olingo.client.api.format.ODataPubFormat;
@@ -33,7 +33,7 @@ import org.apache.olingo.client.api.http.HttpUriRequestFactory;
import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
import org.apache.olingo.client.core.http.DefaultHttpUriRequestFactory;
-public abstract class AbstractConfiguration implements Configuration {
+public abstract class AbstractConfiguration implements CommonConfiguration {
private static final String DEFAULT_PUB_FORMAT = "pubFormat";
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index eb06136..52d5d1c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.domain.ODataGeospatialValue;
import org.apache.olingo.client.api.domain.ODataObjectFactory;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
@@ -26,7 +26,7 @@ import org.apache.olingo.client.api.op.ODataWriter;
import org.apache.olingo.client.core.op.impl.ODataObjectFactoryImpl;
import org.apache.olingo.client.core.op.impl.ODataWriterImpl;
-abstract class AbstractODataClient implements ODataClient {
+public abstract class AbstractODataClient implements CommonODataClient {
private static final long serialVersionUID = 7269096702397630265L;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
index f45b725..e0fcd76 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
@@ -18,17 +18,14 @@
*/
package org.apache.olingo.client.core;
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.api.ODataV4Client;
-
public final class ODataClientFactory {
- public static ODataV3Client getV3() {
- return new ODataV3ClientImpl();
+ public static org.apache.olingo.client.api.v3.ODataClient getV3() {
+ return new org.apache.olingo.client.core.v3.ODataClientImpl();
}
- public static ODataV4Client getV4() {
- return new ODataV4ClientImpl();
+ public static org.apache.olingo.client.api.v4.ODataClient getV4() {
+ return new org.apache.olingo.client.core.v4.ODataClientImpl();
}
private ODataClientFactory() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV3ClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV3ClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV3ClientImpl.java
deleted file mode 100644
index 1146c94..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV3ClientImpl.java
+++ /dev/null
@@ -1,149 +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.client.core;
-
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.api.V3Configuration;
-import org.apache.olingo.client.api.communication.header.HeaderName;
-import org.apache.olingo.client.api.communication.header.ODataHeaders;
-import org.apache.olingo.client.api.communication.request.batch.V3BatchRequestFactory;
-import org.apache.olingo.client.api.communication.request.cud.V3CUDRequestFactory;
-import org.apache.olingo.client.api.communication.request.invoke.V3InvokeRequestFactory;
-import org.apache.olingo.client.api.communication.request.retrieve.V3RetrieveRequestFactory;
-import org.apache.olingo.client.api.communication.request.streamed.V3StreamedRequestFactory;
-import org.apache.olingo.client.api.op.ODataBinder;
-import org.apache.olingo.client.api.op.ODataReader;
-import org.apache.olingo.client.api.op.ODataSerializer;
-import org.apache.olingo.client.api.op.ODataV3Deserializer;
-import org.apache.olingo.client.api.uri.V3URIBuilder;
-import org.apache.olingo.client.api.uri.filter.V3FilterFactory;
-import org.apache.olingo.client.core.communication.header.ODataHeadersImpl;
-import org.apache.olingo.client.core.communication.request.batch.V3BatchRequestFactoryImpl;
-import org.apache.olingo.client.core.communication.request.cud.V3CUDRequestFactoryImpl;
-import org.apache.olingo.client.core.communication.request.invoke.V3InvokeRequestFactoryImpl;
-import org.apache.olingo.client.core.communication.request.retrieve.V3RetrieveRequestFactoryImpl;
-import org.apache.olingo.client.core.communication.request.streamed.V3StreamedRequestFactoryImpl;
-import org.apache.olingo.client.core.op.impl.ODataV3BinderImpl;
-import org.apache.olingo.client.core.op.impl.ODataV3DeserializerImpl;
-import org.apache.olingo.client.core.op.impl.ODataV3ReaderImpl;
-import org.apache.olingo.client.core.op.impl.ODataV3SerializerImpl;
-import org.apache.olingo.client.core.uri.V3URIBuilderImpl;
-import org.apache.olingo.client.core.uri.filter.V3FilterFactoryImpl;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-public class ODataV3ClientImpl extends AbstractODataClient implements ODataV3Client {
-
- private static final long serialVersionUID = -1655712193243609209L;
-
- private final V3Configuration configuration = new V3ConfigurationImpl();
-
- private final V3FilterFactory filterFactory = new V3FilterFactoryImpl();
-
- private final ODataV3Deserializer deserializer = new ODataV3DeserializerImpl(this);
-
- private final ODataSerializer serializer = new ODataV3SerializerImpl(this);
-
- private final ODataReader reader = new ODataV3ReaderImpl(this);
-
- private final ODataBinder binder = new ODataV3BinderImpl(this);
-
- private final V3RetrieveRequestFactory retrieveReqFact = new V3RetrieveRequestFactoryImpl(this);
-
- private final V3CUDRequestFactory cudReqFact = new V3CUDRequestFactoryImpl(this);
-
- private final V3StreamedRequestFactory streamedReqFact = new V3StreamedRequestFactoryImpl(this);
-
- private final V3InvokeRequestFactory invokeReqFact = new V3InvokeRequestFactoryImpl(this);
-
- private final V3BatchRequestFactory batchReqFact = new V3BatchRequestFactoryImpl(this);
-
- @Override
- public ODataServiceVersion getServiceVersion() {
- return ODataServiceVersion.V30;
- }
-
- @Override
- public ODataHeaders getVersionHeaders() {
- final ODataHeadersImpl odataHeaders = new ODataHeadersImpl();
- odataHeaders.setHeader(HeaderName.minDataServiceVersion, ODataServiceVersion.V30.toString());
- odataHeaders.setHeader(HeaderName.maxDataServiceVersion, ODataServiceVersion.V30.toString());
- odataHeaders.setHeader(HeaderName.dataServiceVersion, ODataServiceVersion.V30.toString());
- return odataHeaders;
- }
-
- @Override
- public V3Configuration getConfiguration() {
- return configuration;
- }
-
- @Override
- public V3URIBuilder getURIBuilder(final String serviceRoot) {
- return new V3URIBuilderImpl(configuration, serviceRoot);
- }
-
- @Override
- public V3FilterFactory getFilterFactory() {
- return filterFactory;
- }
-
- @Override
- public ODataV3Deserializer getDeserializer() {
- return deserializer;
- }
-
- @Override
- public ODataSerializer getSerializer() {
- return serializer;
- }
-
- @Override
- public ODataReader getReader() {
- return reader;
- }
-
- @Override
- public ODataBinder getBinder() {
- return binder;
- }
-
- @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/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV4ClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV4ClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV4ClientImpl.java
deleted file mode 100644
index 2d5f6bf..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataV4ClientImpl.java
+++ /dev/null
@@ -1,148 +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.client.core;
-
-import org.apache.olingo.client.api.ODataV4Client;
-import org.apache.olingo.client.api.V4Configuration;
-import org.apache.olingo.client.api.communication.header.HeaderName;
-import org.apache.olingo.client.api.communication.header.ODataHeaders;
-import org.apache.olingo.client.api.communication.request.batch.V4BatchRequestFactory;
-import org.apache.olingo.client.api.communication.request.cud.V4CUDRequestFactory;
-import org.apache.olingo.client.api.communication.request.invoke.V4InvokeRequestFactory;
-import org.apache.olingo.client.api.communication.request.retrieve.V4RetrieveRequestFactory;
-import org.apache.olingo.client.api.communication.request.streamed.V4StreamedRequestFactory;
-import org.apache.olingo.client.api.op.ODataBinder;
-import org.apache.olingo.client.api.op.ODataReader;
-import org.apache.olingo.client.api.op.ODataSerializer;
-import org.apache.olingo.client.api.op.ODataV4Deserializer;
-import org.apache.olingo.client.api.uri.V4URIBuilder;
-import org.apache.olingo.client.api.uri.filter.V4FilterFactory;
-import org.apache.olingo.client.core.communication.header.ODataHeadersImpl;
-import org.apache.olingo.client.core.communication.request.batch.V4BatchRequestFactoryImpl;
-import org.apache.olingo.client.core.communication.request.cud.V4CUDRequestFactoryImpl;
-import org.apache.olingo.client.core.communication.request.invoke.V4InvokeRequestFactoryImpl;
-import org.apache.olingo.client.core.communication.request.retrieve.V4RetrieveRequestFactoryImpl;
-import org.apache.olingo.client.core.communication.request.streamed.V4StreamedRequestFactoryImpl;
-import org.apache.olingo.client.core.op.impl.ODataV4BinderImpl;
-import org.apache.olingo.client.core.op.impl.ODataV4DeserializerImpl;
-import org.apache.olingo.client.core.op.impl.ODataV4ReaderImpl;
-import org.apache.olingo.client.core.op.impl.ODataV4SerializerImpl;
-import org.apache.olingo.client.core.uri.V4URIBuilderImpl;
-import org.apache.olingo.client.core.uri.filter.V4FilterFactoryImpl;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-public class ODataV4ClientImpl extends AbstractODataClient implements ODataV4Client {
-
- private static final long serialVersionUID = -6653176125573631964L;
-
- private final V4Configuration configuration = new V4ConfigurationImpl();
-
- private final V4FilterFactory filterFactory = new V4FilterFactoryImpl();
-
- private final ODataV4Deserializer deserializer = new ODataV4DeserializerImpl(this);
-
- private final ODataSerializer serializer = new ODataV4SerializerImpl(this);
-
- private final ODataReader reader = new ODataV4ReaderImpl(this);
-
- private final ODataBinder binder = new ODataV4BinderImpl(this);
-
- private final V4RetrieveRequestFactory retrieveReqFact = new V4RetrieveRequestFactoryImpl(this);
-
- private final V4CUDRequestFactory cudReqFact = new V4CUDRequestFactoryImpl(this);
-
- private final V4StreamedRequestFactory streamedReqFact = new V4StreamedRequestFactoryImpl(this);
-
- private final V4InvokeRequestFactory invokeReqFact = new V4InvokeRequestFactoryImpl(this);
-
- private final V4BatchRequestFactory batchReqFact = new V4BatchRequestFactoryImpl(this);
-
- @Override
- public ODataServiceVersion getServiceVersion() {
- return ODataServiceVersion.V40;
- }
-
- @Override
- public ODataHeaders getVersionHeaders() {
- final ODataHeadersImpl odataHeaders = new ODataHeadersImpl();
- odataHeaders.setHeader(HeaderName.maxDataServiceVersion, ODataServiceVersion.V40.toString());
- odataHeaders.setHeader(HeaderName.dataServiceVersion, ODataServiceVersion.V40.toString());
- return odataHeaders;
- }
-
- @Override
- public V4Configuration getConfiguration() {
- return configuration;
- }
-
- @Override
- public V4URIBuilder getURIBuilder(final String serviceRoot) {
- return new V4URIBuilderImpl(serviceRoot);
- }
-
- @Override
- public V4FilterFactory getFilterFactory() {
- return filterFactory;
- }
-
- @Override
- public ODataV4Deserializer getDeserializer() {
- return deserializer;
- }
-
- @Override
- public ODataSerializer getSerializer() {
- return serializer;
- }
-
- @Override
- public ODataReader getReader() {
- return reader;
- }
-
- @Override
- public ODataBinder getBinder() {
- return binder;
- }
-
- @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;
- }
-}
[42/52] [abbrv] [OLINGO-205,
OLINGO-200] provided atom v4 deserialization for entity type/set +
entity set request
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java
index f64b233..7ba38f8 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java
@@ -20,6 +20,7 @@ package org.apache.olingo.client.api.communication.request;
import java.util.concurrent.Future;
import org.apache.olingo.client.api.communication.response.ODataResponse;
+import org.apache.olingo.client.api.format.Format;
/**
* Basic OData request.
@@ -27,7 +28,7 @@ import org.apache.olingo.client.api.communication.response.ODataResponse;
* @param <V> OData response type corresponding to the request implementation.
* @param <T> Accepted content-type formats by the request in object.
*/
-public interface ODataBasicRequest<V extends ODataResponse, T extends Enum<T>> extends ODataRequest {
+public interface ODataBasicRequest<V extends ODataResponse, T extends Format> extends ODataRequest {
/**
* Request execute.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataRetrieveRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataRetrieveRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataRetrieveRequest.java
index edabb96..14f907e 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataRetrieveRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataRetrieveRequest.java
@@ -20,9 +20,10 @@ package org.apache.olingo.client.api.communication.request.retrieve;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.format.Format;
/**
* This is an abstract representation of an OData retrieve query request returning one or more result item.
*/
-public interface ODataRetrieveRequest<V, T extends Enum<T>> extends ODataBasicRequest<ODataRetrieveResponse<V>, T> {
+public interface ODataRetrieveRequest<V, T extends Format> extends ODataBasicRequest<ODataRetrieveResponse<V>, T> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkType.java
index 6702c00..179f9cc 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkType.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkType.java
@@ -20,7 +20,6 @@ package org.apache.olingo.client.api.domain;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType;
-import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
@@ -31,11 +30,11 @@ public enum ODataLinkType {
/**
* Entity navigation link.
*/
- ENTITY_NAVIGATION(ODataPubFormat.ATOM + ";type=entry"),
+ ENTITY_NAVIGATION(ContentType.APPLICATION_ATOM_XML.getMimeType() + ";type=entry"),
/**
* Entity set navigation link.
*/
- ENTITY_SET_NAVIGATION(ODataPubFormat.ATOM + ";type=feed"),
+ ENTITY_SET_NAVIGATION(ContentType.APPLICATION_ATOM_XML.getMimeType() + ";type=feed"),
/**
* Association link.
*/
@@ -57,7 +56,8 @@ public enum ODataLinkType {
}
/**
- * Gets <code>LinkType</code> instance from the given rel and type.
+ * Gets
+ * <code>LinkType</code> instance from the given rel and type.
*
* @param client OData client.
* @param rel rel.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-api/src/main/java/org/apache/olingo/client/api/format/Format.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/Format.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/Format.java
new file mode 100644
index 0000000..1d52664
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/Format.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.client.api.format;
+
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public interface Format {
+
+ String toString(ODataServiceVersion version);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataFormat.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataFormat.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataFormat.java
index 2ee704b..8f52ea3 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataFormat.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataFormat.java
@@ -19,11 +19,12 @@
package org.apache.olingo.client.api.format;
import org.apache.http.entity.ContentType;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
* Available formats to be used in various contexts.
*/
-public enum ODataFormat {
+public enum ODataFormat implements Format{
/**
* JSON format with no metadata.
@@ -94,4 +95,9 @@ public enum ODataFormat {
return result;
}
+
+ @Override
+ public String toString(final ODataServiceVersion version) {
+ return this.toString();
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataMediaFormat.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataMediaFormat.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataMediaFormat.java
index 353edc4..5d49ddb 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataMediaFormat.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataMediaFormat.java
@@ -19,11 +19,12 @@
package org.apache.olingo.client.api.format;
import org.apache.http.entity.ContentType;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
* Available formats for media.
*/
-public enum ODataMediaFormat {
+public enum ODataMediaFormat implements Format{
CHARSET_PARAMETER("charset"),
MEDIA_TYPE_WILDCARD("*"),
@@ -68,4 +69,9 @@ public enum ODataMediaFormat {
return result;
}
+
+ @Override
+ public String toString(final ODataServiceVersion version) {
+ return this.toString();
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataPubFormat.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataPubFormat.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataPubFormat.java
index 62e5322..aea294f 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataPubFormat.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataPubFormat.java
@@ -18,34 +18,49 @@
*/
package org.apache.olingo.client.api.format;
+import java.util.EnumMap;
import org.apache.http.entity.ContentType;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
* Available formats for AtomPub exchange.
*/
-public enum ODataPubFormat {
+public enum ODataPubFormat implements Format {
/**
* JSON format with no metadata.
*/
- JSON_NO_METADATA(ContentType.APPLICATION_JSON.getMimeType() + ";odata=nometadata"),
+ JSON_NO_METADATA(),
/**
* JSON format with minimal metadata (default).
*/
- JSON(ContentType.APPLICATION_JSON.getMimeType() + ";odata=minimalmetadata"),
+ JSON(),
/**
* JSON format with no metadata.
*/
- JSON_FULL_METADATA(ContentType.APPLICATION_JSON.getMimeType() + ";odata=fullmetadata"),
+ JSON_FULL_METADATA(),
/**
* Atom format.
*/
- ATOM(ContentType.APPLICATION_ATOM_XML.getMimeType());
+ ATOM();
- private final String format;
+ final static EnumMap<ODataServiceVersion, EnumMap<ODataPubFormat, String>> formatPerVersion =
+ new EnumMap<ODataServiceVersion, EnumMap<ODataPubFormat, String>>(ODataServiceVersion.class);
- ODataPubFormat(final String format) {
- this.format = format;
+ static {
+ final EnumMap<ODataPubFormat, String> v3 = new EnumMap<ODataPubFormat, String>(ODataPubFormat.class);
+ v3.put(JSON_NO_METADATA, ContentType.APPLICATION_JSON.getMimeType() + ";odata=nometadata");
+ v3.put(JSON, ContentType.APPLICATION_JSON.getMimeType() + ";odata=minimalmetadata");
+ v3.put(JSON_FULL_METADATA, ContentType.APPLICATION_JSON.getMimeType() + ";odata=fullmetadata");
+ v3.put(ATOM, ContentType.APPLICATION_ATOM_XML.getMimeType());
+ formatPerVersion.put(ODataServiceVersion.V30, v3);
+
+ final EnumMap<ODataPubFormat, String> v4 = new EnumMap<ODataPubFormat, String>(ODataPubFormat.class);
+ v4.put(JSON_NO_METADATA, ContentType.APPLICATION_JSON.getMimeType() + ";odata.metadata=none");
+ v4.put(JSON, ContentType.APPLICATION_JSON.getMimeType() + ";odata.metadata=minimal");
+ v4.put(JSON_FULL_METADATA, ContentType.APPLICATION_JSON.getMimeType() + ";odata.metadata=full");
+ v4.put(ATOM, ContentType.APPLICATION_ATOM_XML.getMimeType());
+ formatPerVersion.put(ODataServiceVersion.V40, v4);
}
/**
@@ -54,8 +69,17 @@ public enum ODataPubFormat {
* @return format as a string.
*/
@Override
+ public String toString(final ODataServiceVersion version) {
+ if (version.ordinal() < ODataServiceVersion.V30.ordinal()) {
+ throw new IllegalArgumentException("Unsupported version " + version);
+ }
+
+ return ODataPubFormat.formatPerVersion.get(version).get(this);
+ }
+
+ @Override
public String toString() {
- return format;
+ throw new UnsupportedOperationException();
}
/**
@@ -72,7 +96,7 @@ public enum ODataPubFormat {
final String[] parts = format.split(";");
_format.append(parts[0].trim());
if (ContentType.APPLICATION_JSON.getMimeType().equals(parts[0].trim())) {
- if (parts.length > 1 && parts[1].startsWith("odata=")) {
+ if (parts.length > 1 && parts[1].startsWith("odata")) {
_format.append(';').append(parts[1].trim());
} else {
result = ODataPubFormat.JSON;
@@ -82,7 +106,8 @@ public enum ODataPubFormat {
if (result == null) {
final String candidate = _format.toString();
for (ODataPubFormat value : values()) {
- if (candidate.equals(value.toString())) {
+ if (candidate.equals(value.toString(ODataServiceVersion.V30))
+ || candidate.equals(value.toString(ODataServiceVersion.V40))) {
result = value;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataValueFormat.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataValueFormat.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataValueFormat.java
index b04ce7d..818b104 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataValueFormat.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataValueFormat.java
@@ -19,11 +19,12 @@
package org.apache.olingo.client.api.format;
import org.apache.http.entity.ContentType;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
* Available formats for property values.
*/
-public enum ODataValueFormat {
+public enum ODataValueFormat implements Format{
/**
* Application octet stream.
@@ -73,4 +74,9 @@ public enum ODataValueFormat {
return result;
}
+
+ @Override
+ public String toString(final ODataServiceVersion version) {
+ return this.toString();
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
index 307cdc9..8cd5819 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
@@ -31,6 +31,7 @@ import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.request.ODataStreamer;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
import org.apache.olingo.client.api.communication.response.ODataResponse;
+import org.apache.olingo.client.api.format.Format;
import org.apache.olingo.client.api.http.HttpMethod;
/**
@@ -39,88 +40,87 @@ import org.apache.olingo.client.api.http.HttpMethod;
* @param <V> OData response type corresponding to the request implementation.
* @param <T> OData format being used.
*/
-public abstract class AbstractODataBasicRequest<V extends ODataResponse, T extends Enum<T>>
+public abstract class AbstractODataBasicRequest<V extends ODataResponse, T extends Format>
extends ODataRequestImpl<T>
implements ODataBasicRequest<V, T> {
- /**
- * Constructor.
- *
- * @param odataClient client instance getting this request
- * @param formatRef reference class for the format being used
- * @param method request method.
- * @param uri OData request URI.
- */
- public AbstractODataBasicRequest(final CommonODataClient odataClient,
- final Class<T> formatRef, final HttpMethod method, final URI uri) {
+ /**
+ * Constructor.
+ *
+ * @param odataClient client instance getting this request
+ * @param formatRef reference class for the format being used
+ * @param method request method.
+ * @param uri OData request URI.
+ */
+ public AbstractODataBasicRequest(final CommonODataClient odataClient,
+ final Class<T> formatRef, final HttpMethod method, final URI uri) {
- super(odataClient, formatRef, method, uri);
- }
+ super(odataClient, formatRef, method, uri);
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFormat(final T format) {
- if (format != null) {
- setAccept(format.toString());
- setContentType(format.toString());
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFormat(final T format) {
+ if (format != null) {
+ setAccept(format.toString(odataClient.getServiceVersion()));
+ setContentType(format.toString(odataClient.getServiceVersion()));
}
+ }
- /**
- * {@inheritDoc}
- */
- @Override
- public final Future<V> asyncExecute() {
- return odataClient.getConfiguration().getExecutor().submit(new Callable<V>() {
-
- @Override
- public V call() throws Exception {
- return execute();
- }
- });
- }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final Future<V> asyncExecute() {
+ return odataClient.getConfiguration().getExecutor().submit(new Callable<V>() {
+ @Override
+ public V call() throws Exception {
+ return execute();
+ }
+ });
+ }
- /**
- * Gets payload as an InputStream.
- *
- * @return InputStream for entire payload.
- */
- protected abstract InputStream getPayload();
+ /**
+ * Gets payload as an InputStream.
+ *
+ * @return InputStream for entire payload.
+ */
+ protected abstract InputStream getPayload();
- /**
- * Serializes the full request into the given batch request.
- *
- * @param req destination batch request.
- */
- public void batch(final ODataBatchRequest req) {
- batch(req, null);
- }
+ /**
+ * Serializes the full request into the given batch request.
+ *
+ * @param req destination batch request.
+ */
+ public void batch(final ODataBatchRequest req) {
+ batch(req, null);
+ }
- /**
- * Serializes the full request into the given batch request.
- * <p>
- * This method have to be used to serialize a changeset item with the specified contentId.
- *
- * @param req destination batch request.
- * @param contentId contentId of the changeset item.
- */
- public void batch(final ODataBatchRequest req, final String contentId) {
- try {
- req.rawAppend(toByteArray());
- if (StringUtils.isNotBlank(contentId)) {
- req.rawAppend((ODataBatchConstants.CHANGESET_CONTENT_ID_NAME + ": " + contentId).getBytes());
- req.rawAppend(ODataStreamer.CRLF);
- }
- req.rawAppend(ODataStreamer.CRLF);
+ /**
+ * Serializes the full request into the given batch request.
+ * <p>
+ * This method have to be used to serialize a changeset item with the specified contentId.
+ *
+ * @param req destination batch request.
+ * @param contentId contentId of the changeset item.
+ */
+ public void batch(final ODataBatchRequest req, final String contentId) {
+ try {
+ req.rawAppend(toByteArray());
+ if (StringUtils.isNotBlank(contentId)) {
+ req.rawAppend((ODataBatchConstants.CHANGESET_CONTENT_ID_NAME + ": " + contentId).getBytes());
+ req.rawAppend(ODataStreamer.CRLF);
+ }
+ req.rawAppend(ODataStreamer.CRLF);
- final InputStream payload = getPayload();
- if (payload != null) {
- req.rawAppend(IOUtils.toByteArray(getPayload()));
- }
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
+ final InputStream payload = getPayload();
+ if (payload != null) {
+ req.rawAppend(IOUtils.toByteArray(getPayload()));
+ }
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
}
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
index d088e97..2e60a7d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
@@ -42,6 +42,10 @@ import org.apache.olingo.client.api.communication.header.ODataHeaderValues;
import org.apache.olingo.client.api.communication.header.ODataHeaders;
import org.apache.olingo.client.api.communication.request.ODataRequest;
import org.apache.olingo.client.api.communication.request.ODataStreamer;
+import org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory;
+import org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory;
+import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
+import org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory;
import org.apache.olingo.client.api.communication.response.ODataResponse;
import org.apache.olingo.client.api.format.ODataMediaFormat;
import org.apache.olingo.client.api.format.ODataPubFormat;
@@ -51,6 +55,7 @@ import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.data.JSONErrorImpl;
import org.apache.olingo.client.core.data.XMLErrorImpl;
import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.client.api.format.Format;
import org.apache.olingo.client.core.communication.header.ODataHeadersImpl;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.slf4j.Logger;
@@ -66,7 +71,7 @@ import org.slf4j.LoggerFactory;
* @see InvokeRequestFactory
* @see StreamedRequestFactory
*/
-public class ODataRequestImpl<T extends Enum<T>> implements ODataRequest {
+public class ODataRequestImpl<T extends Format> implements ODataRequest {
/**
* Logger.
@@ -251,7 +256,7 @@ public class ODataRequestImpl<T extends Enum<T>> implements ODataRequest {
@Override
public String getAccept() {
final String acceptHead = odataHeaders.getHeader(HeaderName.accept);
- return StringUtils.isBlank(acceptHead) ? getDefaultFormat().toString() : acceptHead;
+ return StringUtils.isBlank(acceptHead) ? getDefaultFormat().toString(odataClient.getServiceVersion()) : acceptHead;
}
/**
@@ -284,7 +289,8 @@ public class ODataRequestImpl<T extends Enum<T>> implements ODataRequest {
@Override
public String getContentType() {
final String contentTypeHead = odataHeaders.getHeader(HeaderName.contentType);
- return StringUtils.isBlank(contentTypeHead) ? getDefaultFormat().toString() : contentTypeHead;
+ return StringUtils.isBlank(contentTypeHead)
+ ? getDefaultFormat().toString(odataClient.getServiceVersion()) : contentTypeHead;
}
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
index c6355e4..abef76c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
@@ -100,7 +100,7 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult>
public void setFormat(final ODataPubFormat format) {
final String _format = (reference.isAssignableFrom(ODataProperty.class) && format == ODataPubFormat.ATOM)
? ODataFormat.XML.toString()
- : format.toString();
+ : format.toString(odataClient.getServiceVersion());
setAccept(_format);
setContentType(_format);
}
@@ -163,7 +163,7 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult>
} else if (this.method == HttpMethod.POST) {
((HttpPost) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input));
- setContentType(ODataPubFormat.JSON.toString());
+ setContentType(ODataPubFormat.JSON.toString(odataClient.getServiceVersion()));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
index fe51722..628e836 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
@@ -26,6 +26,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRetrieveRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.format.Format;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
@@ -33,7 +34,7 @@ import org.apache.olingo.client.core.communication.response.AbstractODataRespons
/**
* This is an abstract representation of an OData retrieve query request returning one or more result item.
*/
-public abstract class AbstractODataRetrieveRequest<V, T extends Enum<T>>
+public abstract class AbstractODataRetrieveRequest<V, T extends Format>
extends AbstractODataBasicRequest<ODataRetrieveResponse<V>, T>
implements ODataRetrieveRequest<V, T>, ODataBatchableRequest {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
index 4226cc2..777d86a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
@@ -92,7 +92,7 @@ public class ODataRawRequestImpl extends ODataRequestImpl<ODataPubFormat>
this.close();
}
}
-
+
return odataClient.getReader().read(new ByteArrayInputStream(obj), getContentType(), reference);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
index d19d0d5..c7f7c52 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
@@ -48,7 +48,7 @@ public abstract class AbstractODataStreamedEntityRequest<V extends ODataResponse
public AbstractODataStreamedEntityRequest(final CommonODataClient odataClient, final HttpMethod method,
URI uri) {
super(odataClient, method, uri);
- setAccept(getFormat().toString());
+ setAccept(getFormat().toString(odataClient.getServiceVersion()));
}
/**
@@ -65,6 +65,6 @@ public abstract class AbstractODataStreamedEntityRequest<V extends ODataResponse
@Override
public final void setFormat(final ODataPubFormat format) {
this.format = format;
- setAccept(format.toString());
+ setAccept(format.toString(odataClient.getServiceVersion()));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
index 74b29fb..3aca585 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
@@ -57,7 +57,7 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
}
private ODataPropertyType guessPropertyType(final JsonNode node) {
- ODataPropertyType type = null;
+ final ODataPropertyType type;
if (node.isValueNode() || node.isNull()) {
type = ODataPropertyType.PRIMITIVE;
@@ -73,7 +73,7 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
}
private Value fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) {
- Value value = null;
+ final Value value;
if (node.isNull()) {
value = new NullValueImpl();
@@ -172,5 +172,4 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
property.setValue(new PrimitiveValueImpl(StringUtils.EMPTY));
}
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
index 8893b91..835d174 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
@@ -153,7 +153,6 @@ public class AtomDeserializer extends AbstractAtomDealer {
private void properties(final XMLEventReader reader, final StartElement start, final AtomEntryImpl entry)
throws XMLStreamException {
-
boolean foundEndProperties = false;
while (reader.hasNext() && !foundEndProperties) {
final XMLEvent event = reader.nextEvent();
@@ -316,7 +315,6 @@ public class AtomDeserializer extends AbstractAtomDealer {
boolean foundEndFeed = false;
while (reader.hasNext() && !foundEndFeed) {
final XMLEvent event = reader.nextEvent();
-
if (event.isStartElement()) {
if (countQName.equals(event.asStartElement().getName())) {
count(reader, event.asStartElement(), feed);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
index 884d815..42d2504 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
@@ -139,7 +139,7 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
}
}
- ODataPropertyType type = null;
+ final ODataPropertyType type;
if (child == null) {
type = ODataPropertyType.PRIMITIVE;
} else {
@@ -168,16 +168,19 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
property.setName(start.getName().getLocalPart());
final Attribute typeAttr = start.getAttributeByName(this.typeQName);
- if (typeAttr != null) {
- property.setType(typeAttr.getValue());
- }
Value value;
final Attribute nullAttr = start.getAttributeByName(this.nullQName);
+ final String typeAttrValue = typeAttr == null ? null : typeAttr.getValue();
+
if (nullAttr == null) {
- final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
+ final EdmTypeInfo typeInfo = StringUtils.isBlank(typeAttrValue)
? null
- : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
+ : new EdmTypeInfo.Builder().setTypeExpression(typeAttrValue).build();
+
+ if (typeInfo != null) {
+ property.setType(typeInfo.getTypeExpression());
+ }
final ODataPropertyType propType = typeInfo == null
? guessPropertyType(reader)
@@ -207,6 +210,7 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
} else {
value = new NullValueImpl();
}
+
property.setValue(value);
return property;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
index eebfef3..c77369a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
@@ -60,7 +60,7 @@ class JSONGeoValueDeserializer {
private MultiPoint multipoint(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
final String crs) {
- MultiPoint multiPoint = null;
+ final MultiPoint multiPoint;
if (itor.hasNext()) {
final List<Point> points = new ArrayList<Point>();
@@ -79,7 +79,7 @@ class JSONGeoValueDeserializer {
private LineString lineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
final String crs) {
- LineString lineString = null;
+ final LineString lineString;
if (itor.hasNext()) {
final List<Point> points = new ArrayList<Point>();
@@ -98,7 +98,7 @@ class JSONGeoValueDeserializer {
private MultiLineString multiLineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
final String crs) {
- MultiLineString multiLineString = null;
+ final MultiLineString multiLineString;
if (itor.hasNext()) {
final List<LineString> lineStrings = new ArrayList<LineString>();
@@ -147,7 +147,7 @@ class JSONGeoValueDeserializer {
private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
final String crs) {
- MultiPolygon multiPolygon = null;
+ final MultiPolygon multiPolygon;
if (itor.hasNext()) {
final List<Polygon> polygons = new ArrayList<Polygon>();
@@ -166,7 +166,7 @@ class JSONGeoValueDeserializer {
private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
final String crs) {
- GeospatialCollection collection = null;
+ final GeospatialCollection collection;
if (itor.hasNext()) {
final List<Geospatial> geospatials = new ArrayList<Geospatial>();
@@ -262,5 +262,4 @@ class JSONGeoValueDeserializer {
return value;
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
index 3827418..bf047af 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
@@ -19,7 +19,6 @@
package org.apache.olingo.client.core.edm;
import org.apache.olingo.client.api.edm.xml.v4.ActionImport;
-import org.apache.olingo.client.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmActionImport;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
index f54d6c1..da29a68 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
@@ -70,12 +70,12 @@ public abstract class EdmOperationImpl extends AbstractEdmOperation {
@Override
public FullQualifiedName getBindingParameterTypeFqn() {
- FullQualifiedName fqn = null;
+ FullQualifiedName bpfqn = null;
final EdmParameter bindingParam = getBindingParameter();
if (bindingParam != null) {
- fqn = new FullQualifiedName(bindingParam.getType().getNamespace(), bindingParam.getType().getName());
+ bpfqn = new FullQualifiedName(bindingParam.getType().getNamespace(), bindingParam.getType().getName());
}
- return fqn;
+ return bpfqn;
}
@Override
@@ -85,6 +85,6 @@ public abstract class EdmOperationImpl extends AbstractEdmOperation {
if (bindingParam != null) {
result = bindingParam.isCollection();
}
- return null;
+ return result;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
index 461e829..abf1a54 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
@@ -23,6 +23,7 @@ import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.slf4j.Logger;
@@ -56,12 +57,11 @@ public class EdmTypeInfo {
}
public EdmTypeInfo build() {
- return new EdmTypeInfo(edm, typeExpression.indexOf('.') == -1
+ return new EdmTypeInfo(edm, typeExpression.indexOf('.') == -1 && StringUtils.isNotBlank(defaultNamespace)
? defaultNamespace + "." + typeExpression
: typeExpression);
}
}
-
private final Edm edm;
private final String typeExpression;
@@ -80,7 +80,6 @@ public class EdmTypeInfo {
private EdmTypeInfo(final Edm edm, final String typeExpression) {
this.edm = edm;
- this.typeExpression = typeExpression;
String baseType;
final int collStartIdx = typeExpression.indexOf("Collection(");
@@ -97,16 +96,30 @@ public class EdmTypeInfo {
baseType = typeExpression.substring(collStartIdx + 11, collEndIdx);
}
+
+ baseType = baseType.replaceAll("^#", "");
+
+ final String typeName;
+ final String namespace;
+
final int lastDotIdx = baseType.lastIndexOf('.');
if (lastDotIdx == -1) {
- throw new IllegalArgumentException("Cannot find namespace or alias in " + typeExpression);
+ namespace = EdmPrimitiveType.EDM_NAMESPACE;
+ typeName = baseType;
+ baseType = new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, baseType).toString();
+ } else {
+ namespace = baseType.substring(0, lastDotIdx);
+ typeName = baseType.substring(lastDotIdx + 1);
}
- final String namespace = baseType.substring(0, lastDotIdx);
- final String typeName = baseType.substring(lastDotIdx + 1);
+
if (StringUtils.isBlank(typeName)) {
throw new IllegalArgumentException("Null or empty type name in " + typeExpression);
}
+ final StringBuilder exp = new StringBuilder();
+ exp.append(baseType);
+
+ this.typeExpression = (this.collection ? exp.insert(0, "Collection(").append(")") : exp).toString();
this.fullQualifiedName = new FullQualifiedName(namespace, typeName);
try {
@@ -168,5 +181,4 @@ public class EdmTypeInfo {
public EdmEntityType getEntityType() {
return entityType;
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
index 2c2cdea..09c39ef 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
@@ -268,7 +268,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
final URI base = defaultBaseURI == null ? resource.getBaseURI() : defaultBaseURI;
-
+
final URI next = resource.getNext();
final ODataEntitySet entitySet = next == null
@@ -282,7 +282,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
for (Entry entryResource : resource.getEntries()) {
entitySet.addEntity(getODataEntity(entryResource));
}
-
+
return entitySet;
}
@@ -310,11 +310,11 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (StringUtils.isNotBlank(resource.getETag())) {
entity.setETag(resource.getETag());
}
-
+
if (resource.getEditLink() != null) {
entity.setEditLink(URIUtils.getURI(base, resource.getEditLink().getHref()));
}
-
+
for (Link link : resource.getAssociationLinks()) {
entity.addLink(client.getObjectFactory().newAssociationLink(link.getTitle(), base, link.getHref()));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java
index 67acc09..103f81d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java
@@ -103,5 +103,4 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
index 6637346..c69b469 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
@@ -148,7 +148,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
appendEntitySetSegment("Car").appendKeySegment(16);
final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
- req.setFormat(format.toString());
+ req.setFormat(format.toString(client.getServiceVersion()));
final ODataRawResponse res = req.execute();
assertNotNull(res);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
index 35cc3d6..3e69aff 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
@@ -138,7 +138,7 @@ public class EntitySetTestITCase extends AbstractTestITCase {
uriBuilder.appendEntitySetSegment("Car");
final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
- req.setFormat(format.toString());
+ req.setFormat(format.toString(client.getServiceVersion()));
final ODataRawResponse res = req.execute();
assertNotNull(res);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
index 3501482..21cf9ae 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
@@ -107,7 +107,8 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
final ODataRetrieveResponse<ODataEntity> res = req.execute();
assertNotNull(res);
- assertTrue(res.getContentType().replaceAll(" ", "").startsWith(ODataPubFormat.JSON.toString()));
+ assertTrue(res.getContentType().replaceAll(" ", "").
+ startsWith(ODataPubFormat.JSON.toString(client.getServiceVersion())));
}
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
index 46a59bd..a745380 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
@@ -35,8 +35,8 @@ public abstract class AbstractTestITCase extends org.apache.olingo.client.core.i
@BeforeClass
public static void setUpODataServiceRoot() throws IOException {
- testStaticServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc";
- testLargeModelServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc/large";
+ testStaticServiceRootURL = "http://localhost:9080/StaticService/V40/Static.svc";
+ testLargeModelServiceRootURL = "http://localhost:9080/StaticService/V40/Static.svc/large";
testAuthServiceRootURL = "http://localhost:9080/DefaultService.svc";
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
new file mode 100644
index 0000000..9e2527a
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.it.v4;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
+import org.apache.olingo.client.api.communication.response.ODataRawResponse;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.core.op.impl.ResourceFactory;
+import static org.junit.Assert.assertNotNull;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This is the unit test class to check basic feed operations.
+ */
+public class EntitySetTestITCase extends AbstractTestITCase {
+
+ protected String getServiceRoot() {
+ return testStaticServiceRootURL;
+ }
+
+ @Test
+ public void rawRequestAsAtom() throws IOException {
+ rawRequest(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ @Ignore
+ public void rawRequestAsJSON() throws IOException {
+ rawRequest(ODataPubFormat.JSON);
+ }
+
+ @Test
+ public void readODataEntitySetIteratorFromAtom() {
+ readODataEntitySetIterator(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ @Ignore
+ public void readODataEntitySetIteratorFromJSON() {
+ readODataEntitySetIterator(ODataPubFormat.JSON);
+ }
+
+ @Test
+ @Ignore
+ public void readODataEntitySetIteratorFromJSONFullMeta() {
+ readODataEntitySetIterator(ODataPubFormat.JSON_FULL_METADATA);
+ }
+
+ @Test
+ @Ignore
+ public void readODataEntitySetIteratorFromJSONNoMeta() {
+ readODataEntitySetIterator(ODataPubFormat.JSON_NO_METADATA);
+ }
+
+ @Test
+ public void readODataEntitySetWithNextFromAtom() {
+ readEntitySetWithNextLink(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ @Ignore
+ public void readODataEntitySetWithNextFromJSON() {
+ readEntitySetWithNextLink(ODataPubFormat.JSON_FULL_METADATA);
+ }
+
+ private void readEntitySetWithNextLink(final ODataPubFormat format) {
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ uriBuilder.appendEntitySetSegment("People");
+
+ final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ req.setFormat(format);
+
+ final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
+ final ODataEntitySet feed = res.getBody();
+
+ assertNotNull(feed);
+
+ debugFeed(client.getBinder().getFeed(feed, ResourceFactory.feedClassForFormat(
+ ODataPubFormat.ATOM == format)), "Just retrieved feed");
+
+ assertEquals(5, feed.getEntities().size());
+// assertNotNull(feed.getNext());
+
+// final URI expected = URI.create(getServiceRoot() + "/Customer?$skiptoken=-9");
+// final URI found = URIUtils.getURI(getServiceRoot(), feed.getNext().toASCIIString());
+
+// assertEquals(expected, found);
+ }
+
+ private void readODataEntitySetIterator(final ODataPubFormat format) {
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ uriBuilder.appendEntitySetSegment("People");
+
+ final ODataEntitySetIteratorRequest req =
+ client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
+ req.setFormat(format);
+
+ final ODataRetrieveResponse<ODataEntitySetIterator> res = req.execute();
+ final ODataEntitySetIterator feedIterator = res.getBody();
+
+ assertNotNull(feedIterator);
+
+ int count = 0;
+
+ while (feedIterator.hasNext()) {
+ assertNotNull(feedIterator.next());
+ count++;
+ }
+ assertEquals(5, count);
+// assertTrue(feedIterator.getNext().toASCIIString().endsWith("Customer?$skiptoken=-9"));
+ }
+
+ private void rawRequest(final ODataPubFormat format) {
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ uriBuilder.appendEntitySetSegment("People");
+
+ final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
+ req.setFormat(format.toString(client.getServiceVersion()));
+
+ final ODataRawResponse res = req.execute();
+ assertNotNull(res);
+
+ final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
+ assertNotNull(entitySet);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java
index c7aeff0..32e6fc8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java
@@ -26,92 +26,93 @@ import java.util.List;
* Interface representing a Entity Data Model as described in the Conceptual Schema Definition.
*/
public interface Edm {
-
- /**
- * This method DOES NOT support lazy loading. All schemas are loaded completely!
- * @return all schemas defined for this EDM
- */
- List<EdmSchema> getSchemas();
- /**
- * Get entity container by full qualified name.
- * <br/>
- * See {@link EdmEntityContainer} for more information.
- *
- * @param name
- * @return {@link EdmEntityContainer}
- */
- EdmEntityContainer getEntityContainer(FullQualifiedName name);
+ /**
+ * This method DOES NOT support lazy loading. All schemas are loaded completely!
+ *
+ * @return all schemas defined for this EDM
+ */
+ List<EdmSchema> getSchemas();
- /**
- * Get enum type by full qualified name.
- * <br/>
- * See {@link EdmEnumType} for more information
- *
- * @param name
- * @return {@link EdmEnumType}
- */
- EdmEnumType getEnumType(FullQualifiedName name);
+ /**
+ * Get entity container by full qualified name.
+ * <br/>
+ * See {@link EdmEntityContainer} for more information.
+ *
+ * @param name
+ * @return {@link EdmEntityContainer}
+ */
+ EdmEntityContainer getEntityContainer(FullQualifiedName name);
- /**
- * Get a type definition by full qualified name.
- * <br/>
- * See {@link EdmTypeDefinition} for more information
- *
- * @param name
- * @return {@link EdmTypeDefinition}
- */
- EdmTypeDefinition getTypeDefinition(FullQualifiedName name);
+ /**
+ * Get enum type by full qualified name.
+ * <br/>
+ * See {@link EdmEnumType} for more information
+ *
+ * @param name
+ * @return {@link EdmEnumType}
+ */
+ EdmEnumType getEnumType(FullQualifiedName name);
- /**
- * Get entity type by full qualified name.
- * <br/>
- * See {@link EdmEntityType} for more information.
- *
- * @param name
- * @return {@link EdmEntityType}
- */
- EdmEntityType getEntityType(FullQualifiedName name);
+ /**
+ * Get a type definition by full qualified name.
+ * <br/>
+ * See {@link EdmTypeDefinition} for more information
+ *
+ * @param name
+ * @return {@link EdmTypeDefinition}
+ */
+ EdmTypeDefinition getTypeDefinition(FullQualifiedName name);
- /**
- * Get complex type by full qualified name..
- * <br/>
- * See {@link EdmComplexType} for more information.
- *
- * @param name
- * @return {@link EdmComplexType}
- */
- EdmComplexType getComplexType(FullQualifiedName name);
+ /**
+ * Get entity type by full qualified name.
+ * <br/>
+ * See {@link EdmEntityType} for more information.
+ *
+ * @param name
+ * @return {@link EdmEntityType}
+ */
+ EdmEntityType getEntityType(FullQualifiedName name);
- /**
- * Get Action by full qualified name and binding parameter type.
- *
- * @param actionName must not be null
- * @param bindingParameterTypeName may be null if it is an unbound action
- * @param isBindingParameterCollection may be null if it is an unbound action
- * @return {@link EdmAction}
- */
- EdmAction getAction(FullQualifiedName actionName, FullQualifiedName bindingParameterTypeName,
- Boolean isBindingParameterCollection);
+ /**
+ * Get complex type by full qualified name..
+ * <br/>
+ * See {@link EdmComplexType} for more information.
+ *
+ * @param name
+ * @return {@link EdmComplexType}
+ */
+ EdmComplexType getComplexType(FullQualifiedName name);
- /**
- * Get Function by full qualified name and binding parameter type and binding parameter names.
- *
- * @param functionName
- * @param bindingParameterTypeName may be null if it is an unbound function
- * @param isBindingParameterCollection may be null if it is an unbound function
- * @param parameterNames may be null if it is an unbound function
- * @return {@link EdmFunction}
- */
- EdmFunction getFunction(FullQualifiedName functionName, FullQualifiedName bindingParameterTypeName,
- Boolean isBindingParameterCollection, List<String> parameterNames);
+ /**
+ * Get Action by full qualified name and binding parameter type.
+ *
+ * @param actionName must not be null
+ * @param bindingParameterTypeName may be null if it is an unbound action
+ * @param isBindingParameterCollection may be null if it is an unbound action
+ * @return {@link EdmAction}
+ */
+ EdmAction getAction(FullQualifiedName actionName, FullQualifiedName bindingParameterTypeName,
+ Boolean isBindingParameterCollection);
- /**
- * Get service metadata.
- * <br/>
- * See {@link EdmServiceMetadata} for more information.
- *
- * @return {@link EdmServiceMetadata}
- */
- EdmServiceMetadata getServiceMetadata();
+ /**
+ * Get Function by full qualified name and binding parameter type and binding parameter names.
+ *
+ * @param functionName
+ * @param bindingParameterTypeName may be null if it is an unbound function
+ * @param isBindingParameterCollection may be null if it is an unbound function
+ * @param parameterNames may be null if it is an unbound function
+ * @return {@link EdmFunction}
+ */
+ EdmFunction getFunction(FullQualifiedName functionName, FullQualifiedName bindingParameterTypeName,
+ Boolean isBindingParameterCollection, List<String> parameterNames);
+
+ /**
+ * Get service metadata.
+ * <br/>
+ * See {@link EdmServiceMetadata} for more information.
+ *
+ * @return {@link EdmServiceMetadata}
+ */
+ EdmServiceMetadata getServiceMetadata();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmActionImport.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmActionImport.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmActionImport.java
index 428fbdf..a302b9e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmActionImport.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmActionImport.java
@@ -23,5 +23,5 @@ package org.apache.olingo.commons.api.edm;
*/
public interface EdmActionImport extends EdmOperationImport {
- EdmAction getAction();
+ EdmAction getAction();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
index f50d400..d637814 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
@@ -40,8 +40,6 @@ public enum ODataServiceVersion {
public static final String NS_METADATA = "metadata";
- public static final String NS_DATA = "data";
-
public static final String NS_SCHEME = "scheme";
public static final String NAVIGATION_LINK_REL = "navigationLinkRel";
@@ -70,8 +68,11 @@ public enum ODataServiceVersion {
{
put(NS_METADATA, "http://docs.oasis-open.org/odata/ns/metadata");
- put(NS_DATA, "http://docs.oasis-open.org/odata/ns/data");
+ put(NS_DATASERVICES, "http://docs.oasis-open.org/odata/ns/data");
put(NS_SCHEME, "http://docs.oasis-open.org/odata/ns/scheme");
+ put(NAVIGATION_LINK_REL, "http://docs.oasis-open.org/odata/ns/related/");
+ put(ASSOCIATION_LINK_REL, "http://docs.oasis-open.org/odata/ns/relatedlinks/");
+ put(MEDIA_EDIT_LINK_REL, "http://docs.oasis-open.org/odata/ns/edit-media/");
}
});
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java
index 346eb2e..732f29f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java
@@ -27,24 +27,29 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
public abstract class AbstractEdmComplexType extends AbstractEdmStructuredType implements EdmComplexType {
- public AbstractEdmComplexType(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName) {
- super(edm, fqn, EdmTypeKind.COMPLEX, baseTypeName);
- }
+ public AbstractEdmComplexType(
+ final Edm edm,
+ final FullQualifiedName fqn,
+ final FullQualifiedName baseTypeName) {
+ super(edm, fqn, EdmTypeKind.COMPLEX, baseTypeName);
+ }
- @Override
- protected EdmStructuredType buildBaseType(final FullQualifiedName baseTypeName) {
- EdmComplexType baseType = null;
- if (baseTypeName != null) {
- baseType = edm.getComplexType(baseTypeName);
- if (baseType == null) {
- throw new EdmException("Can't find base type with name: " + baseTypeName + " for complex type: " + getName());
- }
+ @Override
+ protected EdmStructuredType buildBaseType(final FullQualifiedName baseTypeName) {
+ // TODO: check for comment
+ EdmComplexType baseType = null;
+ if (baseTypeName != null) {
+ baseType = edm.getComplexType(baseTypeName);
+ if (baseType == null) {
+ throw new EdmException("Can't find base type with name: " + baseTypeName + " for complex type: "
+ + getName());
+ }
+ }
+ return baseType;
}
- return baseType;
- }
- @Override
- public EdmComplexType getBaseType() {
- return (EdmComplexType) baseType;
- }
+ @Override
+ public EdmComplexType getBaseType() {
+ return (EdmComplexType) baseType;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
index aba62ba..41eb368 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
@@ -33,119 +33,123 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName;
public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements EdmEntityContainer {
- protected final FullQualifiedName entityContainerName;
+ protected final FullQualifiedName entityContainerName;
- protected final Map<String, EdmSingleton> singletons = new HashMap<String, EdmSingleton>();
- private boolean allSingletonsLoaded = false;
+ protected final Map<String, EdmSingleton> singletons = new HashMap<String, EdmSingleton>();
- protected final Map<String, EdmEntitySet> entitySets = new HashMap<String, EdmEntitySet>();
- private boolean allEntitySetsLoaded = false;
+ private boolean allSingletonsLoaded = false;
- protected final Map<String, EdmActionImport> actionImports = new HashMap<String, EdmActionImport>();
- private boolean allActionImportsLoaded = false;
+ protected final Map<String, EdmEntitySet> entitySets = new HashMap<String, EdmEntitySet>();
- protected final Map<String, EdmFunctionImport> functionImports = new HashMap<String, EdmFunctionImport>();
- private boolean allFunctionImportsLoaded = false;
+ private boolean allEntitySetsLoaded = false;
- public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName) {
- super(edm, entityContainerName.getName());
- this.entityContainerName = entityContainerName;
- }
+ protected final Map<String, EdmActionImport> actionImports = new HashMap<String, EdmActionImport>();
- @Override
- public String getNamespace() {
- return entityContainerName.getNamespace();
- }
+ private boolean allActionImportsLoaded = false;
- protected abstract EdmSingleton createSingleton(String singletonName);
+ protected final Map<String, EdmFunctionImport> functionImports = new HashMap<String, EdmFunctionImport>();
- @Override
- public EdmSingleton getSingleton(final String singletonName) {
- EdmSingleton singleton = singletons.get(singletonName);
- if (singleton == null) {
- singleton = createSingleton(singletonName);
- singletons.put(singletonName, singleton);
+ private boolean allFunctionImportsLoaded = false;
+
+ public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName) {
+ super(edm, entityContainerName.getName());
+ this.entityContainerName = entityContainerName;
+ }
+
+ @Override
+ public String getNamespace() {
+ return entityContainerName.getNamespace();
}
- return singleton;
- }
- protected abstract EdmEntitySet createEntitySet(String entitySetName);
+ protected abstract EdmSingleton createSingleton(String singletonName);
- @Override
- public EdmEntitySet getEntitySet(final String entitySetName) {
- EdmEntitySet entitySet = entitySets.get(entitySetName);
- if (entitySet == null) {
- entitySet = createEntitySet(entitySetName);
- entitySets.put(entitySetName, entitySet);
+ @Override
+ public EdmSingleton getSingleton(final String singletonName) {
+ EdmSingleton singleton = singletons.get(singletonName);
+ if (singleton == null) {
+ singleton = createSingleton(singletonName);
+ singletons.put(singletonName, singleton);
+ }
+ return singleton;
}
- return entitySet;
- }
- protected abstract EdmActionImport createActionImport(String actionImportName);
+ protected abstract EdmEntitySet createEntitySet(String entitySetName);
- @Override
- public EdmActionImport getActionImport(final String actionImportName) {
- EdmActionImport actionImport = actionImports.get(actionImportName);
- if (actionImport == null) {
- actionImport = createActionImport(actionImportName);
- actionImports.put(actionImportName, actionImport);
+ @Override
+ public EdmEntitySet getEntitySet(final String entitySetName) {
+ EdmEntitySet entitySet = entitySets.get(entitySetName);
+ if (entitySet == null) {
+ entitySet = createEntitySet(entitySetName);
+ entitySets.put(entitySetName, entitySet);
+ }
+ return entitySet;
}
- return actionImport;
- }
- protected abstract EdmFunctionImport createFunctionImport(String functionImportName);
+ protected abstract EdmActionImport createActionImport(String actionImportName);
- @Override
- public EdmFunctionImport getFunctionImport(final String functionImportName) {
- EdmFunctionImport functionImport = functionImports.get(functionImportName);
- if (functionImport == null) {
- functionImport = createFunctionImport(functionImportName);
- functionImports.put(functionImportName, functionImport);
+ @Override
+ public EdmActionImport getActionImport(final String actionImportName) {
+ EdmActionImport actionImport = actionImports.get(actionImportName);
+ if (actionImport == null) {
+ actionImport = createActionImport(actionImportName);
+ actionImports.put(actionImportName, actionImport);
+ }
+ return actionImport;
}
- return functionImport;
- }
-
- @Override
- public List<EdmEntitySet> getEntitySets() {
- if (!allEntitySetsLoaded) {
- loadAllEntitySets();
- allEntitySetsLoaded = true;
+
+ protected abstract EdmFunctionImport createFunctionImport(String functionImportName);
+
+ @Override
+ public EdmFunctionImport getFunctionImport(final String functionImportName) {
+ EdmFunctionImport functionImport = functionImports.get(functionImportName);
+ if (functionImport == null) {
+ functionImport = createFunctionImport(functionImportName);
+ functionImports.put(functionImportName, functionImport);
+ }
+ return functionImport;
+ }
+
+ @Override
+ public List<EdmEntitySet> getEntitySets() {
+ if (!allEntitySetsLoaded) {
+ loadAllEntitySets();
+ allEntitySetsLoaded = true;
+ }
+ return new ArrayList<EdmEntitySet>(entitySets.values());
}
- return new ArrayList<EdmEntitySet>(entitySets.values());
- }
- protected abstract void loadAllEntitySets();
+ protected abstract void loadAllEntitySets();
- @Override
- public List<EdmFunctionImport> getFunctionImports() {
- if (!allFunctionImportsLoaded) {
- loadAllFunctionImports();
- allFunctionImportsLoaded = true;
+ @Override
+ public List<EdmFunctionImport> getFunctionImports() {
+ if (!allFunctionImportsLoaded) {
+ loadAllFunctionImports();
+ allFunctionImportsLoaded = true;
+ }
+ return new ArrayList<EdmFunctionImport>(functionImports.values());
}
- return new ArrayList<EdmFunctionImport>(functionImports.values());
- }
- protected abstract void loadAllFunctionImports();
+ protected abstract void loadAllFunctionImports();
- @Override
- public List<EdmSingleton> getSingletons() {
- if (!allSingletonsLoaded) {
- loadAllSingletons();
- allSingletonsLoaded = true;
+ @Override
+ public List<EdmSingleton> getSingletons() {
+ if (!allSingletonsLoaded) {
+ loadAllSingletons();
+ allSingletonsLoaded = true;
+ }
+ return new ArrayList<EdmSingleton>(singletons.values());
}
- return new ArrayList<EdmSingleton>(singletons.values());
- }
- protected abstract void loadAllSingletons();
+ protected abstract void loadAllSingletons();
- @Override
- public List<EdmActionImport> getActionImports() {
- if (!allActionImportsLoaded) {
- loadAllActionImports();
- allActionImportsLoaded = true;
+ @Override
+ public List<EdmActionImport> getActionImports() {
+ if (!allActionImportsLoaded) {
+ loadAllActionImports();
+ allActionImportsLoaded = true;
+ }
+ return new ArrayList<EdmActionImport>(actionImports.values());
}
- return new ArrayList<EdmActionImport>(actionImports.values());
- }
- protected abstract void loadAllActionImports();
+ protected abstract void loadAllActionImports();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java
index b848540..3c2f894 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java
@@ -35,80 +35,83 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
public abstract class AbstractEdmOperation extends EdmTypeImpl implements EdmOperation {
- private final Map<String, EdmParameter> parameters = new LinkedHashMap<String, EdmParameter>();
+ private final Map<String, EdmParameter> parameters = new LinkedHashMap<String, EdmParameter>();
- private String entitySetPath;
+ private String entitySetPath;
- private boolean isBound;
+ private boolean isBound;
- private EdmReturnType returnType;
+ private EdmReturnType returnType;
- private List<String> parameterNames;
+ private List<String> parameterNames;
- protected AbstractEdmOperation(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind) {
- super(edm, fqn, kind);
- }
+ protected AbstractEdmOperation(
+ final Edm edm,
+ final FullQualifiedName fqn,
+ final EdmTypeKind kind) {
+ super(edm, fqn, kind);
+ }
+
+ protected void setParameters(final List<EdmParameter> _parameters) {
+ for (EdmParameter parameter : _parameters) {
+ parameters.put(parameter.getName(), parameter);
+ }
+ }
+
+ protected void setEntitySetPath(final String entitySetPath) {
+ this.entitySetPath = entitySetPath;
+ }
+
+ protected void setIsBound(final boolean isBound) {
+ this.isBound = isBound;
+ }
- protected void setParameters(final List<EdmParameter> _parameters) {
- for (EdmParameter parameter : _parameters) {
- parameters.put(parameter.getName(), parameter);
+ protected void setReturnType(final EdmReturnType returnType) {
+ this.returnType = returnType;
}
- }
-
- protected void setEntitySetPath(final String entitySetPath) {
- this.entitySetPath = entitySetPath;
- }
-
- protected void setIsBound(final boolean isBound) {
- this.isBound = isBound;
- }
-
- protected void setReturnType(final EdmReturnType returnType) {
- this.returnType = returnType;
- }
-
- @Override
- public EdmParameter getParameter(final String name) {
- return parameters.get(name);
- }
-
- @Override
- public List<String> getParameterNames() {
- if (parameterNames == null) {
- parameterNames = new ArrayList<String>(parameters.size());
- for (String parameterName : parameters.keySet()) {
- parameterNames.add(parameterName);
- }
+
+ @Override
+ public EdmParameter getParameter(final String name) {
+ return parameters.get(name);
}
- return parameterNames;
- }
-
- @Override
- public EdmEntitySet getReturnedEntitySet(final EdmEntitySet bindingParameterEntitySet) {
- EdmEntitySet returnedEntitySet = null;
- if (bindingParameterEntitySet != null && entitySetPath != null) {
- final EdmBindingTarget relatedBindingTarget = bindingParameterEntitySet.
- getRelatedBindingTarget(entitySetPath);
- if (relatedBindingTarget == null) {
- throw new EdmException("Cannot find entity set with path: " + entitySetPath);
- }
- if (relatedBindingTarget instanceof EdmEntitySet) {
- returnedEntitySet = (EdmEntitySet) relatedBindingTarget;
- } else {
- throw new EdmException("BindingTarget with name: " + relatedBindingTarget.getName() + " must be an entity set");
- }
+
+ @Override
+ public List<String> getParameterNames() {
+ if (parameterNames == null) {
+ parameterNames = new ArrayList<String>(parameters.size());
+ for (String parameterName : parameters.keySet()) {
+ parameterNames.add(parameterName);
+ }
+ }
+ return parameterNames;
}
- return returnedEntitySet;
- }
- @Override
- public EdmReturnType getReturnType() {
- return returnType;
- }
+ @Override
+ public EdmEntitySet getReturnedEntitySet(final EdmEntitySet bindingParameterEntitySet) {
+ EdmEntitySet returnedEntitySet = null;
+ if (bindingParameterEntitySet != null && entitySetPath != null) {
+ final EdmBindingTarget relatedBindingTarget = bindingParameterEntitySet.
+ getRelatedBindingTarget(entitySetPath);
+ if (relatedBindingTarget == null) {
+ throw new EdmException("Cannot find entity set with path: " + entitySetPath);
+ }
+ if (relatedBindingTarget instanceof EdmEntitySet) {
+ returnedEntitySet = (EdmEntitySet) relatedBindingTarget;
+ } else {
+ throw new EdmException("BindingTarget with name: " + relatedBindingTarget.getName()
+ + " must be an entity set");
+ }
+ }
+ return returnedEntitySet;
+ }
- @Override
- public boolean isBound() {
- return isBound;
- }
+ @Override
+ public EdmReturnType getReturnType() {
+ return returnType;
+ }
+ @Override
+ public boolean isBound() {
+ return isBound;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java
index 96aa49f..fe81533 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java
@@ -27,37 +27,40 @@ import org.apache.olingo.commons.api.edm.Target;
public abstract class AbstractEdmOperationImport extends EdmNamedImpl implements EdmOperationImport {
- protected final EdmEntityContainer container;
-
- private final Target entitySet;
-
- private EdmEntitySet returnedEntitySet;
-
- public AbstractEdmOperationImport(final Edm edm, final EdmEntityContainer container, final String name,
- final Target entitySet) {
-
- super(edm, name);
- this.container = container;
- this.entitySet = entitySet;
- }
-
- @Override
- public EdmEntitySet getReturnedEntitySet() {
- if (entitySet != null && returnedEntitySet == null) {
- EdmEntityContainer entityContainer = edm.getEntityContainer(entitySet.getEntityContainer());
- if (entityContainer == null) {
- throw new EdmException("Can´t find entity container with name: " + entitySet.getEntityContainer());
- }
- returnedEntitySet = entityContainer.getEntitySet(entitySet.getTargetName());
- if (returnedEntitySet == null) {
- throw new EdmException("Can´t find entity set with name: " + entitySet.getTargetName());
- }
+ protected final EdmEntityContainer container;
+
+ private final Target entitySet;
+
+ private EdmEntitySet returnedEntitySet;
+
+ public AbstractEdmOperationImport(
+ final Edm edm,
+ final EdmEntityContainer container,
+ final String name,
+ final Target entitySet) {
+
+ super(edm, name);
+ this.container = container;
+ this.entitySet = entitySet;
}
- return returnedEntitySet;
- }
- @Override
- public EdmEntityContainer getEntityContainer() {
- return container;
- }
+ @Override
+ public EdmEntitySet getReturnedEntitySet() {
+ if (entitySet != null && returnedEntitySet == null) {
+ EdmEntityContainer entityContainer = edm.getEntityContainer(entitySet.getEntityContainer());
+ if (entityContainer == null) {
+ throw new EdmException("Can´t find entity container with name: " + entitySet.getEntityContainer());
+ }
+ returnedEntitySet = entityContainer.getEntitySet(entitySet.getTargetName());
+ if (returnedEntitySet == null) {
+ throw new EdmException("Can´t find entity set with name: " + entitySet.getTargetName());
+ }
+ }
+ return returnedEntitySet;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer() {
+ return container;
+ }
}
[24/52] [abbrv] git commit: Package rename
Posted by sk...@apache.org.
Package rename
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/c876e670
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/c876e670
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/c876e670
Branch: refs/heads/olingo-206-validator
Commit: c876e670763bd21adda3086710db130c0041f135
Parents: fdb1800
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sun Mar 23 16:39:40 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sun Mar 23 16:39:40 2014 +0100
----------------------------------------------------------------------
.../olingo/client/core/AbstractODataClient.java | 4 +-
.../core/edm/xml/AbstractComplexType.java | 2 +-
.../core/edm/xml/AbstractEntityContainer.java | 2 +-
.../client/core/edm/xml/AbstractEntitySet.java | 2 +-
.../client/core/edm/xml/AbstractEntityType.java | 2 +-
.../client/core/edm/xml/AbstractEnumType.java | 2 +-
.../client/core/edm/xml/AbstractSchema.java | 2 +-
.../core/edm/xml/DataServicesDeserializer.java | 2 +-
.../client/core/edm/xml/EdmxDeserializer.java | 2 +-
.../client/core/edm/xml/EntityKeyImpl.java | 2 +-
.../core/edm/xml/ParameterDeserializer.java | 2 +-
.../core/edm/xml/PropertyDeserializer.java | 2 +-
.../edm/xml/v3/AnnotationsDeserializer.java | 2 +-
.../edm/xml/v3/AssociationDeserializer.java | 2 +-
.../edm/xml/v3/AssociationSetDeserializer.java | 2 +-
.../edm/xml/v3/FunctionImportDeserializer.java | 2 +-
.../ReferentialConstraintRoleDeserializer.java | 2 +-
.../edm/xml/v3/TypeAnnotationDeserializer.java | 2 +-
.../core/edm/xml/v4/ActionDeserializer.java | 2 +-
.../core/edm/xml/v4/AnnotationDeserializer.java | 2 +-
.../edm/xml/v4/AnnotationsDeserializer.java | 2 +-
.../core/edm/xml/v4/FunctionDeserializer.java | 2 +-
.../xml/v4/NavigationPropertyDeserializer.java | 2 +-
.../core/edm/xml/v4/ReferenceDeserializer.java | 2 +-
.../core/edm/xml/v4/ReturnTypeDeserializer.java | 2 +-
.../core/edm/xml/v4/SingletonDeserializer.java | 2 +-
.../core/edm/xml/v4/TermDeserializer.java | 2 +-
.../edm/xml/v4/TypeDefinitionDeserializer.java | 2 +-
.../xml/v4/annotation/ApplyDeserializer.java | 2 +-
.../edm/xml/v4/annotation/CastDeserializer.java | 2 +-
.../v4/annotation/CollectionDeserializer.java | 2 +-
.../DynExprConstructDeserializer.java | 2 +-
.../edm/xml/v4/annotation/IsOfDeserializer.java | 2 +-
.../annotation/LabeledElementDeserializer.java | 2 +-
.../edm/xml/v4/annotation/NullDeserializer.java | 2 +-
.../annotation/PropertyValueDeserializer.java | 2 +-
.../xml/v4/annotation/RecordDeserializer.java | 2 +-
.../xml/v4/annotation/UrlRefDeserializer.java | 2 +-
.../client/core/op/AbstractEdmDeserializer.java | 71 ++++
.../client/core/op/AbstractJacksonTool.java | 85 ++++
.../client/core/op/AbstractODataBinder.java | 404 +++++++++++++++++++
.../core/op/AbstractODataDeserializer.java | 107 +++++
.../client/core/op/AbstractODataReader.java | 117 ++++++
.../client/core/op/AbstractODataSerializer.java | 141 +++++++
.../client/core/op/ComplexTypeDeserializer.java | 83 ++++
.../core/op/EntityContainerDeserializer.java | 102 +++++
.../client/core/op/EntityKeyDeserializer.java | 50 +++
.../client/core/op/EntitySetDeserializer.java | 70 ++++
.../client/core/op/EntityTypeDeserializer.java | 92 +++++
.../client/core/op/EnumTypeDeserializer.java | 73 ++++
.../core/op/InjectableSerializerProvider.java | 43 ++
.../client/core/op/ODataObjectFactoryImpl.java | 165 ++++++++
.../olingo/client/core/op/ODataWriterImpl.java | 101 +++++
.../olingo/client/core/op/ResourceFactory.java | 125 ++++++
.../client/core/op/SchemaDeserializer.java | 149 +++++++
.../core/op/impl/AbstractEdmDeserializer.java | 71 ----
.../core/op/impl/AbstractJacksonTool.java | 85 ----
.../core/op/impl/AbstractODataBinder.java | 404 -------------------
.../core/op/impl/AbstractODataDeserializer.java | 107 -----
.../core/op/impl/AbstractODataReader.java | 117 ------
.../core/op/impl/AbstractODataSerializer.java | 141 -------
.../core/op/impl/ComplexTypeDeserializer.java | 83 ----
.../op/impl/EntityContainerDeserializer.java | 102 -----
.../core/op/impl/EntityKeyDeserializer.java | 50 ---
.../core/op/impl/EntitySetDeserializer.java | 70 ----
.../core/op/impl/EntityTypeDeserializer.java | 92 -----
.../core/op/impl/EnumTypeDeserializer.java | 73 ----
.../op/impl/InjectableSerializerProvider.java | 43 --
.../core/op/impl/ODataObjectFactoryImpl.java | 165 --------
.../client/core/op/impl/ODataWriterImpl.java | 101 -----
.../client/core/op/impl/ResourceFactory.java | 125 ------
.../client/core/op/impl/SchemaDeserializer.java | 149 -------
.../client/core/op/impl/v3/ODataBinderImpl.java | 2 +-
.../core/op/impl/v3/ODataDeserializerImpl.java | 2 +-
.../client/core/op/impl/v3/ODataReaderImpl.java | 2 +-
.../core/op/impl/v3/ODataSerializerImpl.java | 2 +-
.../client/core/op/impl/v4/ODataBinderImpl.java | 2 +-
.../core/op/impl/v4/ODataDeserializerImpl.java | 2 +-
.../client/core/op/impl/v4/ODataReaderImpl.java | 2 +-
.../core/op/impl/v4/ODataSerializerImpl.java | 2 +-
.../core/it/v3/EntityRetrieveTestITCase.java | 2 +-
.../client/core/it/v3/EntitySetTestITCase.java | 2 +-
.../olingo/client/core/v3/EntitySetTest.java | 2 +-
.../olingo/client/core/v3/EntityTest.java | 2 +-
84 files changed, 2029 insertions(+), 2029 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index 2ecd92c..b5cfdea 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -23,8 +23,8 @@ import org.apache.olingo.client.api.domain.ODataObjectFactory;
import org.apache.olingo.client.api.op.ODataWriter;
import org.apache.olingo.client.core.domain.ODataGeospatialValueImpl;
import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
-import org.apache.olingo.client.core.op.impl.ODataObjectFactoryImpl;
-import org.apache.olingo.client.core.op.impl.ODataWriterImpl;
+import org.apache.olingo.client.core.op.ODataObjectFactoryImpl;
+import org.apache.olingo.client.core.op.ODataWriterImpl;
public abstract class AbstractODataClient implements CommonODataClient {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractComplexType.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractComplexType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractComplexType.java
index 30d2142..0630a59 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractComplexType.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractComplexType.java
@@ -23,7 +23,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.apache.olingo.client.api.edm.xml.CommonNavigationProperty;
import org.apache.olingo.client.api.edm.xml.CommonProperty;
import org.apache.olingo.client.api.edm.xml.ComplexType;
-import org.apache.olingo.client.core.op.impl.ComplexTypeDeserializer;
+import org.apache.olingo.client.core.op.ComplexTypeDeserializer;
@JsonDeserialize(using = ComplexTypeDeserializer.class)
public abstract class AbstractComplexType extends AbstractEdmItem implements ComplexType {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityContainer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityContainer.java
index ade3a6b..c15266e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityContainer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityContainer.java
@@ -25,7 +25,7 @@ import java.util.List;
import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
import org.apache.olingo.client.api.edm.xml.EntityContainer;
import org.apache.olingo.client.api.edm.xml.EntitySet;
-import org.apache.olingo.client.core.op.impl.EntityContainerDeserializer;
+import org.apache.olingo.client.core.op.EntityContainerDeserializer;
@JsonDeserialize(using = EntityContainerDeserializer.class)
public abstract class AbstractEntityContainer extends AbstractEdmItem implements EntityContainer {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntitySet.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntitySet.java
index 722610a..65650f3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntitySet.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntitySet.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.edm.xml;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.apache.olingo.client.api.edm.xml.EntitySet;
-import org.apache.olingo.client.core.op.impl.EntitySetDeserializer;
+import org.apache.olingo.client.core.op.EntitySetDeserializer;
@JsonDeserialize(using = EntitySetDeserializer.class)
public abstract class AbstractEntitySet extends AbstractEdmItem implements EntitySet {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityType.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityType.java
index d30e124..e375323 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityType.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEntityType.java
@@ -22,7 +22,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.apache.olingo.client.api.edm.xml.EntityKey;
import org.apache.olingo.client.api.edm.xml.EntityType;
-import org.apache.olingo.client.core.op.impl.EntityTypeDeserializer;
+import org.apache.olingo.client.core.op.EntityTypeDeserializer;
@JsonDeserialize(using = EntityTypeDeserializer.class)
public abstract class AbstractEntityType extends AbstractComplexType implements EntityType {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEnumType.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEnumType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEnumType.java
index 2afa794..3730fad 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEnumType.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEnumType.java
@@ -25,7 +25,7 @@ import java.util.List;
import org.apache.olingo.client.api.edm.xml.EnumType;
import org.apache.olingo.client.api.edm.xml.Member;
-import org.apache.olingo.client.core.op.impl.EnumTypeDeserializer;
+import org.apache.olingo.client.core.op.EnumTypeDeserializer;
@JsonDeserialize(using = EnumTypeDeserializer.class)
public abstract class AbstractEnumType extends AbstractEdmItem implements EnumType {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractSchema.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractSchema.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractSchema.java
index b099c31..6cc2915 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractSchema.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractSchema.java
@@ -24,7 +24,7 @@ import org.apache.olingo.client.api.edm.xml.ComplexType;
import org.apache.olingo.client.api.edm.xml.EntityType;
import org.apache.olingo.client.api.edm.xml.EnumType;
import org.apache.olingo.client.api.edm.xml.Schema;
-import org.apache.olingo.client.core.op.impl.SchemaDeserializer;
+import org.apache.olingo.client.core.op.SchemaDeserializer;
@JsonDeserialize(using = SchemaDeserializer.class)
public abstract class AbstractSchema extends AbstractEdmItem implements Schema {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
index a7ded8a..94ec6bb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesDeserializer.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.edm.xml;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import com.fasterxml.jackson.core.JsonParser;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
index 796624b..a3041f0 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxDeserializer.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core.edm.xml;
import org.apache.olingo.client.core.edm.xml.v4.ReferenceImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import com.fasterxml.jackson.core.JsonParser;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java
index 9880a3a..8074e69 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java
@@ -25,7 +25,7 @@ import java.util.List;
import org.apache.olingo.client.api.edm.xml.EntityKey;
import org.apache.olingo.client.api.edm.xml.PropertyRef;
-import org.apache.olingo.client.core.op.impl.EntityKeyDeserializer;
+import org.apache.olingo.client.core.op.EntityKeyDeserializer;
@JsonDeserialize(using = EntityKeyDeserializer.class)
public class EntityKeyImpl extends AbstractEdmItem implements EntityKey {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
index 2587bce..cb0178d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterDeserializer.java
@@ -27,7 +27,7 @@ import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.olingo.client.api.edm.xml.v3.ParameterMode;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ParameterDeserializer extends AbstractEdmDeserializer<AbstractParameter> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
index 6e874b4..ec40746 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyDeserializer.java
@@ -24,7 +24,7 @@ import org.apache.commons.lang3.BooleanUtils;
import org.apache.olingo.client.api.edm.ConcurrencyMode;
import org.apache.olingo.client.api.edm.StoreGeneratedPattern;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AnnotationsDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AnnotationsDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AnnotationsDeserializer.java
index 4fec055..b1e7624 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AnnotationsDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AnnotationsDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class AnnotationsDeserializer extends AbstractEdmDeserializer<AnnotationsImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationDeserializer.java
index 6d999c2..7031453 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class AssociationDeserializer extends AbstractEdmDeserializer<AssociationImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationSetDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationSetDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationSetDeserializer.java
index 4b04aa0..1f74893 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationSetDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/AssociationSetDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class AssociationSetDeserializer extends AbstractEdmDeserializer<AssociationSetImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/FunctionImportDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/FunctionImportDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/FunctionImportDeserializer.java
index 4cca7c8..e0539f5 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/FunctionImportDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/FunctionImportDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class FunctionImportDeserializer extends AbstractEdmDeserializer<FunctionImportImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/ReferentialConstraintRoleDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/ReferentialConstraintRoleDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/ReferentialConstraintRoleDeserializer.java
index 6a46e1e..7212767 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/ReferentialConstraintRoleDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/ReferentialConstraintRoleDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.PropertyRefImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class ReferentialConstraintRoleDeserializer extends AbstractEdmDeserializer<ReferentialConstraintRoleImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/TypeAnnotationDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/TypeAnnotationDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/TypeAnnotationDeserializer.java
index 331f1b1..e111a3c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/TypeAnnotationDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v3/TypeAnnotationDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class TypeAnnotationDeserializer extends AbstractEdmDeserializer<TypeAnnotationImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ActionDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ActionDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ActionDeserializer.java
index 3bde506..e3d0b6a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ActionDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ActionDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class ActionDeserializer extends AbstractEdmDeserializer<ActionImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationDeserializer.java
index 7de7a3e..a12b396 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.annotation.DynExprConstructImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class AnnotationDeserializer extends AbstractEdmDeserializer<AnnotationImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationsDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationsDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationsDeserializer.java
index c46adb5..9ff511b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationsDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/AnnotationsDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class AnnotationsDeserializer extends AbstractEdmDeserializer<AnnotationsImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/FunctionDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/FunctionDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/FunctionDeserializer.java
index f316d2f..cd55f1d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/FunctionDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/FunctionDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class FunctionDeserializer extends AbstractEdmDeserializer<FunctionImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/NavigationPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/NavigationPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/NavigationPropertyDeserializer.java
index f1dc46f..d864361 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/NavigationPropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/NavigationPropertyDeserializer.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core.edm.xml.v4;
import org.apache.olingo.client.core.edm.xml.OnDeleteImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReferenceDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReferenceDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReferenceDeserializer.java
index 839f3c9..1b9f971 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReferenceDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReferenceDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import java.net.URI;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class ReferenceDeserializer extends AbstractEdmDeserializer<ReferenceImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReturnTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReturnTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReturnTypeDeserializer.java
index 89c4070..24ef200 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReturnTypeDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/ReturnTypeDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class ReturnTypeDeserializer extends AbstractEdmDeserializer<ReturnTypeImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/SingletonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/SingletonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/SingletonDeserializer.java
index d97dcd4..cfd4324 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/SingletonDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/SingletonDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class SingletonDeserializer extends AbstractEdmDeserializer<SingletonImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TermDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TermDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TermDeserializer.java
index f1b756e..4e3d89b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TermDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TermDeserializer.java
@@ -28,7 +28,7 @@ import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.edm.xml.v4.CSDLElement;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class TermDeserializer extends AbstractEdmDeserializer<TermImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TypeDefinitionDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TypeDefinitionDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TypeDefinitionDeserializer.java
index 28dee4d..c270cae 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TypeDefinitionDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/TypeDefinitionDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class TypeDefinitionDeserializer extends AbstractEdmDeserializer<TypeDefinitionImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ApplyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ApplyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ApplyDeserializer.java
index e847c9d..68aec7d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ApplyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ApplyDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class ApplyDeserializer extends AbstractEdmDeserializer<Apply> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CastDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CastDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CastDeserializer.java
index b143d70..d2ba56c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CastDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CastDeserializer.java
@@ -27,7 +27,7 @@ import java.io.IOException;
import java.math.BigInteger;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class CastDeserializer extends AbstractEdmDeserializer<Cast> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CollectionDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CollectionDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CollectionDeserializer.java
index 3916f8d..52ad3c1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CollectionDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/CollectionDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class CollectionDeserializer extends AbstractEdmDeserializer<Collection> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java
index 831a8a3..b7b7c66 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java
@@ -28,7 +28,7 @@ import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.ClassUtils;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class DynExprConstructDeserializer extends AbstractEdmDeserializer<DynExprConstructImpl> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java
index 51bafd6..a929563 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java
@@ -27,7 +27,7 @@ import java.io.IOException;
import java.math.BigInteger;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class IsOfDeserializer extends AbstractEdmDeserializer<IsOf> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java
index da99713..7f3615f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class LabeledElementDeserializer extends AbstractEdmDeserializer<LabeledElement> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java
index 192be27..2bdb288 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class NullDeserializer extends AbstractEdmDeserializer<Null> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
index 7a52412..a329658 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class PropertyValueDeserializer extends AbstractEdmDeserializer<PropertyValue> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java
index efe49cc..32ae5ba 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class RecordDeserializer extends AbstractEdmDeserializer<Record> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
index f4fab83..804a08d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import java.io.IOException;
-import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.client.core.op.AbstractEdmDeserializer;
public class UrlRefDeserializer extends AbstractEdmDeserializer<UrlRef> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractEdmDeserializer.java
new file mode 100644
index 0000000..ac00cf3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractEdmDeserializer.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.client.core.op;
+
+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.client.api.CommonODataClient;
+import org.apache.olingo.client.core.edm.xml.v4.ReturnTypeImpl;
+import org.apache.olingo.client.core.edm.xml.v4.annotation.ConstExprConstructImpl;
+
+public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
+
+ protected CommonODataClient client;
+
+ protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
+ return ConstExprConstructImpl.Type.fromString(jp.getCurrentName()) != null;
+ }
+
+ protected ConstExprConstructImpl parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
+ final ConstExprConstructImpl constExpr = new ConstExprConstructImpl();
+ constExpr.setType(ConstExprConstructImpl.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.readValueAs( 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 = (CommonODataClient) ctxt.findInjectableValue(CommonODataClient.class.getName(), null, null);
+ return doDeserialize(jp, ctxt);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java
new file mode 100644
index 0000000..901b175
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.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.client.core.op;
+
+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.client.api.CommonODataClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+abstract class AbstractJacksonTool {
+
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractJacksonTool.class);
+
+ protected final CommonODataClient client;
+
+ protected AbstractJacksonTool(final CommonODataClient client) {
+ this.client = client;
+ }
+
+ protected ObjectMapper getObjectMapper() {
+ final ObjectMapper mapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
+
+ mapper.setInjectableValues(new InjectableValues.Std().addValue(CommonODataClient.class, client));
+
+ mapper.setSerializerProvider(new InjectableSerializerProvider(mapper.getSerializerProvider(),
+ mapper.getSerializationConfig().withAttribute(CommonODataClient.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(CommonODataClient.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/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
new file mode 100644
index 0000000..a7f9a44
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -0,0 +1,404 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.op;
+
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.Iterator;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.client.api.data.Entry;
+import org.apache.olingo.client.api.data.Feed;
+import org.apache.olingo.client.api.data.Link;
+import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.data.ServiceDocumentItem;
+import org.apache.olingo.client.api.data.Value;
+import org.apache.olingo.client.api.domain.ODataCollectionValue;
+import org.apache.olingo.client.api.domain.ODataComplexValue;
+import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.domain.ODataInlineEntity;
+import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.client.api.domain.ODataLink;
+import org.apache.olingo.client.api.domain.ODataOperation;
+import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.api.op.CommonODataBinder;
+import org.apache.olingo.client.core.data.CollectionValueImpl;
+import org.apache.olingo.client.core.data.ComplexValueImpl;
+import org.apache.olingo.client.core.data.GeospatialValueImpl;
+import org.apache.olingo.client.core.data.JSONPropertyImpl;
+import org.apache.olingo.client.core.data.LinkImpl;
+import org.apache.olingo.client.core.data.NullValueImpl;
+import org.apache.olingo.client.core.data.PrimitiveValueImpl;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractODataBinder implements CommonODataBinder {
+
+ private static final long serialVersionUID = 454285889193689536L;
+
+ /**
+ * Logger.
+ */
+ protected final Logger LOG = LoggerFactory.getLogger(AbstractODataBinder.class);
+
+ protected final CommonODataClient client;
+
+ protected AbstractODataBinder(final CommonODataClient client) {
+ this.client = client;
+ }
+
+ @Override
+ public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
+ final ODataServiceDocument serviceDocument = new ODataServiceDocument();
+
+ for (ServiceDocumentItem entitySet : resource.getEntitySets()) {
+ // handles V3 JSON format oddities, where title is not contained
+ serviceDocument.getEntitySets().put(StringUtils.isBlank(entitySet.getTitle())
+ ? entitySet.getName() : entitySet.getTitle(),
+ URIUtils.getURI(resource.getBaseURI(), entitySet.getHref()));
+ }
+
+ return serviceDocument;
+ }
+
+ @Override
+ public Feed getFeed(final ODataEntitySet feed, final Class<? extends Feed> reference) {
+ final Feed feedResource = ResourceFactory.newFeed(reference);
+
+ feedResource.setCount(feed.getCount());
+
+ final URI next = feed.getNext();
+ if (next != null) {
+ feedResource.setNext(next);
+ }
+
+ for (ODataEntity entity : feed.getEntities()) {
+ feedResource.getEntries().add(getEntry(entity, ResourceFactory.entryClassForFeed(reference)));
+ }
+
+ return feedResource;
+ }
+
+ @Override
+ public Entry getEntry(final ODataEntity entity, final Class<? extends Entry> reference) {
+ return getEntry(entity, reference, true);
+ }
+
+ @Override
+ public Entry getEntry(final ODataEntity entity, final Class<? extends Entry> reference, final boolean setType) {
+ final Entry entry = ResourceFactory.newEntry(reference);
+ entry.setType(entity.getName());
+
+ // -------------------------------------------------------------
+ // Add edit and self link
+ // -------------------------------------------------------------
+ final URI editLink = entity.getEditLink();
+ if (editLink != null) {
+ final LinkImpl entryEditLink = new LinkImpl();
+ entryEditLink.setTitle(entity.getName());
+ entryEditLink.setHref(editLink.toASCIIString());
+ entryEditLink.setRel(Constants.EDIT_LINK_REL);
+ entry.setEditLink(entryEditLink);
+ }
+
+ if (entity.isReadOnly()) {
+ final LinkImpl entrySelfLink = new LinkImpl();
+ entrySelfLink.setTitle(entity.getName());
+ entrySelfLink.setHref(entity.getLink().toASCIIString());
+ entrySelfLink.setRel(Constants.SELF_LINK_REL);
+ entry.setSelfLink(entrySelfLink);
+ }
+ // -------------------------------------------------------------
+
+ // -------------------------------------------------------------
+ // Append navigation links (handling inline entry / feed as well)
+ // -------------------------------------------------------------
+ // handle navigation links
+ for (ODataLink link : entity.getNavigationLinks()) {
+ // append link
+ LOG.debug("Append navigation link\n{}", link);
+ entry.getNavigationLinks().add(getLink(link,
+ ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
+ }
+ // -------------------------------------------------------------
+
+ // -------------------------------------------------------------
+ // Append edit-media links
+ // -------------------------------------------------------------
+ for (ODataLink link : entity.getEditMediaLinks()) {
+ LOG.debug("Append edit-media link\n{}", link);
+ entry.getMediaEditLinks().add(getLink(link,
+ ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
+ }
+ // -------------------------------------------------------------
+
+ // -------------------------------------------------------------
+ // Append association links
+ // -------------------------------------------------------------
+ for (ODataLink link : entity.getAssociationLinks()) {
+ LOG.debug("Append association link\n{}", link);
+ entry.getAssociationLinks().add(getLink(link,
+ ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
+ }
+ // -------------------------------------------------------------
+
+ if (entity.isMediaEntity()) {
+ entry.setMediaContentSource(entity.getMediaContentSource());
+ entry.setMediaContentType(entity.getMediaContentType());
+ }
+
+ for (ODataProperty property : entity.getProperties()) {
+ entry.getProperties().add(getProperty(property, reference, setType));
+ }
+
+ return entry;
+ }
+
+ @Override
+ public Link getLink(final ODataLink link, boolean isXML) {
+ final Link linkResource = new LinkImpl();
+ linkResource.setRel(link.getRel());
+ linkResource.setTitle(link.getName());
+ linkResource.setHref(link.getLink() == null ? null : link.getLink().toASCIIString());
+ linkResource.setType(link.getType().toString());
+ linkResource.setMediaETag(link.getMediaETag());
+
+ if (link instanceof ODataInlineEntity) {
+ // append inline entity
+ final ODataEntity inlineEntity = ((ODataInlineEntity) link).getEntity();
+ LOG.debug("Append in-line entity\n{}", inlineEntity);
+
+ linkResource.setInlineEntry(getEntry(inlineEntity, ResourceFactory.entryClassForFormat(isXML)));
+ } else if (link instanceof ODataInlineEntitySet) {
+ // append inline feed
+ final ODataEntitySet InlineFeed = ((ODataInlineEntitySet) link).getEntitySet();
+ LOG.debug("Append in-line feed\n{}", InlineFeed);
+
+ linkResource.setInlineFeed(getFeed(InlineFeed, ResourceFactory.feedClassForFormat(isXML)));
+ }
+
+ return linkResource;
+ }
+
+ @Override
+ public Property getProperty(final ODataProperty property, final Class<? extends Entry> reference,
+ final boolean setType) {
+
+ final Property propertyResource = ResourceFactory.newProperty(reference);
+ propertyResource.setName(property.getName());
+ propertyResource.setValue(getValue(property.getValue(), reference, setType));
+
+ if (setType) {
+ if (property.hasPrimitiveValue()) {
+ propertyResource.setType(property.getPrimitiveValue().getType().toString());
+ } else if (property.hasComplexValue()) {
+ propertyResource.setType(property.getComplexValue().getType());
+ } else if (property.hasCollectionValue()) {
+ propertyResource.setType(property.getCollectionValue().getType());
+ }
+ }
+
+ return propertyResource;
+ }
+
+ private Value getValue(final ODataValue value, final Class<? extends Entry> reference, final boolean setType) {
+ Value valueResource = null;
+
+ if (value == null) {
+ valueResource = new NullValueImpl();
+ } else if (value.isPrimitive()) {
+ valueResource = new PrimitiveValueImpl(value.asPrimitive().toString());
+ } else if (value.isGeospatial()) {
+ valueResource = new GeospatialValueImpl(value.asGeospatial().toValue());
+ } else if (value.isComplex()) {
+ final ODataComplexValue _value = value.asComplex();
+ valueResource = new ComplexValueImpl();
+
+ for (final Iterator<ODataProperty> itor = _value.iterator(); itor.hasNext();) {
+ valueResource.asComplex().get().add(getProperty(itor.next(), reference, setType));
+ }
+ } else if (value.isCollection()) {
+ final ODataCollectionValue _value = value.asCollection();
+ valueResource = new CollectionValueImpl();
+
+ for (final Iterator<ODataValue> itor = _value.iterator(); itor.hasNext();) {
+ valueResource.asCollection().get().add(getValue(itor.next(), reference, setType));
+ }
+ }
+
+ return valueResource;
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource) {
+ return getODataEntitySet(resource, null);
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource, final URI defaultBaseURI) {
+ if (LOG.isDebugEnabled()) {
+ final StringWriter writer = new StringWriter();
+ client.getSerializer().feed(resource, writer);
+ writer.flush();
+ LOG.debug("Feed -> ODataEntitySet:\n{}", writer.toString());
+ }
+
+ final URI base = defaultBaseURI == null ? resource.getBaseURI() : defaultBaseURI;
+
+ final URI next = resource.getNext();
+
+ final ODataEntitySet entitySet = next == null
+ ? client.getObjectFactory().newEntitySet()
+ : client.getObjectFactory().newEntitySet(URIUtils.getURI(base, next.toASCIIString()));
+
+ if (resource.getCount() != null) {
+ entitySet.setCount(resource.getCount());
+ }
+
+ for (Entry entryResource : resource.getEntries()) {
+ entitySet.addEntity(getODataEntity(entryResource));
+ }
+
+ return entitySet;
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource) {
+ return getODataEntity(resource, null);
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
+ if (LOG.isDebugEnabled()) {
+ final StringWriter writer = new StringWriter();
+ client.getSerializer().entry(resource, writer);
+ writer.flush();
+ LOG.debug("EntryResource -> ODataEntity:\n{}", writer.toString());
+ }
+
+ final URI base = defaultBaseURI == null ? resource.getBaseURI() : defaultBaseURI;
+
+ final ODataEntity entity = resource.getSelfLink() == null
+ ? client.getObjectFactory().newEntity(resource.getType())
+ : client.getObjectFactory().newEntity(resource.getType(),
+ URIUtils.getURI(base, resource.getSelfLink().getHref()));
+
+ if (StringUtils.isNotBlank(resource.getETag())) {
+ entity.setETag(resource.getETag());
+ }
+
+ if (resource.getEditLink() != null) {
+ entity.setEditLink(URIUtils.getURI(base, resource.getEditLink().getHref()));
+ }
+
+ for (Link link : resource.getAssociationLinks()) {
+ entity.addLink(client.getObjectFactory().newAssociationLink(link.getTitle(), base, link.getHref()));
+ }
+
+ for (Link link : resource.getNavigationLinks()) {
+ final Entry inlineEntry = link.getInlineEntry();
+ final Feed inlineFeed = link.getInlineFeed();
+
+ if (inlineEntry == null && inlineFeed == null) {
+ entity.addLink(
+ client.getObjectFactory().newEntityNavigationLink(link.getTitle(), base, link.getHref()));
+ } else if (inlineFeed == null) {
+ entity.addLink(client.getObjectFactory().newInlineEntity(
+ link.getTitle(), base, link.getHref(),
+ getODataEntity(inlineEntry,
+ inlineEntry.getBaseURI() == null ? base : inlineEntry.getBaseURI())));
+ } else {
+ entity.addLink(client.getObjectFactory().newInlineEntitySet(
+ link.getTitle(), base, link.getHref(),
+ getODataEntitySet(inlineFeed,
+ inlineFeed.getBaseURI() == null ? base : inlineFeed.getBaseURI())));
+ }
+ }
+
+ for (Link link : resource.getMediaEditLinks()) {
+ entity.addLink(client.getObjectFactory().newMediaEditLink(link.getTitle(), base, link.getHref()));
+ }
+
+ for (ODataOperation operation : resource.getOperations()) {
+ operation.setTarget(URIUtils.getURI(base, operation.getTarget()));
+ entity.getOperations().add(operation);
+ }
+
+ if (resource.isMediaEntry()) {
+ entity.setMediaEntity(true);
+ entity.setMediaContentSource(resource.getMediaContentSource());
+ entity.setMediaContentType(resource.getMediaContentType());
+ }
+
+ for (Property property : resource.getProperties()) {
+ entity.getProperties().add(getODataProperty(property));
+ }
+
+ return entity;
+ }
+
+ @Override
+ public ODataProperty getODataProperty(final Property property) {
+ return new ODataProperty(property.getName(), getODataValue(property));
+ }
+
+ private ODataValue getODataValue(final Property resource) {
+ ODataValue value = null;
+
+ if (resource.getValue().isSimple()) {
+ value = client.getPrimitiveValueBuilder().
+ setText(resource.getValue().asSimple().get()).
+ setType(resource.getType() == null
+ ? null
+ : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
+ } else if (resource.getValue().isGeospatial()) {
+ value = client.getGeospatialValueBuilder().
+ setValue(resource.getValue().asGeospatial().get()).
+ setType(resource.getType() == null
+ || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
+ || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().toString().equals(resource.getType())
+ ? null
+ : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
+ } else if (resource.getValue().isComplex()) {
+ value = new ODataComplexValue(resource.getType());
+
+ for (Property property : resource.getValue().asComplex().get()) {
+ value.asComplex().add(getODataProperty(property));
+ }
+ } else if (resource.getValue().isCollection()) {
+ value = new ODataCollectionValue(resource.getType());
+
+ for (Value _value : resource.getValue().asCollection().get()) {
+ final JSONPropertyImpl fake = new JSONPropertyImpl();
+ fake.setValue(_value);
+ value.asCollection().add(getODataValue(fake));
+ }
+ }
+
+ return value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
new file mode 100644
index 0000000..483dc7b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.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.client.core.op;
+
+import java.io.InputStream;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.data.Entry;
+import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.client.api.data.Feed;
+import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.api.op.CommonODataDeserializer;
+import org.apache.olingo.client.core.data.AtomDeserializer;
+import org.apache.olingo.client.core.data.AtomEntryImpl;
+import org.apache.olingo.client.core.data.AtomFeedImpl;
+import org.apache.olingo.client.core.data.AtomPropertyImpl;
+import org.apache.olingo.client.core.data.JSONEntryImpl;
+import org.apache.olingo.client.core.data.JSONErrorBundle;
+import org.apache.olingo.client.core.data.JSONFeedImpl;
+import org.apache.olingo.client.core.data.JSONPropertyImpl;
+import org.apache.olingo.client.core.data.XMLErrorImpl;
+
+public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements CommonODataDeserializer {
+
+ private static final long serialVersionUID = -4244158979195609909L;
+
+ private final AtomDeserializer atomDeserializer;
+
+ public AbstractODataDeserializer(final CommonODataClient client) {
+ super(client);
+
+ this.atomDeserializer = new AtomDeserializer(client.getServiceVersion());
+ }
+
+ @Override
+ public Feed toFeed(final InputStream input, final ODataPubFormat format) {
+ return format == ODataPubFormat.ATOM
+ ? atom(input, AtomFeedImpl.class)
+ : json(input, JSONFeedImpl.class);
+ }
+
+ @Override
+ public Entry toEntry(final InputStream input, final ODataPubFormat format) {
+ return format == ODataPubFormat.ATOM
+ ? atom(input, AtomEntryImpl.class)
+ : json(input, JSONEntryImpl.class);
+ }
+
+ @Override
+ public Property toProperty(final InputStream input, final ODataFormat format) {
+ return format == ODataFormat.XML
+ ? atom(input, AtomPropertyImpl.class)
+ : json(input, JSONPropertyImpl.class);
+ }
+
+ @Override
+ public ODataError toError(final InputStream input, final boolean isXML) {
+ return isXML
+ ? xml(input, XMLErrorImpl.class)
+ : json(input, JSONErrorBundle.class).getError();
+ }
+
+ /*
+ * ------------------ Protected methods ------------------
+ */
+ protected <T> T xml(final InputStream input, final Class<T> reference) {
+ try {
+ return getXmlMapper().readValue(input, reference);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
+ }
+ }
+
+ protected <T> T atom(final InputStream input, final Class<T> reference) {
+ try {
+ return atomDeserializer.read(input, reference);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
+ }
+ }
+
+ protected <T> T json(final InputStream input, final Class<T> reference) {
+ try {
+ return getObjectMapper().readValue(input, reference);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
new file mode 100644
index 0000000..031eb50
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.op;
+
+import java.io.InputStream;
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
+import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.client.api.op.CommonODataReader;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractODataReader implements CommonODataReader {
+
+ private static final long serialVersionUID = -1988865870981207079L;
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractODataReader.class);
+
+ protected final CommonODataClient client;
+
+ protected AbstractODataReader(final CommonODataClient client) {
+ this.client = client;
+ }
+
+ @Override
+ public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
+ return client.getBinder().getODataEntitySet(client.getDeserializer().toFeed(input, format));
+ }
+
+ @Override
+ public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
+ return client.getBinder().getODataEntity(client.getDeserializer().toEntry(input, format));
+ }
+
+ @Override
+ public ODataProperty readProperty(final InputStream input, final ODataFormat format) {
+ final Property property = client.getDeserializer().toProperty(input, format);
+ return client.getBinder().getODataProperty(property);
+ }
+
+ @Override
+ public ODataError readError(final InputStream inputStream, final boolean isXML) {
+ return client.getDeserializer().toError(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 (ODataValue.class.isAssignableFrom(reference)) {
+ res = client.getPrimitiveValueBuilder().
+ setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT
+ ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
+ setText(IOUtils.toString(src)).
+ build();
+ } else if (XMLMetadata.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/olingo-odata4/blob/c876e670/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
new file mode 100644
index 0000000..48a0b8d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.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.client.core.op;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.data.Entry;
+import org.apache.olingo.client.api.data.Feed;
+import org.apache.olingo.client.api.data.Link;
+import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.op.ODataSerializer;
+import org.apache.olingo.client.core.data.AtomEntryImpl;
+import org.apache.olingo.client.core.data.AtomFeedImpl;
+import org.apache.olingo.client.core.data.AtomPropertyImpl;
+import org.apache.olingo.client.core.data.AtomSerializer;
+import org.apache.olingo.client.core.data.JSONEntryImpl;
+import org.apache.olingo.client.core.data.JSONFeedImpl;
+import org.apache.olingo.client.core.data.JSONPropertyImpl;
+
+public abstract class AbstractODataSerializer extends AbstractJacksonTool implements ODataSerializer {
+
+ private static final long serialVersionUID = -357777648541325363L;
+
+ private final AtomSerializer atomSerializer;
+
+ public AbstractODataSerializer(final CommonODataClient client) {
+ super(client);
+
+ this.atomSerializer = new AtomSerializer(client.getServiceVersion());
+ }
+
+ @Override
+ public void feed(final Feed obj, final OutputStream out) {
+ feed(obj, new OutputStreamWriter(out));
+ }
+
+ @Override
+ public void feed(final Feed obj, final Writer writer) {
+ if (obj instanceof AtomFeedImpl) {
+ atom((AtomFeedImpl) obj, writer);
+ } else {
+ json((JSONFeedImpl) obj, writer);
+ }
+ }
+
+ @Override
+ public void entry(final Entry obj, final OutputStream out) {
+ entry(obj, new OutputStreamWriter(out));
+ }
+
+ @Override
+ public void entry(final Entry obj, final Writer writer) {
+ if (obj instanceof AtomEntryImpl) {
+ atom((AtomEntryImpl) obj, writer);
+ } else {
+ json((JSONEntryImpl) obj, writer);
+ }
+ }
+
+ @Override
+ public void property(final Property obj, final OutputStream out) {
+ property(obj, new OutputStreamWriter(out));
+ }
+
+ @Override
+ public void property(final Property obj, final Writer writer) {
+ if (obj instanceof AtomPropertyImpl) {
+ atom((AtomPropertyImpl) obj, writer);
+ } else {
+ json((JSONPropertyImpl) obj, writer);
+ }
+ }
+
+ @Override
+ public void link(final Link link, final ODataFormat format, final OutputStream out) {
+ link(link, format, new OutputStreamWriter(out));
+ }
+
+ @Override
+ public void link(final Link link, final ODataFormat format, final Writer writer) {
+ if (format == ODataFormat.XML) {
+ atom(link, writer);
+ } else {
+ jsonLink(link, writer);
+ }
+ }
+
+ /*
+ * ------------------ Protected methods ------------------
+ */
+ protected <T> void atom(final T obj, final Writer writer) {
+ try {
+ atomSerializer.write(writer, obj);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While serializing Atom object", e);
+ }
+ }
+
+ protected <T> 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 jsonLink(final Link link, final Writer writer) {
+ final ObjectMapper mapper = getObjectMapper();
+ final ObjectNode uri = mapper.createObjectNode();
+ uri.put(Constants.JSON_URL, link.getHref());
+
+ try {
+ mapper.writeValue(writer, uri);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While serializing JSON link", e);
+ }
+ }
+}
[14/52] [abbrv] [OLINGO-65] Geospatial types implemented,
EdmStream mock implemented with URI as backend, V3 pruned types implemented,
EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
index 1e92bab..eebfef3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
@@ -24,19 +24,28 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
+import org.apache.olingo.client.api.data.GeoUtils;
+import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
class JSONGeoValueDeserializer {
- private Point point(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type, final String crs) {
+ private final ODataServiceVersion version;
+
+ public JSONGeoValueDeserializer(final ODataServiceVersion version) {
+ this.version = version;
+ }
+
+ private Point point(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final String crs) {
Point point = null;
if (itor.hasNext()) {
@@ -48,7 +57,7 @@ class JSONGeoValueDeserializer {
return point;
}
- private MultiPoint multipoint(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+ private MultiPoint multipoint(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
final String crs) {
MultiPoint multiPoint = null;
@@ -67,7 +76,7 @@ class JSONGeoValueDeserializer {
return multiPoint;
}
- private LineString lineString(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+ private LineString lineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
final String crs) {
LineString lineString = null;
@@ -86,7 +95,7 @@ class JSONGeoValueDeserializer {
return lineString;
}
- private MultiLineString multiLineString(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+ private MultiLineString multiLineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
final String crs) {
MultiLineString multiLineString = null;
@@ -105,7 +114,7 @@ class JSONGeoValueDeserializer {
return multiLineString;
}
- private Polygon polygon(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+ private Polygon polygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
final String crs) {
List<Point> extPoints = null;
@@ -135,7 +144,7 @@ class JSONGeoValueDeserializer {
return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints);
}
- private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+ private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
final String crs) {
MultiPolygon multiPolygon = null;
@@ -154,7 +163,7 @@ class JSONGeoValueDeserializer {
return multiPolygon;
}
- private GeospatialCollection collection(final Iterator<JsonNode> itor, final ODataJClientEdmPrimitiveType type,
+ private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
final String crs) {
GeospatialCollection collection = null;
@@ -166,16 +175,16 @@ class JSONGeoValueDeserializer {
final JsonNode geo = itor.next();
final String collItemType = geo.get(Constants.ATTR_TYPE).asText();
final String callAsType;
- if (ODataJClientEdmPrimitiveType.GeographyCollection.name().equals(collItemType)
- || ODataJClientEdmPrimitiveType.GeometryCollection.name().equals(collItemType)) {
+ if (EdmPrimitiveTypeKind.GeographyCollection.name().equals(collItemType)
+ || EdmPrimitiveTypeKind.GeometryCollection.name().equals(collItemType)) {
callAsType = collItemType;
} else {
- callAsType = (type == ODataJClientEdmPrimitiveType.GeographyCollection ? "Geography" : "Geometry")
+ callAsType = (type == EdmPrimitiveTypeKind.GeographyCollection ? "Geography" : "Geometry")
+ collItemType;
}
- geospatials.add(deserialize(geo, ODataJClientEdmPrimitiveType.valueOf(callAsType)));
+ geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build()));
}
collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials);
@@ -186,9 +195,10 @@ class JSONGeoValueDeserializer {
return collection;
}
- public Geospatial deserialize(final JsonNode node, final ODataJClientEdmPrimitiveType type) {
- final ODataJClientEdmPrimitiveType actualType;
- if ((type == ODataJClientEdmPrimitiveType.Geography || type == ODataJClientEdmPrimitiveType.Geometry)
+ public Geospatial deserialize(final JsonNode node, final EdmTypeInfo typeInfo) {
+ final EdmPrimitiveTypeKind actualType;
+ if ((typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geography
+ || typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geometry)
&& node.has(Constants.ATTR_TYPE)) {
String nodeType = node.get(Constants.ATTR_TYPE).asText();
@@ -196,9 +206,9 @@ class JSONGeoValueDeserializer {
final int yIdx = nodeType.indexOf('y');
nodeType = nodeType.substring(yIdx + 1);
}
- actualType = ODataJClientEdmPrimitiveType.fromValue(type.toString() + nodeType);
+ actualType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getFullQualifiedName().toString() + nodeType);
} else {
- actualType = type;
+ actualType = typeInfo.getPrimitiveTypeKind();
}
final Iterator<JsonNode> cooItor = node.has(Constants.JSON_COORDINATES)
@@ -214,37 +224,37 @@ class JSONGeoValueDeserializer {
switch (actualType) {
case GeographyPoint:
case GeometryPoint:
- value = point(cooItor, type, crs);
+ value = point(cooItor, actualType, crs);
break;
case GeographyMultiPoint:
case GeometryMultiPoint:
- value = multipoint(cooItor, type, crs);
+ value = multipoint(cooItor, actualType, crs);
break;
case GeographyLineString:
case GeometryLineString:
- value = lineString(cooItor, type, crs);
+ value = lineString(cooItor, actualType, crs);
break;
case GeographyMultiLineString:
case GeometryMultiLineString:
- value = multiLineString(cooItor, type, crs);
+ value = multiLineString(cooItor, actualType, crs);
break;
case GeographyPolygon:
case GeometryPolygon:
- value = polygon(cooItor, type, crs);
+ value = polygon(cooItor, actualType, crs);
break;
case GeographyMultiPolygon:
case GeometryMultiPolygon:
- value = multiPolygon(cooItor, type, crs);
+ value = multiPolygon(cooItor, actualType, crs);
break;
case GeographyCollection:
case GeometryCollection:
- value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), type, crs);
+ value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, crs);
break;
default:
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
index 207ded6..2e692ae 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
@@ -22,16 +22,16 @@ import com.fasterxml.jackson.core.JsonGenerator;
import java.io.IOException;
import java.util.Iterator;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.ComposedGeospatial;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.ComposedGeospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
class JSONGeoValueSerializer {
@@ -106,17 +106,17 @@ class JSONGeoValueSerializer {
}
public void serialize(final JsonGenerator jgen, final Geospatial value) throws IOException {
- if (value.getEdmSimpleType().equals(ODataJClientEdmPrimitiveType.GeographyCollection)
- || value.getEdmSimpleType().equals(ODataJClientEdmPrimitiveType.GeometryCollection)) {
+ if (value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeographyCollection)
+ || value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) {
- jgen.writeStringField(Constants.ATTR_TYPE, ODataJClientEdmPrimitiveType.GeometryCollection.name());
+ jgen.writeStringField(Constants.ATTR_TYPE, EdmPrimitiveTypeKind.GeometryCollection.name());
} else {
- final int yIdx = value.getEdmSimpleType().name().indexOf('y');
- final String itemType = value.getEdmSimpleType().name().substring(yIdx + 1);
+ final int yIdx = value.getEdmPrimitiveTypeKind().name().indexOf('y');
+ final String itemType = value.getEdmPrimitiveTypeKind().name().substring(yIdx + 1);
jgen.writeStringField(Constants.ATTR_TYPE, itemType);
}
- switch (value.getEdmSimpleType()) {
+ switch (value.getEdmPrimitiveTypeKind()) {
case GeographyPoint:
case GeometryPoint:
jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
index da6f0fd..948a930 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
@@ -56,15 +56,19 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
public class EdmClientImpl extends AbstractEdmImpl {
+ private final ODataServiceVersion version;
+
private final XMLMetadata xmlMetadata;
private final EdmServiceMetadata serviceMetadata;
- public EdmClientImpl(final XMLMetadata xmlMetadata) {
+ public EdmClientImpl(final ODataServiceVersion version, final XMLMetadata xmlMetadata) {
+ this.version = version;
this.xmlMetadata = xmlMetadata;
this.serviceMetadata = AbstractEdmServiceMetadataImpl.getInstance(xmlMetadata);
}
@@ -115,7 +119,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
if (schema != null) {
final EnumType xmlEnumType = schema.getEnumType(enumName.getName());
if (xmlEnumType != null) {
- result = new EdmEnumTypeImpl(this, enumName, xmlEnumType);
+ result = new EdmEnumTypeImpl(version, this, enumName, xmlEnumType);
}
}
@@ -131,7 +135,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
final TypeDefinition xmlTypeDefinition = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
getTypeDefinition(typeDefinitionName.getName());
if (xmlTypeDefinition != null) {
- result = new EdmTypeDefinitionImpl(this, typeDefinitionName, xmlTypeDefinition);
+ result = new EdmTypeDefinitionImpl(version, this, typeDefinitionName, xmlTypeDefinition);
}
} else {
throw new UnsupportedInV3Exception();
@@ -378,7 +382,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
protected List<EdmSchema> createSchemas() {
final List<EdmSchema> schemas = new ArrayList<EdmSchema>();
for (Schema schema : xmlMetadata.getSchemas()) {
- schemas.add(new EdmSchemaImpl(this, xmlMetadata, schema));
+ schemas.add(new EdmSchemaImpl(version, this, xmlMetadata, schema));
}
return schemas;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
index 10a1b2e..05cfa27 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
@@ -27,7 +27,6 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.AbstractEdmEnumType;
import org.apache.olingo.commons.core.edm.EdmMemberImpl;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import java.util.ArrayList;
import java.util.Collection;
@@ -37,6 +36,9 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType {
@@ -54,14 +56,16 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType
private final Map<String, EdmMember> members;
- public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName fqn, final EnumType xmlEnumType) {
+ public EdmEnumTypeImpl(final ODataServiceVersion version, final Edm edm, final FullQualifiedName fqn,
+ final EnumType xmlEnumType) {
+
super(edm, fqn, xmlEnumType.isFlags());
if (xmlEnumType.getUnderlyingType() == null) {
- this.underlyingType = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+ this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
} else {
- this.underlyingType = EdmPrimitiveTypeKind.valueOfFQN(xmlEnumType.getUnderlyingType()).
- getEdmPrimitiveTypeInstance();
+ this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ EdmPrimitiveTypeKind.valueOfFQN(version, xmlEnumType.getUnderlyingType()));
if (!ArrayUtils.contains(VALID_UNDERLYING_TYPES, this.underlyingType.getKind())) {
throw new EdmException("Not allowed as underlying type: " + this.underlyingType.getKind());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
index 58c9496..ffe41cd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
@@ -41,18 +41,25 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.edm.AbstractEdmSchemaImpl;
public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
+ private final ODataServiceVersion version;
+
private final Edm edm;
private final XMLMetadata xmlMetadata;
private final Schema schema;
- public EdmSchemaImpl(Edm edm, XMLMetadata xmlMetadata, Schema schema) {
+ public EdmSchemaImpl(final ODataServiceVersion version, final Edm edm,
+ final XMLMetadata xmlMetadata, final Schema schema) {
+
super(schema.getNamespace(), schema.getAlias());
+
+ this.version = version;
this.edm = edm;
this.xmlMetadata = xmlMetadata;
this.schema = schema;
@@ -77,7 +84,8 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).getTypeDefinitions();
if (providerTypeDefinitions != null) {
for (TypeDefinition def : providerTypeDefinitions) {
- typeDefinitions.add(new EdmTypeDefinitionImpl(edm, new FullQualifiedName("namespace", def.getName()), def));
+ typeDefinitions.add(
+ new EdmTypeDefinitionImpl(version, edm, new FullQualifiedName("namespace", def.getName()), def));
}
}
}
@@ -90,7 +98,8 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
final List<EnumType> providerEnumTypes = schema.getEnumTypes();
if (providerEnumTypes != null) {
for (EnumType enumType : providerEnumTypes) {
- enumTypes.add(new EdmEnumTypeImpl(edm, new FullQualifiedName(namespace, enumType.getName()), enumType));
+ enumTypes.add(
+ new EdmEnumTypeImpl(version, edm, new FullQualifiedName(namespace, enumType.getName()), enumType));
}
}
return enumTypes;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
index cf2ad47..199d61e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
@@ -22,10 +22,12 @@ import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.edm.AbstractEdmTypeDefinition;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements EdmTypeDefinition {
@@ -33,14 +35,14 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
private EdmPrimitiveType edmPrimitiveTypeInstance;
- public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
- final TypeDefinition typeDefinition) {
+ public EdmTypeDefinitionImpl(final ODataServiceVersion version, final Edm edm,
+ final FullQualifiedName typeDefinitionName, final TypeDefinition typeDefinition) {
super(edm, typeDefinitionName);
this.typeDefinition = typeDefinition;
try {
- edmPrimitiveTypeInstance = EdmPrimitiveTypeKind.valueOfFQN(typeDefinition.getUnderlyingType()).
- getEdmPrimitiveTypeInstance();
+ this.edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ EdmPrimitiveTypeKind.valueOfFQN(version, typeDefinition.getUnderlyingType()));
} catch (IllegalArgumentException e) {
throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
index 3ed86dc..461e829 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
@@ -18,15 +18,13 @@
*/
package org.apache.olingo.client.core.edm;
-import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,9 +70,7 @@ public class EdmTypeInfo {
private final FullQualifiedName fullQualifiedName;
- private EdmPrimitiveType primitiveType;
-
- private final boolean geospatialType;
+ private EdmPrimitiveTypeKind primitiveType;
private EdmEnumType enumType;
@@ -114,14 +110,10 @@ public class EdmTypeInfo {
this.fullQualifiedName = new FullQualifiedName(namespace, typeName);
try {
- this.primitiveType = EdmPrimitiveTypeKind.valueOf(this.fullQualifiedName.getName()).
- getEdmPrimitiveTypeInstance();
+ this.primitiveType = EdmPrimitiveTypeKind.valueOf(this.fullQualifiedName.getName());
} catch (IllegalArgumentException e) {
LOG.debug("{} does not appear to refer to an Edm primitive type", this.fullQualifiedName);
}
- // TODO - OLINGO-65 implement Geospatial types!
- this.geospatialType = this.fullQualifiedName.getNamespace().equals(EdmPrimitiveType.EDM_NAMESPACE)
- && this.fullQualifiedName.getName().startsWith("Geo");
if (this.primitiveType == null && this.edm != null) {
this.enumType = this.edm.getEnumType(this.fullQualifiedName);
if (this.enumType == null) {
@@ -146,21 +138,13 @@ public class EdmTypeInfo {
}
public boolean isPrimitiveType() {
- return this.primitiveType != null || isGeospatialType();
+ return this.primitiveType != null;
}
- public EdmPrimitiveType getPrimitiveType() {
+ public EdmPrimitiveTypeKind getPrimitiveTypeKind() {
return primitiveType;
}
- public boolean isGeospatialType() {
- return geospatialType;
- }
-
- public Object getGeospatialType() {
- throw new NotImplementedException("Geospatial types missing");
- }
-
public boolean isEnumType() {
return this.enumType != null;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
index 69a278f..b185d5d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
@@ -38,7 +38,6 @@ import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataGeospatialValue;
import org.apache.olingo.client.api.domain.ODataInlineEntity;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataOperation;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
@@ -55,6 +54,7 @@ import org.apache.olingo.client.core.data.JSONPropertyImpl;
import org.apache.olingo.client.core.data.LinkImpl;
import org.apache.olingo.client.core.data.NullValueImpl;
import org.apache.olingo.client.core.data.PrimitiveValueImpl;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -378,14 +378,14 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
value = new ODataPrimitiveValue.Builder(client).setText(resource.getValue().asSimple().get()).
setType(resource.getType() == null
? null
- : ODataJClientEdmPrimitiveType.fromValue(resource.getType())).build();
+ : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
} else if (resource.getValue().isGeospatial()) {
value = new ODataGeospatialValue.Builder(client).setValue(resource.getValue().asGeospatial().get()).
setType(resource.getType() == null
- || ODataJClientEdmPrimitiveType.Geography.toString().equals(resource.getType())
- || ODataJClientEdmPrimitiveType.Geometry.toString().equals(resource.getType())
+ || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
+ || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().toString().equals(resource.getType())
? null
- : ODataJClientEdmPrimitiveType.fromValue(resource.getType())).build();
+ : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
} else if (resource.getValue().isComplex()) {
value = new ODataComplexValue(resource.getType());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
index cfe08ec..596e8fd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
@@ -26,7 +26,6 @@ import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.domain.ODataValue;
@@ -35,6 +34,7 @@ import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.format.ODataValueFormat;
import org.apache.olingo.client.api.op.CommonODataReader;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -91,7 +91,7 @@ public abstract class AbstractODataReader implements CommonODataReader {
} else if (ODataValue.class.isAssignableFrom(reference)) {
res = client.getPrimitiveValueBuilder().
setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT
- ? ODataJClientEdmPrimitiveType.String : ODataJClientEdmPrimitiveType.Stream).
+ ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(src)).
build();
} else if (XMLMetadata.class.isAssignableFrom(reference)) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
index 54e4ad0..6649a39 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
@@ -40,7 +40,7 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
@Override
public Edm readMetadata(final InputStream input) {
- return new EdmClientImpl(client.getDeserializer().toMetadata(input));
+ return new EdmClientImpl(client.getServiceVersion(), client.getDeserializer().toMetadata(input));
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
index 5a64d63..8324cca 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
@@ -38,7 +38,7 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
@Override
public Edm readMetadata(final InputStream input) {
- return new EdmClientImpl(client.getDeserializer().toMetadata(input));
+ return new EdmClientImpl(client.getServiceVersion(), client.getDeserializer().toMetadata(input));
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
index a40da38..5326602 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
@@ -32,22 +32,22 @@ import java.util.List;
import java.util.UUID;
import org.apache.commons.codec.binary.Base64;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataGeospatialValue;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataTimestamp;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial.Dimension;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
public abstract class AbstractPrimitiveTest extends AbstractTest {
@@ -66,13 +66,15 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected ODataPrimitiveValue writePrimitiveValue(final ODataPrimitiveValue value) {
final ODataPrimitiveValue newValue;
- if (ODataJClientEdmPrimitiveType.isGeospatial(value.getTypeName())) {
+ final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOfFQN(
+ getClient().getServiceVersion(), value.getTypeName());
+ if (typeKind.isGeospatial()) {
newValue = getClient().getGeospatialValueBuilder().
- setType(ODataJClientEdmPrimitiveType.fromValue(value.getTypeName())).
+ setType(EdmPrimitiveTypeKind.valueOfFQN(getVersion(), value.getTypeName())).
setValue(((ODataGeospatialValue) value).getGeospatial()).build();
} else {
newValue = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.fromValue(value.getTypeName())).
+ setType(EdmPrimitiveTypeKind.valueOfFQN(getClient().getServiceVersion(), value.getTypeName())).
setValue(value.toValue()).build();
}
@@ -95,7 +97,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final ODataPrimitiveValue value =
readPrimitiveValue(getClass().getResourceAsStream(getFilename(entity, propertyName)));
- if (ODataJClientEdmPrimitiveType.isGeospatial(value.getTypeName())) {
+ final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOfFQN(
+ getClient().getServiceVersion(), value.getTypeName());
+ if (typeKind.isGeospatial()) {
assertEquals(value.toValue(), writePrimitiveValue(value).toValue());
} else {
assertEquals(value.toString(), writePrimitiveValue(value).toString());
@@ -106,7 +110,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void int32(final String entity, final String propertyName, final int check) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.Int32.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Int32.toString(), opv.getTypeName());
final Integer value = opv.<Integer>toCastValue();
assertNotNull(value);
@@ -115,7 +119,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void string(final String entity, final String propertyName, final String check) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.String.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.String.toString(), opv.getTypeName());
final String value = opv.<String>toCastValue();
assertNotNull(value);
@@ -126,7 +130,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void decimal(final String entity, final String propertyName, final BigDecimal check) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.Decimal.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Decimal.toString(), opv.getTypeName());
final BigDecimal value = opv.<BigDecimal>toCastValue();
assertNotNull(value);
@@ -135,7 +139,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void datetime(final String entity, final String propertyName, final String check) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.DateTime.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.DateTime.toString(), opv.getTypeName());
final ODataTimestamp value = opv.<ODataTimestamp>toCastValue();
assertNotNull(value);
@@ -144,7 +148,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void guid(final String entity, final String propertyName, final String check) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.Guid.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Guid.toString(), opv.getTypeName());
final UUID value = opv.<UUID>toCastValue();
assertNotNull(value);
@@ -153,7 +157,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void binary(final String entity, final String propertyName) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.Binary.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Binary.toString(), opv.getTypeName());
final byte[] value = opv.<byte[]>toCastValue();
assertNotNull(value);
@@ -171,7 +175,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String entity,
final String propertyName,
final Point expectedValues,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -202,7 +206,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String entity,
final String propertyName,
final List<Point> check,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -219,7 +223,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String entity,
final String propertyName,
final List<Point> check,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -246,7 +250,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String entity,
final String propertyName,
final List<List<Point>> check,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -301,7 +305,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String propertyName,
final List<Point> checkInterior,
final List<Point> checkExterior,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -321,7 +325,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String propertyName,
final List<List<Point>> checkInterior,
final List<List<Point>> checkExterior,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -344,7 +348,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void geomCollection(
final String entity,
final String propertyName,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -373,7 +377,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void geogCollection(
final String entity,
final String propertyName,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
index 48e17e7..e9b97f2 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
@@ -27,13 +27,13 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataCollectionValue;
import org.apache.olingo.client.api.domain.ODataComplexValue;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.junit.Test;
@@ -52,7 +52,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
+ "Customer_-10_CustomerId_value.txt");
final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.String).
+ setType(EdmPrimitiveTypeKind.String).
setText(IOUtils.toString(input)).
build();
assertNotNull(value);
@@ -76,7 +76,8 @@ public abstract class AbstractPropertyTest extends AbstractTest {
} else {
// This is needed because type information gets lost with JSON serialization
final ODataPrimitiveValue typedValue = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.fromValue(property.getPrimitiveValue().getTypeName())).
+ setType(EdmPrimitiveTypeKind.valueOfFQN(
+ getClient().getServiceVersion(), property.getPrimitiveValue().getTypeName())).
setText(written.getPrimitiveValue().toString()).
build();
comparable = getClient().getObjectFactory().newPrimitiveProperty(written.getName(), typedValue);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index 589affa..e87b877 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -58,7 +58,6 @@ import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataInlineEntity;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataValue;
@@ -68,6 +67,7 @@ import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.utils.URIUtils;
import org.apache.olingo.client.core.data.AtomEntryImpl;
import org.apache.olingo.client.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -214,7 +214,7 @@ public abstract class AbstractTestITCase {
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Information",
getClient().getPrimitiveValueBuilder().setText(sampleinfo).setType(
- ODataJClientEdmPrimitiveType.String).build()));
+ EdmPrimitiveTypeKind.String).build()));
return entity;
}
@@ -228,12 +228,12 @@ public abstract class AbstractTestITCase {
// add name attribute
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name",
getClient().getPrimitiveValueBuilder().setText(sampleName).setType(
- ODataJClientEdmPrimitiveType.String).build()));
+ EdmPrimitiveTypeKind.String).build()));
// add key attribute
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
getClient().getPrimitiveValueBuilder().setText(String.valueOf(id)).setType(
- ODataJClientEdmPrimitiveType.Int32).build()));
+ EdmPrimitiveTypeKind.Int32).build()));
// add BackupContactInfo attribute (collection)
final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
@@ -249,13 +249,13 @@ public abstract class AbstractTestITCase {
// add BackupContactInfo.ContactDetails.AlternativeNames attribute (collection)
final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
altNamesValue.add(getClient().getPrimitiveValueBuilder().
- setText("myname").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("myname").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
// add BackupContactInfo.ContactDetails.EmailBag attribute (collection)
final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
emailBagValue.add(getClient().getPrimitiveValueBuilder().
- setText("myname@mydomain.com").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("myname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(getClient().getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
// add BackupContactInfo.ContactDetails.ContactAlias attribute (complex)
@@ -266,7 +266,7 @@ public abstract class AbstractTestITCase {
// add BackupContactInfo.ContactDetails.ContactAlias.AlternativeNames attribute (collection)
final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
aliasAltNamesValue.add(getClient().getPrimitiveValueBuilder().
- setText("myAlternativeName").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
contactAliasValue.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
if (withInlineInfo) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 0d7bac2..465dc07 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -42,13 +42,13 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.NoContentException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Ignore;
import org.junit.Test;
@@ -288,10 +288,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(key).setType(ODataJClientEdmPrimitiveType.Int32)
+ client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32)
.build()));
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32)
+ client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32)
.build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
@@ -383,9 +383,9 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
ODataEntity order = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
order.addLink(client.getObjectFactory().newEntityNavigationLink(
"Customer", URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString())));
@@ -442,22 +442,22 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("MessageId",
client.getPrimitiveValueBuilder().setValue(1000).
- setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ setType(EdmPrimitiveTypeKind.Int32).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("FromUsername",
client.getPrimitiveValueBuilder().setValue("1").
- setType(ODataJClientEdmPrimitiveType.String).build()));
+ setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("ToUsername",
client.getPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
- setType(ODataJClientEdmPrimitiveType.String).build()));
+ setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Subject",
client.getPrimitiveValueBuilder().setValue("Test subject").
- setType(ODataJClientEdmPrimitiveType.String).build()));
+ setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Body",
client.getPrimitiveValueBuilder().setValue("Test body").
- setType(ODataJClientEdmPrimitiveType.String).build()));
+ setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
client.getPrimitiveValueBuilder().setValue(false).
- setType(ODataJClientEdmPrimitiveType.Boolean).build()));
+ setType(EdmPrimitiveTypeKind.Boolean).build()));
final CommonURIBuilder<?> builder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Message");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index 7717226..8399494 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -32,8 +32,8 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateR
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
/**
@@ -184,7 +184,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
message.getProperties().remove(message.getProperty("IsRead"));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
client.getPrimitiveValueBuilder().setValue(!before).
- setType(ODataJClientEdmPrimitiveType.Boolean).build()));
+ setType(EdmPrimitiveTypeKind.Boolean).build()));
return client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, message);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index 6b23f14..b8ce3b4 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -44,7 +44,6 @@ import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataInlineEntity;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataValue;
@@ -52,6 +51,7 @@ import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
@@ -209,9 +209,9 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(key).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32).build()));
orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(),
@@ -267,13 +267,13 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
// add name attribute
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Name",
- client.getPrimitiveValueBuilder().setText(name).setType(ODataJClientEdmPrimitiveType.String).build()));
+ client.getPrimitiveValueBuilder().setText(name).setType(EdmPrimitiveTypeKind.String).build()));
// add key attribute
if (id != 0) {
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
client.getPrimitiveValueBuilder().setText(String.valueOf(id)).
- setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ setType(EdmPrimitiveTypeKind.Int32).build()));
}
final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
@@ -285,12 +285,12 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
altNamesValue.add(client.getPrimitiveValueBuilder().
- setText("My Alternative name").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("My Alternative name").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
emailBagValue.add(client.getPrimitiveValueBuilder().
- setText("altname@mydomain.com").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("altname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
final ODataComplexValue contactAliasValue = new ODataComplexValue(
@@ -299,17 +299,17 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
aliasAltNamesValue.add(client.getPrimitiveValueBuilder().
- setText("myAlternativeName").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
final ODataComplexValue homePhone = new ODataComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone");
homePhone.add(client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
client.getPrimitiveValueBuilder().setText("8437568356834568").
- setType(ODataJClientEdmPrimitiveType.String).build()));
+ setType(EdmPrimitiveTypeKind.String).build()));
homePhone.add(client.getObjectFactory().newPrimitiveProperty("Extension",
client.getPrimitiveValueBuilder().setText("124365426534621534423ttrf").
- setType(ODataJClientEdmPrimitiveType.String).
+ setType(EdmPrimitiveTypeKind.String).
build()));
contactDetails.add(client.getObjectFactory().newComplexProperty("HomePhone", homePhone));
@@ -372,7 +372,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
entity.setMediaEntity(true);
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Information",
- client.getPrimitiveValueBuilder().setText(info).setType(ODataJClientEdmPrimitiveType.String).build()));
+ client.getPrimitiveValueBuilder().setText(info).setType(EdmPrimitiveTypeKind.String).build()));
return entity;
}
// validate newly created entities
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index 7718317..c64d7bb 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -30,19 +30,19 @@ import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.domain.ODataComplexValue;
import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
import org.junit.Ignore;
import org.junit.Test;
@@ -70,15 +70,15 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
private void read(final ODataPubFormat format) {
ODataEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f");
assertEquals(
- ODataJClientEdmPrimitiveType.Double.toString(),
+ EdmPrimitiveTypeKind.Double.toString(),
row.getProperty("Double").getPrimitiveValue().getTypeName());
assertEquals(
- ODataJClientEdmPrimitiveType.Guid.toString(),
+ EdmPrimitiveTypeKind.Guid.toString(),
row.getProperty("Id").getPrimitiveValue().getTypeName());
row = readRow(format, "672b8250-1e6e-4785-80cf-b94b572e42b3");
assertEquals(
- ODataJClientEdmPrimitiveType.Decimal.toString(),
+ EdmPrimitiveTypeKind.Decimal.toString(),
row.getProperty("Decimal").getPrimitiveValue().getTypeName());
}
@@ -99,50 +99,50 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
ODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Id",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Guid).setValue(guid).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).setValue(guid).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aString",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.String).setValue("string").
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).setValue("string").
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aBoolean",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Boolean).setValue(true).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Boolean).setValue(true).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLong",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Int64).setValue(15L).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int64).setValue(15L).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDouble",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Double).setValue(1.5D).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Double).setValue(1.5D).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aByte",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.SByte).setValue(Byte.MAX_VALUE).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDate",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.DateTime).setValue(new Date()).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()).
build()));
final Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null);
point.setX(1.2);
point.setY(2.1);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPoint",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPoint).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(point).build()));
final List<Point> points = new ArrayList<Point>();
points.add(point);
points.add(point);
final MultiPoint multipoint = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPoint",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiPoint).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
setValue(multipoint).build()));
final LineString lineString = new LineString(Geospatial.Dimension.GEOMETRY, null, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLineString",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryLineString).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryLineString).
setValue(lineString).build()));
final List<LineString> lineStrings = new ArrayList<LineString>();
lineStrings.add(lineString);
lineStrings.add(lineString);
final MultiLineString multiLineString = new MultiLineString(Geospatial.Dimension.GEOGRAPHY, null, lineStrings);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiLineString",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiLineString).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
setValue(multiLineString).build()));
final Point otherPoint = new Point(Geospatial.Dimension.GEOGRAPHY, null);
otherPoint.setX(3.4);
@@ -152,14 +152,14 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
points.add(point);
final Polygon polygon = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, points, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPolygon",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPolygon).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
setValue(polygon).build()));
final List<Polygon> polygons = new ArrayList<Polygon>();
polygons.add(polygon);
polygons.add(polygon);
final MultiPolygon multiPolygon = new MultiPolygon(Geospatial.Dimension.GEOGRAPHY, null, polygons);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPolygon",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyMultiPolygon).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
setValue(multiPolygon).build()));
final List<Geospatial> geospatials = new ArrayList<Geospatial>();
geospatials.add(otherPoint);
@@ -168,47 +168,47 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
geospatials.add(multiPolygon);
final GeospatialCollection geoColl = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, geospatials);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aCollection",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyCollection).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(geoColl).build()));
final ODataComplexValue contactDetails =
new ODataComplexValue("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails");
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("FirstContacted",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Binary).setValue("text".getBytes()).build()));
+ setType(EdmPrimitiveTypeKind.Binary).setValue("text".getBytes()).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("LastContacted",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.DateTimeOffset).setText("2001-04-05T05:05:05.001+00:01").build()));
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setText("2001-04-05T05:05:05.001+00:01").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Contacted",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.DateTime).setText("2001-04-05T05:05:04.001").build()));
+ setType(EdmPrimitiveTypeKind.DateTime).setText("2001-04-05T05:05:04.001").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("GUID",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Guid).setValue(UUID.randomUUID()).build()));
+ setType(EdmPrimitiveTypeKind.Guid).setValue(UUID.randomUUID()).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("PreferedContactTime",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Time).setText("-P9DT51M10.5063807S").build()));
+ setType(EdmPrimitiveTypeKind.Time).setText("-P9DT51M10.5063807S").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Byte",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Byte).setValue(Integer.valueOf(241)).build()));
+ setType(EdmPrimitiveTypeKind.Byte).setValue(Integer.valueOf(241)).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("SignedByte",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.SByte).setValue(Byte.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Double",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Double).setValue(Double.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.Double).setValue(Double.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Single",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Single).setValue(Float.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.Single).setValue(Float.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Short",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Int16).setValue(Short.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.Int16).setValue(Short.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Int",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Int32).setValue(Integer.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.Int32).setValue(Integer.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Long",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Int64).setValue(Long.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.Int64).setValue(Long.MAX_VALUE).build()));
row.getProperties().add(client.getObjectFactory().newComplexProperty("aContact", contactDetails));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().
@@ -220,37 +220,37 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
row = readRow(format, guid.toString());
assertNotNull(row);
- assertEquals(ODataJClientEdmPrimitiveType.Guid.toString(),
+ assertEquals(EdmPrimitiveTypeKind.Guid.toString(),
row.getProperty("Id").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.String.toString(),
+ assertEquals(EdmPrimitiveTypeKind.String.toString(),
row.getProperty("aString").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.Boolean.toString(),
+ assertEquals(EdmPrimitiveTypeKind.Boolean.toString(),
row.getProperty("aBoolean").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.Int64.toString(),
+ assertEquals(EdmPrimitiveTypeKind.Int64.toString(),
row.getProperty("aLong").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.Double.toString(),
+ assertEquals(EdmPrimitiveTypeKind.Double.toString(),
row.getProperty("aDouble").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.SByte.toString(),
+ assertEquals(EdmPrimitiveTypeKind.SByte.toString(),
row.getProperty("aByte").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.DateTime.toString(),
+ assertEquals(EdmPrimitiveTypeKind.DateTime.toString(),
row.getProperty("aDate").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeographyPoint.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyPoint.toString(),
row.getProperty("aPoint").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiPoint.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint.toString(),
row.getProperty("aMultiPoint").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeometryLineString.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeometryLineString.toString(),
row.getProperty("aLineString").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiLineString.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString.toString(),
row.getProperty("aMultiLineString").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeographyPolygon.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyPolygon.toString(),
row.getProperty("aPolygon").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeographyMultiPolygon.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyMultiPolygon.toString(),
row.getProperty("aMultiPolygon").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeographyCollection.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyCollection.toString(),
row.getProperty("aCollection").getPrimitiveValue().getTypeName());
assertEquals("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails",
row.getProperty("aContact").getComplexValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.SByte.toString(),
+ assertEquals(EdmPrimitiveTypeKind.SByte.toString(),
row.getProperty("aContact").getComplexValue().get("SignedByte").getPrimitiveValue().getTypeName());
final ODataDeleteResponse deleteRes = client.getCUDRequestFactory().getDeleteRequest(row.getEditLink()).
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 8559d4f..903adf8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -25,14 +25,14 @@ import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.client.core.op.impl.ResourceFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.junit.Test;
public class EntityTest extends AbstractTest {
@@ -89,7 +89,7 @@ public class EntityTest extends AbstractTest {
if ("GeogMultiLine".equals(property.getName())) {
found = true;
assertTrue(property.hasPrimitiveValue());
- assertEquals(ODataJClientEdmPrimitiveType.GeographyMultiLineString.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyMultiLineString.getFullQualifiedName().toString(),
property.getPrimitiveValue().getTypeName());
}
}
@@ -168,7 +168,7 @@ public class EntityTest extends AbstractTest {
assertNotNull(entity);
final ODataProperty geogCollection = entity.getProperty("GeogCollection");
- assertEquals(ODataJClientEdmPrimitiveType.GeographyCollection.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyCollection.getFullQualifiedName().toString(),
geogCollection.getPrimitiveValue().getTypeName());
int count = 0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
index fea25ca..5dca101 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
@@ -49,8 +49,9 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.junit.Test;
public class MetadataTest extends AbstractTest {
@@ -133,7 +134,7 @@ public class MetadataTest extends AbstractTest {
new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService", "ProductReview"));
assertNotNull(entity);
assertFalse(entity.getPropertyNames().isEmpty());
- assertEquals(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance(),
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32),
entity.getProperty("ProductId").getType());
assertFalse(entity.getKeyPropertyRefs().isEmpty());
@@ -150,7 +151,7 @@ public class MetadataTest extends AbstractTest {
for (EdmActionImportInfo info : metadata.getServiceMetadata().getActionImportInfos()) {
actionImports.add(info.getActionImportName());
}
- final Set<String> expectedAI = new HashSet<String>(Arrays.asList(new String[]{
+ final Set<String> expectedAI = new HashSet<String>(Arrays.asList(new String[] {
"ResetDataSource",
"IncreaseSalaries",
"Sack",
@@ -162,7 +163,7 @@ public class MetadataTest extends AbstractTest {
for (EdmFunctionImportInfo info : metadata.getServiceMetadata().getFunctionImportInfos()) {
functionImports.add(info.getFunctionImportName());
}
- final Set<String> expectedFI = new HashSet<String>(Arrays.asList(new String[]{
+ final Set<String> expectedFI = new HashSet<String>(Arrays.asList(new String[] {
"GetPrimitiveString",
"GetSpecificCustomer",
"GetCustomerCount",
@@ -177,7 +178,7 @@ public class MetadataTest extends AbstractTest {
final EdmFunctionImport getArgumentPlusOne = container.getFunctionImport("GetArgumentPlusOne");
assertNotNull(getArgumentPlusOne);
- assertEquals(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance(),
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32),
getArgumentPlusOne.getFunction(null).getReturnType().getType());
final EdmActionImport resetDataSource = container.getActionImport("ResetDataSource");
@@ -191,7 +192,7 @@ public class MetadataTest extends AbstractTest {
final EdmFunction getComputer = metadata.getFunction(
new FullQualifiedName(container.getNamespace(), "GetComputer"),
new FullQualifiedName(container.getNamespace(), computer.getName()),
- Boolean.FALSE, Arrays.asList(new String[]{"computer"}));
+ Boolean.FALSE, Arrays.asList(new String[] {"computer"}));
assertNotNull(getComputer);
assertEquals(computer, getComputer.getParameter("computer").getType());
assertEquals(computer, getComputer.getReturnType().getType());
[47/52] [abbrv] git commit: [OLINGO-205, OLINGO-200, OLINGO-65] merge
Posted by sk...@apache.org.
[OLINGO-205, OLINGO-200, OLINGO-65] merge
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/5b5576f8
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/5b5576f8
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/5b5576f8
Branch: refs/heads/olingo-206-validator
Commit: 5b5576f86cfa8d3fb07151ff774238ba2a87c0d9
Parents: 9aefb95 a55ed62
Author: fmartelli <fa...@gmail.com>
Authored: Mon Mar 24 10:05:44 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Mon Mar 24 10:05:44 2014 +0100
----------------------------------------------------------------------
lib/client-api/pom.xml | 5 -
.../olingo/client/api/CommonConfiguration.java | 8 +-
.../olingo/client/api/CommonODataClient.java | 12 +-
.../org/apache/olingo/client/api/Constants.java | 258 ------------
.../ODataClientErrorException.java | 2 +-
.../request/ODataBasicRequest.java | 2 +-
.../request/cud/CommonCUDRequestFactory.java | 8 +-
.../request/cud/ODataDeleteRequest.java | 2 +-
.../request/cud/ODataEntityCreateRequest.java | 2 +-
.../request/cud/ODataEntityUpdateRequest.java | 2 +-
.../request/cud/ODataLinkCreateRequest.java | 2 +-
.../request/cud/ODataLinkUpdateRequest.java | 2 +-
.../request/cud/ODataPropertyUpdateRequest.java | 2 +-
.../request/cud/ODataValueUpdateRequest.java | 2 +-
.../invoke/CommonInvokeRequestFactory.java | 4 +-
.../request/invoke/ODataInvokeRequest.java | 6 +-
.../request/invoke/ODataNoContent.java | 2 +-
.../request/retrieve/ODataEntityRequest.java | 4 +-
.../retrieve/ODataEntitySetIteratorRequest.java | 2 +-
.../request/retrieve/ODataEntitySetRequest.java | 4 +-
.../request/retrieve/ODataMediaRequest.java | 2 +-
.../request/retrieve/ODataMetadataRequest.java | 2 +-
.../request/retrieve/ODataPropertyRequest.java | 4 +-
.../request/retrieve/ODataRetrieveRequest.java | 2 +-
.../retrieve/ODataServiceDocumentRequest.java | 4 +-
.../request/retrieve/ODataValueRequest.java | 4 +-
.../retrieve/v3/ODataLinkCollectionRequest.java | 2 +-
.../streamed/ODataStreamedEntityRequest.java | 2 +-
.../response/ODataEntityCreateResponse.java | 2 +-
.../response/ODataEntityUpdateResponse.java | 2 +-
.../response/ODataInvokeResponse.java | 2 +-
.../ODataMediaEntityCreateResponse.java | 2 +-
.../ODataMediaEntityUpdateResponse.java | 2 +-
.../response/ODataPropertyUpdateResponse.java | 2 +-
.../response/ODataValueUpdateResponse.java | 2 +-
.../olingo/client/api/data/CollectionValue.java | 27 --
.../olingo/client/api/data/ComplexValue.java | 27 --
.../apache/olingo/client/api/data/Entry.java | 167 --------
.../org/apache/olingo/client/api/data/Feed.java | 75 ----
.../apache/olingo/client/api/data/GeoUtils.java | 90 -----
.../olingo/client/api/data/GeospatialValue.java | 28 --
.../org/apache/olingo/client/api/data/Link.java | 121 ------
.../olingo/client/api/data/NullValue.java | 26 --
.../olingo/client/api/data/ODataError.java | 67 ---
.../olingo/client/api/data/PrimitiveValue.java | 25 --
.../apache/olingo/client/api/data/Property.java | 34 --
.../apache/olingo/client/api/data/Value.java | 44 --
.../client/api/data/v3/LinkCollection.java | 52 ---
.../client/api/domain/AbstractODataValue.java | 127 ------
.../client/api/domain/ODataCollectionValue.java | 98 -----
.../client/api/domain/ODataComplexValue.java | 97 -----
.../olingo/client/api/domain/ODataEntity.java | 316 ---------------
.../client/api/domain/ODataEntitySet.java | 120 ------
.../api/domain/ODataEntitySetIterator.java | 8 +-
.../client/api/domain/ODataGeospatialValue.java | 57 ---
.../client/api/domain/ODataInlineEntity.java | 74 ----
.../client/api/domain/ODataInlineEntitySet.java | 74 ----
.../client/api/domain/ODataInvokeResult.java | 30 --
.../olingo/client/api/domain/ODataItem.java | 111 -----
.../olingo/client/api/domain/ODataLink.java | 190 ---------
.../olingo/client/api/domain/ODataLinkType.java | 93 -----
.../client/api/domain/ODataObjectFactory.java | 218 ----------
.../client/api/domain/ODataOperation.java | 88 ----
.../client/api/domain/ODataPrimitiveValue.java | 67 ---
.../olingo/client/api/domain/ODataProperty.java | 186 ---------
.../client/api/domain/ODataPropertyType.java | 40 --
.../client/api/domain/ODataServiceDocument.java | 183 ---------
.../olingo/client/api/domain/ODataValue.java | 84 ----
.../apache/olingo/client/api/format/Format.java | 26 --
.../olingo/client/api/format/ODataFormat.java | 103 -----
.../client/api/format/ODataMediaFormat.java | 77 ----
.../client/api/format/ODataPubFormat.java | 122 ------
.../client/api/format/ODataValueFormat.java | 82 ----
.../client/api/op/ClientODataDeserializer.java | 39 ++
.../olingo/client/api/op/CommonODataBinder.java | 18 +-
.../client/api/op/CommonODataDeserializer.java | 84 ----
.../olingo/client/api/op/CommonODataReader.java | 14 +-
.../olingo/client/api/op/ODataSerializer.java | 100 -----
.../olingo/client/api/op/ODataWriter.java | 10 +-
.../olingo/client/api/op/v3/ODataBinder.java | 2 +-
.../client/api/op/v3/ODataDeserializer.java | 8 +-
.../olingo/client/api/op/v3/ODataReader.java | 2 +-
.../client/api/op/v4/ODataDeserializer.java | 4 +-
lib/client-core/pom.xml | 21 -
.../client/core/AbstractConfiguration.java | 8 +-
.../olingo/client/core/AbstractODataClient.java | 8 +-
.../request/AbstractODataBasicRequest.java | 2 +-
.../communication/request/ODataRequestImpl.java | 14 +-
.../request/batch/ODataBatchUtilities.java | 2 +-
.../request/cud/AbstractCUDRequestFactory.java | 8 +-
.../request/cud/ODataDeleteRequestImpl.java | 2 +-
.../cud/ODataEntityCreateRequestImpl.java | 4 +-
.../cud/ODataEntityUpdateRequestImpl.java | 4 +-
.../request/cud/ODataLinkCreateRequestImpl.java | 4 +-
.../request/cud/ODataLinkUpdateRequestImpl.java | 4 +-
.../cud/ODataPropertyUpdateRequestImpl.java | 4 +-
.../cud/ODataValueUpdateRequestImpl.java | 4 +-
.../invoke/AbstractInvokeRequestFactory.java | 2 +-
.../request/invoke/ODataInvokeRequestImpl.java | 14 +-
.../invoke/v3/InvokeRequestFactoryImpl.java | 10 +-
.../invoke/v4/InvokeRequestFactoryImpl.java | 4 +-
.../retrieve/AbstractODataRetrieveRequest.java | 2 +-
.../retrieve/ODataEntityRequestImpl.java | 4 +-
.../ODataEntitySetIteratorRequestImpl.java | 2 +-
.../retrieve/ODataEntitySetRequestImpl.java | 4 +-
.../request/retrieve/ODataMediaRequestImpl.java | 2 +-
.../retrieve/ODataMetadataRequestImpl.java | 2 +-
.../retrieve/ODataPropertyRequestImpl.java | 4 +-
.../request/retrieve/ODataRawRequestImpl.java | 2 +-
.../ODataServiceDocumentRequestImpl.java | 4 +-
.../request/retrieve/ODataValueRequestImpl.java | 4 +-
.../v3/ODataLinkCollectionRequestImpl.java | 2 +-
.../AbstractODataStreamedEntityRequest.java | 2 +-
.../streamed/AbstractODataStreamedRequest.java | 2 +-
.../ODataMediaEntityCreateRequestImpl.java | 2 +-
.../ODataMediaEntityUpdateRequestImpl.java | 2 +-
.../batch/ODataBatchResponseManager.java | 2 +-
.../client/core/data/AbstractAtomDealer.java | 87 ----
.../client/core/data/AbstractAtomObject.java | 78 ----
.../olingo/client/core/data/AbstractEntry.java | 159 --------
.../core/data/AbstractJsonDeserializer.java | 175 --------
.../core/data/AbstractJsonSerializer.java | 94 -----
.../client/core/data/AbstractPayloadObject.java | 48 ---
.../client/core/data/AbstractPropertyImpl.java | 80 ----
.../olingo/client/core/data/AbstractValue.java | 98 -----
.../client/core/data/AtomDeserializer.java | 368 -----------------
.../olingo/client/core/data/AtomEntryImpl.java | 25 --
.../olingo/client/core/data/AtomFeedImpl.java | 66 ---
.../core/data/AtomGeoValueDeserializer.java | 253 ------------
.../core/data/AtomGeoValueSerializer.java | 222 ----------
.../core/data/AtomPropertyDeserializer.java | 218 ----------
.../client/core/data/AtomPropertyImpl.java | 25 --
.../core/data/AtomPropertySerializer.java | 88 ----
.../olingo/client/core/data/AtomSerializer.java | 264 ------------
.../client/core/data/CollectionValueImpl.java | 40 --
.../client/core/data/ComplexValueImpl.java | 40 --
.../client/core/data/GeospatialValueImpl.java | 42 --
.../client/core/data/JSONEntryDeserializer.java | 244 -----------
.../olingo/client/core/data/JSONEntryImpl.java | 94 -----
.../client/core/data/JSONEntrySerializer.java | 120 ------
.../client/core/data/JSONErrorBundle.java | 50 ---
.../olingo/client/core/data/JSONErrorImpl.java | 237 -----------
.../client/core/data/JSONFeedDeserializer.java | 68 ----
.../olingo/client/core/data/JSONFeedImpl.java | 113 ------
.../client/core/data/JSONFeedSerializer.java | 57 ---
.../core/data/JSONGeoValueDeserializer.java | 265 ------------
.../core/data/JSONGeoValueSerializer.java | 175 --------
.../core/data/JSONPropertyDeserializer.java | 71 ----
.../client/core/data/JSONPropertyImpl.java | 53 ---
.../core/data/JSONPropertySerializer.java | 59 ---
.../data/JSONServiceDocumentDeserializer.java | 5 +-
.../olingo/client/core/data/LinkImpl.java | 112 -----
.../olingo/client/core/data/NullValueImpl.java | 35 --
.../core/data/ODataJacksonDeserializer.java | 45 ---
.../core/data/ODataJacksonSerializer.java | 45 ---
.../client/core/data/PrimitiveValueImpl.java | 41 --
.../olingo/client/core/data/XMLErrorImpl.java | 213 ----------
.../data/XMLServiceDocumentDeserializer.java | 3 +-
.../core/data/v3/JSONLinkCollectionImpl.java | 118 ------
.../core/data/v3/JSONServiceDocumentImpl.java | 4 +-
.../core/data/v3/XMLLinkCollectionImpl.java | 70 ----
.../core/data/v4/JSONServiceDocumentImpl.java | 4 +-
.../core/domain/ODataGeospatialValueImpl.java | 4 +-
.../core/domain/ODataPrimitiveValueImpl.java | 13 +-
.../client/core/edm/EdmActionImportImpl.java | 2 +-
.../olingo/client/core/edm/EdmClientImpl.java | 1 +
.../client/core/edm/EdmComplexTypeImpl.java | 1 +
.../client/core/edm/EdmEntityContainerImpl.java | 1 +
.../client/core/edm/EdmEntityTypeImpl.java | 1 +
.../client/core/edm/EdmFunctionImportImpl.java | 1 +
.../core/edm/EdmNavigationPropertyImpl.java | 1 +
.../client/core/edm/EdmParameterImpl.java | 1 +
.../olingo/client/core/edm/EdmPropertyImpl.java | 1 +
.../client/core/edm/EdmReturnTypeImpl.java | 1 +
.../olingo/client/core/edm/EdmTypeInfo.java | 184 ---------
.../core/edm/v3/EdmActionImportProxy.java | 2 +-
.../core/edm/v3/EdmFunctionImportProxy.java | 2 +-
.../core/edm/xml/AbstractComplexType.java | 1 -
.../core/edm/xml/AbstractEdmDeserializer.java | 71 ++++
.../core/edm/xml/AbstractEntityContainer.java | 1 -
.../client/core/edm/xml/AbstractEntitySet.java | 1 -
.../client/core/edm/xml/AbstractEntityType.java | 1 -
.../client/core/edm/xml/AbstractEnumType.java | 1 -
.../client/core/edm/xml/AbstractSchema.java | 1 -
.../core/edm/xml/ComplexTypeDeserializer.java | 82 ++++
.../core/edm/xml/DataServicesDeserializer.java | 3 +-
.../client/core/edm/xml/EdmxDeserializer.java | 3 +-
.../edm/xml/EntityContainerDeserializer.java | 101 +++++
.../core/edm/xml/EntityKeyDeserializer.java | 47 +++
.../client/core/edm/xml/EntityKeyImpl.java | 1 -
.../core/edm/xml/EntitySetDeserializer.java | 69 ++++
.../core/edm/xml/EntityTypeDeserializer.java | 90 +++++
.../core/edm/xml/EnumTypeDeserializer.java | 72 ++++
.../core/edm/xml/ParameterDeserializer.java | 3 +-
.../core/edm/xml/PropertyDeserializer.java | 3 +-
.../client/core/edm/xml/SchemaDeserializer.java | 148 +++++++
.../edm/xml/v3/AnnotationsDeserializer.java | 2 +-
.../edm/xml/v3/AssociationDeserializer.java | 2 +-
.../edm/xml/v3/AssociationSetDeserializer.java | 2 +-
.../edm/xml/v3/FunctionImportDeserializer.java | 2 +-
.../ReferentialConstraintRoleDeserializer.java | 2 +-
.../edm/xml/v3/TypeAnnotationDeserializer.java | 2 +-
.../core/edm/xml/v4/ActionDeserializer.java | 2 +-
.../core/edm/xml/v4/AnnotationDeserializer.java | 2 +-
.../edm/xml/v4/AnnotationsDeserializer.java | 2 +-
.../core/edm/xml/v4/FunctionDeserializer.java | 2 +-
.../xml/v4/NavigationPropertyDeserializer.java | 2 +-
.../core/edm/xml/v4/ReferenceDeserializer.java | 2 +-
.../core/edm/xml/v4/ReturnTypeDeserializer.java | 2 +-
.../core/edm/xml/v4/SingletonDeserializer.java | 2 +-
.../core/edm/xml/v4/TermDeserializer.java | 2 +-
.../edm/xml/v4/TypeDefinitionDeserializer.java | 2 +-
.../xml/v4/annotation/ApplyDeserializer.java | 2 +-
.../edm/xml/v4/annotation/CastDeserializer.java | 2 +-
.../v4/annotation/CollectionDeserializer.java | 2 +-
.../DynExprConstructDeserializer.java | 2 +-
.../edm/xml/v4/annotation/IsOfDeserializer.java | 2 +-
.../annotation/LabeledElementDeserializer.java | 2 +-
.../edm/xml/v4/annotation/NullDeserializer.java | 2 +-
.../annotation/PropertyValueDeserializer.java | 2 +-
.../xml/v4/annotation/RecordDeserializer.java | 2 +-
.../xml/v4/annotation/UrlRefDeserializer.java | 2 +-
.../client/core/op/AbstractODataBinder.java | 405 +++++++++++++++++++
.../client/core/op/AbstractODataReader.java | 117 ++++++
.../olingo/client/core/op/ODataWriterImpl.java | 102 +++++
.../core/op/impl/AbstractEdmDeserializer.java | 71 ----
.../core/op/impl/AbstractJacksonTool.java | 85 ----
.../core/op/impl/AbstractODataBinder.java | 404 ------------------
.../core/op/impl/AbstractODataDeserializer.java | 106 -----
.../core/op/impl/AbstractODataReader.java | 117 ------
.../core/op/impl/AbstractODataSerializer.java | 141 -------
.../core/op/impl/ComplexTypeDeserializer.java | 83 ----
.../op/impl/EntityContainerDeserializer.java | 102 -----
.../core/op/impl/EntityKeyDeserializer.java | 50 ---
.../core/op/impl/EntitySetDeserializer.java | 70 ----
.../core/op/impl/EntityTypeDeserializer.java | 92 -----
.../core/op/impl/EnumTypeDeserializer.java | 73 ----
.../op/impl/InjectableSerializerProvider.java | 43 --
.../core/op/impl/ODataObjectFactoryImpl.java | 165 --------
.../client/core/op/impl/ODataWriterImpl.java | 101 -----
.../client/core/op/impl/ResourceFactory.java | 125 ------
.../client/core/op/impl/SchemaDeserializer.java | 149 -------
.../client/core/op/impl/v3/ODataBinderImpl.java | 4 +-
.../core/op/impl/v3/ODataDeserializerImpl.java | 16 +-
.../client/core/op/impl/v3/ODataReaderImpl.java | 6 +-
.../core/op/impl/v3/ODataSerializerImpl.java | 8 +-
.../client/core/op/impl/v4/ODataBinderImpl.java | 4 +-
.../core/op/impl/v4/ODataDeserializerImpl.java | 10 +-
.../client/core/op/impl/v4/ODataReaderImpl.java | 6 +-
.../core/op/impl/v4/ODataSerializerImpl.java | 8 +-
.../apache/olingo/client/core/uri/URIUtils.java | 22 +-
.../olingo/client/core/v3/ODataClientImpl.java | 6 +-
.../olingo/client/core/v4/ODataClientImpl.java | 6 +-
.../client/core/AbstractPrimitiveTest.java | 10 +-
.../client/core/AbstractPropertyTest.java | 12 +-
.../apache/olingo/client/core/AbstractTest.java | 4 +-
.../olingo/client/core/AtomLinksQualifier.java | 2 +-
.../client/core/it/AbstractTestITCase.java | 28 +-
.../client/core/it/v3/AsyncTestITCase.java | 4 +-
.../client/core/it/v3/CountTestITCase.java | 4 +-
.../core/it/v3/EntityCreateTestITCase.java | 12 +-
.../core/it/v3/EntityRetrieveTestITCase.java | 16 +-
.../client/core/it/v3/EntitySetTestITCase.java | 6 +-
.../core/it/v3/EntityUpdateTestITCase.java | 4 +-
.../client/core/it/v3/ErrorTestITCase.java | 4 +-
.../core/it/v3/FilterFactoryTestITCase.java | 2 +-
.../client/core/it/v3/FilterTestITCase.java | 2 +-
.../core/it/v3/KeyAsSegmentTestITCase.java | 4 +-
.../client/core/it/v3/LinkTestITCase.java | 4 +-
.../core/it/v3/MediaEntityTestITCase.java | 8 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 20 +-
.../client/core/it/v3/OpenTypeTestITCase.java | 6 +-
.../core/it/v3/PrimitiveKeysTestITCase.java | 4 +-
.../core/it/v3/PropertyRetrieveTestITCase.java | 14 +-
.../client/core/it/v3/PropertyTestITCase.java | 10 +-
.../core/it/v3/PropertyValueTestITCase.java | 6 +-
.../core/it/v3/QueryOptionsTestITCase.java | 12 +-
.../v3/ServiceDocumentRetrieveTestITCase.java | 4 +-
.../core/it/v3/ServiceDocumentTestITCase.java | 4 +-
.../client/core/it/v4/EntitySetTestITCase.java | 8 +-
.../apache/olingo/client/core/v3/AtomTest.java | 4 +-
.../olingo/client/core/v3/EntitySetTest.java | 6 +-
.../olingo/client/core/v3/EntityTest.java | 10 +-
.../apache/olingo/client/core/v3/ErrorTest.java | 4 +-
.../apache/olingo/client/core/v3/JSONTest.java | 6 +-
.../client/core/v3/PrimitiveValueTest.java | 2 +-
.../client/core/v3/ServiceDocumentTest.java | 4 +-
.../client/core/v4/PrimitiveValueTest.java | 2 +-
.../client/core/v4/ServiceDocumentTest.java | 4 +-
.../client/core/v3/AllGeoTypesSet_-10_Geom.xml | 13 +-
.../v3/AllGeoTypesSet_-3_GeomMultiPolygon.xml | 43 +-
.../olingo/client/core/v3/AllGeoTypesSet_-5.xml | 97 ++---
.../v3/AllGeoTypesSet_-5_GeogCollection.xml | 19 +-
.../core/v3/AllGeoTypesSet_-5_GeogPolygon.xml | 18 +-
.../core/v3/AllGeoTypesSet_-6_GeomMultiLine.xml | 24 +-
.../v3/AllGeoTypesSet_-7_GeomMultiPoint.xml | 14 +-
.../olingo/client/core/v3/AllGeoTypesSet_-8.xml | 81 ++--
.../v3/AllGeoTypesSet_-8_GeomCollection.xml | 18 +-
lib/commons-api/pom.xml | 5 +
.../apache/olingo/commons/api/Constants.java | 243 +++++++++++
.../commons/api/data/CollectionValue.java | 27 ++
.../olingo/commons/api/data/ComplexValue.java | 27 ++
.../apache/olingo/commons/api/data/Entry.java | 167 ++++++++
.../apache/olingo/commons/api/data/Feed.java | 75 ++++
.../olingo/commons/api/data/GeoUtils.java | 90 +++++
.../commons/api/data/GeospatialValue.java | 28 ++
.../apache/olingo/commons/api/data/Link.java | 121 ++++++
.../olingo/commons/api/data/NullValue.java | 26 ++
.../olingo/commons/api/data/PrimitiveValue.java | 25 ++
.../olingo/commons/api/data/Property.java | 34 ++
.../apache/olingo/commons/api/data/Value.java | 44 ++
.../commons/api/data/v3/LinkCollection.java | 52 +++
.../commons/api/domain/AbstractODataValue.java | 127 ++++++
.../api/domain/ODataCollectionValue.java | 98 +++++
.../commons/api/domain/ODataComplexValue.java | 97 +++++
.../olingo/commons/api/domain/ODataEntity.java | 316 +++++++++++++++
.../commons/api/domain/ODataEntitySet.java | 120 ++++++
.../olingo/commons/api/domain/ODataError.java | 67 +++
.../api/domain/ODataGeospatialValue.java | 57 +++
.../commons/api/domain/ODataInlineEntity.java | 74 ++++
.../api/domain/ODataInlineEntitySet.java | 74 ++++
.../commons/api/domain/ODataInvokeResult.java | 30 ++
.../olingo/commons/api/domain/ODataItem.java | 111 +++++
.../olingo/commons/api/domain/ODataLink.java | 190 +++++++++
.../commons/api/domain/ODataLinkType.java | 93 +++++
.../commons/api/domain/ODataObjectFactory.java | 218 ++++++++++
.../commons/api/domain/ODataOperation.java | 88 ++++
.../commons/api/domain/ODataPrimitiveValue.java | 67 +++
.../commons/api/domain/ODataProperty.java | 186 +++++++++
.../commons/api/domain/ODataPropertyType.java | 40 ++
.../api/domain/ODataServiceDocument.java | 183 +++++++++
.../olingo/commons/api/domain/ODataValue.java | 84 ++++
.../olingo/commons/api/format/ContentType.java | 47 +++
.../olingo/commons/api/format/Format.java | 26 ++
.../olingo/commons/api/format/ODataFormat.java | 102 +++++
.../commons/api/format/ODataMediaFormat.java | 76 ++++
.../commons/api/format/ODataPubFormat.java | 121 ++++++
.../commons/api/format/ODataValueFormat.java | 81 ++++
.../commons/api/op/CommonODataDeserializer.java | 71 ++++
.../olingo/commons/api/op/ODataSerializer.java | 100 +++++
lib/commons-core/pom.xml | 21 +
.../commons/core/data/AbstractAtomDealer.java | 87 ++++
.../commons/core/data/AbstractAtomObject.java | 78 ++++
.../olingo/commons/core/data/AbstractEntry.java | 159 ++++++++
.../core/data/AbstractJsonDeserializer.java | 175 ++++++++
.../core/data/AbstractJsonSerializer.java | 94 +++++
.../core/data/AbstractPayloadObject.java | 48 +++
.../commons/core/data/AbstractPropertyImpl.java | 80 ++++
.../olingo/commons/core/data/AbstractValue.java | 98 +++++
.../commons/core/data/AtomDeserializer.java | 368 +++++++++++++++++
.../olingo/commons/core/data/AtomEntryImpl.java | 25 ++
.../olingo/commons/core/data/AtomFeedImpl.java | 66 +++
.../core/data/AtomGeoValueDeserializer.java | 261 ++++++++++++
.../core/data/AtomGeoValueSerializer.java | 221 ++++++++++
.../core/data/AtomPropertyDeserializer.java | 218 ++++++++++
.../commons/core/data/AtomPropertyImpl.java | 25 ++
.../core/data/AtomPropertySerializer.java | 88 ++++
.../commons/core/data/AtomSerializer.java | 264 ++++++++++++
.../commons/core/data/CollectionValueImpl.java | 40 ++
.../commons/core/data/ComplexValueImpl.java | 40 ++
.../commons/core/data/GeospatialValueImpl.java | 42 ++
.../core/data/JSONEntryDeserializer.java | 241 +++++++++++
.../olingo/commons/core/data/JSONEntryImpl.java | 92 +++++
.../commons/core/data/JSONEntrySerializer.java | 120 ++++++
.../commons/core/data/JSONErrorBundle.java | 50 +++
.../olingo/commons/core/data/JSONErrorImpl.java | 237 +++++++++++
.../commons/core/data/JSONFeedDeserializer.java | 68 ++++
.../olingo/commons/core/data/JSONFeedImpl.java | 113 ++++++
.../commons/core/data/JSONFeedSerializer.java | 57 +++
.../core/data/JSONGeoValueDeserializer.java | 273 +++++++++++++
.../core/data/JSONGeoValueSerializer.java | 183 +++++++++
.../core/data/JSONPropertyDeserializer.java | 71 ++++
.../commons/core/data/JSONPropertyImpl.java | 53 +++
.../core/data/JSONPropertySerializer.java | 59 +++
.../olingo/commons/core/data/LinkImpl.java | 112 +++++
.../olingo/commons/core/data/NullValueImpl.java | 35 ++
.../core/data/ODataJacksonDeserializer.java | 44 ++
.../core/data/ODataJacksonSerializer.java | 45 +++
.../commons/core/data/PrimitiveValueImpl.java | 41 ++
.../olingo/commons/core/data/XMLErrorImpl.java | 213 ++++++++++
.../core/data/v3/JSONLinkCollectionImpl.java | 118 ++++++
.../core/data/v3/XMLLinkCollectionImpl.java | 70 ++++
.../olingo/commons/core/edm/EdmTypeInfo.java | 184 +++++++++
.../commons/core/op/AbstractJacksonTool.java | 83 ++++
.../core/op/AbstractODataDeserializer.java | 106 +++++
.../core/op/AbstractODataSerializer.java | 141 +++++++
.../core/op/InjectableSerializerProvider.java | 43 ++
.../commons/core/op/ODataObjectFactoryImpl.java | 162 ++++++++
.../olingo/commons/core/op/ResourceFactory.java | 125 ++++++
389 files changed, 11517 insertions(+), 11309 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java
----------------------------------------------------------------------
diff --cc lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java
index 48f2614,59786f3..af0ec21
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java
@@@ -18,15 -18,15 +18,15 @@@
*/
package org.apache.olingo.client.api;
- import org.apache.olingo.client.api.format.ODataFormat;
- import org.apache.olingo.client.api.format.ODataMediaFormat;
- import org.apache.olingo.client.api.format.ODataPubFormat;
- import org.apache.olingo.client.api.format.ODataValueFormat;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.format.ODataMediaFormat;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientFactory;
import org.apache.olingo.client.api.http.HttpUriRequestFactory;
import java.io.Serializable;
import java.util.concurrent.ExecutorService;
++import org.apache.olingo.commons.api.format.ODataFormat;
++import org.apache.olingo.commons.api.format.ODataMediaFormat;
++import org.apache.olingo.commons.api.format.ODataPubFormat;
++import org.apache.olingo.commons.api.format.ODataValueFormat;
/**
* Configuration wrapper.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java
----------------------------------------------------------------------
diff --cc lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java
index 7ba38f8,f64b233..1d97bcc
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java
@@@ -20,7 -20,6 +20,7 @@@ package org.apache.olingo.client.api.co
import java.util.concurrent.Future;
import org.apache.olingo.client.api.communication.response.ODataResponse;
- import org.apache.olingo.client.api.format.Format;
++import org.apache.olingo.commons.api.format.Format;
/**
* Basic OData request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataRetrieveRequest.java
----------------------------------------------------------------------
diff --cc lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataRetrieveRequest.java
index 14f907e,edabb96..073f520
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataRetrieveRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataRetrieveRequest.java
@@@ -20,7 -20,6 +20,7 @@@ package org.apache.olingo.client.api.co
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
- import org.apache.olingo.client.api.format.Format;
++import org.apache.olingo.commons.api.format.Format;
/**
* This is an abstract representation of an OData retrieve query request returning one or more result item.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
----------------------------------------------------------------------
diff --cc lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
index 8cd5819,307cdc9..80eadf1
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
@@@ -31,7 -31,6 +31,7 @@@ import org.apache.olingo.client.api.com
import org.apache.olingo.client.api.communication.request.ODataStreamer;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
import org.apache.olingo.client.api.communication.response.ODataResponse;
- import org.apache.olingo.client.api.format.Format;
++import org.apache.olingo.commons.api.format.Format;
import org.apache.olingo.client.api.http.HttpMethod;
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --cc lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
index 2e60a7d,bec2f65..3e6c1bb
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
@@@ -42,22 -42,17 +42,22 @@@ import org.apache.olingo.client.api.com
import org.apache.olingo.client.api.communication.header.ODataHeaders;
import org.apache.olingo.client.api.communication.request.ODataRequest;
import org.apache.olingo.client.api.communication.request.ODataStreamer;
+import org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory;
+import org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory;
+import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
+import org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory;
import org.apache.olingo.client.api.communication.response.ODataResponse;
- import org.apache.olingo.client.api.format.ODataMediaFormat;
- import org.apache.olingo.client.api.format.ODataPubFormat;
- import org.apache.olingo.client.api.format.ODataValueFormat;
++import org.apache.olingo.commons.api.format.Format;
+import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.client.api.http.HttpMethod;
- import org.apache.olingo.client.core.data.JSONErrorImpl;
- import org.apache.olingo.client.core.data.XMLErrorImpl;
- import org.apache.olingo.client.api.data.ODataError;
- import org.apache.olingo.client.api.format.Format;
+import org.apache.olingo.client.core.communication.header.ODataHeadersImpl;
++import org.apache.olingo.commons.api.domain.ODataError;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+ import org.apache.olingo.commons.api.format.ODataMediaFormat;
+ import org.apache.olingo.commons.api.format.ODataPubFormat;
+ import org.apache.olingo.commons.api.format.ODataValueFormat;
-import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.api.http.HttpMethod;
+ import org.apache.olingo.commons.core.data.JSONErrorImpl;
+ import org.apache.olingo.commons.core.data.XMLErrorImpl;
-import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.client.core.communication.header.ODataHeadersImpl;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
----------------------------------------------------------------------
diff --cc lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
index 628e836,fe51722..7fd3966
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
@@@ -26,7 -26,6 +26,7 @@@ import org.apache.olingo.client.api.Com
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRetrieveRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
- import org.apache.olingo.client.api.format.Format;
++import org.apache.olingo.commons.api.format.Format;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
----------------------------------------------------------------------
diff --cc lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
index bf047af,ae64d31..ae6b8d4
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
@@@ -40,5 -41,5 +41,4 @@@ public class EdmActionImportImpl extend
return edm.getAction(new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(actionImport.getAction()).
setDefaultNamespace(container.getNamespace()).build().getFullQualifiedName(), null, null);
}
--
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --cc lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 0000000,0524c13..44e7ad4
mode 000000,100644..100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@@ -1,0 -1,405 +1,405 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ package org.apache.olingo.client.core.op;
+
+ import org.apache.olingo.commons.core.op.ResourceFactory;
+ import java.io.StringWriter;
+ import java.net.URI;
+ import java.util.Iterator;
+ import org.apache.commons.lang3.StringUtils;
+ import org.apache.olingo.client.api.CommonODataClient;
+ import org.apache.olingo.commons.api.Constants;
+ import org.apache.olingo.commons.api.data.Entry;
+ import org.apache.olingo.commons.api.data.Feed;
+ import org.apache.olingo.commons.api.data.Link;
+ import org.apache.olingo.commons.api.data.Property;
+ import org.apache.olingo.client.api.data.ServiceDocument;
+ import org.apache.olingo.client.api.data.ServiceDocumentItem;
+ import org.apache.olingo.commons.api.data.Value;
+ import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+ import org.apache.olingo.commons.api.domain.ODataComplexValue;
+ import org.apache.olingo.commons.api.domain.ODataEntity;
+ import org.apache.olingo.commons.api.domain.ODataEntitySet;
+ import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+ import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+ import org.apache.olingo.commons.api.domain.ODataLink;
+ import org.apache.olingo.commons.api.domain.ODataOperation;
+ import org.apache.olingo.commons.api.domain.ODataProperty;
+ import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+ import org.apache.olingo.commons.api.domain.ODataValue;
+ import org.apache.olingo.commons.api.format.ODataPubFormat;
+ import org.apache.olingo.client.api.op.CommonODataBinder;
+ import org.apache.olingo.commons.core.data.CollectionValueImpl;
+ import org.apache.olingo.commons.core.data.ComplexValueImpl;
+ import org.apache.olingo.commons.core.data.GeospatialValueImpl;
+ import org.apache.olingo.commons.core.data.JSONPropertyImpl;
+ import org.apache.olingo.commons.core.data.LinkImpl;
+ import org.apache.olingo.commons.core.data.NullValueImpl;
+ import org.apache.olingo.commons.core.data.PrimitiveValueImpl;
+ import org.apache.olingo.client.core.uri.URIUtils;
+ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
+
+ public abstract class AbstractODataBinder implements CommonODataBinder {
+
+ private static final long serialVersionUID = 454285889193689536L;
+
+ /**
+ * Logger.
+ */
+ protected final Logger LOG = LoggerFactory.getLogger(AbstractODataBinder.class);
+
+ protected final CommonODataClient client;
+
+ protected AbstractODataBinder(final CommonODataClient client) {
+ this.client = client;
+ }
+
+ @Override
+ public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
+ final ODataServiceDocument serviceDocument = new ODataServiceDocument();
+
+ for (ServiceDocumentItem entitySet : resource.getEntitySets()) {
+ // handles V3 JSON format oddities, where title is not contained
+ serviceDocument.getEntitySets().put(StringUtils.isBlank(entitySet.getTitle())
+ ? entitySet.getName() : entitySet.getTitle(),
+ URIUtils.getURI(resource.getBaseURI(), entitySet.getHref()));
+ }
+
+ return serviceDocument;
+ }
+
+ @Override
+ public Feed getFeed(final ODataEntitySet feed, final Class<? extends Feed> reference) {
+ final Feed feedResource = ResourceFactory.newFeed(reference);
+
+ feedResource.setCount(feed.getCount());
+
+ final URI next = feed.getNext();
+ if (next != null) {
+ feedResource.setNext(next);
+ }
+
+ for (ODataEntity entity : feed.getEntities()) {
+ feedResource.getEntries().add(getEntry(entity, ResourceFactory.entryClassForFeed(reference)));
+ }
+
+ return feedResource;
+ }
+
+ @Override
+ public Entry getEntry(final ODataEntity entity, final Class<? extends Entry> reference) {
+ return getEntry(entity, reference, true);
+ }
+
+ @Override
+ public Entry getEntry(final ODataEntity entity, final Class<? extends Entry> reference, final boolean setType) {
+ final Entry entry = ResourceFactory.newEntry(reference);
+ entry.setType(entity.getName());
+
+ // -------------------------------------------------------------
+ // Add edit and self link
+ // -------------------------------------------------------------
+ final URI editLink = entity.getEditLink();
+ if (editLink != null) {
+ final LinkImpl entryEditLink = new LinkImpl();
+ entryEditLink.setTitle(entity.getName());
+ entryEditLink.setHref(editLink.toASCIIString());
+ entryEditLink.setRel(Constants.EDIT_LINK_REL);
+ entry.setEditLink(entryEditLink);
+ }
+
+ if (entity.isReadOnly()) {
+ final LinkImpl entrySelfLink = new LinkImpl();
+ entrySelfLink.setTitle(entity.getName());
+ entrySelfLink.setHref(entity.getLink().toASCIIString());
+ entrySelfLink.setRel(Constants.SELF_LINK_REL);
+ entry.setSelfLink(entrySelfLink);
+ }
+ // -------------------------------------------------------------
+
+ // -------------------------------------------------------------
+ // Append navigation links (handling inline entry / feed as well)
+ // -------------------------------------------------------------
+ // handle navigation links
+ for (ODataLink link : entity.getNavigationLinks()) {
+ // append link
+ LOG.debug("Append navigation link\n{}", link);
+ entry.getNavigationLinks().add(getLink(link,
+ ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
+ }
+ // -------------------------------------------------------------
+
+ // -------------------------------------------------------------
+ // Append edit-media links
+ // -------------------------------------------------------------
+ for (ODataLink link : entity.getEditMediaLinks()) {
+ LOG.debug("Append edit-media link\n{}", link);
+ entry.getMediaEditLinks().add(getLink(link,
+ ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
+ }
+ // -------------------------------------------------------------
+
+ // -------------------------------------------------------------
+ // Append association links
+ // -------------------------------------------------------------
+ for (ODataLink link : entity.getAssociationLinks()) {
+ LOG.debug("Append association link\n{}", link);
+ entry.getAssociationLinks().add(getLink(link,
+ ResourceFactory.formatForEntryClass(reference) == ODataPubFormat.ATOM));
+ }
+ // -------------------------------------------------------------
+
+ if (entity.isMediaEntity()) {
+ entry.setMediaContentSource(entity.getMediaContentSource());
+ entry.setMediaContentType(entity.getMediaContentType());
+ }
+
+ for (ODataProperty property : entity.getProperties()) {
+ entry.getProperties().add(getProperty(property, reference, setType));
+ }
+
+ return entry;
+ }
+
+ @Override
+ public Link getLink(final ODataLink link, boolean isXML) {
+ final Link linkResource = new LinkImpl();
+ linkResource.setRel(link.getRel());
+ linkResource.setTitle(link.getName());
+ linkResource.setHref(link.getLink() == null ? null : link.getLink().toASCIIString());
+ linkResource.setType(link.getType().toString());
+ linkResource.setMediaETag(link.getMediaETag());
+
+ if (link instanceof ODataInlineEntity) {
+ // append inline entity
+ final ODataEntity inlineEntity = ((ODataInlineEntity) link).getEntity();
+ LOG.debug("Append in-line entity\n{}", inlineEntity);
+
+ linkResource.setInlineEntry(getEntry(inlineEntity, ResourceFactory.entryClassForFormat(isXML)));
+ } else if (link instanceof ODataInlineEntitySet) {
+ // append inline feed
+ final ODataEntitySet InlineFeed = ((ODataInlineEntitySet) link).getEntitySet();
+ LOG.debug("Append in-line feed\n{}", InlineFeed);
+
+ linkResource.setInlineFeed(getFeed(InlineFeed, ResourceFactory.feedClassForFormat(isXML)));
+ }
+
+ return linkResource;
+ }
+
+ @Override
+ public Property getProperty(final ODataProperty property, final Class<? extends Entry> reference,
+ final boolean setType) {
+
+ final Property propertyResource = ResourceFactory.newProperty(reference);
+ propertyResource.setName(property.getName());
+ propertyResource.setValue(getValue(property.getValue(), reference, setType));
+
+ if (setType) {
+ if (property.hasPrimitiveValue()) {
+ propertyResource.setType(property.getPrimitiveValue().getType().toString());
+ } else if (property.hasComplexValue()) {
+ propertyResource.setType(property.getComplexValue().getType());
+ } else if (property.hasCollectionValue()) {
+ propertyResource.setType(property.getCollectionValue().getType());
+ }
+ }
+
+ return propertyResource;
+ }
+
+ private Value getValue(final ODataValue value, final Class<? extends Entry> reference, final boolean setType) {
+ Value valueResource = null;
+
+ if (value == null) {
+ valueResource = new NullValueImpl();
+ } else if (value.isPrimitive()) {
+ valueResource = new PrimitiveValueImpl(value.asPrimitive().toString());
+ } else if (value.isGeospatial()) {
+ valueResource = new GeospatialValueImpl(value.asGeospatial().toValue());
+ } else if (value.isComplex()) {
+ final ODataComplexValue _value = value.asComplex();
+ valueResource = new ComplexValueImpl();
+
+ for (final Iterator<ODataProperty> itor = _value.iterator(); itor.hasNext();) {
+ valueResource.asComplex().get().add(getProperty(itor.next(), reference, setType));
+ }
+ } else if (value.isCollection()) {
+ final ODataCollectionValue _value = value.asCollection();
+ valueResource = new CollectionValueImpl();
+
+ for (final Iterator<ODataValue> itor = _value.iterator(); itor.hasNext();) {
+ valueResource.asCollection().get().add(getValue(itor.next(), reference, setType));
+ }
+ }
+
+ return valueResource;
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource) {
+ return getODataEntitySet(resource, null);
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource, final URI defaultBaseURI) {
+ if (LOG.isDebugEnabled()) {
+ final StringWriter writer = new StringWriter();
+ client.getSerializer().feed(resource, writer);
+ writer.flush();
+ LOG.debug("Feed -> ODataEntitySet:\n{}", writer.toString());
+ }
+
+ final URI base = defaultBaseURI == null ? resource.getBaseURI() : defaultBaseURI;
-
++
+ final URI next = resource.getNext();
+
+ final ODataEntitySet entitySet = next == null
+ ? client.getObjectFactory().newEntitySet()
+ : client.getObjectFactory().newEntitySet(URIUtils.getURI(base, next.toASCIIString()));
+
+ if (resource.getCount() != null) {
+ entitySet.setCount(resource.getCount());
+ }
+
+ for (Entry entryResource : resource.getEntries()) {
+ entitySet.addEntity(getODataEntity(entryResource));
+ }
-
++
+ return entitySet;
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource) {
+ return getODataEntity(resource, null);
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
+ if (LOG.isDebugEnabled()) {
+ final StringWriter writer = new StringWriter();
+ client.getSerializer().entry(resource, writer);
+ writer.flush();
+ LOG.debug("EntryResource -> ODataEntity:\n{}", writer.toString());
+ }
+
+ final URI base = defaultBaseURI == null ? resource.getBaseURI() : defaultBaseURI;
+
+ final ODataEntity entity = resource.getSelfLink() == null
+ ? client.getObjectFactory().newEntity(resource.getType())
+ : client.getObjectFactory().newEntity(resource.getType(),
+ URIUtils.getURI(base, resource.getSelfLink().getHref()));
+
+ if (StringUtils.isNotBlank(resource.getETag())) {
+ entity.setETag(resource.getETag());
+ }
-
++
+ if (resource.getEditLink() != null) {
+ entity.setEditLink(URIUtils.getURI(base, resource.getEditLink().getHref()));
+ }
-
++
+ for (Link link : resource.getAssociationLinks()) {
+ entity.addLink(client.getObjectFactory().newAssociationLink(link.getTitle(), base, link.getHref()));
+ }
+
+ for (Link link : resource.getNavigationLinks()) {
+ final Entry inlineEntry = link.getInlineEntry();
+ final Feed inlineFeed = link.getInlineFeed();
+
+ if (inlineEntry == null && inlineFeed == null) {
+ entity.addLink(
+ client.getObjectFactory().newEntityNavigationLink(link.getTitle(), base, link.getHref()));
+ } else if (inlineFeed == null) {
+ entity.addLink(client.getObjectFactory().newInlineEntity(
+ link.getTitle(), base, link.getHref(),
+ getODataEntity(inlineEntry,
+ inlineEntry.getBaseURI() == null ? base : inlineEntry.getBaseURI())));
+ } else {
+ entity.addLink(client.getObjectFactory().newInlineEntitySet(
+ link.getTitle(), base, link.getHref(),
+ getODataEntitySet(inlineFeed,
+ inlineFeed.getBaseURI() == null ? base : inlineFeed.getBaseURI())));
+ }
+ }
+
+ for (Link link : resource.getMediaEditLinks()) {
+ entity.addLink(client.getObjectFactory().newMediaEditLink(link.getTitle(), base, link.getHref()));
+ }
+
+ for (ODataOperation operation : resource.getOperations()) {
+ operation.setTarget(URIUtils.getURI(base, operation.getTarget()));
+ entity.getOperations().add(operation);
+ }
+
+ if (resource.isMediaEntry()) {
+ entity.setMediaEntity(true);
+ entity.setMediaContentSource(resource.getMediaContentSource());
+ entity.setMediaContentType(resource.getMediaContentType());
+ }
+
+ for (Property property : resource.getProperties()) {
+ entity.getProperties().add(getODataProperty(property));
+ }
+
+ return entity;
+ }
+
+ @Override
+ public ODataProperty getODataProperty(final Property property) {
+ return new ODataProperty(property.getName(), getODataValue(property));
+ }
+
+ private ODataValue getODataValue(final Property resource) {
+ ODataValue value = null;
+
+ if (resource.getValue().isSimple()) {
+ value = client.getPrimitiveValueBuilder().
+ setText(resource.getValue().asSimple().get()).
+ setType(resource.getType() == null
+ ? null
+ : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
+ } else if (resource.getValue().isGeospatial()) {
+ value = client.getGeospatialValueBuilder().
+ setValue(resource.getValue().asGeospatial().get()).
+ setType(resource.getType() == null
+ || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
+ || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().toString().equals(resource.getType())
+ ? null
+ : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
+ } else if (resource.getValue().isComplex()) {
+ value = new ODataComplexValue(resource.getType());
+
+ for (Property property : resource.getValue().asComplex().get()) {
+ value.asComplex().add(getODataProperty(property));
+ }
+ } else if (resource.getValue().isCollection()) {
+ value = new ODataCollectionValue(resource.getType());
+
+ for (Value _value : resource.getValue().asCollection().get()) {
+ final JSONPropertyImpl fake = new JSONPropertyImpl();
+ fake.setValue(_value);
+ value.asCollection().add(getODataValue(fake));
+ }
+ }
+
+ return value;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --cc lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index 9e2527a,0000000..e3e8a1e
mode 100644,000000..100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@@ -1,152 -1,0 +1,152 @@@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.it.v4;
+
++import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
+import org.apache.olingo.client.api.communication.response.ODataRawResponse;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
- import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
- import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
- import org.apache.olingo.client.core.op.impl.ResourceFactory;
- import static org.junit.Assert.assertNotNull;
++import org.apache.olingo.commons.api.domain.ODataEntitySet;
++import org.apache.olingo.commons.api.format.ODataPubFormat;
++import org.apache.olingo.commons.core.op.ResourceFactory;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This is the unit test class to check basic feed operations.
+ */
+public class EntitySetTestITCase extends AbstractTestITCase {
+
+ protected String getServiceRoot() {
+ return testStaticServiceRootURL;
+ }
+
+ @Test
+ public void rawRequestAsAtom() throws IOException {
+ rawRequest(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ @Ignore
+ public void rawRequestAsJSON() throws IOException {
+ rawRequest(ODataPubFormat.JSON);
+ }
+
+ @Test
+ public void readODataEntitySetIteratorFromAtom() {
+ readODataEntitySetIterator(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ @Ignore
+ public void readODataEntitySetIteratorFromJSON() {
+ readODataEntitySetIterator(ODataPubFormat.JSON);
+ }
+
+ @Test
+ @Ignore
+ public void readODataEntitySetIteratorFromJSONFullMeta() {
+ readODataEntitySetIterator(ODataPubFormat.JSON_FULL_METADATA);
+ }
+
+ @Test
+ @Ignore
+ public void readODataEntitySetIteratorFromJSONNoMeta() {
+ readODataEntitySetIterator(ODataPubFormat.JSON_NO_METADATA);
+ }
+
+ @Test
+ public void readODataEntitySetWithNextFromAtom() {
+ readEntitySetWithNextLink(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ @Ignore
+ public void readODataEntitySetWithNextFromJSON() {
+ readEntitySetWithNextLink(ODataPubFormat.JSON_FULL_METADATA);
+ }
+
+ private void readEntitySetWithNextLink(final ODataPubFormat format) {
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ uriBuilder.appendEntitySetSegment("People");
+
+ final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ req.setFormat(format);
+
+ final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
+ final ODataEntitySet feed = res.getBody();
+
+ assertNotNull(feed);
+
+ debugFeed(client.getBinder().getFeed(feed, ResourceFactory.feedClassForFormat(
+ ODataPubFormat.ATOM == format)), "Just retrieved feed");
+
+ assertEquals(5, feed.getEntities().size());
+// assertNotNull(feed.getNext());
+
+// final URI expected = URI.create(getServiceRoot() + "/Customer?$skiptoken=-9");
+// final URI found = URIUtils.getURI(getServiceRoot(), feed.getNext().toASCIIString());
+
+// assertEquals(expected, found);
+ }
+
+ private void readODataEntitySetIterator(final ODataPubFormat format) {
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ uriBuilder.appendEntitySetSegment("People");
+
+ final ODataEntitySetIteratorRequest req =
+ client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
+ req.setFormat(format);
+
+ final ODataRetrieveResponse<ODataEntitySetIterator> res = req.execute();
+ final ODataEntitySetIterator feedIterator = res.getBody();
+
+ assertNotNull(feedIterator);
+
+ int count = 0;
+
+ while (feedIterator.hasNext()) {
+ assertNotNull(feedIterator.next());
+ count++;
+ }
+ assertEquals(5, count);
+// assertTrue(feedIterator.getNext().toASCIIString().endsWith("Customer?$skiptoken=-9"));
+ }
+
+ private void rawRequest(final ODataPubFormat format) {
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ uriBuilder.appendEntitySetSegment("People");
+
+ final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
+ req.setFormat(format.toString(client.getServiceVersion()));
+
+ final ODataRawResponse res = req.execute();
+ assertNotNull(res);
+
+ final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
+ assertNotNull(entitySet);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java
----------------------------------------------------------------------
diff --cc lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java
index 0000000,59dc834..28727ea
mode 000000,100644..100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java
@@@ -1,0 -1,93 +1,93 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ package org.apache.olingo.commons.api.domain;
+
+ import org.apache.commons.lang3.StringUtils;
+ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+ import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
+
+ /**
+ * OData link types.
+ */
+ public enum ODataLinkType {
+
+ /**
+ * Entity navigation link.
+ */
- ENTITY_NAVIGATION(ODataPubFormat.ATOM + ";type=entry"),
++ ENTITY_NAVIGATION(ContentType.APPLICATION_ATOM_XML + ";type=entry"),
+ /**
+ * Entity set navigation link.
+ */
- ENTITY_SET_NAVIGATION(ODataPubFormat.ATOM + ";type=feed"),
++ ENTITY_SET_NAVIGATION(ContentType.APPLICATION_ATOM_XML + ";type=feed"),
+ /**
+ * Association link.
+ */
+ ASSOCIATION(ContentType.APPLICATION_XML),
+ /**
+ * Media-edit link.
+ */
+ MEDIA_EDIT("*/*");
+
+ private String type;
+
+ private ODataLinkType(final String type) {
+ this.type = type;
+ }
+
+ private ODataLinkType setType(final String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
- * Gets <code>LinkType</code> instance from the given rel and type.
++ * Gets
++ * <code>LinkType</code> instance from the given rel and type.
+ *
+ * @param version OData protocol version.
+ * @param rel rel.
+ * @param type type.
+ * @return <code>ODataLinkType</code> object.
+ */
+ public static ODataLinkType fromString(final ODataServiceVersion version, final String rel, final String type) {
+ if (StringUtils.isNotBlank(rel)
+ && rel.startsWith(version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL))) {
+
+ return MEDIA_EDIT.setType(StringUtils.isBlank(type) ? "*/*" : type);
+ }
+
+ if (ODataLinkType.ENTITY_NAVIGATION.type.equals(type)) {
+ return ENTITY_NAVIGATION;
+ }
+
+ if (ODataLinkType.ENTITY_SET_NAVIGATION.type.equals(type)) {
+ return ENTITY_SET_NAVIGATION;
+ }
+
+ if (ODataLinkType.ASSOCIATION.type.equals(type)) {
+ return ASSOCIATION;
+ }
+
+ throw new IllegalArgumentException("Invalid link type: " + type);
+ }
+
+ @Override
+ public String toString() {
+ return type;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/Format.java
----------------------------------------------------------------------
diff --cc lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/Format.java
index 0000000,0000000..f031018
new file mode 100644
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/Format.java
@@@ -1,0 -1,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.commons.api.format;
++
++import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
++
++public interface Format {
++
++ String toString(ODataServiceVersion version);
++}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
----------------------------------------------------------------------
diff --cc lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
index 0000000,30d9e09..7401e0b
mode 000000,100644..100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
@@@ -1,0 -1,95 +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.commons.api.format;
+
++import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
++
+ /**
+ * Available formats to be used in various contexts.
+ */
-public enum ODataFormat {
++public enum ODataFormat implements Format{
+
+ /**
+ * JSON format with no metadata.
+ */
+ JSON_NO_METADATA(ContentType.APPLICATION_JSON + ";odata=nometadata"),
+ /**
+ * JSON format with minimal metadata (default).
+ */
+ JSON(ContentType.APPLICATION_JSON + ";odata=minimalmetadata"),
+ /**
+ * JSON format with no metadata.
+ */
+ JSON_FULL_METADATA(ContentType.APPLICATION_JSON + ";odata=fullmetadata"),
+ /**
+ * XML format.
+ */
+ XML(ContentType.APPLICATION_XML);
+
+ 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].trim());
+ if (ContentType.APPLICATION_JSON.equals(parts[0].trim())) {
+ if (parts.length > 1) {
+ _format.append(';').append(parts[1].trim());
+ } 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;
+ }
++
++ @Override
++ public String toString(final ODataServiceVersion version) {
++ return this.toString();
++ }
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataMediaFormat.java
----------------------------------------------------------------------
diff --cc lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataMediaFormat.java
index 0000000,c479de4..a9410d5
mode 000000,100644..100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataMediaFormat.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataMediaFormat.java
@@@ -1,0 -1,69 +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.commons.api.format;
+
++import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
++
+ /**
+ * Available formats for media.
+ */
-public enum ODataMediaFormat {
++public enum ODataMediaFormat implements Format{
+
+ CHARSET_PARAMETER("charset"),
+ MEDIA_TYPE_WILDCARD("*"),
+ WILDCARD(ContentType.WILDCARD),
+ APPLICATION_XML(ContentType.APPLICATION_XML),
+ APPLICATION_ATOM_XML(ContentType.APPLICATION_ATOM_XML),
+ APPLICATION_XHTML_XML(ContentType.APPLICATION_XHTML_XML),
+ APPLICATION_SVG_XML(ContentType.APPLICATION_SVG_XML),
+ APPLICATION_JSON(ContentType.APPLICATION_JSON),
+ APPLICATION_FORM_URLENCODED(ContentType.APPLICATION_FORM_URLENCODED),
+ MULTIPART_FORM_DATA(ContentType.MULTIPART_FORM_DATA),
+ APPLICATION_OCTET_STREAM(ContentType.APPLICATION_OCTET_STREAM),
+ TEXT_PLAIN(ContentType.TEXT_PLAIN),
+ TEXT_XML(ContentType.TEXT_XML),
+ TEXT_HTML(ContentType.TEXT_HTML);
+
+ 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;
+ }
++
++ @Override
++ public String toString(final ODataServiceVersion version) {
++ return this.toString();
++ }
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java
----------------------------------------------------------------------
diff --cc lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java
index 0000000,6cd6a05..62dc61b
mode 000000,100644..100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java
@@@ -1,0 -1,95 +1,121 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ package org.apache.olingo.commons.api.format;
+
++import java.util.EnumMap;
++import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
++
+ /**
+ * Available formats for AtomPub exchange.
+ */
-public enum ODataPubFormat {
++public enum ODataPubFormat implements Format {
+
+ /**
+ * JSON format with no metadata.
+ */
- JSON_NO_METADATA(ContentType.APPLICATION_JSON + ";odata=nometadata"),
++ JSON_NO_METADATA(),
+ /**
+ * JSON format with minimal metadata (default).
+ */
- JSON(ContentType.APPLICATION_JSON + ";odata=minimalmetadata"),
++ JSON(),
+ /**
+ * JSON format with no metadata.
+ */
- JSON_FULL_METADATA(ContentType.APPLICATION_JSON + ";odata=fullmetadata"),
++ JSON_FULL_METADATA(),
+ /**
+ * Atom format.
+ */
- ATOM(ContentType.APPLICATION_ATOM_XML);
++ ATOM();
++
++ final static EnumMap<ODataServiceVersion, EnumMap<ODataPubFormat, String>> formatPerVersion =
++ new EnumMap<ODataServiceVersion, EnumMap<ODataPubFormat, String>>(ODataServiceVersion.class);
+
- private final String format;
++ static {
++ final EnumMap<ODataPubFormat, String> v3 = new EnumMap<ODataPubFormat, String>(ODataPubFormat.class);
++ v3.put(JSON_NO_METADATA, ContentType.APPLICATION_JSON + ";odata=nometadata");
++ v3.put(JSON, ContentType.APPLICATION_JSON + ";odata=minimalmetadata");
++ v3.put(JSON_FULL_METADATA, ContentType.APPLICATION_JSON + ";odata=fullmetadata");
++ v3.put(ATOM, ContentType.APPLICATION_ATOM_XML);
++ formatPerVersion.put(ODataServiceVersion.V30, v3);
+
- ODataPubFormat(final String format) {
- this.format = format;
++ final EnumMap<ODataPubFormat, String> v4 = new EnumMap<ODataPubFormat, String>(ODataPubFormat.class);
++ v4.put(JSON_NO_METADATA, ContentType.APPLICATION_JSON + ";odata.metadata=none");
++ v4.put(JSON, ContentType.APPLICATION_JSON + ";odata.metadata=minimal");
++ v4.put(JSON_FULL_METADATA, ContentType.APPLICATION_JSON + ";odata.metadata=full");
++ v4.put(ATOM, ContentType.APPLICATION_ATOM_XML);
++ formatPerVersion.put(ODataServiceVersion.V40, v4);
+ }
+
+ /**
+ * Gets format as a string.
+ *
+ * @return format as a string.
+ */
+ @Override
++ public String toString(final ODataServiceVersion version) {
++ if (version.ordinal() < ODataServiceVersion.V30.ordinal()) {
++ throw new IllegalArgumentException("Unsupported version " + version);
++ }
++
++ return ODataPubFormat.formatPerVersion.get(version).get(this);
++ }
++
++ @Override
+ public String toString() {
- return format;
++ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * 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].trim());
+ if (ContentType.APPLICATION_JSON.equals(parts[0].trim())) {
- if (parts.length > 1 && parts[1].startsWith("odata=")) {
++ if (parts.length > 1 && parts[1].startsWith("odata")) {
+ _format.append(';').append(parts[1].trim());
+ } else {
+ result = ODataPubFormat.JSON;
+ }
+ }
+
+ if (result == null) {
+ final String candidate = _format.toString();
+ for (ODataPubFormat value : values()) {
- if (candidate.equals(value.toString())) {
++ if (candidate.equals(value.toString(ODataServiceVersion.V30))
++ || candidate.equals(value.toString(ODataServiceVersion.V40))) {
+ result = value;
+ }
+ }
+ }
+
+ if (result == null) {
+ throw new IllegalArgumentException("Unsupported format: " + format);
+ }
+
+ return result;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataValueFormat.java
----------------------------------------------------------------------
diff --cc lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataValueFormat.java
index 0000000,1b290bf..28ce108
mode 000000,100644..100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataValueFormat.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataValueFormat.java
@@@ -1,0 -1,74 +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.commons.api.format;
+
++import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
++
+ /**
+ * Available formats for property values.
+ */
-public enum ODataValueFormat {
++public enum ODataValueFormat implements Format {
+
+ /**
+ * Application octet stream.
+ */
+ STREAM(ContentType.APPLICATION_OCTET_STREAM),
+ /**
+ * Plain text format.
+ */
+ TEXT(ContentType.TEXT_PLAIN);
+
+ 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;
+ }
++
++ @Override
++ public String toString(final ODataServiceVersion version) {
++ return this.toString();
++ }
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --cc lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
index 0000000,2d865ce..4c92ae6
mode 000000,100644..100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
@@@ -1,0 -1,176 +1,175 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ package org.apache.olingo.commons.core.data;
+
+ import com.fasterxml.jackson.databind.JsonNode;
+ import com.fasterxml.jackson.databind.node.ObjectNode;
+ import java.util.Iterator;
+ import java.util.Map;
+ import org.apache.commons.lang3.StringUtils;
+ import org.apache.olingo.commons.api.Constants;
+ import org.apache.olingo.commons.api.data.CollectionValue;
+ import org.apache.olingo.commons.api.data.ComplexValue;
+ import org.apache.olingo.commons.api.data.Value;
+ import org.apache.olingo.commons.api.domain.ODataPropertyType;
+ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+ import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
+
+ private JSONGeoValueDeserializer geoDeserializer;
+
+ private JSONGeoValueDeserializer getGeoDeserializer() {
+ if (geoDeserializer == null) {
+ geoDeserializer = new JSONGeoValueDeserializer(version);
+ }
+ return geoDeserializer;
+ }
+
+ protected EdmPrimitiveTypeKind getPrimitiveType(final JsonNode node) {
+ EdmPrimitiveTypeKind result = EdmPrimitiveTypeKind.String;
+
+ if (node.isIntegralNumber()) {
+ result = EdmPrimitiveTypeKind.Int32;
+ } else if (node.isBoolean()) {
+ result = EdmPrimitiveTypeKind.Boolean;
+ } else if (node.isFloatingPointNumber()) {
+ result = EdmPrimitiveTypeKind.Double;
+ }
+
+ return result;
+ }
+
+ private ODataPropertyType guessPropertyType(final JsonNode node) {
- ODataPropertyType type = null;
++ final ODataPropertyType type;
+
+ if (node.isValueNode() || node.isNull()) {
+ type = ODataPropertyType.PRIMITIVE;
+ } else if (node.isArray()) {
+ type = ODataPropertyType.COLLECTION;
+ } else if (node.isObject()) {
+ type = ODataPropertyType.COMPLEX;
+ } else {
+ type = ODataPropertyType.EMPTY;
+ }
+
+ return type;
+ }
+
+ private Value fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) {
- Value value = null;
++ final Value value;
+
+ if (node.isNull()) {
+ value = new NullValueImpl();
+ } else {
+ if (typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+ value = new GeospatialValueImpl(getGeoDeserializer().deserialize(node, typeInfo));
+ } else {
+ value = new PrimitiveValueImpl(node.asText());
+ }
+ }
+
+ return value;
+ }
+
+ private ComplexValue fromComplex(final JsonNode node) {
+ final ComplexValue value = new ComplexValueImpl();
+
+ String type = null;
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+
+ if (type == null && field.getKey().endsWith(Constants.JSON_TYPE_SUFFIX)) {
+ type = field.getValue().asText();
+ } else {
+ final JSONPropertyImpl property = new JSONPropertyImpl();
+ property.setName(field.getKey());
+ property.setType(type);
+ type = null;
+
+ value(property, field.getValue());
+ value.get().add(property);
+ }
+ }
+
+ return value;
+ }
+
+ private CollectionValue fromCollection(final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo) {
+ final CollectionValueImpl value = new CollectionValueImpl();
+
+ final EdmTypeInfo type = typeInfo == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
+
+ while (nodeItor.hasNext()) {
+ final JsonNode child = nodeItor.next();
+
+ if (child.isValueNode()) {
+ value.get().add(fromPrimitive(child, type));
+ } else if (child.isContainerNode()) {
+ if (child.has(Constants.JSON_TYPE)) {
+ ((ObjectNode) child).remove(Constants.JSON_TYPE);
+ }
+ value.get().add(fromComplex(child));
+ }
+ }
+
+ return value;
+ }
+
+ protected void value(final JSONPropertyImpl property, final JsonNode node) {
+ final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
+
+ final ODataPropertyType propType = typeInfo == null
+ ? guessPropertyType(node)
+ : typeInfo.isCollection()
+ ? ODataPropertyType.COLLECTION
+ : typeInfo.isPrimitiveType()
+ ? ODataPropertyType.PRIMITIVE
+ : ODataPropertyType.COMPLEX;
+
+ switch (propType) {
+ case COLLECTION:
+ property.setValue(fromCollection(node.elements(), typeInfo));
+ break;
+
+ case COMPLEX:
+ if (node.has(Constants.JSON_TYPE)) {
+ property.setType(node.get(Constants.JSON_TYPE).asText());
+ ((ObjectNode) node).remove(Constants.JSON_TYPE);
+ }
+ property.setValue(fromComplex(node));
+ break;
+
+ case PRIMITIVE:
+ if (property.getType() == null) {
+ property.setType(getPrimitiveType(node).getFullQualifiedName().toString());
+ }
+ property.setValue(fromPrimitive(node, typeInfo));
+ break;
+
+ case EMPTY:
+ default:
+ property.setValue(new PrimitiveValueImpl(StringUtils.EMPTY));
+ }
+ }
-
+ }
[06/52] [abbrv] Consistently using package name to differentiate V3
and V4
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/V3ConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/V3ConfigurationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/V3ConfigurationImpl.java
deleted file mode 100644
index 3844794..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/V3ConfigurationImpl.java
+++ /dev/null
@@ -1,57 +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.client.core;
-
-import org.apache.olingo.client.api.V3Configuration;
-
-public class V3ConfigurationImpl extends AbstractConfiguration implements V3Configuration {
-
- private static final long serialVersionUID = -8719958537946884777L;
-
- private static final String KEY_AS_SEGMENT = "keyAsSegment";
-
- protected V3ConfigurationImpl() {
- super();
- }
-
- /**
- * 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.
- */
- @Override
- public boolean isKeyAsSegment() {
- return (Boolean) getProperty(KEY_AS_SEGMENT, false);
- }
-
- /**
- * 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.
- */
- @Override
- public void setKeyAsSegment(final boolean value) {
- setProperty(KEY_AS_SEGMENT, value);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/V4ConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/V4ConfigurationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/V4ConfigurationImpl.java
deleted file mode 100644
index 11c579e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/V4ConfigurationImpl.java
+++ /dev/null
@@ -1,31 +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.client.core;
-
-import org.apache.olingo.client.api.V4Configuration;
-
-public class V4ConfigurationImpl extends AbstractConfiguration implements V4Configuration {
-
- private static final long serialVersionUID = -1134213707190176857L;
-
- protected V4ConfigurationImpl() {
- super();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/Wrapper.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/Wrapper.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/Wrapper.java
deleted file mode 100644
index 1237a2f..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/Wrapper.java
+++ /dev/null
@@ -1,41 +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.client.core;
-
-/**
- * Generic wrapper class.
- *
- * @param <T>
- */
-public class Wrapper<T> {
-
- private T wrapped;
-
- public void setWrapped(final T wrapped) {
- this.wrapped = wrapped;
- }
-
- public T getWrapped() {
- if (wrapped == null) {
- throw new IllegalStateException("Wrapped object not set");
- }
-
- return wrapped;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
index 84135eb..307cdc9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
@@ -26,7 +26,7 @@ import java.util.concurrent.Future;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.ODataBatchConstants;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.request.ODataStreamer;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
@@ -51,7 +51,7 @@ public abstract class AbstractODataBasicRequest<V extends ODataResponse, T exten
* @param method request method.
* @param uri OData request URI.
*/
- public AbstractODataBasicRequest(final ODataClient odataClient,
+ public AbstractODataBasicRequest(final CommonODataClient odataClient,
final Class<T> formatRef, final HttpMethod method, final URI uri) {
super(odataClient, formatRef, method, uri);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataStreamManager.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataStreamManager.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataStreamManager.java
index 2c59ff0..94f49d1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataStreamManager.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataStreamManager.java
@@ -31,7 +31,6 @@ import org.apache.http.HttpResponse;
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
import org.apache.olingo.client.api.communication.response.ODataResponse;
import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.core.Wrapper;
/**
* OData request payload management abstract class.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
index e931cb1..d088e97 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
@@ -33,8 +33,8 @@ import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.DecompressingHttpClient;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.V3Configuration;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.v3.Configuration;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.ODataServerErrorException;
import org.apache.olingo.client.api.communication.header.HeaderName;
@@ -73,7 +73,7 @@ public class ODataRequestImpl<T extends Enum<T>> implements ODataRequest {
*/
protected static final Logger LOG = LoggerFactory.getLogger(ODataRequest.class);
- protected final ODataClient odataClient;
+ protected final CommonODataClient odataClient;
protected final Class<T> formatRef;
@@ -110,7 +110,7 @@ public class ODataRequestImpl<T extends Enum<T>> implements ODataRequest {
* @param method HTTP request method. If configured X-HTTP-METHOD header will be used.
* @param uri OData request URI.
*/
- protected ODataRequestImpl(final ODataClient odataClient,
+ protected ODataRequestImpl(final CommonODataClient odataClient,
final Class<T> formatRef, final HttpMethod method, final URI uri) {
this.odataClient = odataClient;
@@ -376,7 +376,7 @@ public class ODataRequestImpl<T extends Enum<T>> implements ODataRequest {
// Add header for KeyAsSegment management
if (odataClient.getServiceVersion() == ODataServiceVersion.V30
- && ((V3Configuration) odataClient.getConfiguration()).isKeyAsSegment()) {
+ && ((Configuration) odataClient.getConfiguration()).isKeyAsSegment()) {
addCustomHeader(
HeaderName.dataServiceUrlConventions.toString(), ODataHeaderValues.keyAsSegment);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/Wrapper.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/Wrapper.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/Wrapper.java
new file mode 100644
index 0000000..ca2baf1
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/Wrapper.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.client.core.communication.request;
+
+/**
+ * Generic wrapper class.
+ *
+ * @param <T>
+ */
+public class Wrapper<T> {
+
+ private T wrapped;
+
+ public void setWrapped(final T wrapped) {
+ this.wrapped = wrapped;
+ }
+
+ public T getWrapped() {
+ if (wrapped == null) {
+ throw new IllegalStateException("Wrapped object not set");
+ }
+
+ return wrapped;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchRequestFactory.java
index c92a243..5efbca7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractBatchRequestFactory.java
@@ -12,20 +12,20 @@
*/
package org.apache.olingo.client.core.communication.request.batch;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.request.batch.BatchRequestFactory;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.communication.request.batch.CommonBatchRequestFactory;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
/**
* OData batch request factory class.
*/
-public abstract class AbstractBatchRequestFactory implements BatchRequestFactory {
+public abstract class AbstractBatchRequestFactory implements CommonBatchRequestFactory {
private static final long serialVersionUID = -3875283254713404483L;
- protected final ODataClient client;
+ protected final CommonODataClient client;
- protected AbstractBatchRequestFactory(final ODataClient client) {
+ protected AbstractBatchRequestFactory(final CommonODataClient client) {
this.client = client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchRequestImpl.java
index 114bf56..9ebf783 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchRequestImpl.java
@@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.ODataBatchConstants;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.batch.BatchStreamManager;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequestItem;
@@ -65,7 +65,7 @@ public class ODataBatchRequestImpl extends AbstractODataStreamedRequest<ODataBat
* @param odataClient client instance getting this request
* @param uri batch request URI (http://serviceRoot/$batch)
*/
- ODataBatchRequestImpl(final ODataClient odataClient, final URI uri) {
+ ODataBatchRequestImpl(final CommonODataClient odataClient, final URI uri) {
super(odataClient, HttpMethod.POST, uri);
// create a random UUID value for boundary
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/V3BatchRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/V3BatchRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/V3BatchRequestFactoryImpl.java
deleted file mode 100644
index 865de64..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/V3BatchRequestFactoryImpl.java
+++ /dev/null
@@ -1,32 +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.client.core.communication.request.batch;
-
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.api.communication.request.batch.V3BatchRequestFactory;
-
-public class V3BatchRequestFactoryImpl extends AbstractBatchRequestFactory
- implements V3BatchRequestFactory {
-
- private static final long serialVersionUID = -6271567229804128570L;
-
- public V3BatchRequestFactoryImpl(final ODataV3Client client) {
- super(client);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/V4BatchRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/V4BatchRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/V4BatchRequestFactoryImpl.java
deleted file mode 100644
index 0e61d4c..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/V4BatchRequestFactoryImpl.java
+++ /dev/null
@@ -1,32 +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.client.core.communication.request.batch;
-
-import org.apache.olingo.client.api.ODataV4Client;
-import org.apache.olingo.client.api.communication.request.batch.V4BatchRequestFactory;
-
-public class V4BatchRequestFactoryImpl extends AbstractBatchRequestFactory
- implements V4BatchRequestFactory {
-
- private static final long serialVersionUID = 788349446729208639L;
-
- public V4BatchRequestFactoryImpl(final ODataV4Client client) {
- super(client);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v3/BatchRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v3/BatchRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v3/BatchRequestFactoryImpl.java
new file mode 100644
index 0000000..489124a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v3/BatchRequestFactoryImpl.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.client.core.communication.request.batch.v3;
+
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory;
+import org.apache.olingo.client.core.communication.request.batch.AbstractBatchRequestFactory;
+
+public class BatchRequestFactoryImpl extends AbstractBatchRequestFactory
+ implements BatchRequestFactory {
+
+ private static final long serialVersionUID = -6271567229804128570L;
+
+ public BatchRequestFactoryImpl(final ODataClient client) {
+ super(client);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/BatchRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/BatchRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/BatchRequestFactoryImpl.java
new file mode 100644
index 0000000..fc0a012
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/BatchRequestFactoryImpl.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.client.core.communication.request.batch.v4;
+
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.api.communication.request.batch.v4.BatchRequestFactory;
+import org.apache.olingo.client.core.communication.request.batch.AbstractBatchRequestFactory;
+
+public class BatchRequestFactoryImpl extends AbstractBatchRequestFactory
+ implements BatchRequestFactory {
+
+ private static final long serialVersionUID = 788349446729208639L;
+
+ public BatchRequestFactoryImpl(final ODataClient client) {
+ super(client);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
index b5128e6..4659d15 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
@@ -19,9 +19,9 @@
package org.apache.olingo.client.core.communication.request.cud;
import java.net.URI;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.UpdateType;
-import org.apache.olingo.client.api.communication.request.cud.CUDRequestFactory;
+import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory;
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
@@ -35,13 +35,13 @@ import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.http.HttpMethod;
-public abstract class AbstractCUDRequestFactory implements CUDRequestFactory {
+public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFactory {
private static final long serialVersionUID = -2723641791198745990L;
- protected final ODataClient client;
+ protected final CommonODataClient client;
- protected AbstractCUDRequestFactory(final ODataClient client) {
+ protected AbstractCUDRequestFactory(final CommonODataClient client) {
this.client = client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java
index f281d0f..720c5b6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java
@@ -22,7 +22,7 @@ import java.io.InputStream;
import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
@@ -44,7 +44,7 @@ public class ODataDeleteRequestImpl extends AbstractODataBasicRequest<ODataDelet
* @param method HTTP method to be used
* @param uri URI of the entity to be deleted.
*/
- ODataDeleteRequestImpl(final ODataClient odataClient, final HttpMethod method, final URI uri) {
+ ODataDeleteRequestImpl(final CommonODataClient odataClient, final HttpMethod method, final URI uri) {
super(odataClient, ODataPubFormat.class, method, uri);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
index 4fc989f..1cad2a9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
@@ -24,7 +24,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
@@ -53,7 +53,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* @param targetURI entity set URI.
* @param entity entity to be created.
*/
- ODataEntityCreateRequestImpl(final ODataClient odataClient, final URI targetURI, final ODataEntity entity) {
+ ODataEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI, final ODataEntity entity) {
super(odataClient, ODataPubFormat.class, HttpMethod.POST, targetURI);
this.entity = entity;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
index 5214159..662a844 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
@@ -24,7 +24,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
@@ -54,7 +54,7 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat
* @param uri URI of the entity to be updated.
* @param changes changes to be applied.
*/
- ODataEntityUpdateRequestImpl(final ODataClient odataClient,
+ ODataEntityUpdateRequestImpl(final CommonODataClient odataClient,
final HttpMethod method, final URI uri, final ODataEntity changes) {
super(odataClient, ODataPubFormat.class, method, uri);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
index ba67959..f02dc34 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
@@ -24,7 +24,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataLinkCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataLinkOperationResponse;
@@ -53,7 +53,7 @@ public class ODataLinkCreateRequestImpl extends AbstractODataBasicRequest<ODataL
* @param targetURI entity set URI.
* @param link entity to be linked.
*/
- ODataLinkCreateRequestImpl(final ODataClient odataClient, final URI targetURI, final ODataLink link) {
+ ODataLinkCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI, final ODataLink link) {
super(odataClient, ODataFormat.class, HttpMethod.POST, targetURI);
// set request body
this.link = link;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
index ed06ec0..419ee03 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
@@ -24,7 +24,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataLinkUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataLinkOperationResponse;
@@ -54,7 +54,7 @@ public class ODataLinkUpdateRequestImpl extends AbstractODataBasicRequest<ODataL
* @param targetURI entity URI.
* @param link entity to be linked.
*/
- ODataLinkUpdateRequestImpl(final ODataClient odataClient,
+ ODataLinkUpdateRequestImpl(final CommonODataClient odataClient,
final HttpMethod method, final URI targetURI, final ODataLink link) {
super(odataClient, ODataFormat.class, method, targetURI);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
index 57fe26f..f782a6e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
@@ -24,7 +24,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateResponse;
@@ -54,7 +54,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
* @param targetURI entity set or entity or entity property URI.
* @param property value to be created.
*/
- ODataPropertyUpdateRequestImpl(final ODataClient odataClient,
+ ODataPropertyUpdateRequestImpl(final CommonODataClient odataClient,
final HttpMethod method, final URI targetURI, final ODataProperty property) {
super(odataClient, ODataFormat.class, method, targetURI);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
index 8f340fc..53e0c05 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
@@ -25,7 +25,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
@@ -58,7 +58,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
* @param targetURI entity set or entity or entity property URI.
* @param value value to be created.
*/
- ODataValueUpdateRequestImpl(final ODataClient odataClient,
+ ODataValueUpdateRequestImpl(final CommonODataClient odataClient,
final HttpMethod method, final URI targetURI, final ODataValue value) {
super(odataClient, ODataValueFormat.class, method, targetURI);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/V3CUDRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/V3CUDRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/V3CUDRequestFactoryImpl.java
deleted file mode 100644
index a4d06b5..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/V3CUDRequestFactoryImpl.java
+++ /dev/null
@@ -1,32 +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.client.core.communication.request.cud;
-
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.api.communication.request.cud.V3CUDRequestFactory;
-
-public class V3CUDRequestFactoryImpl extends AbstractCUDRequestFactory
- implements V3CUDRequestFactory {
-
- private static final long serialVersionUID = 109196636064983035L;
-
- public V3CUDRequestFactoryImpl(final ODataV3Client client) {
- super(client);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/V4CUDRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/V4CUDRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/V4CUDRequestFactoryImpl.java
deleted file mode 100644
index fbbde56..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/V4CUDRequestFactoryImpl.java
+++ /dev/null
@@ -1,32 +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.client.core.communication.request.cud;
-
-import org.apache.olingo.client.api.ODataV4Client;
-import org.apache.olingo.client.api.communication.request.cud.V4CUDRequestFactory;
-
-public class V4CUDRequestFactoryImpl extends AbstractCUDRequestFactory
- implements V4CUDRequestFactory {
-
- private static final long serialVersionUID = 3080623853913380425L;
-
- public V4CUDRequestFactoryImpl(final ODataV4Client client) {
- super(client);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/CUDRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/CUDRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/CUDRequestFactoryImpl.java
new file mode 100644
index 0000000..425bcd3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/CUDRequestFactoryImpl.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.client.core.communication.request.cud.v3;
+
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory;
+import org.apache.olingo.client.core.communication.request.cud.AbstractCUDRequestFactory;
+
+public class CUDRequestFactoryImpl extends AbstractCUDRequestFactory
+ implements CUDRequestFactory {
+
+ private static final long serialVersionUID = 109196636064983035L;
+
+ public CUDRequestFactoryImpl(final ODataClient client) {
+ super(client);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java
new file mode 100644
index 0000000..426d903
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.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.client.core.communication.request.cud.v4;
+
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory;
+import org.apache.olingo.client.core.communication.request.cud.AbstractCUDRequestFactory;
+
+public class CUDRequestFactoryImpl extends AbstractCUDRequestFactory
+ implements CUDRequestFactory {
+
+ private static final long serialVersionUID = 3080623853913380425L;
+
+ public CUDRequestFactoryImpl(final ODataClient client) {
+ super(client);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
index c006ed1..64aa550 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
@@ -20,21 +20,22 @@ package org.apache.olingo.client.core.communication.request.invoke;
import java.net.URI;
import java.util.Map;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.domain.ODataInvokeResult;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-abstract class AbstractInvokeRequestFactory<FI extends CommonFunctionImport> implements InvokeRequestFactory<FI> {
+public abstract class AbstractInvokeRequestFactory<FI extends CommonFunctionImport>
+ implements CommonInvokeRequestFactory<FI> {
private static final long serialVersionUID = -906760270085197249L;
- protected final ODataClient client;
+ protected final CommonODataClient client;
- protected AbstractInvokeRequestFactory(final ODataClient client) {
+ protected AbstractInvokeRequestFactory(final CommonODataClient client) {
this.client = client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
index 3c53275..3dc9485 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
@@ -30,7 +30,7 @@ import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
@@ -70,8 +70,8 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult>
* @param method HTTP method of the request.
* @param uri URI that identifies the operation.
*/
- ODataInvokeRequestImpl(
- final ODataClient odataClient,
+ public ODataInvokeRequestImpl(
+ final CommonODataClient odataClient,
final Class<T> reference,
final HttpMethod method,
final URI uri) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/V3InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/V3InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/V3InvokeRequestFactoryImpl.java
deleted file mode 100644
index 34203de..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/V3InvokeRequestFactoryImpl.java
+++ /dev/null
@@ -1,89 +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.client.core.communication.request.invoke;
-
-import java.net.URI;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
-import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
-import org.apache.olingo.client.api.communication.request.invoke.V3InvokeRequestFactory;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.domain.ODataJClientEdmType;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
-import org.apache.olingo.client.api.http.HttpMethod;
-
-public class V3InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<FunctionImport>
- implements V3InvokeRequestFactory {
-
- private static final long serialVersionUID = -659256862901915496L;
-
- public V3InvokeRequestFactoryImpl(final ODataV3Client client) {
- super(client);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @SuppressWarnings("unchecked")
- public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
- final URI uri,
- final XMLMetadata metadata,
- final FunctionImport functionImport) {
-
- HttpMethod method = null;
- if (HttpMethod.GET.name().equals(functionImport.getHttpMethod())) {
- method = HttpMethod.GET;
- } else if (HttpMethod.POST.name().equals(functionImport.getHttpMethod())) {
- method = HttpMethod.POST;
- } else if (functionImport.getHttpMethod() == null) {
- if (functionImport.isSideEffecting()) {
- method = HttpMethod.POST;
- } else {
- method = HttpMethod.GET;
- }
- }
-
- ODataInvokeRequest<RES> result;
- if (StringUtils.isBlank(functionImport.getReturnType())) {
- result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataNoContent>(
- client, ODataNoContent.class, method, uri);
- } else {
- final ODataJClientEdmType returnType = new ODataJClientEdmType(metadata, functionImport.getReturnType());
-
- if (returnType.isCollection() && returnType.isEntityType()) {
- result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntitySet>(
- client, ODataEntitySet.class, method, uri);
- } else if (!returnType.isCollection() && returnType.isEntityType()) {
- result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntity>(
- client, ODataEntity.class, method, uri);
- } else {
- result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataProperty>(
- client, ODataProperty.class, method, uri);
- }
- }
-
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/V4InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/V4InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/V4InvokeRequestFactoryImpl.java
deleted file mode 100644
index 4bbfb56..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/V4InvokeRequestFactoryImpl.java
+++ /dev/null
@@ -1,43 +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.client.core.communication.request.invoke;
-
-import java.net.URI;
-import org.apache.olingo.client.api.ODataV4Client;
-import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
-import org.apache.olingo.client.api.communication.request.invoke.V4InvokeRequestFactory;
-import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
-
-public class V4InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<FunctionImport>
- implements V4InvokeRequestFactory {
-
- private static final long serialVersionUID = 8452737360003104372L;
-
- public V4InvokeRequestFactoryImpl(final ODataV4Client client) {
- super(client);
- }
-
- @Override
- public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
- final URI uri, final XMLMetadata metadata, final FunctionImport functionImport) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
new file mode 100644
index 0000000..e387b2e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.communication.request.invoke.v3;
+
+import java.net.URI;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
+import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
+import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
+import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.domain.ODataInvokeResult;
+import org.apache.olingo.client.api.domain.ODataJClientEdmType;
+import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.communication.request.invoke.AbstractInvokeRequestFactory;
+import org.apache.olingo.client.core.communication.request.invoke.ODataInvokeRequestImpl;
+
+public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<FunctionImport>
+ implements InvokeRequestFactory {
+
+ private static final long serialVersionUID = -659256862901915496L;
+
+ public InvokeRequestFactoryImpl(final ODataClient client) {
+ super(client);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
+ final URI uri,
+ final XMLMetadata metadata,
+ final FunctionImport functionImport) {
+
+ HttpMethod method = null;
+ if (HttpMethod.GET.name().equals(functionImport.getHttpMethod())) {
+ method = HttpMethod.GET;
+ } else if (HttpMethod.POST.name().equals(functionImport.getHttpMethod())) {
+ method = HttpMethod.POST;
+ } else if (functionImport.getHttpMethod() == null) {
+ if (functionImport.isSideEffecting()) {
+ method = HttpMethod.POST;
+ } else {
+ method = HttpMethod.GET;
+ }
+ }
+
+ ODataInvokeRequest<RES> result;
+ if (StringUtils.isBlank(functionImport.getReturnType())) {
+ result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataNoContent>(
+ client, ODataNoContent.class, method, uri);
+ } else {
+ final ODataJClientEdmType returnType = new ODataJClientEdmType(metadata, functionImport.getReturnType());
+
+ if (returnType.isCollection() && returnType.isEntityType()) {
+ result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntitySet>(
+ client, ODataEntitySet.class, method, uri);
+ } else if (!returnType.isCollection() && returnType.isEntityType()) {
+ result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntity>(
+ client, ODataEntity.class, method, uri);
+ } else {
+ result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataProperty>(
+ client, ODataProperty.class, method, uri);
+ }
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
new file mode 100644
index 0000000..ab35401
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.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.client.core.communication.request.invoke.v4;
+
+import java.net.URI;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
+import org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory;
+import org.apache.olingo.client.api.domain.ODataInvokeResult;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
+import org.apache.olingo.client.core.communication.request.invoke.AbstractInvokeRequestFactory;
+
+public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<FunctionImport>
+ implements InvokeRequestFactory {
+
+ private static final long serialVersionUID = 8452737360003104372L;
+
+ public InvokeRequestFactoryImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
+ final URI uri, final XMLMetadata metadata, final FunctionImport functionImport) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
index 944317d..fe51722 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
@@ -22,7 +22,7 @@ import java.io.InputStream;
import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRetrieveRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
@@ -31,10 +31,9 @@ import org.apache.olingo.client.core.communication.request.AbstractODataBasicReq
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
/**
- * This is an abstract representation of an OData retrieve query request returning one or more result item. Get instance
- * by using ODataRetrieveRequestFactory.
+ * This is an abstract representation of an OData retrieve query request returning one or more result item.
*/
-abstract class AbstractODataRetrieveRequest<V, T extends Enum<T>>
+public abstract class AbstractODataRetrieveRequest<V, T extends Enum<T>>
extends AbstractODataBasicRequest<ODataRetrieveResponse<V>, T>
implements ODataRetrieveRequest<V, T>, ODataBatchableRequest {
@@ -45,7 +44,7 @@ abstract class AbstractODataRetrieveRequest<V, T extends Enum<T>>
* @param formatRef reference class for the format being used
* @param query query to be executed.
*/
- AbstractODataRetrieveRequest(final ODataClient odataClient, final Class<T> formatRef, final URI query) {
+ public AbstractODataRetrieveRequest(final CommonODataClient odataClient, final Class<T> formatRef, final URI query) {
super(odataClient, formatRef, HttpMethod.GET, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
index 722814c..ddbfd10 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.core.communication.request.retrieve;
import java.net.URI;
import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
@@ -30,15 +30,15 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataProperty
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.RetrieveRequestFactory;
+import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
-public abstract class AbstractRetrieveRequestFactory implements RetrieveRequestFactory {
+public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRequestFactory {
private static final long serialVersionUID = -111683263158803362L;
- protected final ODataClient client;
+ protected final CommonODataClient client;
- protected AbstractRetrieveRequestFactory(final ODataClient client) {
+ protected AbstractRetrieveRequestFactory(final CommonODataClient client) {
this.client = client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
index 2a35514..2390ac3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.communication.request.retrieve;
import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataEntity;
@@ -39,7 +39,7 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataEntityRequestImpl(final ODataClient odataClient, final URI query) {
+ ODataEntityRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataPubFormat.class, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
index 345f673..261611c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.communication.request.retrieve;
import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
@@ -42,7 +42,7 @@ public class ODataEntitySetIteratorRequestImpl
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataEntitySetIteratorRequestImpl(final ODataClient odataClient, final URI query) {
+ ODataEntitySetIteratorRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataPubFormat.class, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
index a18cba9..1decb54 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.communication.request.retrieve;
import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataEntitySet;
@@ -41,7 +41,7 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataEntitySetRequestImpl(final ODataClient odataClient, final URI query) {
+ ODataEntitySetRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataPubFormat.class, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataLinkCollectionRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataLinkCollectionRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataLinkCollectionRequestImpl.java
deleted file mode 100644
index 73e6c67..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataLinkCollectionRequestImpl.java
+++ /dev/null
@@ -1,98 +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.client.core.communication.request.retrieve;
-
-import java.io.IOException;
-import java.net.URI;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataLinkCollectionRequest;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataLinkCollection;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.http.HttpClientException;
-
-/**
- * This class implements an OData link query request.
- */
-public class ODataLinkCollectionRequestImpl extends AbstractODataRetrieveRequest<ODataLinkCollection, ODataFormat>
- implements ODataLinkCollectionRequest {
-
- /**
- * Private constructor.
- *
- * @param odataClient client instance getting this request
- * @param targetURI target URI.
- * @param linkName link name.
- */
- ODataLinkCollectionRequestImpl(final ODataV3Client odataClient, final URI targetURI, final String linkName) {
- super(odataClient, ODataFormat.class,
- odataClient.getURIBuilder(targetURI.toASCIIString()).appendLinksSegment(linkName).build());
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public ODataRetrieveResponse<ODataLinkCollection> execute() {
- return new ODataLinkCollectionResponseImpl(httpClient, doExecute());
- }
-
- protected class ODataLinkCollectionResponseImpl extends ODataRetrieveResponseImpl {
-
- private ODataLinkCollection links = null;
-
- /**
- * Constructor.
- * <p>
- * Just to create response templates to be initialized from batch.
- */
- private ODataLinkCollectionResponseImpl() {
- }
-
- /**
- * Constructor.
- *
- * @param client HTTP client.
- * @param res HTTP response.
- */
- private ODataLinkCollectionResponseImpl(final HttpClient client, final HttpResponse res) {
- super(client, res);
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public ODataLinkCollection getBody() {
- if (links == null) {
- try {
- links = odataClient.getReader().readLinks(
- res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
- } catch (IOException e) {
- throw new HttpClientException(e);
- } finally {
- this.close();
- }
- }
- return links;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java
index 9209f96..b2a0f5d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java
@@ -23,7 +23,7 @@ import java.io.InputStream;
import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
@@ -42,7 +42,7 @@ public class ODataMediaRequestImpl extends AbstractODataRetrieveRequest<InputStr
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataMediaRequestImpl(final ODataClient odataClient, final URI query) {
+ ODataMediaRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataMediaFormat.class, query);
setAccept(ODataMediaFormat.APPLICATION_OCTET_STREAM.toString());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
index 7d2df29..58c7cb7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
@@ -22,7 +22,7 @@ import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.entity.ContentType;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMetadataRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
@@ -41,7 +41,7 @@ class ODataMetadataRequestImpl extends AbstractODataRetrieveRequest<Edm, ODataPu
* @param odataClient client instance getting this request
* @param uri metadata URI.
*/
- ODataMetadataRequestImpl(final ODataClient odataClient, final URI uri) {
+ ODataMetadataRequestImpl(final CommonODataClient odataClient, final URI uri) {
super(odataClient, ODataPubFormat.class, uri);
super.setAccept(ContentType.APPLICATION_XML.getMimeType());
super.setContentType(ContentType.APPLICATION_XML.getMimeType());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
index d7e51d8..5055a75 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataProperty;
@@ -41,7 +41,7 @@ public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<OData
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataPropertyRequestImpl(final ODataClient odataClient, final URI query) {
+ ODataPropertyRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataFormat.class, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
index bbfe953..4226cc2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
@@ -24,7 +24,7 @@ import java.net.URI;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.format.ODataPubFormat;
@@ -44,7 +44,7 @@ public class ODataRawRequestImpl extends ODataRequestImpl<ODataPubFormat>
* @param odataClient client instance getting this request
* @param uri request URI.
*/
- ODataRawRequestImpl(final ODataClient odataClient, final URI uri) {
+ ODataRawRequestImpl(final CommonODataClient odataClient, final URI uri) {
super(odataClient, ODataPubFormat.class, HttpMethod.GET, uri);
}
[03/52] [abbrv] Consistently using package name to differentiate V3
and V4
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractComparingFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractComparingFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractComparingFilter.java
deleted file mode 100644
index 702128e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractComparingFilter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-
-abstract class AbstractComparingFilter implements URIFilter {
-
- private final FilterArg left;
-
- private final FilterArg right;
-
- AbstractComparingFilter(final FilterArg left, final FilterArg right) {
- this.left = left;
- this.right = right;
- }
-
- protected abstract String getOp();
-
- @Override
- public String build() {
- return new StringBuilder().
- append('(').append(left.build()).
- append(' ').append(getOp()).append(' ').
- append(right.build()).append(')').
- toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractFilterArgFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractFilterArgFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractFilterArgFactory.java
deleted file mode 100644
index 96d8fb0..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractFilterArgFactory.java
+++ /dev/null
@@ -1,178 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-import org.apache.olingo.client.api.uri.filter.FilterArgFactory;
-
-/**
- * OData filter arguments factory.
- */
-abstract class AbstractFilterArgFactory implements FilterArgFactory {
-
- @Override
- public FilterArg _null() {
- return new FilterConst("null");
- }
-
- @Override
- public FilterArg property(final String propertyPath) {
- return new FilterProperty(propertyPath);
- }
-
- @Override
- public FilterArg literal(final Object value) {
- return new FilterLiteral(value);
- }
-
- @Override
- public FilterArg add(final FilterArg first, final FilterArg second) {
- return new FilterOp("add", first, second);
- }
-
- @Override
- public FilterArg sub(final FilterArg first, final FilterArg second) {
- return new FilterOp("add", first, second);
- }
-
- @Override
- public FilterArg mul(final FilterArg first, final FilterArg second) {
- return new FilterOp("mul", first, second);
- }
-
- @Override
- public FilterArg div(final FilterArg first, final FilterArg second) {
- return new FilterOp("div", first, second);
- }
-
- @Override
- public FilterArg mod(final FilterArg first, final FilterArg second) {
- return new FilterOp("mod", first, second);
- }
-
- @Override
- public FilterArg endswith(final FilterArg first, final FilterArg second) {
- return new FilterFunction("endswith", first, second);
- }
-
- @Override
- public FilterArg startswith(final FilterArg first, final FilterArg second) {
- return new FilterFunction("startswith", first, second);
- }
-
- @Override
- public FilterArg length(final FilterArg param) {
- return new FilterFunction("length", param);
- }
-
- @Override
- public FilterArg indexof(final FilterArg first, final FilterArg second) {
- return new FilterFunction("indexof", first, second);
- }
-
- @Override
- public FilterArg replace(final FilterArg first, final FilterArg second, final FilterArg third) {
- return new FilterFunction("replace", first, second, third);
- }
-
- @Override
- public FilterArg substring(final FilterArg arg, final FilterArg pos) {
- return new FilterFunction("substring", arg, pos);
- }
-
- @Override
- public FilterArg substring(final FilterArg arg, final FilterArg pos, final FilterArg length) {
- return new FilterFunction("substring", arg, pos, length);
- }
-
- @Override
- public FilterArg tolower(final FilterArg param) {
- return new FilterFunction("tolower", param);
- }
-
- @Override
- public FilterArg toupper(final FilterArg param) {
- return new FilterFunction("toupper", param);
- }
-
- @Override
- public FilterArg trim(final FilterArg param) {
- return new FilterFunction("trim", param);
- }
-
- @Override
- public FilterArg concat(final FilterArg first, final FilterArg second) {
- return new FilterFunction("concat", first, second);
- }
-
- @Override
- public FilterArg day(final FilterArg param) {
- return new FilterFunction("day", param);
- }
-
- @Override
- public FilterArg hour(final FilterArg param) {
- return new FilterFunction("hour", param);
- }
-
- @Override
- public FilterArg minute(final FilterArg param) {
- return new FilterFunction("minute", param);
- }
-
- @Override
- public FilterArg month(final FilterArg param) {
- return new FilterFunction("month", param);
- }
-
- @Override
- public FilterArg second(final FilterArg param) {
- return new FilterFunction("second", param);
- }
-
- @Override
- public FilterArg year(final FilterArg param) {
- return new FilterFunction("year", param);
- }
-
- @Override
- public FilterArg round(final FilterArg param) {
- return new FilterFunction("round", param);
- }
-
- @Override
- public FilterArg floor(final FilterArg param) {
- return new FilterFunction("floor", param);
- }
-
- @Override
- public FilterArg ceiling(final FilterArg param) {
- return new FilterFunction("ceiling", param);
- }
-
- @Override
- public FilterArg isof(final FilterArg type) {
- return new FilterFunction("isof", type);
- }
-
- @Override
- public FilterArg isof(final FilterArg expression, final FilterArg type) {
- return new FilterFunction("isof", expression, type);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractFilterFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractFilterFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractFilterFactory.java
deleted file mode 100644
index b939e91..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AbstractFilterFactory.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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-import org.apache.olingo.client.api.uri.filter.FilterFactory;
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-
-abstract class AbstractFilterFactory implements FilterFactory {
-
- private static final long serialVersionUID = -6141317149802621836L;
-
- @Override
- public URIFilter match(final FilterArg arg) {
- return new MatchFilter(arg);
- }
-
- @Override
- public URIFilter eq(final String key, final Object value) {
- return new EqFilter(getArgFactory().property(key), getArgFactory().literal(value));
- }
-
- @Override
- public URIFilter eq(final FilterArg left, final FilterArg right) {
- return new EqFilter(left, right);
- }
-
- @Override
- public URIFilter ne(final String key, final Object value) {
- return new NeFilter(getArgFactory().property(key), getArgFactory().literal(value));
- }
-
- @Override
- public URIFilter ne(final FilterArg left, final FilterArg right) {
- return new NeFilter(left, right);
- }
-
- @Override
- public URIFilter gt(final String key, final Object value) {
- return new GtFilter(getArgFactory().property(key), getArgFactory().literal(value));
- }
-
- @Override
- public URIFilter gt(final FilterArg left, final FilterArg right) {
- return new GtFilter(left, right);
- }
-
- @Override
- public URIFilter ge(final String key, final Object value) {
- return new GeFilter(getArgFactory().property(key), getArgFactory().literal(value));
- }
-
- @Override
- public URIFilter ge(final FilterArg left, final FilterArg right) {
- return new GeFilter(left, right);
- }
-
- @Override
- public URIFilter lt(final String key, final Object value) {
- return new LtFilter(getArgFactory().property(key), getArgFactory().literal(value));
- }
-
- @Override
- public URIFilter lt(final FilterArg left, final FilterArg right) {
- return new LtFilter(left, right);
- }
-
- @Override
- public URIFilter le(final String key, final Object value) {
- return new LeFilter(getArgFactory().property(key), getArgFactory().literal(value));
- }
-
- @Override
- public URIFilter le(final FilterArg left, final FilterArg right) {
- return new LeFilter(left, right);
- }
-
- @Override
- public URIFilter and(final URIFilter left, final URIFilter right) {
- return new AndFilter(left, right);
- }
-
- @Override
- public URIFilter or(final URIFilter left, final URIFilter right) {
- return new OrFilter(left, right);
- }
-
- @Override
- public URIFilter not(final URIFilter filter) {
- return new NotFilter(filter);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AndFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AndFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AndFilter.java
deleted file mode 100644
index 173ea21..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/AndFilter.java
+++ /dev/null
@@ -1,42 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-
-public class AndFilter implements URIFilter {
-
- private final URIFilter left;
-
- private final URIFilter right;
-
- public AndFilter(final URIFilter left, final URIFilter right) {
- this.left = left;
- this.right = right;
- }
-
- @Override
- public String build() {
- return new StringBuilder().
- append('(').append(left.build()).
- append(" and ").
- append(right.build()).append(')').
- toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/EqFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/EqFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/EqFilter.java
deleted file mode 100644
index 7ba0f93..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/EqFilter.java
+++ /dev/null
@@ -1,33 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-
-public class EqFilter extends AbstractComparingFilter {
-
- EqFilter(final FilterArg left, final FilterArg right) {
- super(left, right);
- }
-
- @Override
- protected String getOp() {
- return "eq";
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterConst.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterConst.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterConst.java
deleted file mode 100644
index 117815a..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterConst.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-
-/**
- * Filter property path; obtain instances via <tt>FilterArgFactory</tt>.
- *
- * @see org.apache.olingo.client.api.uri.filter.FilterArgFactory
- */
-public class FilterConst implements FilterArg {
-
- private final String value;
-
- FilterConst(final String value) {
- this.value = value;
- }
-
- @Override
- public String build() {
- return value;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterFunction.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterFunction.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterFunction.java
deleted file mode 100644
index 47cd719..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterFunction.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-import org.apache.commons.lang3.StringUtils;
-
-public class FilterFunction implements FilterArg {
-
- private final String function;
-
- private final FilterArg[] params;
-
- FilterFunction(final String function, final FilterArg... params) {
- this.function = function;
- this.params = params;
- }
-
- @Override
- public String build() {
- final String[] strParams = params == null || params.length == 0 ? new String[0] : new String[params.length];
- for (int i = 0; i < strParams.length; i++) {
- strParams[i] = params[i].build();
- }
-
- return new StringBuilder(function).
- append('(').
- append(strParams.length == 0 ? StringUtils.EMPTY : StringUtils.join(strParams, ',')).
- append(')').
- toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterLambda.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterLambda.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterLambda.java
deleted file mode 100644
index 18f783a..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterLambda.java
+++ /dev/null
@@ -1,46 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-
-public class FilterLambda implements FilterArg {
-
- private final FilterArg collection;
-
- private final String operator;
-
- private final URIFilter expression;
-
- FilterLambda(final FilterArg collection, final String operator, final URIFilter expression) {
- this.collection = collection;
- this.operator = operator;
- this.expression = expression;
- }
-
- @Override
- public String build() {
- return new StringBuilder(collection.build()).
- append('/').
- append(operator).
- append(expression.build()).
- toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterLiteral.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterLiteral.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterLiteral.java
deleted file mode 100644
index 2f353f1..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterLiteral.java
+++ /dev/null
@@ -1,41 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-import org.apache.olingo.client.api.utils.URIUtils;
-
-/**
- * Filter value literals; obtain instances via <tt>FilterArgFactory</tt>.
- *
- * @see FilterArgFactory
- */
-public class FilterLiteral implements FilterArg {
-
- private final Object value;
-
- FilterLiteral(final Object value) {
- this.value = value;
- }
-
- @Override
- public String build() {
- return URIUtils.escape(value);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterOp.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterOp.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterOp.java
deleted file mode 100644
index 5cdced7..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterOp.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-
-public class FilterOp implements FilterArg {
-
- private final String op;
-
- private final FilterArg first;
-
- private final FilterArg second;
-
- FilterOp(final String op, final FilterArg first, final FilterArg second) {
- this.op = op;
- this.first = first;
- this.second = second;
- }
-
- @Override
- public String build() {
- return new StringBuilder().
- append('(').append(first.build()).
- append(' ').append(op).append(' ').
- append(second.build()).append(')').
- toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterProperty.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterProperty.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterProperty.java
deleted file mode 100644
index 53b2ca7..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/FilterProperty.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-
-/**
- * Filter property path; obtain instances via <tt>FilterArgFactory</tt>.
- *
- * @see FilterArgFactory
- */
-public class FilterProperty implements FilterArg {
-
- private final String propertyPath;
-
- FilterProperty(final String value) {
- this.propertyPath = value;
- }
-
- @Override
- public String build() {
- return propertyPath;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/GeFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/GeFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/GeFilter.java
deleted file mode 100644
index 439920f..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/GeFilter.java
+++ /dev/null
@@ -1,33 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-
-public class GeFilter extends AbstractComparingFilter {
-
- GeFilter(final FilterArg left, final FilterArg right) {
- super(left, right);
- }
-
- @Override
- protected String getOp() {
- return "ge";
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/GtFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/GtFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/GtFilter.java
deleted file mode 100644
index 34eb2c2..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/GtFilter.java
+++ /dev/null
@@ -1,33 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-
-public class GtFilter extends AbstractComparingFilter {
-
- GtFilter(final FilterArg left, final FilterArg right) {
- super(left, right);
- }
-
- @Override
- protected String getOp() {
- return "gt";
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/HasFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/HasFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/HasFilter.java
deleted file mode 100644
index b6029db..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/HasFilter.java
+++ /dev/null
@@ -1,34 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-
-public class HasFilter extends AbstractComparingFilter {
-
- HasFilter(final FilterArg left, final FilterArg right) {
- super(left, right);
- }
-
- @Override
- protected String getOp() {
- return "has";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/LeFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/LeFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/LeFilter.java
deleted file mode 100644
index 36452c3..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/LeFilter.java
+++ /dev/null
@@ -1,33 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-
-public class LeFilter extends AbstractComparingFilter {
-
- LeFilter(final FilterArg left, final FilterArg right) {
- super(left, right);
- }
-
- @Override
- protected String getOp() {
- return "le";
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/LtFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/LtFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/LtFilter.java
deleted file mode 100644
index 8dd963f..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/LtFilter.java
+++ /dev/null
@@ -1,33 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-
-public class LtFilter extends AbstractComparingFilter {
-
- LtFilter(final FilterArg left, final FilterArg right) {
- super(left, right);
- }
-
- @Override
- protected String getOp() {
- return "lt";
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/MatchFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/MatchFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/MatchFilter.java
deleted file mode 100644
index 0706fc1..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/MatchFilter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-
-public class MatchFilter implements URIFilter {
-
- private final FilterArg arg;
-
- MatchFilter(final FilterArg arg) {
- this.arg = arg;
- }
-
- @Override
- public String build() {
- return arg.build();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/NeFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/NeFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/NeFilter.java
deleted file mode 100644
index c3a5849..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/NeFilter.java
+++ /dev/null
@@ -1,33 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-
-public class NeFilter extends AbstractComparingFilter {
-
- NeFilter(final FilterArg left, final FilterArg right) {
- super(left, right);
- }
-
- @Override
- protected String getOp() {
- return "ne";
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/NotFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/NotFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/NotFilter.java
deleted file mode 100644
index 911cd66..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/NotFilter.java
+++ /dev/null
@@ -1,35 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-
-public class NotFilter implements URIFilter {
-
- private final URIFilter filter;
-
- public NotFilter(final URIFilter left) {
- this.filter = left;
- }
-
- @Override
- public String build() {
- return new StringBuilder("not (").append(filter.build()).append(')').toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/OrFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/OrFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/OrFilter.java
deleted file mode 100644
index 31b0d4f..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/OrFilter.java
+++ /dev/null
@@ -1,42 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-
-public class OrFilter implements URIFilter {
-
- private final URIFilter left;
-
- private final URIFilter right;
-
- public OrFilter(final URIFilter left, final URIFilter right) {
- this.left = left;
- this.right = right;
- }
-
- @Override
- public String build() {
- return new StringBuilder().
- append('(').append(left.build()).
- append(" or ").
- append(right.build()).append(')').
- toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V3FilterArgFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V3FilterArgFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V3FilterArgFactoryImpl.java
deleted file mode 100644
index e208f11..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V3FilterArgFactoryImpl.java
+++ /dev/null
@@ -1,31 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-import org.apache.olingo.client.api.uri.filter.V3FilterArgFactory;
-
-public class V3FilterArgFactoryImpl extends AbstractFilterArgFactory implements V3FilterArgFactory {
-
- @Override
- public FilterArg substringof(final FilterArg first, final FilterArg second) {
- return new FilterFunction("substringof", first, second);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V3FilterFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V3FilterFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V3FilterFactoryImpl.java
deleted file mode 100644
index 1feb9d7..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V3FilterFactoryImpl.java
+++ /dev/null
@@ -1,33 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.V3FilterArgFactory;
-import org.apache.olingo.client.api.uri.filter.V3FilterFactory;
-
-public class V3FilterFactoryImpl extends AbstractFilterFactory implements V3FilterFactory {
-
- private static final long serialVersionUID = 1092594961118334631L;
-
- @Override
- public V3FilterArgFactory getArgFactory() {
- return new V3FilterArgFactoryImpl();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V4FilterArgFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V4FilterArgFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V4FilterArgFactoryImpl.java
deleted file mode 100644
index b21f307..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V4FilterArgFactoryImpl.java
+++ /dev/null
@@ -1,107 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-import org.apache.olingo.client.api.uri.filter.V4FilterArgFactory;
-
-public class V4FilterArgFactoryImpl extends AbstractFilterArgFactory implements V4FilterArgFactory {
-
- @Override
- public FilterArg contains(final FilterArg first, final FilterArg second) {
- return new FilterFunction("contains", first, second);
- }
-
- @Override
- public FilterArg fractionalseconds(final FilterArg param) {
- return new FilterFunction("fractionalseconds", param);
- }
-
- @Override
- public FilterArg date(final FilterArg param) {
- return new FilterFunction("date", param);
- }
-
- @Override
- public FilterArg time(final FilterArg param) {
- return new FilterFunction("time", param);
- }
-
- @Override
- public FilterArg totaloffsetminutes(final FilterArg param) {
- return new FilterFunction("totaloffsetminutes", param);
- }
-
- @Override
- public FilterArg now() {
- return new FilterFunction("now");
- }
-
- @Override
- public FilterArg mindatetime() {
- return new FilterFunction("mindatetime");
- }
-
- @Override
- public FilterArg maxdatetime() {
- return new FilterFunction("maxdatetime");
- }
-
- @Override
- public FilterArg totalseconds(final FilterArg param) {
- return new FilterFunction("totalseconds", param);
- }
-
- @Override
- public FilterArg cast(final FilterArg type) {
- return new FilterFunction("cast", type);
- }
-
- @Override
- public FilterArg cast(final FilterArg expression, final FilterArg type) {
- return new FilterFunction("cast", expression, type);
- }
-
- @Override
- public FilterArg geoDistance(final FilterArg first, final FilterArg second) {
- return new FilterFunction("geo.distance", first, second);
- }
-
- @Override
- public FilterArg geoIntersects(final FilterArg first, final FilterArg second) {
- return new FilterFunction("geo.intersects", first, second);
- }
-
- @Override
- public FilterArg geoLength(final FilterArg first, final FilterArg second) {
- return new FilterFunction("geo.length", first, second);
- }
-
- @Override
- public FilterArg any(final FilterArg collection, final URIFilter expression) {
- return new FilterLambda(collection, "any", expression);
- }
-
- @Override
- public FilterArg all(final FilterArg collection, final URIFilter expression) {
- return new FilterLambda(collection, "all", expression);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V4FilterFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V4FilterFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V4FilterFactoryImpl.java
deleted file mode 100644
index 342938d..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/filter/V4FilterFactoryImpl.java
+++ /dev/null
@@ -1,46 +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.client.core.uri.filter;
-
-import org.apache.olingo.client.api.uri.filter.FilterArg;
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-import org.apache.olingo.client.api.uri.filter.V4FilterArgFactory;
-import org.apache.olingo.client.api.uri.filter.V4FilterFactory;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-
-public class V4FilterFactoryImpl extends AbstractFilterFactory implements V4FilterFactory {
-
- private static final long serialVersionUID = -5358934829490623191L;
-
- @Override
- public V4FilterArgFactory getArgFactory() {
- return new V4FilterArgFactoryImpl();
- }
-
- @Override
- public URIFilter has(final String key, final EdmEnumType enumType, final String memberName) {
- return has(getArgFactory().property(key), enumType, memberName);
- }
-
- @Override
- public URIFilter has(final FilterArg left, final EdmEnumType enumType, final String memberName) {
- return new HasFilter(left, new FilterProperty(enumType.toUriLiteral(memberName)));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterArgFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterArgFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterArgFactoryImpl.java
new file mode 100644
index 0000000..c4c176c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterArgFactoryImpl.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.client.core.uri.v3;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.v3.FilterArgFactory;
+import org.apache.olingo.client.core.uri.AbstractFilterArgFactory;
+import org.apache.olingo.client.core.uri.FilterFunction;
+
+public class FilterArgFactoryImpl extends AbstractFilterArgFactory implements FilterArgFactory {
+
+ @Override
+ public FilterArg substringof(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("substringof", first, second);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterFactoryImpl.java
new file mode 100644
index 0000000..a26cd51
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/FilterFactoryImpl.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.client.core.uri.v3;
+
+import org.apache.olingo.client.api.uri.v3.FilterArgFactory;
+import org.apache.olingo.client.api.uri.v3.FilterFactory;
+import org.apache.olingo.client.core.uri.AbstractFilterFactory;
+
+public class FilterFactoryImpl extends AbstractFilterFactory implements FilterFactory {
+
+ private static final long serialVersionUID = 1092594961118334631L;
+
+ @Override
+ public FilterArgFactory getArgFactory() {
+ return new FilterArgFactoryImpl();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java
new file mode 100644
index 0000000..ced9a6e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.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.client.core.uri.v3;
+
+import org.apache.olingo.client.api.utils.URIUtils;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.v3.Configuration;
+import org.apache.olingo.client.api.uri.QueryOption;
+import org.apache.olingo.client.api.uri.SegmentType;
+import org.apache.olingo.client.api.uri.v3.URIBuilder;
+import org.apache.olingo.client.core.uri.AbstractURIBuilder;
+
+public class URIBuilderImpl extends AbstractURIBuilder<URIBuilder> implements URIBuilder {
+
+ private static final long serialVersionUID = -3506851722447870532L;
+
+ private final Configuration configuration;
+
+ public URIBuilderImpl(final Configuration configuration, final String serviceRoot) {
+ super(serviceRoot);
+ this.configuration = configuration;
+ }
+
+ @Override
+ protected URIBuilder getThis() {
+ return this;
+ }
+
+ @Override
+ protected char getBoundOperationSeparator() {
+ return '/';
+ }
+
+ @Override
+ protected char getDerivedEntityTypeSeparator() {
+ return '/';
+ }
+
+ @Override
+ public URIBuilder appendLinksSegment(final String segmentValue) {
+ segments.add(new Segment(SegmentType.LINKS, SegmentType.LINKS.getValue()));
+ segments.add(new Segment(SegmentType.ENTITYSET, segmentValue));
+
+ return getThis();
+ }
+
+ @Override
+ protected String noKeysWrapper() {
+ return StringUtils.EMPTY;
+ }
+
+ @Override
+ public URIBuilder appendKeySegment(final Object val) {
+ if (configuration.isKeyAsSegment()) {
+ final String segValue = URIUtils.escape(val);
+ segments.add(new Segment(SegmentType.KEY_AS_SEGMENT, segValue));
+ } else {
+ super.appendKeySegment(val);
+ }
+
+ return getThis();
+ }
+
+ @Override
+ public URIBuilder appendKeySegment(final Map<String, Object> segmentValues) {
+ if (!configuration.isKeyAsSegment()) {
+ super.appendKeySegment(segmentValues);
+ }
+
+ return getThis();
+ }
+
+ @Override
+ public URIBuilder inlineCount(final InlineCount inlineCount) {
+ return addQueryOption(QueryOption.INLINECOUNT, inlineCount.name());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterArgFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterArgFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterArgFactoryImpl.java
new file mode 100644
index 0000000..39298f3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterArgFactoryImpl.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.uri.v4;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.client.api.uri.v4.FilterArgFactory;
+import org.apache.olingo.client.core.uri.AbstractFilterArgFactory;
+import org.apache.olingo.client.core.uri.FilterFunction;
+import org.apache.olingo.client.core.uri.FilterLambda;
+
+public class FilterArgFactoryImpl extends AbstractFilterArgFactory implements FilterArgFactory {
+
+ @Override
+ public FilterArg contains(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("contains", first, second);
+ }
+
+ @Override
+ public FilterArg fractionalseconds(final FilterArg param) {
+ return new FilterFunction("fractionalseconds", param);
+ }
+
+ @Override
+ public FilterArg date(final FilterArg param) {
+ return new FilterFunction("date", param);
+ }
+
+ @Override
+ public FilterArg time(final FilterArg param) {
+ return new FilterFunction("time", param);
+ }
+
+ @Override
+ public FilterArg totaloffsetminutes(final FilterArg param) {
+ return new FilterFunction("totaloffsetminutes", param);
+ }
+
+ @Override
+ public FilterArg now() {
+ return new FilterFunction("now");
+ }
+
+ @Override
+ public FilterArg mindatetime() {
+ return new FilterFunction("mindatetime");
+ }
+
+ @Override
+ public FilterArg maxdatetime() {
+ return new FilterFunction("maxdatetime");
+ }
+
+ @Override
+ public FilterArg totalseconds(final FilterArg param) {
+ return new FilterFunction("totalseconds", param);
+ }
+
+ @Override
+ public FilterArg cast(final FilterArg type) {
+ return new FilterFunction("cast", type);
+ }
+
+ @Override
+ public FilterArg cast(final FilterArg expression, final FilterArg type) {
+ return new FilterFunction("cast", expression, type);
+ }
+
+ @Override
+ public FilterArg geoDistance(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("geo.distance", first, second);
+ }
+
+ @Override
+ public FilterArg geoIntersects(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("geo.intersects", first, second);
+ }
+
+ @Override
+ public FilterArg geoLength(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("geo.length", first, second);
+ }
+
+ @Override
+ public FilterArg any(final FilterArg collection, final URIFilter expression) {
+ return new FilterLambda(collection, "any", expression);
+ }
+
+ @Override
+ public FilterArg all(final FilterArg collection, final URIFilter expression) {
+ return new FilterLambda(collection, "all", expression);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterFactoryImpl.java
new file mode 100644
index 0000000..2acf1c3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/FilterFactoryImpl.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.client.core.uri.v4;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.client.api.uri.v4.FilterArgFactory;
+import org.apache.olingo.client.api.uri.v4.FilterFactory;
+import org.apache.olingo.client.core.uri.AbstractFilterFactory;
+import org.apache.olingo.client.core.uri.FilterProperty;
+import org.apache.olingo.client.core.uri.HasFilter;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+
+public class FilterFactoryImpl extends AbstractFilterFactory implements FilterFactory {
+
+ private static final long serialVersionUID = -5358934829490623191L;
+
+ @Override
+ public FilterArgFactory getArgFactory() {
+ return new FilterArgFactoryImpl();
+ }
+
+ @Override
+ public URIFilter has(final String key, final EdmEnumType enumType, final String memberName) {
+ return has(getArgFactory().property(key), enumType, memberName);
+ }
+
+ @Override
+ public URIFilter has(final FilterArg left, final EdmEnumType enumType, final String memberName) {
+ return new HasFilter(left, new FilterProperty(enumType.toUriLiteral(memberName)));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java
new file mode 100644
index 0000000..ae4284d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.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.client.core.uri.v4;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.uri.QueryOption;
+import org.apache.olingo.client.api.uri.SegmentType;
+import org.apache.olingo.client.api.uri.v4.URIBuilder;
+import org.apache.olingo.client.core.uri.AbstractURIBuilder;
+
+public class URIBuilderImpl extends AbstractURIBuilder<URIBuilder> implements URIBuilder {
+
+ private static final long serialVersionUID = -3506851722447870532L;
+
+ public URIBuilderImpl(final String serviceRoot) {
+ super(serviceRoot);
+ }
+
+ @Override
+ protected URIBuilder getThis() {
+ return this;
+ }
+
+ @Override
+ protected String noKeysWrapper() {
+ return "()";
+ }
+
+ @Override
+ protected char getBoundOperationSeparator() {
+ return '.';
+ }
+
+ @Override
+ protected char getDerivedEntityTypeSeparator() {
+ return '.';
+ }
+
+ @Override
+ public URIBuilder appendSingletonSegment(final String segmentValue) {
+ segments.add(new Segment(SegmentType.SINGLETON, segmentValue));
+ return getThis();
+ }
+
+ @Override
+ public URIBuilder appendEntityIdSegment(final String segmentValue) {
+ segments.add(new Segment(SegmentType.ENTITY, null));
+ return addQueryOption(QueryOption.ID, segmentValue);
+ }
+
+ @Override
+ public URIBuilder appendRefSegment() {
+ segments.add(new Segment(SegmentType.REF, SegmentType.REF.getValue()));
+ return getThis();
+ }
+
+ @Override
+ public URIBuilder appendCrossjoinSegment(final String... segmentValues) {
+ StringBuilder segValue = new StringBuilder(SegmentType.CROSS_JOIN.getValue()).
+ append('(').append(StringUtils.join(segmentValues, ",")).append(')');
+ segments.add(new Segment(SegmentType.CROSS_JOIN, segValue.toString()));
+ return getThis();
+ }
+
+ @Override
+ public URIBuilder count(final boolean value) {
+ return addQueryOption(QueryOption.COUNT, Boolean.toString(value));
+ }
+
+ @Override
+ public URIBuilder appendAllSegment() {
+ segments.add(new Segment(SegmentType.ALL, SegmentType.ALL.getValue()));
+ return getThis();
+ }
+
+ @Override
+ public URIBuilder id(final String idValue) {
+ return addQueryOption(QueryOption.ID, idValue);
+ }
+
+ @Override
+ public URIBuilder search(final String expression) {
+ return addQueryOption(QueryOption.SEARCH, expression);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ConfigurationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ConfigurationImpl.java
new file mode 100644
index 0000000..04ec3f7
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ConfigurationImpl.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.client.core.v3;
+
+import org.apache.olingo.client.api.v3.Configuration;
+import org.apache.olingo.client.core.AbstractConfiguration;
+
+public class ConfigurationImpl extends AbstractConfiguration implements Configuration {
+
+ private static final long serialVersionUID = -8719958537946884777L;
+
+ private static final String KEY_AS_SEGMENT = "keyAsSegment";
+
+ protected ConfigurationImpl() {
+ super();
+ }
+
+ /**
+ * 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.
+ */
+ @Override
+ public boolean isKeyAsSegment() {
+ return (Boolean) getProperty(KEY_AS_SEGMENT, false);
+ }
+
+ /**
+ * 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.
+ */
+ @Override
+ public void setKeyAsSegment(final boolean value) {
+ setProperty(KEY_AS_SEGMENT, value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
new file mode 100644
index 0000000..b7f0c3b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.v3;
+
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.v3.Configuration;
+import org.apache.olingo.client.api.communication.header.HeaderName;
+import org.apache.olingo.client.api.communication.header.ODataHeaders;
+import org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory;
+import org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory;
+import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
+import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
+import org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory;
+import org.apache.olingo.client.api.op.ODataSerializer;
+import org.apache.olingo.client.api.op.v3.ODataDeserializer;
+import org.apache.olingo.client.api.op.v3.ODataBinder;
+import org.apache.olingo.client.api.op.v3.ODataReader;
+import org.apache.olingo.client.api.uri.v3.URIBuilder;
+import org.apache.olingo.client.api.uri.v3.FilterFactory;
+import org.apache.olingo.client.core.AbstractODataClient;
+import org.apache.olingo.client.core.communication.header.ODataHeadersImpl;
+import org.apache.olingo.client.core.communication.request.batch.v3.BatchRequestFactoryImpl;
+import org.apache.olingo.client.core.communication.request.cud.v3.CUDRequestFactoryImpl;
+import org.apache.olingo.client.core.communication.request.invoke.v3.InvokeRequestFactoryImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.v3.RetrieveRequestFactoryImpl;
+import org.apache.olingo.client.core.communication.request.streamed.v3.StreamedRequestFactoryImpl;
+import org.apache.olingo.client.core.op.impl.v3.ODataBinderImpl;
+import org.apache.olingo.client.core.op.impl.v3.ODataDeserializerImpl;
+import org.apache.olingo.client.core.op.impl.v3.ODataReaderImpl;
+import org.apache.olingo.client.core.op.impl.v3.ODataSerializerImpl;
+import org.apache.olingo.client.core.uri.v3.URIBuilderImpl;
+import org.apache.olingo.client.core.uri.v3.FilterFactoryImpl;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public class ODataClientImpl extends AbstractODataClient implements ODataClient {
+
+ private static final long serialVersionUID = -1655712193243609209L;
+
+ private final Configuration configuration = new ConfigurationImpl();
+
+ private final FilterFactory filterFactory = new FilterFactoryImpl();
+
+ private final ODataDeserializer deserializer = new ODataDeserializerImpl(this);
+
+ private final ODataSerializer serializer = new ODataSerializerImpl(this);
+
+ private final ODataReader reader = new ODataReaderImpl(this);
+
+ private final ODataBinder binder = new ODataBinderImpl(this);
+
+ private final RetrieveRequestFactory retrieveReqFact = new RetrieveRequestFactoryImpl(this);
+
+ private final CUDRequestFactory cudReqFact = new CUDRequestFactoryImpl(this);
+
+ private final StreamedRequestFactory streamedReqFact = new StreamedRequestFactoryImpl(this);
+
+ private final InvokeRequestFactory invokeReqFact = new InvokeRequestFactoryImpl(this);
+
+ private final BatchRequestFactory batchReqFact = new BatchRequestFactoryImpl(this);
+
+ @Override
+ public ODataServiceVersion getServiceVersion() {
+ return ODataServiceVersion.V30;
+ }
+
+ @Override
+ public ODataHeaders getVersionHeaders() {
+ final ODataHeadersImpl odataHeaders = new ODataHeadersImpl();
+ odataHeaders.setHeader(HeaderName.minDataServiceVersion, ODataServiceVersion.V30.toString());
+ odataHeaders.setHeader(HeaderName.maxDataServiceVersion, ODataServiceVersion.V30.toString());
+ odataHeaders.setHeader(HeaderName.dataServiceVersion, ODataServiceVersion.V30.toString());
+ return odataHeaders;
+ }
+
+ @Override
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ @Override
+ public URIBuilder getURIBuilder(final String serviceRoot) {
+ return new URIBuilderImpl(configuration, serviceRoot);
+ }
+
+ @Override
+ public FilterFactory getFilterFactory() {
+ return filterFactory;
+ }
+
+ @Override
+ public ODataDeserializer getDeserializer() {
+ return deserializer;
+ }
+
+ @Override
+ public ODataSerializer getSerializer() {
+ return serializer;
+ }
+
+ @Override
+ public ODataReader getReader() {
+ return reader;
+ }
+
+ @Override
+ public ODataBinder getBinder() {
+ return binder;
+ }
+
+ @Override
+ public RetrieveRequestFactory getRetrieveRequestFactory() {
+ return retrieveReqFact;
+ }
+
+ @Override
+ public CUDRequestFactory getCUDRequestFactory() {
+ return cudReqFact;
+ }
+
+ @Override
+ public StreamedRequestFactory getStreamedRequestFactory() {
+ return streamedReqFact;
+ }
+
+ @Override
+ public InvokeRequestFactory getInvokeRequestFactory() {
+ return invokeReqFact;
+ }
+
+ @Override
+ public BatchRequestFactory getBatchRequestFactory() {
+ return batchReqFact;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ConfigurationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ConfigurationImpl.java
new file mode 100644
index 0000000..fab57da
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ConfigurationImpl.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.client.core.v4;
+
+import org.apache.olingo.client.api.v4.Configuration;
+import org.apache.olingo.client.core.AbstractConfiguration;
+
+public class ConfigurationImpl extends AbstractConfiguration implements Configuration {
+
+ private static final long serialVersionUID = -1134213707190176857L;
+
+ protected ConfigurationImpl() {
+ super();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
new file mode 100644
index 0000000..74c439a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.v4;
+
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.api.v4.Configuration;
+import org.apache.olingo.client.api.communication.header.HeaderName;
+import org.apache.olingo.client.api.communication.header.ODataHeaders;
+import org.apache.olingo.client.api.communication.request.batch.v4.BatchRequestFactory;
+import org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory;
+import org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory;
+import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRequestFactory;
+import org.apache.olingo.client.api.communication.request.streamed.v4.StreamedRequestFactory;
+import org.apache.olingo.client.api.op.ODataSerializer;
+import org.apache.olingo.client.api.op.v4.ODataBinder;
+import org.apache.olingo.client.api.op.v4.ODataDeserializer;
+import org.apache.olingo.client.api.op.v4.ODataReader;
+import org.apache.olingo.client.api.uri.v4.URIBuilder;
+import org.apache.olingo.client.api.uri.v4.FilterFactory;
+import org.apache.olingo.client.core.AbstractODataClient;
+import org.apache.olingo.client.core.communication.header.ODataHeadersImpl;
+import org.apache.olingo.client.core.communication.request.batch.v4.BatchRequestFactoryImpl;
+import org.apache.olingo.client.core.communication.request.cud.v4.CUDRequestFactoryImpl;
+import org.apache.olingo.client.core.communication.request.invoke.v4.InvokeRequestFactoryImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.v4.RetrieveRequestFactoryImpl;
+import org.apache.olingo.client.core.communication.request.streamed.v4.StreamedRequestFactoryImpl;
+import org.apache.olingo.client.core.op.impl.v4.ODataBinderImpl;
+import org.apache.olingo.client.core.op.impl.v4.ODataDeserializerImpl;
+import org.apache.olingo.client.core.op.impl.v4.ODataReaderImpl;
+import org.apache.olingo.client.core.op.impl.v4.ODataSerializerImpl;
+import org.apache.olingo.client.core.uri.v4.URIBuilderImpl;
+import org.apache.olingo.client.core.uri.v4.FilterFactoryImpl;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public class ODataClientImpl extends AbstractODataClient implements ODataClient {
+
+ private static final long serialVersionUID = -6653176125573631964L;
+
+ private final Configuration configuration = new ConfigurationImpl();
+
+ private final FilterFactory filterFactory = new FilterFactoryImpl();
+
+ private final ODataDeserializer deserializer = new ODataDeserializerImpl(this);
+
+ private final ODataSerializer serializer = new ODataSerializerImpl(this);
+
+ private final ODataReader reader = new ODataReaderImpl(this);
+
+ private final ODataBinder binder = new ODataBinderImpl(this);
+
+ private final RetrieveRequestFactory retrieveReqFact = new RetrieveRequestFactoryImpl(this);
+
+ private final CUDRequestFactory cudReqFact = new CUDRequestFactoryImpl(this);
+
+ private final StreamedRequestFactory streamedReqFact = new StreamedRequestFactoryImpl(this);
+
+ private final InvokeRequestFactory invokeReqFact = new InvokeRequestFactoryImpl(this);
+
+ private final BatchRequestFactory batchReqFact = new BatchRequestFactoryImpl(this);
+
+ @Override
+ public ODataServiceVersion getServiceVersion() {
+ return ODataServiceVersion.V40;
+ }
+
+ @Override
+ public ODataHeaders getVersionHeaders() {
+ final ODataHeadersImpl odataHeaders = new ODataHeadersImpl();
+ odataHeaders.setHeader(HeaderName.maxDataServiceVersion, ODataServiceVersion.V40.toString());
+ odataHeaders.setHeader(HeaderName.dataServiceVersion, ODataServiceVersion.V40.toString());
+ return odataHeaders;
+ }
+
+ @Override
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ @Override
+ public URIBuilder getURIBuilder(final String serviceRoot) {
+ return new URIBuilderImpl(serviceRoot);
+ }
+
+ @Override
+ public FilterFactory getFilterFactory() {
+ return filterFactory;
+ }
+
+ @Override
+ public ODataDeserializer getDeserializer() {
+ return deserializer;
+ }
+
+ @Override
+ public ODataSerializer getSerializer() {
+ return serializer;
+ }
+
+ @Override
+ public ODataReader getReader() {
+ return reader;
+ }
+
+ @Override
+ public ODataBinder getBinder() {
+ return binder;
+ }
+
+ @Override
+ public RetrieveRequestFactory getRetrieveRequestFactory() {
+ return retrieveReqFact;
+ }
+
+ @Override
+ public CUDRequestFactory getCUDRequestFactory() {
+ return cudReqFact;
+ }
+
+ @Override
+ public StreamedRequestFactory getStreamedRequestFactory() {
+ return streamedReqFact;
+ }
+
+ @Override
+ public InvokeRequestFactory getInvokeRequestFactory() {
+ return invokeReqFact;
+ }
+
+ @Override
+ public BatchRequestFactory getBatchRequestFactory() {
+ return batchReqFact;
+ }
+}
[15/52] [abbrv] git commit: [OLINGO-65] Geospatial types implemented,
EdmStream mock implemented with URI as backend, V3 pruned types implemented,
EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces
Posted by sk...@apache.org.
[OLINGO-65] Geospatial types implemented, EdmStream mock implemented with URI as backend, V3 pruned types implemented, EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/559698d4
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/559698d4
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/559698d4
Branch: refs/heads/olingo-206-validator
Commit: 559698d4dbb14dd8085f0b829fa980f01abdf139
Parents: bab0362
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Mar 21 11:51:11 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Mar 21 11:51:11 2014 +0100
----------------------------------------------------------------------
lib/client-api/pom.xml | 4 -
.../apache/olingo/client/api/data/GeoUtils.java | 90 ++++++
.../olingo/client/api/data/GeospatialValue.java | 2 +-
.../client/api/domain/ODataGeospatialValue.java | 9 +-
.../domain/ODataJClientEdmPrimitiveType.java | 45 +--
.../client/api/domain/ODataPrimitiveValue.java | 108 +++++--
.../client/api/domain/ODataTimestamp.java | 23 +-
.../domain/geospatial/ComposedGeospatial.java | 78 -----
.../api/domain/geospatial/Geospatial.java | 169 -----------
.../domain/geospatial/GeospatialCollection.java | 49 ---
.../api/domain/geospatial/LineString.java | 39 ---
.../api/domain/geospatial/MultiLineString.java | 39 ---
.../api/domain/geospatial/MultiPoint.java | 39 ---
.../api/domain/geospatial/MultiPolygon.java | 39 ---
.../client/api/domain/geospatial/Point.java | 77 -----
.../client/api/domain/geospatial/Polygon.java | 74 -----
.../olingo/client/api/utils/GeoUtils.java | 90 ------
.../cud/ODataValueUpdateRequestImpl.java | 4 +-
.../request/retrieve/ODataValueRequestImpl.java | 4 +-
.../core/data/AbstractJsonDeserializer.java | 43 +--
.../core/data/AbstractJsonSerializer.java | 22 +-
.../core/data/AtomGeoValueDeserializer.java | 35 +--
.../core/data/AtomGeoValueSerializer.java | 18 +-
.../core/data/AtomPropertyDeserializer.java | 4 +-
.../olingo/client/core/data/GeoUtils.java | 90 ------
.../client/core/data/GeospatialValueImpl.java | 2 +-
.../core/data/JSONGeoValueDeserializer.java | 74 +++--
.../core/data/JSONGeoValueSerializer.java | 32 +-
.../olingo/client/core/edm/EdmClientImpl.java | 12 +-
.../olingo/client/core/edm/EdmEnumTypeImpl.java | 14 +-
.../olingo/client/core/edm/EdmSchemaImpl.java | 15 +-
.../client/core/edm/EdmTypeDefinitionImpl.java | 12 +-
.../olingo/client/core/edm/EdmTypeInfo.java | 26 +-
.../core/op/impl/AbstractODataBinder.java | 10 +-
.../core/op/impl/AbstractODataReader.java | 4 +-
.../client/core/op/impl/v3/ODataReaderImpl.java | 2 +-
.../client/core/op/impl/v4/ODataReaderImpl.java | 2 +-
.../client/core/AbstractPrimitiveTest.java | 60 ++--
.../client/core/AbstractPropertyTest.java | 7 +-
.../client/core/it/AbstractTestITCase.java | 14 +-
.../core/it/v3/EntityCreateTestITCase.java | 22 +-
.../core/it/v3/EntityUpdateTestITCase.java | 4 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 22 +-
.../client/core/it/v3/OpenTypeTestITCase.java | 106 +++----
.../olingo/client/core/v3/EntityTest.java | 10 +-
.../olingo/client/core/v3/MetadataTest.java | 13 +-
.../client/core/v3/PrimitiveValueTest.java | 107 ++++---
.../client/core/v4/FilterFactoryTest.java | 3 +-
.../olingo/client/core/v4/MetadataTest.java | 9 +-
.../client/core/v4/PrimitiveValueTest.java | 14 +-
lib/commons-api/pom.xml | 8 +
.../commons/api/edm/EdmGeospatialType.java | 34 +++
.../commons/api/edm/EdmPrimitiveTypeKind.java | 139 +++++++++
.../commons/api/edm/geo/ComposedGeospatial.java | 78 +++++
.../olingo/commons/api/edm/geo/Geospatial.java | 169 +++++++++++
.../api/edm/geo/GeospatialCollection.java | 48 +++
.../olingo/commons/api/edm/geo/LineString.java | 38 +++
.../commons/api/edm/geo/MultiLineString.java | 39 +++
.../olingo/commons/api/edm/geo/MultiPoint.java | 39 +++
.../commons/api/edm/geo/MultiPolygon.java | 38 +++
.../olingo/commons/api/edm/geo/Point.java | 77 +++++
.../olingo/commons/api/edm/geo/Polygon.java | 73 +++++
.../commons/core/edm/AbstractEdmParameter.java | 5 +-
.../commons/core/edm/AbstractEdmProperty.java | 5 +-
.../commons/core/edm/AbstractEdmReturnType.java | 5 +-
.../AbstractEdmGeospatialType.java | 76 +++++
.../commons/core/edm/primitivetype/EdmDate.java | 5 +-
.../core/edm/primitivetype/EdmDateTime.java | 124 ++++++++
.../core/edm/primitivetype/EdmGeography.java | 36 +++
.../primitivetype/EdmGeographyCollection.java | 37 +++
.../primitivetype/EdmGeographyLineString.java | 37 +++
.../EdmGeographyMultiLineString.java | 37 +++
.../primitivetype/EdmGeographyMultiPoint.java | 37 +++
.../primitivetype/EdmGeographyMultiPolygon.java | 37 +++
.../edm/primitivetype/EdmGeographyPoint.java | 37 +++
.../edm/primitivetype/EdmGeographyPolygon.java | 37 +++
.../core/edm/primitivetype/EdmGeometry.java | 36 +++
.../primitivetype/EdmGeometryCollection.java | 37 +++
.../primitivetype/EdmGeometryLineString.java | 37 +++
.../EdmGeometryMultiLineString.java | 37 +++
.../primitivetype/EdmGeometryMultiPoint.java | 37 +++
.../primitivetype/EdmGeometryMultiPolygon.java | 37 +++
.../edm/primitivetype/EdmGeometryPoint.java | 37 +++
.../edm/primitivetype/EdmGeometryPolygon.java | 37 +++
.../commons/core/edm/primitivetype/EdmNull.java | 75 -----
.../primitivetype/EdmPrimitiveTypeFactory.java | 138 +++++++++
.../edm/primitivetype/EdmPrimitiveTypeKind.java | 95 ------
.../core/edm/primitivetype/EdmStream.java | 88 ++++++
.../commons/core/edm/primitivetype/EdmTime.java | 77 +++++
.../primitivetype/CommonPrimitiveTypeTest.java | 191 ++++++------
.../core/edm/primitivetype/EdmBinaryTest.java | 30 +-
.../core/edm/primitivetype/EdmBooleanTest.java | 4 +-
.../core/edm/primitivetype/EdmByteTest.java | 5 +-
.../core/edm/primitivetype/EdmDateTest.java | 4 +-
.../primitivetype/EdmDateTimeOffsetTest.java | 4 +-
.../core/edm/primitivetype/EdmDecimalTest.java | 19 +-
.../core/edm/primitivetype/EdmDoubleTest.java | 17 +-
.../core/edm/primitivetype/EdmDurationTest.java | 4 +-
.../core/edm/primitivetype/EdmGuidTest.java | 4 +-
.../core/edm/primitivetype/EdmInt16Test.java | 9 +-
.../core/edm/primitivetype/EdmInt32Test.java | 11 +-
.../core/edm/primitivetype/EdmInt64Test.java | 13 +-
.../core/edm/primitivetype/EdmNullTest.java | 24 +-
.../core/edm/primitivetype/EdmSByteTest.java | 5 +-
.../core/edm/primitivetype/EdmSingleTest.java | 15 +-
.../core/edm/primitivetype/EdmStringTest.java | 4 +-
.../edm/primitivetype/EdmTimeOfDayTest.java | 4 +-
.../core/edm/primitivetype/UInt7Test.java | 6 +-
.../core/edm/provider/EdmEnumTypeImpl.java | 9 +-
.../edm/provider/EdmTypeDefinitionImpl.java | 9 +-
.../core/uri/UriResourceLambdaAllImpl.java | 16 +-
.../core/uri/UriResourceLambdaAnyImpl.java | 15 +-
.../olingo/server/core/uri/parser/Parser.java | 1 -
.../server/core/uri/parser/UriContext.java | 4 -
.../core/uri/parser/UriParseTreeVisitor.java | 302 +++++++++----------
.../core/uri/queryoption/ExpandItemImpl.java | 1 -
.../edm/provider/EdmComplexTypeImplTest.java | 13 +-
.../edm/provider/EdmEntityTypeImplTest.java | 14 +-
.../server/core/edm/provider/EdmEnumTest.java | 9 +-
.../edm/provider/EdmFunctionImportImplTest.java | 31 +-
.../core/edm/provider/EdmParameterImplTest.java | 6 +-
.../core/edm/provider/EdmPropertyImplTest.java | 4 +-
.../edm/provider/EdmReturnTypeImplTest.java | 9 +-
.../edm/provider/EdmTypeDefinitionImplTest.java | 23 +-
.../server/core/testutil/EdmTechProvider.java | 2 +-
.../server/core/uri/UriResourceImplTest.java | 43 +--
.../core/uri/testutil/ExpandValidator.java | 1 -
.../core/uri/testutil/ResourceValidator.java | 1 -
128 files changed, 2916 insertions(+), 1823 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/client-api/pom.xml b/lib/client-api/pom.xml
index e506a97..eb3f9e3 100644
--- a/lib/client-api/pom.xml
+++ b/lib/client-api/pom.xml
@@ -46,10 +46,6 @@
<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>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java
new file mode 100644
index 0000000..083b4e0
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.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.client.api.data;
+
+import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+
+public final class GeoUtils {
+
+ private GeoUtils() {
+ // Empty private constructor for static utility classes
+ }
+
+ public static Geospatial.Dimension getDimension(final EdmPrimitiveTypeKind type) {
+ Geospatial.Dimension dimension;
+
+ switch (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;
+ }
+
+ public static EdmPrimitiveTypeKind getType(final Geospatial.Dimension dimension, final String elementName) {
+ EdmPrimitiveTypeKind type = null;
+
+ if (Constants.ELEM_POINT.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyPoint
+ : EdmPrimitiveTypeKind.GeometryPoint;
+ } else if (Constants.ELEM_MULTIPOINT.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyMultiPoint
+ : EdmPrimitiveTypeKind.GeometryMultiPoint;
+ } else if (Constants.ELEM_LINESTRING.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyLineString
+ : EdmPrimitiveTypeKind.GeometryLineString;
+ } else if (Constants.ELEM_MULTILINESTRING.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyMultiLineString
+ : EdmPrimitiveTypeKind.GeometryMultiLineString;
+ } else if (Constants.ELEM_POLYGON.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyPolygon
+ : EdmPrimitiveTypeKind.GeometryPolygon;
+ } else if (Constants.ELEM_MULTIPOLYGON.equals(elementName)) {
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyMultiPolygon
+ : EdmPrimitiveTypeKind.GeometryMultiPolygon;
+ } else if (Constants.ELEM_GEOCOLLECTION.equals(elementName)
+ || Constants.ELEM_GEOMEMBERS.equals(elementName)) {
+
+ type = dimension == Geospatial.Dimension.GEOGRAPHY
+ ? EdmPrimitiveTypeKind.GeographyCollection
+ : EdmPrimitiveTypeKind.GeometryCollection;
+ }
+
+ return type;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
index b0deea4..c5d4d2a 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.data;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
public interface GeospatialValue extends Value {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
index 93c4cfb..bd96587 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
@@ -19,7 +19,8 @@
package org.apache.olingo.client.api.domain;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
public class ODataGeospatialValue extends ODataPrimitiveValue {
@@ -57,7 +58,7 @@ public class ODataGeospatialValue extends ODataPrimitiveValue {
* @param type type.
* @return the current builder.
*/
- public Builder setType(final ODataJClientEdmPrimitiveType type) {
+ public Builder setType(final EdmPrimitiveTypeKind type) {
isSupported(type);
if (type != null && !type.isGeospatial()) {
@@ -65,7 +66,7 @@ public class ODataGeospatialValue extends ODataPrimitiveValue {
"Use " + ODataPrimitiveValue.class.getSimpleName() + " for non-geospatial types");
}
- if (type == ODataJClientEdmPrimitiveType.Geography || type == ODataJClientEdmPrimitiveType.Geometry) {
+ if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) {
throw new IllegalArgumentException(
type + " is not an instantiable type. "
+ "An entity can declare a property to be of type Geometry. "
@@ -86,7 +87,7 @@ public class ODataGeospatialValue extends ODataPrimitiveValue {
throw new IllegalArgumentException("No Geospatial value provided");
}
if (this.ogv.type == null) {
- this.ogv.type = ((Geospatial) this.ogv.value).getEdmSimpleType();
+ this.ogv.type = ((Geospatial) this.ogv.value).getEdmPrimitiveTypeKind();
}
return this.ogv;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
index 4b1decc..5ea5edf 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
@@ -22,15 +22,15 @@ import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
/**
* Represent the primitive types of the Entity Data Model (EDM).
@@ -72,11 +72,11 @@ public enum ODataJClientEdmPrimitiveType {
/**
* A 64-bit value expressed as Coordinated Universal Time (UTC).
*/
- DateTime(new ODataServiceVersion[]{ODataServiceVersion.V30}, ODataTimestamp.class, "yyyy-MM-dd'T'HH:mm:ss"),
+ 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(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataTimestamp.class, "yyyy-MM-dd"),
/**
* Date and time as an Offset in minutes from GMT.
*/
@@ -84,15 +84,15 @@ public enum ODataJClientEdmPrimitiveType {
/**
* 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),
+ 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),
+ TimeOfDay(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataDuration.class),
/**
* Signed duration in days, hours, minutes, and (sub)seconds.
*/
- Duration(new ODataServiceVersion[]{ODataServiceVersion.V40}, ODataDuration.class),
+ Duration(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataDuration.class),
/**
* Numeric values with fixed precision and scale.
*/
@@ -257,25 +257,6 @@ public enum ODataJClientEdmPrimitiveType {
}
/**
- * Gets <tt>EdmSimpleType</tt> from object instance.
- *
- * @param workingVersion OData version.
- * @param obj object.
- * @return <tt>EdmSimpleType</tt> object.
- */
- public static ODataJClientEdmPrimitiveType fromObject(final ODataServiceVersion workingVersion, final Object obj) {
- for (ODataJClientEdmPrimitiveType edmSimpleType : ODataJClientEdmPrimitiveType.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.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
index df69d1f..21d8562 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
@@ -28,9 +28,8 @@ 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.client.api.CommonODataClient;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
* OData primitive property value.
@@ -50,8 +49,8 @@ public class ODataPrimitiveValue extends ODataValue {
this.client = client;
}
- public AbstractBuilder isSupported(final ODataJClientEdmPrimitiveType type) {
- if (type != null && !ArrayUtils.contains(type.getSupportedVersions(), client.getServiceVersion())) {
+ public AbstractBuilder isSupported(final EdmPrimitiveTypeKind type) {
+ if (type != null && !type.getSupportedVersions().contains(client.getServiceVersion())) {
throw new IllegalArgumentException(String.format(
"Type %s not supported by the current OData working version", type.toString()));
}
@@ -103,12 +102,12 @@ public class ODataPrimitiveValue extends ODataValue {
* @param type type.
* @return the current builder.
*/
- public Builder setType(final ODataJClientEdmPrimitiveType type) {
+ public Builder setType(final EdmPrimitiveTypeKind type) {
isSupported(type);
- if (type == ODataJClientEdmPrimitiveType.Stream) {
+ if (type == EdmPrimitiveTypeKind.Stream) {
throw new IllegalArgumentException(String.format(
- "Cannot build a primitive value for %s", ODataJClientEdmPrimitiveType.Stream.toString()));
+ "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
}
this.opv.type = type;
@@ -129,7 +128,7 @@ public class ODataPrimitiveValue extends ODataValue {
}
if (this.opv.type == null) {
- this.opv.type = ODataJClientEdmPrimitiveType.String;
+ this.opv.type = EdmPrimitiveTypeKind.String;
}
if (this.opv.type.isGeospatial()) {
@@ -147,7 +146,7 @@ public class ODataPrimitiveValue extends ODataValue {
this.opv.value = new ODataDuration((Duration) this.opv.value);
}
- if (this.opv.value != null && !this.opv.type.javaType().isAssignableFrom(this.opv.value.getClass())) {
+ if (this.opv.value != null && !this.opv.getJavaType().isAssignableFrom(this.opv.value.getClass())) {
throw new IllegalArgumentException("Provided value is not compatible with " + this.opv.type.toString());
}
@@ -177,7 +176,7 @@ public class ODataPrimitiveValue extends ODataValue {
/**
* Value type.
*/
- protected ODataJClientEdmPrimitiveType type;
+ protected EdmPrimitiveTypeKind type;
/**
* Protected constructor, need to use the builder to instantiate this class.
@@ -189,15 +188,82 @@ public class ODataPrimitiveValue extends ODataValue {
this.client = client;
}
+ private Class<?> getJavaType() {
+ Class<?> javaType = null;
+
+ switch (this.type) {
+ case Binary:
+ javaType = byte[].class;
+ break;
+
+ case SByte:
+ javaType = Byte.class;
+ break;
+
+ case Boolean:
+ javaType = Boolean.class;
+ break;
+
+ case Date:
+ case DateTime:
+ case DateTimeOffset:
+ javaType = ODataTimestamp.class;
+ break;
+
+ case Time:
+ case TimeOfDay:
+ javaType = ODataDuration.class;
+ break;
+
+ case Decimal:
+ javaType = BigDecimal.class;
+ break;
+
+ case Single:
+ javaType = Float.class;
+ break;
+
+ case Double:
+ javaType = Double.class;
+ break;
+
+ case Guid:
+ javaType = UUID.class;
+ break;
+
+ case Int16:
+ javaType = Short.class;
+ break;
+
+ case Byte:
+ case Int32:
+ javaType = Integer.class;
+ break;
+
+ case Int64:
+ javaType = Long.class;
+ break;
+
+ case Stream:
+ javaType = URI.class;
+ break;
+
+ case String:
+ javaType = String.class;
+ break;
+
+ default:
+ javaType = this.value.getClass();
+ }
+
+ return javaType;
+ }
+
/**
* 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;
@@ -267,10 +333,6 @@ public class ODataPrimitiveValue extends ODataValue {
*/
private void formatValue() {
switch (this.type) {
- case Null:
- this.text = StringUtils.EMPTY;
- break;
-
case Binary:
this.text = Base64.encodeBase64String(this.<byte[]>toCastValue());
break;
@@ -295,15 +357,15 @@ public class ODataPrimitiveValue extends ODataValue {
break;
case Decimal:
- this.text = new DecimalFormat(this.type.pattern()).format(this.<BigDecimal>toCastValue());
+ this.text = new DecimalFormat("#.#######################").format(this.<BigDecimal>toCastValue());
break;
case Single:
- this.text = new DecimalFormat(this.type.pattern()).format(this.<Float>toCastValue());
+ this.text = new DecimalFormat("#.#######E0").format(this.<Float>toCastValue());
break;
case Double:
- this.text = new DecimalFormat(this.type.pattern()).format(this.<Double>toCastValue());
+ this.text = new DecimalFormat("#.#######################E0").format(this.<Double>toCastValue());
break;
case Guid:
@@ -341,7 +403,7 @@ public class ODataPrimitiveValue extends ODataValue {
* @return type name.
*/
public String getTypeName() {
- return type.toString();
+ return type.getFullQualifiedName().toString();
}
/**
@@ -369,6 +431,6 @@ public class ODataPrimitiveValue extends ODataValue {
*/
@SuppressWarnings("unchecked")
public <T> T toCastValue() {
- return (T) type.javaType().cast(toValue());
+ return (T) getJavaType().cast(toValue());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
index a1f3e3d..3f3eb9c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
@@ -25,6 +25,7 @@ import java.util.Date;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
* Helper class for handling datetime and datetime-offset primitive values.
@@ -41,17 +42,25 @@ public final class ODataTimestamp implements Serializable {
private final boolean offset;
- public static ODataTimestamp getInstance(final ODataJClientEdmPrimitiveType type, final Timestamp timestamp) {
- return new ODataTimestamp(new SimpleDateFormat(type.pattern()),
- new Date(timestamp.getTime()), timestamp.getNanos(), type == ODataJClientEdmPrimitiveType.DateTimeOffset);
+ private static String getPattern(final EdmPrimitiveTypeKind type) {
+ return type == EdmPrimitiveTypeKind.DateTime
+ ? "yyyy-MM-dd'T'HH:mm:ss"
+ : type == EdmPrimitiveTypeKind.Date
+ ? "yyyy-MM-dd"
+ : "yyyy-MM-dd'T'HH:mm:ss";
}
- public static ODataTimestamp parse(final ODataJClientEdmPrimitiveType type, final String input) {
+ public static ODataTimestamp getInstance(final EdmPrimitiveTypeKind type, final Timestamp timestamp) {
+ return new ODataTimestamp(new SimpleDateFormat(getPattern(type)),
+ new Date(timestamp.getTime()), timestamp.getNanos(), type == EdmPrimitiveTypeKind.DateTimeOffset);
+ }
+
+ public static ODataTimestamp parse(final EdmPrimitiveTypeKind type, final String input) {
final ODataTimestamp instance;
final String[] dateParts = input.split("\\.");
- final SimpleDateFormat sdf = new SimpleDateFormat(type.pattern());
- final boolean isOffset = type == ODataJClientEdmPrimitiveType.DateTimeOffset;
+ final SimpleDateFormat sdf = new SimpleDateFormat(getPattern(type));
+ final boolean isOffset = type == EdmPrimitiveTypeKind.DateTimeOffset;
try {
final Date date = sdf.parse(dateParts[0]);
@@ -70,7 +79,7 @@ public final class ODataTimestamp implements Serializable {
instance = new ODataTimestamp(sdf, date, isOffset);
}
} catch (Exception e) {
- throw new IllegalArgumentException("Cannot parse " + type.pattern(), e);
+ throw new IllegalArgumentException("Cannot parse " + getPattern(type), e);
}
return instance;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.java
deleted file mode 100644
index 2ef65e8..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.java
+++ /dev/null
@@ -1,78 +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.client.api.domain.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 crs crs.
- * @param geospatials geospatials info.
- */
- protected ComposedGeospatial(final Dimension dimension, final Type type, final String crs,
- final List<T> geospatials) {
-
- super(dimension, type, crs);
- 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/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java
deleted file mode 100644
index 44e9558..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java
+++ /dev/null
@@ -1,169 +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.client.api.domain.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.client.api.domain.ODataJClientEdmPrimitiveType;
-
-/**
- * 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;
-
- protected String crs;
-
- /**
- * 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, final String crs) {
- this.dimension = dimension;
- this.type = type;
- this.crs = crs;
- }
-
- /**
- * Gets dimension.
- *
- * @return dimension.
- * @see Dimension
- */
- public Dimension getDimension() {
- return dimension;
- }
-
- /**
- * Gets type.
- *
- * @return type.
- * @see Type
- */
- public Type getType() {
- return type;
- }
-
- /**
- * Gets CRS.
- *
- * @return CRS
- */
- public String getCrs() {
- return crs;
- }
-
- /**
- * 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 ODataJClientEdmPrimitiveType 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/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.java
deleted file mode 100644
index 6409212..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.java
+++ /dev/null
@@ -1,49 +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.client.api.domain.geospatial;
-
-import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-/**
- * Wrapper for a collection of geospatials info.
- */
-public class GeospatialCollection extends ComposedGeospatial<Geospatial> {
-
- private static final long serialVersionUID = -9181547636133878977L;
-
- /**
- * Constructor.
- *
- * @param dimension dimension.
- * @param crs crs.
- * @param geospatials geospatials info.
- */
- public GeospatialCollection(final Dimension dimension, final String crs, final List<Geospatial> geospatials) {
- super(dimension, Type.GEOSPATIALCOLLECTION, crs, geospatials);
- }
-
- @Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
- return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyCollection
- : ODataJClientEdmPrimitiveType.GeometryCollection;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java
deleted file mode 100644
index 474b578..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java
+++ /dev/null
@@ -1,39 +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.client.api.domain.geospatial;
-
-import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-public class LineString extends ComposedGeospatial<Point> {
-
- private static final long serialVersionUID = 3207958185407535907L;
-
- public LineString(final Dimension dimension, final String crs, final List<Point> points) {
- super(dimension, Type.LINESTRING, crs, points);
- }
-
- @Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
- return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyLineString
- : ODataJClientEdmPrimitiveType.GeometryLineString;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java
deleted file mode 100644
index 3eb0466..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java
+++ /dev/null
@@ -1,39 +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.client.api.domain.geospatial;
-
-import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-public class MultiLineString extends ComposedGeospatial<LineString> {
-
- private static final long serialVersionUID = -5042414471218124125L;
-
- public MultiLineString(final Dimension dimension, final String crs, final List<LineString> lineStrings) {
- super(dimension, Type.MULTILINESTRING, crs, lineStrings);
- }
-
- @Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
- return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiLineString
- : ODataJClientEdmPrimitiveType.GeometryMultiLineString;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java
deleted file mode 100644
index 8ea16b9..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java
+++ /dev/null
@@ -1,39 +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.client.api.domain.geospatial;
-
-import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-public class MultiPoint extends ComposedGeospatial<Point> {
-
- private static final long serialVersionUID = 4951011255142116129L;
-
- public MultiPoint(final Dimension dimension, final String crs, final List<Point> points) {
- super(dimension, Type.MULTIPOINT, crs, points);
- }
-
- @Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
- return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPoint
- : ODataJClientEdmPrimitiveType.GeometryMultiPoint;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java
deleted file mode 100644
index ed55b92..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java
+++ /dev/null
@@ -1,39 +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.client.api.domain.geospatial;
-
-import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-public class MultiPolygon extends ComposedGeospatial<Polygon> {
-
- private static final long serialVersionUID = -160184788048512883L;
-
- public MultiPolygon(final Dimension dimension, final String crs, final List<Polygon> polygons) {
- super(dimension, Type.MULTIPOLYGON, crs, polygons);
- }
-
- @Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
- return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPolygon
- : ODataJClientEdmPrimitiveType.GeometryMultiPolygon;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java
deleted file mode 100644
index 63b9166..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java
+++ /dev/null
@@ -1,77 +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.client.api.domain.geospatial;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-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, final String crs) {
- super(dimension, Type.POINT, crs);
- }
-
- 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 ODataJClientEdmPrimitiveType getEdmSimpleType() {
- return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPoint
- : ODataJClientEdmPrimitiveType.GeometryPoint;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Polygon.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Polygon.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Polygon.java
deleted file mode 100644
index 2aa1787..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Polygon.java
+++ /dev/null
@@ -1,74 +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.client.api.domain.geospatial;
-
-import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-
-/**
- * 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 crs crs.
- * @param interior interior points.
- * @param exterior exterior points.
- */
- public Polygon(final Dimension dimension, final String crs, final List<Point> interior, final List<Point> exterior) {
- super(dimension, Type.POLYGON, crs);
- this.interior = new MultiPoint(dimension, crs, interior);
- this.exterior = new MultiPoint(dimension, crs, 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 ODataJClientEdmPrimitiveType getEdmSimpleType() {
- return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPolygon
- : ODataJClientEdmPrimitiveType.GeometryPolygon;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/GeoUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/GeoUtils.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/GeoUtils.java
deleted file mode 100644
index c4270fe..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/GeoUtils.java
+++ /dev/null
@@ -1,90 +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.client.api.utils;
-
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-
-public final class GeoUtils {
-
- private GeoUtils() {
- // Empty private constructor for static utility classes
- }
-
- public static Geospatial.Dimension getDimension(final ODataJClientEdmPrimitiveType type) {
- Geospatial.Dimension dimension;
-
- switch (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;
- }
-
- public static ODataJClientEdmPrimitiveType getType(final Geospatial.Dimension dimension, final String elementName) {
- ODataJClientEdmPrimitiveType type = null;
-
- if (Constants.ELEM_POINT.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPoint
- : ODataJClientEdmPrimitiveType.GeometryPoint;
- } else if (Constants.ELEM_MULTIPOINT.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPoint
- : ODataJClientEdmPrimitiveType.GeometryMultiPoint;
- } else if (Constants.ELEM_LINESTRING.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyLineString
- : ODataJClientEdmPrimitiveType.GeometryLineString;
- } else if (Constants.ELEM_MULTILINESTRING.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiLineString
- : ODataJClientEdmPrimitiveType.GeometryMultiLineString;
- } else if (Constants.ELEM_POLYGON.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPolygon
- : ODataJClientEdmPrimitiveType.GeometryPolygon;
- } else if (Constants.ELEM_MULTIPOLYGON.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPolygon
- : ODataJClientEdmPrimitiveType.GeometryMultiPolygon;
- } else if (Constants.ELEM_GEOCOLLECTION.equals(elementName)
- || Constants.ELEM_GEOMEMBERS.equals(elementName)) {
-
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyCollection
- : ODataJClientEdmPrimitiveType.GeometryCollection;
- }
-
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
index 53e0c05..af0eba6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
@@ -29,7 +29,6 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataValueFormat;
@@ -38,6 +37,7 @@ import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.utils.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
* This class implements an OData update entity property value request.
@@ -125,7 +125,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
try {
value = new ODataPrimitiveValue.Builder(odataClient).
setType(format == ODataValueFormat.TEXT
- ? ODataJClientEdmPrimitiveType.String : ODataJClientEdmPrimitiveType.Stream).
+ ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(getRawResponse())).
build();
} catch (IOException e) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
index 964ec42..7a2ef0c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
@@ -26,11 +26,11 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
* This class implements an OData entity property value query request.
@@ -93,7 +93,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataVal
try {
value = new ODataPrimitiveValue.Builder(odataClient).
setType(format == ODataValueFormat.TEXT
- ? ODataJClientEdmPrimitiveType.String : ODataJClientEdmPrimitiveType.Stream).
+ ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(getRawResponse())).
build();
} catch (IOException e) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
index d353c07..74b29fb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonDeserializer.java
@@ -27,23 +27,30 @@ import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.CollectionValue;
import org.apache.olingo.client.api.data.ComplexValue;
import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.ODataJClientEdmType;
import org.apache.olingo.client.api.domain.ODataPropertyType;
+import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
- private final JSONGeoValueDeserializer geoDeserializer = new JSONGeoValueDeserializer();
+ private JSONGeoValueDeserializer geoDeserializer;
- protected ODataJClientEdmPrimitiveType getPrimitiveType(final JsonNode node) {
- ODataJClientEdmPrimitiveType result = ODataJClientEdmPrimitiveType.String;
+ private JSONGeoValueDeserializer getGeoDeserializer() {
+ if (geoDeserializer == null) {
+ geoDeserializer = new JSONGeoValueDeserializer(client.getServiceVersion());
+ }
+ return geoDeserializer;
+ }
+
+ protected EdmPrimitiveTypeKind getPrimitiveType(final JsonNode node) {
+ EdmPrimitiveTypeKind result = EdmPrimitiveTypeKind.String;
if (node.isIntegralNumber()) {
- result = ODataJClientEdmPrimitiveType.Int32;
+ result = EdmPrimitiveTypeKind.Int32;
} else if (node.isBoolean()) {
- result = ODataJClientEdmPrimitiveType.Boolean;
+ result = EdmPrimitiveTypeKind.Boolean;
} else if (node.isFloatingPointNumber()) {
- result = ODataJClientEdmPrimitiveType.Double;
+ result = EdmPrimitiveTypeKind.Double;
}
return result;
@@ -65,16 +72,14 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
return type;
}
- private Value fromPrimitive(final JsonNode node, final ODataJClientEdmType typeInfo) {
+ private Value fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) {
Value value = null;
if (node.isNull()) {
value = new NullValueImpl();
} else {
- if (typeInfo != null && typeInfo.isGeospatialType()) {
- final ODataJClientEdmPrimitiveType geoType = ODataJClientEdmPrimitiveType.fromValue(typeInfo.getBaseType());
-
- value = new GeospatialValueImpl(this.geoDeserializer.deserialize(node, geoType));
+ if (typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+ value = new GeospatialValueImpl(getGeoDeserializer().deserialize(node, typeInfo));
} else {
value = new PrimitiveValueImpl(node.asText());
}
@@ -106,12 +111,12 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
return value;
}
- private CollectionValue fromCollection(final Iterator<JsonNode> nodeItor, final ODataJClientEdmType typeInfo) {
+ private CollectionValue fromCollection(final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo) {
final CollectionValueImpl value = new CollectionValueImpl();
- final ODataJClientEdmType type = typeInfo == null
+ final EdmTypeInfo type = typeInfo == null
? null
- : new ODataJClientEdmType(typeInfo.getBaseType());
+ : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
while (nodeItor.hasNext()) {
final JsonNode child = nodeItor.next();
@@ -130,9 +135,9 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
}
protected void value(final JSONPropertyImpl property, final JsonNode node) {
- final ODataJClientEdmType typeInfo = StringUtils.isBlank(property.getType())
+ final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
? null
- : new ODataJClientEdmType(property.getType());
+ : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
final ODataPropertyType propType = typeInfo == null
? guessPropertyType(node)
@@ -157,7 +162,7 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
case PRIMITIVE:
if (property.getType() == null) {
- property.setType(getPrimitiveType(node).toString());
+ property.setType(getPrimitiveType(node).getFullQualifiedName().toString());
}
property.setValue(fromPrimitive(node, typeInfo));
break;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
index 3398ed9..7427845 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
@@ -26,15 +26,15 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.apache.olingo.client.api.data.CollectionValue;
import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.ODataJClientEdmType;
+import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
- private static final ODataJClientEdmPrimitiveType[] NUMBER_TYPES = {
- ODataJClientEdmPrimitiveType.Byte, ODataJClientEdmPrimitiveType.SByte,
- ODataJClientEdmPrimitiveType.Single, ODataJClientEdmPrimitiveType.Double,
- ODataJClientEdmPrimitiveType.Int16, ODataJClientEdmPrimitiveType.Int32, ODataJClientEdmPrimitiveType.Int64
+ private static final EdmPrimitiveTypeKind[] NUMBER_TYPES = {
+ EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte,
+ EdmPrimitiveTypeKind.Single, EdmPrimitiveTypeKind.Double,
+ EdmPrimitiveTypeKind.Int16, EdmPrimitiveTypeKind.Int32, EdmPrimitiveTypeKind.Int64
};
private final JSONGeoValueSerializer geoSerializer = new JSONGeoValueSerializer();
@@ -50,20 +50,20 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
}
private void value(final JsonGenerator jgen, final String type, final Value value) throws IOException {
- final ODataJClientEdmType typeInfo = type == null
+ final EdmTypeInfo typeInfo = type == null
? null
- : new ODataJClientEdmType(type);
+ : new EdmTypeInfo.Builder().setTypeExpression(type).build();
if (value.isNull()) {
jgen.writeNull();
} else if (value.isSimple()) {
final boolean isNumber = typeInfo == null
? NumberUtils.isNumber(value.asSimple().get())
- : ArrayUtils.contains(NUMBER_TYPES, typeInfo.getPrimitiveType());
+ : ArrayUtils.contains(NUMBER_TYPES, typeInfo.getPrimitiveTypeKind());
final boolean isBoolean = typeInfo == null
? (value.asSimple().get().equalsIgnoreCase(Boolean.TRUE.toString())
|| value.asSimple().get().equalsIgnoreCase(Boolean.FALSE.toString()))
- : typeInfo.getPrimitiveType() == ODataJClientEdmPrimitiveType.Boolean;
+ : typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Boolean;
if (isNumber) {
jgen.writeNumber(value.asSimple().get());
@@ -77,7 +77,7 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
geoSerializer.serialize(jgen, value.asGeospatial().get());
jgen.writeEndObject();
} else if (value.isCollection()) {
- collection(jgen, typeInfo == null ? null : typeInfo.getBaseType(), value.asCollection());
+ collection(jgen, typeInfo == null ? null : typeInfo.getFullQualifiedName().toString(), value.asCollection());
} else if (value.isComplex()) {
jgen.writeStartObject();
for (Property property : value.asComplex().get()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
index e733d2a..20dd164 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
@@ -28,20 +28,21 @@ import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
+import org.apache.olingo.client.api.data.GeoUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
class AtomGeoValueDeserializer {
private List<Point> points(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
final List<Point> result = new ArrayList<Point>();
@@ -67,7 +68,7 @@ class AtomGeoValueDeserializer {
}
private MultiPoint multipoint(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
List<Point> points = Collections.<Point>emptyList();
@@ -88,13 +89,13 @@ class AtomGeoValueDeserializer {
}
private LineString lineString(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
return new LineString(GeoUtils.getDimension(type), crs, points(reader, start, type, null));
}
private Polygon polygon(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
List<Point> extPoints = null;
List<Point> intPoints = null;
@@ -121,7 +122,7 @@ class AtomGeoValueDeserializer {
}
private MultiLineString multiLineString(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
final List<LineString> lineStrings = new ArrayList<LineString>();
@@ -142,7 +143,7 @@ class AtomGeoValueDeserializer {
}
private MultiPolygon multiPolygon(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
final List<Polygon> polygons = new ArrayList<Polygon>();
@@ -163,7 +164,7 @@ class AtomGeoValueDeserializer {
}
private GeospatialCollection collection(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
final List<Geospatial> geospatials = new ArrayList<Geospatial>();
@@ -196,7 +197,7 @@ class AtomGeoValueDeserializer {
}
public Geospatial deserialize(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type) throws XMLStreamException {
String crs = null;
final Attribute srsName = start.getAttributeByName(Constants.QNAME_ATTR_SRSNAME);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
index 409ff99..2d69ef7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
@@ -25,14 +25,14 @@ import java.util.Iterator;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
class AtomGeoValueSerializer {
@@ -126,7 +126,7 @@ class AtomGeoValueSerializer {
}
public void serialize(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
- switch (value.getEdmSimpleType()) {
+ switch (value.getEdmPrimitiveTypeKind()) {
case GeographyPoint:
case GeometryPoint:
writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINT, Constants.NS_GML);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
index 9a24e38..00e6ac7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
@@ -28,9 +28,9 @@ import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.CollectionValue;
import org.apache.olingo.client.api.data.ComplexValue;
import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataJClientEdmType;
import org.apache.olingo.client.api.domain.ODataPropertyType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
class AtomPropertyDeserializer extends AbstractAtomDealer {
@@ -53,7 +53,7 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
if (event.isStartElement()) {
if (typeInfo != null && typeInfo.isGeospatialType()) {
- final ODataJClientEdmPrimitiveType geoType = ODataJClientEdmPrimitiveType.fromValue(typeInfo.getBaseType());
+ final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getBaseType());
value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeoUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeoUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeoUtils.java
deleted file mode 100644
index e0574be..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeoUtils.java
+++ /dev/null
@@ -1,90 +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.client.core.data;
-
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-
-public final class GeoUtils {
-
- private GeoUtils() {
- // Empty private constructor for static utility classes
- }
-
- public static Geospatial.Dimension getDimension(final ODataJClientEdmPrimitiveType type) {
- Geospatial.Dimension dimension;
-
- switch (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;
- }
-
- public static ODataJClientEdmPrimitiveType getType(final Geospatial.Dimension dimension, final String elementName) {
- ODataJClientEdmPrimitiveType type = null;
-
- if (Constants.ELEM_POINT.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPoint
- : ODataJClientEdmPrimitiveType.GeometryPoint;
- } else if (Constants.ELEM_MULTIPOINT.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPoint
- : ODataJClientEdmPrimitiveType.GeometryMultiPoint;
- } else if (Constants.ELEM_LINESTRING.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyLineString
- : ODataJClientEdmPrimitiveType.GeometryLineString;
- } else if (Constants.ELEM_MULTILINESTRING.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiLineString
- : ODataJClientEdmPrimitiveType.GeometryMultiLineString;
- } else if (Constants.ELEM_POLYGON.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPolygon
- : ODataJClientEdmPrimitiveType.GeometryPolygon;
- } else if (Constants.ELEM_MULTIPOLYGON.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPolygon
- : ODataJClientEdmPrimitiveType.GeometryMultiPolygon;
- } else if (Constants.ELEM_GEOCOLLECTION.equals(elementName)
- || Constants.ELEM_GEOMEMBERS.equals(elementName)) {
-
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyCollection
- : ODataJClientEdmPrimitiveType.GeometryCollection;
- }
-
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
index 040b4f8..fdb0f44 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core.data;
import org.apache.olingo.client.api.data.GeospatialValue;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
public class GeospatialValueImpl extends AbstractValue implements GeospatialValue {
[10/52] [abbrv] [OLINGO-65] Geospatial types implemented,
EdmStream mock implemented with URI as backend, V3 pruned types implemented,
EdmSimpleTypeKind adapted, EdmSimpleTypeFactory introduces
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/559698d4/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
index 31392d2..483fc5c 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
@@ -54,7 +54,6 @@ import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.MemberImpl;
public class ResourceValidator implements Validator {
private Edm edm;
[19/52] [abbrv] [OLINGO-65] Implementation completed
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
new file mode 100644
index 0000000..4f191d8
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.domain;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.olingo.client.api.domain.AbstractODataValue;
+import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public class ODataPrimitiveValueImpl extends AbstractODataValue implements ODataPrimitiveValue {
+
+ private static final long serialVersionUID = 8889282662298376036L;
+
+ public static class BuilderImpl implements Builder {
+
+ private final ODataServiceVersion version;
+
+ private final ODataPrimitiveValueImpl instance;
+
+ public BuilderImpl(final ODataServiceVersion version) {
+ this.version = version;
+ this.instance = new ODataPrimitiveValueImpl();
+ }
+
+ @Override
+ public BuilderImpl setType(final EdmPrimitiveTypeKind type) {
+ if (type != null && !type.getSupportedVersions().contains(version)) {
+ throw new IllegalArgumentException(String.format(
+ "Type %s not supported by OData version %s", type.toString(), version));
+ }
+ if (type == EdmPrimitiveTypeKind.Stream) {
+ throw new IllegalArgumentException(String.format(
+ "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
+ }
+ if (type != null && type.isGeospatial()) {
+ throw new IllegalArgumentException("Don't use this for geospatial types");
+ }
+
+ this.instance.typeKind = type == null ? EdmPrimitiveTypeKind.String : type;
+ this.instance.type = EdmPrimitiveTypeFactory.getNonGeoInstance(this.instance.typeKind);
+
+ return this;
+ }
+
+ @Override
+ public BuilderImpl setText(final String text) {
+ this.instance.text = text;
+ return this;
+ }
+
+ @Override
+ public BuilderImpl setValue(final Object value) {
+ this.instance.value = value;
+ return this;
+ }
+
+ @Override
+ public ODataPrimitiveValueImpl build() {
+ if (this.instance.text == null && this.instance.value == null) {
+ throw new IllegalArgumentException("Must provide either text or value");
+ }
+ if (this.instance.text != null && this.instance.value != null) {
+ throw new IllegalArgumentException("Cannot provide both text and value");
+ }
+
+ if (this.instance.type == null) {
+ setType(EdmPrimitiveTypeKind.String);
+ }
+
+ if (this.instance.text != null) {
+ final Class<?> returnType = this.instance.type.getDefaultType().isAssignableFrom(Calendar.class)
+ ? Timestamp.class : this.instance.type.getDefaultType();
+ try {
+ // TODO: when Edm is available, set facets when calling this method
+ this.instance.value = this.instance.type.valueOfString(
+ this.instance.text, null, null, 40, 25, null, returnType);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ if (this.instance.value != null) {
+ try {
+ // TODO: when Edm is available, set facets when calling this method
+ this.instance.text = this.instance.type.valueToString(
+ this.instance.value, null, null, 40, 25, null);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ return this.instance;
+ }
+ }
+
+ /**
+ * Type kind.
+ */
+ private EdmPrimitiveTypeKind typeKind;
+
+ /**
+ * Type.
+ */
+ private EdmPrimitiveType type;
+
+ /**
+ * Text value.
+ */
+ private String text;
+
+ /**
+ * Actual value.
+ */
+ private Object value;
+
+ @Override
+ public EdmPrimitiveTypeKind getTypeKind() {
+ return typeKind;
+ }
+
+ @Override
+ public EdmPrimitiveType getType() {
+ return type;
+ }
+
+ @Override
+ public Object toValue() {
+ return this.value;
+ }
+
+ @Override
+ public <T> T toCastValue(final Class<T> reference) throws EdmPrimitiveTypeException {
+ // TODO: when Edm is available, set facets when calling this method
+ return type.valueOfString(this.text, null, null, 40, 25, null, reference);
+ }
+
+ @Override
+ public String toString() {
+ return this.text;
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
index b185d5d..2c2cdea 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
@@ -22,8 +22,8 @@ import java.io.StringWriter;
import java.net.URI;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.data.Feed;
import org.apache.olingo.client.api.data.Link;
@@ -35,18 +35,15 @@ import org.apache.olingo.client.api.domain.ODataCollectionValue;
import org.apache.olingo.client.api.domain.ODataComplexValue;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
import org.apache.olingo.client.api.domain.ODataInlineEntity;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataOperation;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.op.CommonODataBinder;
-import org.apache.olingo.client.api.utils.URIUtils;
import org.apache.olingo.client.core.data.CollectionValueImpl;
import org.apache.olingo.client.core.data.ComplexValueImpl;
import org.apache.olingo.client.core.data.GeospatialValueImpl;
@@ -54,6 +51,7 @@ import org.apache.olingo.client.core.data.JSONPropertyImpl;
import org.apache.olingo.client.core.data.LinkImpl;
import org.apache.olingo.client.core.data.NullValueImpl;
import org.apache.olingo.client.core.data.PrimitiveValueImpl;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -216,11 +214,11 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (setType) {
if (property.hasPrimitiveValue()) {
- propertyResource.setType(property.getPrimitiveValue().getTypeName());
+ propertyResource.setType(property.getPrimitiveValue().getType().toString());
} else if (property.hasComplexValue()) {
- propertyResource.setType(property.getComplexValue().getTypeName());
+ propertyResource.setType(property.getComplexValue().getType());
} else if (property.hasCollectionValue()) {
- propertyResource.setType(property.getCollectionValue().getTypeName());
+ propertyResource.setType(property.getCollectionValue().getType());
}
}
@@ -233,12 +231,9 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (value == null) {
valueResource = new NullValueImpl();
} else if (value.isPrimitive()) {
- final ODataPrimitiveValue _value = value.asPrimitive();
- if (_value instanceof ODataGeospatialValue) {
- valueResource = new GeospatialValueImpl(((ODataGeospatialValue) _value).getGeospatial());
- } else {
- valueResource = new PrimitiveValueImpl(_value.toString());
- }
+ valueResource = new PrimitiveValueImpl(value.asPrimitive().toString());
+ } else if (value.isGeospatial()) {
+ valueResource = new GeospatialValueImpl(value.asGeospatial().toValue());
} else if (value.isComplex()) {
final ODataComplexValue _value = value.asComplex();
valueResource = new ComplexValueImpl();
@@ -375,12 +370,14 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
ODataValue value = null;
if (resource.getValue().isSimple()) {
- value = new ODataPrimitiveValue.Builder(client).setText(resource.getValue().asSimple().get()).
+ value = client.getPrimitiveValueBuilder().
+ setText(resource.getValue().asSimple().get()).
setType(resource.getType() == null
? null
: EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
} else if (resource.getValue().isGeospatial()) {
- value = new ODataGeospatialValue.Builder(client).setValue(resource.getValue().asGeospatial().get()).
+ value = client.getGeospatialValueBuilder().
+ setValue(resource.getValue().asGeospatial().get()).
setType(resource.getType() == null
|| EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
|| EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().toString().equals(resource.getType())
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
index 3104b8e..cc0b388 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
@@ -25,6 +25,7 @@ import org.apache.olingo.client.api.domain.ODataCollectionValue;
import org.apache.olingo.client.api.domain.ODataComplexValue;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.domain.ODataGeospatialValue;
import org.apache.olingo.client.api.domain.ODataInlineEntity;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
import org.apache.olingo.client.api.domain.ODataLink;
@@ -42,45 +43,21 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
this.client = client;
}
- /**
- * Instantiates a new entity set.
- *
- * @return entity set.
- */
@Override
public ODataEntitySet newEntitySet() {
return new ODataEntitySet();
}
- /**
- * Instantiates a new entity set.
- *
- * @param next next link.
- * @return entity set.
- */
@Override
public ODataEntitySet newEntitySet(final URI next) {
return new ODataEntitySet(next);
}
- /**
- * Instantiates a new entity.
- *
- * @param name OData entity name.
- * @return entity.
- */
@Override
public ODataEntity newEntity(final String name) {
return new ODataEntity(name);
}
- /**
- * Instantiates a new entity.
- *
- * @param name OData entity name.
- * @param link self link.
- * @return entity.
- */
@Override
public ODataEntity newEntity(final String name, final URI link) {
final ODataEntity result = new ODataEntity(name);
@@ -88,14 +65,6 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
return result;
}
- /**
- * Instantiates a new in-line entity set.
- *
- * @param name name.
- * @param link edit link.
- * @param entitySet entity set.
- * @return in-line entity set.
- */
@Override
public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
final ODataEntitySet entitySet) {
@@ -104,15 +73,6 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
}
- /**
- * Instantiates a new in-line entity set.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @param entitySet entity set.
- * @return in-line entity set.
- */
@Override
public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
final ODataEntitySet entitySet) {
@@ -121,28 +81,11 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
}
- /**
- * Instantiates a new in-line entity.
- *
- * @param name name.
- * @param link edit link.
- * @param entity entity.
- * @return in-line entity.
- */
@Override
public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
return new ODataInlineEntity(client.getServiceVersion(), link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
}
- /**
- * Instantiates a new in-line entity.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @param entity entity.
- * @return in-line entity.
- */
@Override
public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
final ODataEntity entity) {
@@ -151,145 +94,69 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
}
- /**
- * Instantiates a new entity navigation link.
- *
- * @param name name.
- * @param link link.
- * @return entity navigation link.
- */
@Override
public ODataLink newEntityNavigationLink(final String name, final URI link) {
return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
}
- /**
- * Instantiates a new entity navigation link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return entity navigation link.
- */
@Override
public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
}
- /**
- * Instantiates a new entity set navigation link.
- *
- * @param name name.
- * @param link link.
- * @return entity set navigation link.
- */
@Override
public ODataLink newFeedNavigationLink(final String name, final URI link) {
return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
}
- /**
- * Instantiates a new entity set navigation link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return entity set navigation link.
- */
@Override
public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
}
- /**
- * Instantiates a new association link.
- *
- * @param name name.
- * @param link link.
- * @return association link.
- */
@Override
public ODataLink newAssociationLink(final String name, final URI link) {
return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
}
- /**
- * Instantiates a new association link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return association link.
- */
@Override
public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
}
- /**
- * Instantiates a new media-edit link.
- *
- * @param name name.
- * @param link link.
- * @return media-edit link.
- */
@Override
public ODataLink newMediaEditLink(final String name, final URI link) {
return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(link).
setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
}
- /**
- * Instantiates a new media-edit link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return media-edit link.
- */
@Override
public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
return new ODataLink.Builder().setVersion(client.getServiceVersion()).setURI(baseURI, href).
setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
}
- /**
- * Instantiates a new primitive property.
- *
- * @param name name.
- * @param value value.
- * @return primitive property.
- */
@Override
public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
return new ODataProperty(name, value);
}
- /**
- * Instantiates a new complex property.
- *
- * @param name name.
- * @param value value.
- * @return complex property.
- */
+ @Override
+ public ODataProperty newPrimitiveProperty(final String name, final ODataGeospatialValue value) {
+ return new ODataProperty(name, value);
+ }
+
@Override
public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
return new ODataProperty(name, value);
}
- /**
- * Instantiates a new collection property.
- *
- * @param name name.
- * @param value value.
- * @return collection property.
- */
@Override
public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
return new ODataProperty(name, value);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index 8812129..9951db2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -22,7 +22,7 @@ import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
import org.apache.olingo.client.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.op.v4.ODataBinder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.op.impl.AbstractODataBinder;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
index 14f2704..2beecb3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.client.core.uri;
-import org.apache.olingo.client.api.utils.URIUtils;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
index c7e2d6a..cef0349 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
@@ -19,7 +19,6 @@
package org.apache.olingo.client.core.uri;
import org.apache.olingo.client.api.uri.FilterArg;
-import org.apache.olingo.client.api.utils.URIUtils;
/**
* Filter value literals; obtain instances via <tt>FilterArgFactory</tt>.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
new file mode 100644
index 0000000..50245ff
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.uri;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URLEncoder;
+import java.sql.Timestamp;
+import java.text.DecimalFormat;
+import java.util.Calendar;
+import java.util.UUID;
+import javax.xml.datatype.Duration;
+import org.apache.commons.codec.binary.Hex;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.entity.InputStreamEntity;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTime;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * URI utilities.
+ */
+public final class URIUtils {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(URIUtils.class);
+
+ private URIUtils() {
+ // Empty private constructor for static utility classes
+ }
+
+ /**
+ * Build URI starting from the given base and href.
+ * <br/>
+ * If href is absolute or base is null then base will be ignored.
+ *
+ * @param base URI prefix.
+ * @param href URI suffix.
+ * @return built URI.
+ */
+ public static URI getURI(final String base, final String href) {
+ if (href == null) {
+ throw new IllegalArgumentException("Null link provided");
+ }
+
+ URI uri = URI.create(href);
+
+ if (!uri.isAbsolute() && base != null) {
+ uri = URI.create(base + "/" + href);
+ }
+
+ return uri.normalize();
+ }
+
+ /**
+ * Build URI starting from the given base and href.
+ * <br/>
+ * If href is absolute or base is null then base will be ignored.
+ *
+ * @param base URI prefix.
+ * @param href URI suffix.
+ * @return built URI.
+ */
+ public static URI getURI(final URI base, final URI href) {
+ if (href == null) {
+ throw new IllegalArgumentException("Null link provided");
+ }
+ return getURI(base, href.toASCIIString());
+ }
+
+ /**
+ * Build URI starting from the given base and href.
+ * <br/>
+ * If href is absolute or base is null then base will be ignored.
+ *
+ * @param base URI prefix.
+ * @param href URI suffix.
+ * @return built URI.
+ */
+ public static URI getURI(final URI base, final String href) {
+ if (href == null) {
+ throw new IllegalArgumentException("Null link provided");
+ }
+
+ URI uri = URI.create(href);
+
+ if (!uri.isAbsolute() && base != null) {
+ uri = URI.create(base.toASCIIString() + "/" + href);
+ }
+
+ return uri.normalize();
+ }
+
+ /**
+ * Gets function import URI segment.
+ *
+ * @param entityContainer entity container.
+ * @param functionImport function import.
+ * @return URI segment.
+ */
+ public static String rootFunctionImportURISegment(
+ final EdmEntityContainer entityContainer, final EdmFunctionImport functionImport) {
+
+ final StringBuilder result = new StringBuilder();
+ // TODO: https://issues.apache.org/jira/browse/OLINGO-209
+ // if (!entityContainer.isDefaultEntityContainer()) {
+ // result.append(entityContainer.getName()).append('.');
+ // }
+ result.append(functionImport.getName());
+
+ return result.toString();
+ }
+
+ /**
+ * Turns primitive values into their respective URI representation.
+ *
+ * @param obj primitive value
+ * @return URI representation
+ */
+ public static String escape(final Object obj) {
+ String value;
+
+ try {
+ value = (obj instanceof UUID)
+ ? "guid'" + obj.toString() + "'"
+ : (obj instanceof byte[])
+ ? "X'" + Hex.encodeHexString((byte[]) obj) + "'"
+ : (obj instanceof Timestamp)
+ ? "datetime'" + URLEncoder.encode(EdmDateTime.getInstance().
+ valueToString(obj, null, null, null, null, null), Constants.UTF8) + "'"
+ : (obj instanceof Calendar)
+ ? "datetimeoffset'" + URLEncoder.encode(EdmDateTimeOffset.getInstance().
+ valueToString(obj, null, null, null, null, null), Constants.UTF8)
+ + "'"
+ : (obj instanceof Duration)
+ ? "time'" + URLEncoder.encode(EdmTime.getInstance().
+ valueToString(obj, null, null, null, null, null), Constants.UTF8) + "'"
+ : (obj instanceof BigDecimal)
+ ? new DecimalFormat("#.#######################").format((BigDecimal) obj) + "M"
+ : (obj instanceof Double)
+ ? new DecimalFormat("#.#######################E0").format((Double) obj) + "D"
+ : (obj instanceof Float)
+ ? new DecimalFormat("#.#######E0").format((Float) obj) + "f"
+ : (obj instanceof Long)
+ ? ((Long) obj).toString() + "L"
+ : (obj instanceof String)
+ ? "'" + URLEncoder.encode((String) obj, Constants.UTF8) + "'"
+ : obj.toString();
+ } catch (Exception e) {
+ LOG.warn("While escaping '{}', using toString()", obj, e);
+ value = obj.toString();
+ }
+
+ return value;
+ }
+
+ public static InputStreamEntity buildInputStreamEntity(final CommonODataClient client, final InputStream input) {
+ InputStreamEntity entity;
+ if (client.getConfiguration().isUseChuncked()) {
+ entity = new InputStreamEntity(input, -1);
+ } else {
+ byte[] bytes = new byte[0];
+ try {
+ bytes = IOUtils.toByteArray(input);
+ } catch (IOException e) {
+ LOG.error("While reading input for not chunked encoding", e);
+ }
+
+ entity = new InputStreamEntity(new ByteArrayInputStream(bytes), bytes.length);
+ }
+ entity.setChunked(client.getConfiguration().isUseChuncked());
+
+ return entity;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java
index ced9a6e..b541579 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v3/URIBuilderImpl.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.uri.v3;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
index 5326602..df66603 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
@@ -18,13 +18,10 @@
*/
package org.apache.olingo.client.core;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import java.io.File;
import java.io.InputStream;
import java.math.BigDecimal;
+import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -35,8 +32,8 @@ import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.domain.ODataGeospatialValue;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataTimestamp;
import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
@@ -48,6 +45,9 @@ import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
public abstract class AbstractPrimitiveTest extends AbstractTest {
@@ -65,18 +65,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
}
protected ODataPrimitiveValue writePrimitiveValue(final ODataPrimitiveValue value) {
- final ODataPrimitiveValue newValue;
- final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOfFQN(
- getClient().getServiceVersion(), value.getTypeName());
- if (typeKind.isGeospatial()) {
- newValue = getClient().getGeospatialValueBuilder().
- setType(EdmPrimitiveTypeKind.valueOfFQN(getVersion(), value.getTypeName())).
- setValue(((ODataGeospatialValue) value).getGeospatial()).build();
- } else {
- newValue = getClient().getPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.valueOfFQN(getClient().getServiceVersion(), value.getTypeName())).
- setValue(value.toValue()).build();
- }
+ final ODataPrimitiveValue newValue = getClient().getPrimitiveValueBuilder().
+ setType(value.getTypeKind()).
+ setValue(value.toValue()).build();
final InputStream written = getClient().getWriter().writeProperty(
getClient().getObjectFactory().newPrimitiveProperty(Constants.ELEM_PROPERTY, newValue),
@@ -97,69 +88,102 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final ODataPrimitiveValue value =
readPrimitiveValue(getClass().getResourceAsStream(getFilename(entity, propertyName)));
- final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOfFQN(
- getClient().getServiceVersion(), value.getTypeName());
- if (typeKind.isGeospatial()) {
- assertEquals(value.toValue(), writePrimitiveValue(value).toValue());
- } else {
- assertEquals(value.toString(), writePrimitiveValue(value).toString());
- }
+ assertEquals(value.toString(), writePrimitiveValue(value).toString());
return value;
}
- protected void int32(final String entity, final String propertyName, final int check) {
+ protected ODataGeospatialValue writeGeospatialValue(final ODataGeospatialValue value) {
+ final ODataGeospatialValue newValue = getClient().getGeospatialValueBuilder().
+ setType(value.getTypeKind()).
+ setValue(value.toValue()).
+ build();
+ final InputStream written = getClient().getWriter().writeProperty(
+ getClient().getObjectFactory().newPrimitiveProperty(Constants.ELEM_PROPERTY, newValue),
+ getFormat());
+ return readGeospatialValue(written);
+ }
+
+ protected ODataGeospatialValue readGeospatialValue(final InputStream input) {
+ final ODataProperty property = getClient().getReader().readProperty(input, getFormat());
+ assertNotNull(property);
+ assertTrue(property.hasGeospatialValue());
+ assertNotNull(property.getGeospatialValue());
+
+ return property.getGeospatialValue();
+ }
+
+ protected ODataGeospatialValue readGeospatialValue(final String entity, final String propertyName) {
+ final ODataGeospatialValue value =
+ readGeospatialValue(getClass().getResourceAsStream(getFilename(entity, propertyName)));
+
+ assertEquals(value.toValue(), writeGeospatialValue(value).toValue());
+
+ return value;
+ }
+
+ protected void int32(final String entity, final String propertyName, final int check)
+ throws EdmPrimitiveTypeException {
+
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.Int32.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Int32, opv.getTypeKind());
- final Integer value = opv.<Integer>toCastValue();
+ final Integer value = opv.toCastValue(Integer.class);
assertNotNull(value);
assertTrue(check == value);
}
- protected void string(final String entity, final String propertyName, final String check) {
+ protected void string(final String entity, final String propertyName, final String check)
+ throws EdmPrimitiveTypeException {
+
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.String.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.String, opv.getTypeKind());
- final String value = opv.<String>toCastValue();
+ final String value = opv.toCastValue(String.class);
assertNotNull(value);
assertEquals(check, value);
assertEquals(opv, writePrimitiveValue(opv));
}
- protected void decimal(final String entity, final String propertyName, final BigDecimal check) {
+ protected void decimal(final String entity, final String propertyName, final BigDecimal check)
+ throws EdmPrimitiveTypeException {
+
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.Decimal.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Decimal, opv.getTypeKind());
- final BigDecimal value = opv.<BigDecimal>toCastValue();
+ final BigDecimal value = opv.toCastValue(BigDecimal.class);
assertNotNull(value);
assertTrue(check.equals(value));
}
- protected void datetime(final String entity, final String propertyName, final String check) {
+ protected void datetime(final String entity, final String propertyName, final String check)
+ throws EdmPrimitiveTypeException {
+
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.DateTime.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.DateTime, opv.getTypeKind());
- final ODataTimestamp value = opv.<ODataTimestamp>toCastValue();
+ final Timestamp value = opv.toCastValue(Timestamp.class);
assertNotNull(value);
assertEquals(check, opv.toString());
}
- protected void guid(final String entity, final String propertyName, final String check) {
+ protected void guid(final String entity, final String propertyName, final String check)
+ throws EdmPrimitiveTypeException {
+
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.Guid.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Guid, opv.getTypeKind());
- final UUID value = opv.<UUID>toCastValue();
+ final UUID value = opv.toCastValue(UUID.class);
assertNotNull(value);
assertEquals(check, opv.toString());
}
- protected void binary(final String entity, final String propertyName) {
+ protected void binary(final String entity, final String propertyName) throws EdmPrimitiveTypeException {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.Binary.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Binary, opv.getTypeKind());
- final byte[] value = opv.<byte[]>toCastValue();
+ final byte[] value = opv.toCastValue(byte[].class);
assertNotNull(value);
assertTrue(value.length > 0);
assertTrue(Base64.isBase64(opv.toString()));
@@ -178,10 +202,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType.toString(), opv.getTypeName());
+ final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ assertEquals(expectedType, opv.getTypeKind());
- final Point point = opv.<Point>toCastValue();
+ final Point point = opv.toCastValue(Point.class);
assertNotNull(point);
assertEquals(expectedDimension, point.getDimension());
@@ -209,10 +233,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType.toString(), opv.getTypeName());
+ final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ assertEquals(expectedType, opv.getTypeKind());
- final LineString lineString = opv.<LineString>toCastValue();
+ final LineString lineString = opv.toCastValue(LineString.class);
assertNotNull(lineString);
assertEquals(expectedDimension, lineString.getDimension());
@@ -226,10 +250,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType.toString(), opv.getTypeName());
+ final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ assertEquals(expectedType, opv.getTypeKind());
- final MultiPoint multiPoint = opv.<MultiPoint>toCastValue();
+ final MultiPoint multiPoint = opv.toCastValue(MultiPoint.class);
assertNotNull(multiPoint);
assertEquals(expectedDimension, multiPoint.getDimension());
@@ -253,10 +277,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType.toString(), opv.getTypeName());
+ final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ assertEquals(expectedType, opv.getTypeKind());
- final MultiLineString multiLine = opv.<MultiLineString>toCastValue();
+ final MultiLineString multiLine = opv.toCastValue(MultiLineString.class);
assertNotNull(multiLine);
assertEquals(expectedDimension, multiLine.getDimension());
@@ -308,10 +332,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType.toString(), opv.getTypeName());
+ final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ assertEquals(expectedType, opv.getTypeKind());
- final Polygon polygon = opv.<Polygon>toCastValue();
+ final Polygon polygon = opv.toCastValue(Polygon.class);
assertNotNull(polygon);
assertEquals(expectedDimension, polygon.getDimension());
@@ -328,10 +352,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType.toString(), opv.getTypeName());
+ final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ assertEquals(expectedType, opv.getTypeKind());
- final MultiPolygon multiPolygon = opv.<MultiPolygon>toCastValue();
+ final MultiPolygon multiPolygon = opv.toCastValue(MultiPolygon.class);
assertNotNull(multiPolygon);
assertEquals(expectedDimension, multiPolygon.getDimension());
@@ -351,10 +375,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType.toString(), opv.getTypeName());
+ final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ assertEquals(expectedType, opv.getTypeKind());
- final GeospatialCollection collection = opv.<GeospatialCollection>toCastValue();
+ final GeospatialCollection collection = opv.toCastValue(GeospatialCollection.class);
assertNotNull(collection);
assertEquals(expectedDimension, collection.getDimension());
@@ -380,10 +404,10 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType.toString(), opv.getTypeName());
+ final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ assertEquals(expectedType, opv.getTypeKind());
- final GeospatialCollection collection = opv.<GeospatialCollection>toCastValue();
+ final GeospatialCollection collection = opv.toCastValue(GeospatialCollection.class);
assertNotNull(collection);
assertEquals(expectedDimension, collection.getDimension());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
index e9b97f2..a67f8b8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
@@ -33,6 +33,7 @@ import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.junit.Test;
@@ -51,7 +52,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
getVersion().name().toLowerCase() + File.separatorChar
+ "Customer_-10_CustomerId_value.txt");
- final ODataValue value = getClient().getPrimitiveValueBuilder().
+ final ODataPrimitiveValue value = getClient().getPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.String).
setText(IOUtils.toString(input)).
build();
@@ -59,14 +60,14 @@ public abstract class AbstractPropertyTest extends AbstractTest {
assertEquals("-10", value.toString());
}
- private ODataProperty primitive() throws IOException {
+ private ODataProperty primitive() throws IOException, EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream(
getVersion().name().toLowerCase() + File.separatorChar
+ "Customer_-10_CustomerId." + getSuffix(getFormat()));
final ODataProperty property = getClient().getReader().readProperty(input, getFormat());
assertNotNull(property);
assertTrue(property.hasPrimitiveValue());
- assertTrue(-10 == property.getPrimitiveValue().<Integer>toCastValue());
+ assertTrue(-10 == property.getPrimitiveValue().toCastValue(Integer.class));
ODataProperty comparable;
final ODataProperty written = getClient().getReader().readProperty(
@@ -76,8 +77,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
} else {
// This is needed because type information gets lost with JSON serialization
final ODataPrimitiveValue typedValue = getClient().getPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.valueOfFQN(
- getClient().getServiceVersion(), property.getPrimitiveValue().getTypeName())).
+ setType(property.getPrimitiveValue().getTypeKind()).
setText(written.getPrimitiveValue().toString()).
build();
comparable = getClient().getObjectFactory().newPrimitiveProperty(written.getName(), typedValue);
@@ -89,7 +89,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
}
@Test
- public void readPrimitiveProperty() throws IOException {
+ public void readPrimitiveProperty() throws IOException, EdmPrimitiveTypeException {
primitive();
}
@@ -109,7 +109,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
comparable = written;
} else {
// This is needed because type information gets lost with JSON serialization
- final ODataComplexValue typedValue = new ODataComplexValue(property.getComplexValue().getTypeName());
+ final ODataComplexValue typedValue = new ODataComplexValue(property.getComplexValue().getType());
for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
final ODataProperty prop = itor.next();
typedValue.add(prop);
@@ -144,7 +144,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
} else {
// This is needed because type information gets lost with JSON serialization
final ODataCollectionValue typedValue =
- new ODataCollectionValue(property.getCollectionValue().getTypeName());
+ new ODataCollectionValue(property.getCollectionValue().getType());
for (final Iterator<ODataValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
final ODataValue value = itor.next();
if (value.isPrimitive()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index e87b877..1a30ef7 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -64,7 +64,7 @@ import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.data.AtomEntryImpl;
import org.apache.olingo.client.core.data.JSONEntryImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -198,8 +198,8 @@ public abstract class AbstractTestITCase {
assertTrue("Found " + actual + " but expected " + original, found);
} else {
assertTrue("Primitive value for '" + propertyName + "' type mismatch: " + original.asPrimitive().
- getTypeName() + "-" + actual.asPrimitive().getTypeName(),
- original.asPrimitive().getTypeName().equals(actual.asPrimitive().getTypeName()));
+ getTypeKind() + "-" + actual.asPrimitive().getTypeKind(),
+ original.asPrimitive().getTypeKind().equals(actual.asPrimitive().getTypeKind()));
assertEquals("Primitive value for '" + propertyName + "' mismatch: " + original.asPrimitive().toString()
+ "-" + actual.asPrimitive().toString(),
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index 4527aa0..294d190 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
-import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.util.concurrent.ExecutionException;
@@ -95,7 +94,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
*/
@Test
@Ignore
- public void createMediaEntity() throws InterruptedException, ExecutionException, IOException {
+ public void createMediaEntity() throws Exception {
CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car");
final String TO_BE_UPDATED = "async buffered stream sample";
@@ -110,7 +109,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
while (!futureCreateRes.isDone()) {
Thread.sleep(1000L);
}
-
+
final ODataMediaEntityCreateResponse createRes = futureCreateRes.get();
assertEquals(201, createRes.getStatusCode());
@@ -120,8 +119,8 @@ public class AsyncTestITCase extends AbstractTestITCase {
assertEquals(2, created.getProperties().size());
final int id = "VIN".equals(created.getProperties().get(0).getName())
- ? created.getProperties().get(0).getPrimitiveValue().<Integer>toCastValue()
- : created.getProperties().get(1).getPrimitiveValue().<Integer>toCastValue();
+ ? created.getProperties().get(0).getPrimitiveValue().toCastValue(Integer.class)
+ : created.getProperties().get(1).getPrimitiveValue().toCastValue(Integer.class);
builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(id).appendValueSegment();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
index bcdef88..455d376 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
@@ -28,35 +28,33 @@ import org.apache.olingo.client.api.format.ODataValueFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
public class CountTestITCase extends AbstractTestITCase {
- //counts the total number of customers
- @Test
- public void entityCount() {
- CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customer").count();
- final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
- req.setFormat(ODataValueFormat.TEXT);
- try {
- final ODataValue value = req.execute().getBody();
- assertTrue(10 <= Integer.parseInt(value.toString()));
- } catch (ODataClientErrorException e) {
- LOG.error("Error code: {}", e.getStatusLine().getStatusCode(), e);
- }
+ @Test
+ public void entityCount() {
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customer").count();
+ final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
+ req.setFormat(ODataValueFormat.TEXT);
+ try {
+ final ODataValue value = req.execute().getBody();
+ assertTrue(10 <= Integer.parseInt(value.toString()));
+ } catch (ODataClientErrorException e) {
+ LOG.error("Error code: {}", e.getStatusLine().getStatusCode(), e);
}
- //returns 415 error for invalid header.
+ }
- @Test
- public void invalidAccept() {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customer").count();
- final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
- req.setFormat(ODataValueFormat.TEXT);
- req.setAccept("application/json;odata=fullmetadata");
- try {
- final ODataValue value = req.execute().getBody();
- fail();
- } catch (ODataClientErrorException e) {
- assertEquals(415, e.getStatusLine().getStatusCode());
- }
+ @Test
+ public void invalidAccept() {
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customer").count();
+ final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
+ req.setFormat(ODataValueFormat.TEXT);
+ req.setAccept("application/json;odata=fullmetadata");
+ try {
+ final ODataValue value = req.execute().getBody();
+ fail();
+ } catch (ODataClientErrorException e) {
+ assertEquals(415, e.getStatusLine().getStatusCode());
}
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 465dc07..d16f060 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -47,7 +47,8 @@ import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.NoContentException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Ignore;
import org.junit.Test;
@@ -182,14 +183,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
}
@Test
- public void createWithFeedNavigationAsAtom() {
+ public void createWithFeedNavigationAsAtom() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.ATOM;
final ODataEntity actual = createWithFeedNavigationLink(format, 7);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@Test
- public void createWithFeedNavigationAsJSON() {
+ public void createWithFeedNavigationAsJSON() throws EdmPrimitiveTypeException {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final ODataEntity actual = createWithFeedNavigationLink(format, 8);
@@ -197,14 +198,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
}
@Test
- public void createWithBackNavigationAsAtom() {
+ public void createWithBackNavigationAsAtom() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.ATOM;
final ODataEntity actual = createWithBackNavigationLink(format, 9);
cleanAfterCreate(format, actual, true, getServiceRoot());
}
@Test
- public void createWithBackNavigationAsJSON() {
+ public void createWithBackNavigationAsJSON() throws EdmPrimitiveTypeException {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final ODataEntity actual = createWithBackNavigationLink(format, 10);
@@ -275,7 +276,9 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
}
}
- private ODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id) {
+ private ODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id)
+ throws EdmPrimitiveTypeException {
+
final String sampleName = "Sample customer";
final ODataEntity original = getSampleCustomerProfile(id, sampleName, false);
@@ -321,8 +324,8 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
assertEquals(2, entitySet.getCount());
for (ODataEntity entity : entitySet.getEntities()) {
- final Integer key = entity.getProperty("OrderId").getPrimitiveValue().<Integer>toCastValue();
- final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().<Integer>toCastValue();
+ final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
+ final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(keys.contains(key));
assertEquals(Integer.valueOf(id), customerId);
keys.remove(key);
@@ -374,7 +377,9 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
return actual;
}
- private ODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id) {
+ private ODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id)
+ throws EdmPrimitiveTypeException {
+
final String sampleName = "Sample customer";
ODataEntity customer = getSampleCustomerProfile(id, sampleName, false);
@@ -405,8 +410,8 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
customer = customerreq.execute().getBody();
- assertEquals(
- Integer.valueOf(id), customer.getProperty("CustomerId").getPrimitiveValue().<Integer>toCastValue());
+ assertEquals(Integer.valueOf(id),
+ customer.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class));
final ODataEntitySetRequest orderreq = client.getRetrieveRequestFactory().getEntitySetRequest(
URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "/Orders"));
@@ -417,7 +422,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
assertEquals(Integer.valueOf(id),
orderres.getBody().getEntities().get(0).getProperty("OrderId").getPrimitiveValue().
- <Integer>toCastValue());
+ toCastValue(Integer.class));
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(
URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "?$expand=Orders"));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
index 02a74ae..6637346 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
@@ -39,6 +39,7 @@ import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.op.impl.ResourceFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.junit.Test;
/**
@@ -170,7 +171,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
rawRequest(ODataPubFormat.JSON_FULL_METADATA);
}
- private void multiKey(final ODataPubFormat format) {
+ private void multiKey(final ODataPubFormat format) throws EdmPrimitiveTypeException {
final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
multiKey.put("FromUsername", "1");
multiKey.put("MessageId", -10);
@@ -184,16 +185,16 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final ODataRetrieveResponse<ODataEntity> res = req.execute();
final ODataEntity entity = res.getBody();
assertNotNull(entity);
- assertEquals("1", entity.getProperty("FromUsername").getPrimitiveValue().<String>toCastValue());
+ assertEquals("1", entity.getProperty("FromUsername").getPrimitiveValue().toCastValue(String.class));
}
@Test
- public void multiKeyAsAtom() {
+ public void multiKeyAsAtom() throws EdmPrimitiveTypeException {
multiKey(ODataPubFormat.ATOM);
}
@Test
- public void multiKeyAsJSON() {
+ public void multiKeyAsJSON() throws EdmPrimitiveTypeException {
multiKey(ODataPubFormat.JSON_FULL_METADATA);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
index 08c414f..35cc3d6 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
@@ -32,7 +32,7 @@ import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.op.impl.ResourceFactory;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index 8399494..6e918e9 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -33,6 +33,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
@@ -106,16 +107,16 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
}
@Test
- public void patchLinkAsAtom() {
+ public void patchLinkAsAtom() throws EdmPrimitiveTypeException {
patchLink(ODataPubFormat.ATOM);
}
@Test
- public void patchLinkAsJSON() {
+ public void patchLinkAsJSON() throws EdmPrimitiveTypeException {
patchLink(ODataPubFormat.JSON_FULL_METADATA);
}
- public void patchLink(final ODataPubFormat format) {
+ public void patchLink(final ODataPubFormat format) throws EdmPrimitiveTypeException {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).build();
@@ -142,7 +143,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
ODataEntity newInfo = req.execute().getBody();
assertEquals(Integer.valueOf(12),
- newInfo.getProperty("CustomerInfoId").getPrimitiveValue().<Integer>toCastValue());
+ newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class));
// ---------------------------------------
// ---------------------------------------
@@ -167,11 +168,13 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
newInfo = req.execute().getBody();
assertEquals(Integer.valueOf(11),
- newInfo.getProperty("CustomerInfoId").getPrimitiveValue().<Integer>toCastValue());
+ newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class));
// ---------------------------------------
}
- private ODataEntityUpdateRequest buildMultiKeyUpdateReq(final ODataPubFormat format) {
+ private ODataEntityUpdateRequest buildMultiKeyUpdateReq(final ODataPubFormat format)
+ throws EdmPrimitiveTypeException {
+
final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
multiKey.put("FromUsername", "1");
multiKey.put("MessageId", -10);
@@ -180,7 +183,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
message.getAssociationLinks().clear();
message.getNavigationLinks().clear();
- final boolean before = message.getProperty("IsRead").getPrimitiveValue().<Boolean>toCastValue();
+ final boolean before = message.getProperty("IsRead").getPrimitiveValue().toCastValue(Boolean.class);
message.getProperties().remove(message.getProperty("IsRead"));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
client.getPrimitiveValueBuilder().setValue(!before).
@@ -189,23 +192,23 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
return client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, message);
}
- private void mergeMultiKey(final ODataPubFormat format) {
+ private void mergeMultiKey(final ODataPubFormat format) throws EdmPrimitiveTypeException {
final ODataEntityUpdateResponse res = buildMultiKeyUpdateReq(format).execute();
assertEquals(204, res.getStatusCode());
}
@Test
- public void mergeMultiKeyAsAtom() {
+ public void mergeMultiKeyAsAtom() throws EdmPrimitiveTypeException {
mergeMultiKey(ODataPubFormat.ATOM);
}
@Test
- public void mergeMultiKeyAsJSON() {
+ public void mergeMultiKeyAsJSON() throws EdmPrimitiveTypeException {
mergeMultiKey(ODataPubFormat.JSON_FULL_METADATA);
}
@Test
- public void updateReturnContent() {
+ public void updateReturnContent() throws EdmPrimitiveTypeException {
final ODataEntityUpdateRequest req = buildMultiKeyUpdateReq(client.getConfiguration().getDefaultPubFormat());
req.setPrefer(ODataHeaderValues.preferReturnContent);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
index e4b9212..a61b853 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
@@ -36,7 +36,7 @@ import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.commons.api.edm.Edm;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
index a043430..33446cf 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
@@ -171,7 +171,7 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
Integer id = null;
for (ODataProperty prop : created.getProperties()) {
if ("VIN".equals(prop.getName())) {
- id = prop.getPrimitiveValue().<Integer>toCastValue();
+ id = prop.getPrimitiveValue().toCastValue(Integer.class);
}
}
assertNotNull(id);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index b8ce3b4..a1a90f9 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -50,7 +50,8 @@ import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
@@ -122,7 +123,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
// create collection navigation link with ATOM
@Test
- public void createCollectionNavWithAtom() {
+ public void createCollectionNavWithAtom() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.ATOM;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
@@ -132,7 +133,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
// create collection navigation link with JSON
@Test
- public void createCollectionNavWithJSON() {
+ public void createCollectionNavWithJSON() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
@@ -195,7 +196,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
// create collection navigation link
public ODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
- final String contentType, final String prefer) {
+ final String contentType, final String prefer) throws EdmPrimitiveTypeException {
{
final String name = "Collection Navigation Key Customer";
final ODataEntity original = getNewCustomer(id, name, false);
@@ -242,8 +243,8 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
assertEquals(2, entitySet.getCount());
for (ODataEntity entity : entitySet.getEntities()) {
- final Integer key = entity.getProperty("OrderId").getPrimitiveValue().<Integer>toCastValue();
- final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().<Integer>toCastValue();
+ final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
+ final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(navigationKeys.contains(key));
assertEquals(Integer.valueOf(id), customerId);
navigationKeys.remove(key);
@@ -511,7 +512,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
assertTrue("Found " + actual + " and expected " + original, found);
} else {
assertTrue("Primitive value for '" + propertyName + "' type mismatch",
- original.asPrimitive().getTypeName().equals(actual.asPrimitive().getTypeName()));
+ original.asPrimitive().getTypeKind() == actual.asPrimitive().getTypeKind());
assertEquals("Primitive value for '" + propertyName + "' mismatch",
original.asPrimitive().toString(), actual.asPrimitive().toString());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index c64d7bb..2d06ba0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -69,17 +69,11 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
private void read(final ODataPubFormat format) {
ODataEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f");
- assertEquals(
- EdmPrimitiveTypeKind.Double.toString(),
- row.getProperty("Double").getPrimitiveValue().getTypeName());
- assertEquals(
- EdmPrimitiveTypeKind.Guid.toString(),
- row.getProperty("Id").getPrimitiveValue().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Double, row.getProperty("Double").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.Guid, row.getProperty("Id").getPrimitiveValue().getTypeKind());
row = readRow(format, "672b8250-1e6e-4785-80cf-b94b572e42b3");
- assertEquals(
- EdmPrimitiveTypeKind.Decimal.toString(),
- row.getProperty("Decimal").getPrimitiveValue().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Decimal, row.getProperty("Decimal").getPrimitiveValue().getTypeKind());
}
@Test
@@ -213,45 +207,45 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().
getEntityCreateRequest(client.getURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Row").build(), row);
+ appendEntitySetSegment("Row").build(), row);
createReq.setFormat(format);
final ODataEntityCreateResponse createRes = createReq.execute();
assertEquals(201, createRes.getStatusCode());
row = readRow(format, guid.toString());
assertNotNull(row);
- assertEquals(EdmPrimitiveTypeKind.Guid.toString(),
- row.getProperty("Id").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.String.toString(),
- row.getProperty("aString").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.Boolean.toString(),
- row.getProperty("aBoolean").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.Int64.toString(),
- row.getProperty("aLong").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.Double.toString(),
- row.getProperty("aDouble").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.SByte.toString(),
- row.getProperty("aByte").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.DateTime.toString(),
- row.getProperty("aDate").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.GeographyPoint.toString(),
- row.getProperty("aPoint").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint.toString(),
- row.getProperty("aMultiPoint").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.GeometryLineString.toString(),
- row.getProperty("aLineString").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString.toString(),
- row.getProperty("aMultiLineString").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.GeographyPolygon.toString(),
- row.getProperty("aPolygon").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.GeographyMultiPolygon.toString(),
- row.getProperty("aMultiPolygon").getPrimitiveValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.GeographyCollection.toString(),
- row.getProperty("aCollection").getPrimitiveValue().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Guid,
+ row.getProperty("Id").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.String,
+ row.getProperty("aString").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.Boolean,
+ row.getProperty("aBoolean").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.Int64,
+ row.getProperty("aLong").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.Double,
+ row.getProperty("aDouble").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.SByte,
+ row.getProperty("aByte").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.DateTime,
+ row.getProperty("aDate").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeographyPoint,
+ row.getProperty("aPoint").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint,
+ row.getProperty("aMultiPoint").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeometryLineString,
+ row.getProperty("aLineString").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString,
+ row.getProperty("aMultiLineString").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeographyPolygon,
+ row.getProperty("aPolygon").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeographyMultiPolygon,
+ row.getProperty("aMultiPolygon").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeographyCollection,
+ row.getProperty("aCollection").getPrimitiveValue().getTypeKind());
assertEquals("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails",
- row.getProperty("aContact").getComplexValue().getTypeName());
- assertEquals(EdmPrimitiveTypeKind.SByte.toString(),
- row.getProperty("aContact").getComplexValue().get("SignedByte").getPrimitiveValue().getTypeName());
+ row.getProperty("aContact").getComplexValue().getType());
+ assertEquals(EdmPrimitiveTypeKind.SByte,
+ row.getProperty("aContact").getComplexValue().get("SignedByte").getPrimitiveValue().getTypeKind());
final ODataDeleteResponse deleteRes = client.getCUDRequestFactory().getDeleteRequest(row.getEditLink()).
execute();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
index f7db133..d69fb68 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
@@ -25,7 +25,6 @@ import java.math.BigDecimal;
import java.util.UUID;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataDuration;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.junit.Test;
@@ -46,26 +45,16 @@ public class PrimitiveKeysTestITCase extends AbstractTestITCase {
}
private void readPrimitiveKeys(final ODataPubFormat format) {
- // commented as per #115
- //readEntity("EdmBinarySet", new byte[] {Byte.valueOf("2"), Byte.valueOf("3"), Byte.valueOf("4")}, format);
readEntity("EdmBooleanSet", Boolean.TRUE, format);
readEntity("EdmByteSet", 255, format);
readEntity("EdmDecimalSet", new BigDecimal("79228162514264337593543950335"), format);
readEntity("EdmDoubleSet", 1.7976931348623157E+308D, format);
- readEntity("EdmSingleSet", 3.40282347E+38F, format);
+ readEntity("EdmSingleSet", 3.4028235E+38F, format);
readEntity("EdmGuidSet", UUID.fromString("00000000-0000-0000-0000-000000000000"), format);
readEntity("EdmInt16Set", 32767, format);
readEntity("EdmInt32Set", -2147483648, format);
readEntity("EdmInt64Set", 9223372036854775807L, format);
readEntity("EdmStringSet", "$", format);
- readEntity("EdmTimeSet", new ODataDuration("-P10675199DT2H48M5.4775808S"), format);
- // commented as per #115
- //readEntity("EdmDateTimeSet",
- // ODataTimestamp.parse(EdmSimpleType.DATE_TIME.pattern(), "0001-01-01T00:00:00"),
- // format);
- //readEntity("EdmDateTimeOffsetSet",
- // ODataTimestamp.parse(EdmSimpleType.DATE_TIME_OFFSET.pattern(), "2013-08-14T13:33:46.1045905+02:00"),
- // format);
}
@Test
[29/52] [abbrv] [OLINGO-200] Moving domain objects to commons-api
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkType.java
deleted file mode 100644
index 6702c00..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkType.java
+++ /dev/null
@@ -1,93 +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.client.api.domain;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.http.entity.ContentType;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-/**
- * OData link types.
- */
-public enum ODataLinkType {
-
- /**
- * Entity navigation link.
- */
- ENTITY_NAVIGATION(ODataPubFormat.ATOM + ";type=entry"),
- /**
- * Entity set navigation link.
- */
- ENTITY_SET_NAVIGATION(ODataPubFormat.ATOM + ";type=feed"),
- /**
- * Association link.
- */
- ASSOCIATION(ContentType.APPLICATION_XML.getMimeType()),
- /**
- * Media-edit link.
- */
- MEDIA_EDIT("*/*");
-
- private String type;
-
- private ODataLinkType(final String type) {
- this.type = type;
- }
-
- private ODataLinkType setType(final String type) {
- this.type = type;
- return this;
- }
-
- /**
- * Gets <code>LinkType</code> instance from the given rel and type.
- *
- * @param client OData client.
- * @param rel rel.
- * @param type type.
- * @return <code>ODataLinkType</code> object.
- */
- public static ODataLinkType fromString(final ODataServiceVersion version, final String rel, final String type) {
- if (StringUtils.isNotBlank(rel)
- && rel.startsWith(version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL))) {
-
- return MEDIA_EDIT.setType(StringUtils.isBlank(type) ? "*/*" : type);
- }
-
- if (ODataLinkType.ENTITY_NAVIGATION.type.equals(type)) {
- return ENTITY_NAVIGATION;
- }
-
- if (ODataLinkType.ENTITY_SET_NAVIGATION.type.equals(type)) {
- return ENTITY_SET_NAVIGATION;
- }
-
- if (ODataLinkType.ASSOCIATION.type.equals(type)) {
- return ASSOCIATION;
- }
-
- throw new IllegalArgumentException("Invalid link type: " + type);
- }
-
- @Override
- public String toString() {
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java
deleted file mode 100644
index ddafea4..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataObjectFactory.java
+++ /dev/null
@@ -1,218 +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.client.api.domain;
-
-import java.net.URI;
-
-/**
- * Entry point for generating OData domain objects.
- *
- * @see ODataEntitySet
- * @see ODataEntity
- * @see ODataProperty
- * @see ODataLink
- */
-public interface ODataObjectFactory {
-
- /**
- * Instantiates a new entity set.
- *
- * @return entity set.
- */
- ODataEntitySet newEntitySet();
-
- /**
- * Instantiates a new entity set.
- *
- * @param next next link.
- * @return entity set.
- */
- ODataEntitySet newEntitySet(URI next);
-
- /**
- * Instantiates a new entity.
- *
- * @param name OData entity name.
- * @return entity.
- */
- ODataEntity newEntity(String name);
-
- /**
- * Instantiates a new entity.
- *
- * @param name OData entity name.
- * @param link self link.
- * @return entity.
- */
- ODataEntity newEntity(String name, URI link);
-
- /**
- * Instantiates a new in-line entity set.
- *
- * @param name name.
- * @param link edit link.
- * @param entitySet entity set.
- * @return in-line entity set.
- */
- ODataInlineEntitySet newInlineEntitySet(String name, URI link, ODataEntitySet entitySet);
-
- /**
- * Instantiates a new in-line entity set.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @param entitySet entity set.
- * @return in-line entity set.
- */
- ODataInlineEntitySet newInlineEntitySet(String name, URI baseURI, String href, ODataEntitySet entitySet);
-
- /**
- * Instantiates a new in-line entity.
- *
- * @param name name.
- * @param link edit link.
- * @param entity entity.
- * @return in-line entity.
- */
- ODataInlineEntity newInlineEntity(String name, URI link, ODataEntity entity);
-
- /**
- * Instantiates a new in-line entity.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @param entity entity.
- * @return in-line entity.
- */
- ODataInlineEntity newInlineEntity(String name, URI baseURI, String href, ODataEntity entity);
-
- /**
- * Instantiates a new entity navigation link.
- *
- * @param name name.
- * @param link link.
- * @return entity navigation link.
- */
- ODataLink newEntityNavigationLink(String name, URI link);
-
- /**
- * Instantiates a new entity navigation link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return entity navigation link.
- */
- ODataLink newEntityNavigationLink(String name, URI baseURI, String href);
-
- /**
- * Instantiates a new entity set navigation link.
- *
- * @param name name.
- * @param link link.
- * @return entity set navigation link.
- */
- ODataLink newFeedNavigationLink(String name, URI link);
-
- /**
- * Instantiates a new entity set navigation link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return entity set navigation link.
- */
- ODataLink newFeedNavigationLink(String name, URI baseURI, String href);
-
- /**
- * Instantiates a new association link.
- *
- * @param name name.
- * @param link link.
- * @return association link.
- */
- ODataLink newAssociationLink(String name, URI link);
-
- /**
- * Instantiates a new association link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return association link.
- */
- ODataLink newAssociationLink(String name, URI baseURI, String href);
-
- /**
- * Instantiates a new media-edit link.
- *
- * @param name name.
- * @param link link.
- * @return media-edit link.
- */
- ODataLink newMediaEditLink(String name, URI link);
-
- /**
- * Instantiates a new media-edit link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return media-edit link.
- */
- ODataLink newMediaEditLink(String name, URI baseURI, String href);
-
- /**
- * Instantiates a new primitive property.
- *
- * @param name name.
- * @param value primitive value.
- * @return primitive property.
- */
- ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
-
- /**
- * Instantiates a new primitive property.
- *
- * @param name name.
- * @param value geospatial value.
- * @return primitive property.
- */
- ODataProperty newPrimitiveProperty(String name, ODataGeospatialValue value);
-
- /**
- * Instantiates a new complex property.
- *
- * @param name name.
- * @param value value.
- * @return complex property.
- */
- ODataProperty newComplexProperty(String name, ODataComplexValue value);
-
- /**
- * Instantiates a new collection property.
- *
- * @param name name.
- * @param value value.
- * @return collection property.
- */
- ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataOperation.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataOperation.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataOperation.java
deleted file mode 100644
index c18260f..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataOperation.java
+++ /dev/null
@@ -1,88 +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.client.api.domain;
-
-import java.io.Serializable;
-import java.net.URI;
-
-public class ODataOperation implements Serializable {
-
- private static final long serialVersionUID = 4155165768886762490L;
-
- private String metadataAnchor;
-
- private String title;
-
- private URI target;
-
- /**
- * Gets metadata anchor.
- *
- * @return metadata anchor.
- */
- public String getMetadataAnchor() {
- return metadataAnchor;
- }
-
- /**
- * Sets metadata anchor.
- *
- * @param metadataAnchor metadata anchor.
- */
- public void setMetadataAnchor(final String metadataAnchor) {
- this.metadataAnchor = metadataAnchor;
- }
-
- /**
- * Gets title.
- *
- * @return title.
- */
- public String getTitle() {
- return title;
- }
-
- /**
- * Sets title.
- *
- * @param title title.
- */
- public void setTitle(final String title) {
- this.title = title;
- }
-
- /**
- * Gets target.
- *
- * @return target.
- */
- public URI getTarget() {
- return target;
- }
-
- /**
- * Sets target.
- *
- * @param target target.
- */
- public void setTarget(final URI target) {
- this.target = target;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
deleted file mode 100644
index a615eed..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
+++ /dev/null
@@ -1,67 +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.client.api.domain;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-
-public interface ODataPrimitiveValue extends ODataValue {
-
- interface Builder {
-
- Builder setType(EdmPrimitiveTypeKind type);
-
- Builder setText(String text);
-
- Builder setValue(Object value);
-
- ODataPrimitiveValue build();
- }
-
- EdmPrimitiveTypeKind getTypeKind();
-
- EdmPrimitiveType getType();
-
- /**
- * Returns the current value as generic Object.
- *
- * @return an uncasted instance of this value
- */
- Object toValue();
-
- /**
- * Returns the current value casted to the given type.
- *
- * @param <T> cast type
- * @param reference class reference
- * @return the current value as typed java instance
- * @throws EdmPrimitiveTypeException if the object is not assignable to the type T.
- */
- <T> T toCastValue(Class<T> reference) throws EdmPrimitiveTypeException;
-
- /**
- * Serialize the current value as String.
- *
- * @return a String representation of this value
- */
- @Override
- String toString();
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java
deleted file mode 100644
index 440b461..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataProperty.java
+++ /dev/null
@@ -1,186 +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.client.api.domain;
-
-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 {
-
- 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.
- */
- public 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 geospatial value.
- *
- * @return 'TRUE' if has geospatial value; 'FALSE' otherwise.
- */
- public boolean hasGeospatialValue() {
- return !hasNullValue() && this.value.isGeospatial();
- }
-
- /**
- * Gets geospatial value.
- *
- * @return geospatial value if exists; null otherwise.
- */
- public ODataGeospatialValue getGeospatialValue() {
- return hasGeospatialValue() ? this.value.asGeospatial() : 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/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPropertyType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPropertyType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPropertyType.java
deleted file mode 100644
index 356596f..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPropertyType.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.domain;
-
-public enum ODataPropertyType {
-
- /**
- * Primitive (including geospatial and enum).
- */
- PRIMITIVE,
- /**
- * Collection
- */
- COLLECTION,
- /**
- * Complex.
- */
- COMPLEX,
- /**
- * Empty type (possibly, no type information could be retrieved).
- */
- EMPTY
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataServiceDocument.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataServiceDocument.java
deleted file mode 100644
index d0f495d..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataServiceDocument.java
+++ /dev/null
@@ -1,183 +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.client.api.domain;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-public class ODataServiceDocument {
-
- private URI metadataContext;
-
- private String metadataETag;
-
- private final Map<String, URI> entitySets = new HashMap<String, URI>();
-
- private final Map<String, URI> functionImports = new HashMap<String, URI>();
-
- private final Map<String, URI> singletons = new HashMap<String, URI>();
-
- private final Map<String, URI> relatedServiceDocuments = new HashMap<String, URI>();
-
- public URI getMetadataContext() {
- return metadataContext;
- }
-
- public void setMetadataContext(final URI metadataContext) {
- this.metadataContext = metadataContext;
- }
-
- public String getMetadataETag() {
- return metadataETag;
- }
-
- public void setMetadataETag(final String metadataETag) {
- this.metadataETag = metadataETag;
- }
-
- public Map<String, URI> getEntitySets() {
- return entitySets;
- }
-
- /**
- * Gets entity set titles.
- *
- * @return entity set titles.
- */
- public Collection<String> getEntitySetTitles() {
- return entitySets.keySet();
- }
-
- /**
- * Gets entity set URIs.
- *
- * @return entity set URIs.
- */
- public Collection<URI> getEntitySetURIs() {
- return entitySets.values();
- }
-
- /**
- * Gets URI about the given entity set.
- *
- * @param title title.
- * @return URI.
- */
- public URI getEntitySetURI(final String title) {
- return entitySets.get(title);
- }
-
- public Map<String, URI> getFunctionImports() {
- return functionImports;
- }
-
- /**
- * Gets function import titles.
- *
- * @return function import titles.
- */
- public Collection<String> getFunctionImportTitles() {
- return functionImports.keySet();
- }
-
- /**
- * Gets function import URIs.
- *
- * @return function import URIs.
- */
- public Collection<URI> getFunctionImportURIs() {
- return functionImports.values();
- }
-
- /**
- * Gets URI of the given function import.
- *
- * @param title title.
- * @return URI.
- */
- public URI getFunctionImportURI(final String title) {
- return functionImports.get(title);
- }
-
- public Map<String, URI> getSingletons() {
- return singletons;
- }
-
- /**
- * Gets singleton titles.
- *
- * @return singleton titles.
- */
- public Collection<String> getSingletonTitles() {
- return singletons.keySet();
- }
-
- /**
- * Gets singleton URIs.
- *
- * @return singleton URIs.
- */
- public Collection<URI> getSingletonURIs() {
- return singletons.values();
- }
-
- /**
- * Gets URI of the given singleton.
- *
- * @param title title.
- * @return URI.
- */
- public URI getSingletonURI(final String title) {
- return singletons.get(title);
- }
-
- public Map<String, URI> getRelatedServiceDocuments() {
- return relatedServiceDocuments;
- }
-
- /**
- * Gets related service documents titles.
- *
- * @return related service documents titles.
- */
- public Collection<String> getRelatedServiceDocumentsTitles() {
- return relatedServiceDocuments.keySet();
- }
-
- /**
- * Gets related service documents URIs.
- *
- * @return related service documents URIs.
- */
- public Collection<URI> getRelatedServiceDocumentsURIs() {
- return relatedServiceDocuments.values();
- }
-
- /**
- * Gets URI of the given related service documents.
- *
- * @param title title.
- * @return URI.
- */
- public URI getRelatedServiceDocumentURI(final String title) {
- return relatedServiceDocuments.get(title);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java
deleted file mode 100644
index d56f188..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataValue.java
+++ /dev/null
@@ -1,84 +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.client.api.domain;
-
-import java.io.Serializable;
-
-/**
- * Abstract representation of an OData entity property value.
- */
-public interface ODataValue extends Serializable {
-
- /**
- * Check is is a primitive value.
- *
- * @return 'TRUE' if primitive; 'FALSE' otherwise.
- */
- boolean isPrimitive();
-
- /**
- * Casts to primitive value.
- *
- * @return primitive value.
- */
- ODataPrimitiveValue asPrimitive();
-
- /**
- * Check is is a geospatail value.
- *
- * @return 'TRUE' if geospatail; 'FALSE' otherwise.
- */
- boolean isGeospatial();
-
- /**
- * Casts to geospatail value.
- *
- * @return geospatail value.
- */
- ODataGeospatialValue asGeospatial();
-
- /**
- * Check is is a collection value.
- *
- * @return 'TRUE' if collection; 'FALSE' otherwise.
- */
- boolean isCollection();
-
- /**
- * Casts to collection value.
- *
- * @return collection value.
- */
- ODataCollectionValue asCollection();
-
- /**
- * Check is is a complex value.
- *
- * @return 'TRUE' if complex; 'FALSE' otherwise.
- */
- boolean isComplex();
-
- /**
- * Casts to complex value.
- *
- * @return complex value.
- */
- ODataComplexValue asComplex();
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataFormat.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataFormat.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataFormat.java
deleted file mode 100644
index 2ee704b..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataFormat.java
+++ /dev/null
@@ -1,97 +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.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].trim());
- if (ContentType.APPLICATION_JSON.getMimeType().equals(parts[0].trim())) {
- if (parts.length > 1) {
- _format.append(';').append(parts[1].trim());
- } 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/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataMediaFormat.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataMediaFormat.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataMediaFormat.java
deleted file mode 100644
index 353edc4..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataMediaFormat.java
+++ /dev/null
@@ -1,71 +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.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/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataPubFormat.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataPubFormat.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataPubFormat.java
deleted file mode 100644
index 62e5322..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataPubFormat.java
+++ /dev/null
@@ -1,97 +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.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].trim());
- if (ContentType.APPLICATION_JSON.getMimeType().equals(parts[0].trim())) {
- if (parts.length > 1 && parts[1].startsWith("odata=")) {
- _format.append(';').append(parts[1].trim());
- } 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/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataValueFormat.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataValueFormat.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataValueFormat.java
deleted file mode 100644
index b04ce7d..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/format/ODataValueFormat.java
+++ /dev/null
@@ -1,76 +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.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/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
index 94375f6..8dd7232 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
@@ -25,11 +25,11 @@ import org.apache.olingo.client.api.data.Feed;
import org.apache.olingo.client.api.data.Link;
import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
public interface CommonODataBinder extends Serializable {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
index d0edb3b..0c0428c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
@@ -26,8 +26,8 @@ import org.apache.olingo.client.api.data.Feed;
import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* Utility class for serialization.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
index ceb7f6b..3f28f62 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
@@ -21,12 +21,12 @@ package org.apache.olingo.client.api.op;
import java.io.InputStream;
import java.io.Serializable;
import org.apache.olingo.client.api.data.ODataError;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.edm.Edm;
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java
index e7f9682..0734586 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java
@@ -25,7 +25,7 @@ import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.data.Feed;
import org.apache.olingo.client.api.data.Link;
import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
/**
* Utility class for serialization.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
index dd7afcd..b83b2cd 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
@@ -21,11 +21,11 @@ package org.apache.olingo.client.api.op;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Collection;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* OData writer.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
index 1b4a98b..99d840d 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.api.op.v3;
import java.io.InputStream;
import org.apache.olingo.client.api.data.v3.LinkCollection;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.CommonODataDeserializer;
public interface ODataDeserializer extends CommonODataDeserializer {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
index bb436ad..7049617 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.api.op.v3;
import java.io.InputStream;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.CommonODataReader;
public interface ODataReader extends CommonODataReader {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java
index 5c32aec..f50ced3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractConfiguration.java
@@ -24,10 +24,10 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.olingo.client.api.CommonConfiguration;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataMediaFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataMediaFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientFactory;
import org.apache.olingo.client.api.http.HttpUriRequestFactory;
import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index b5cfdea..6c889e8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataObjectFactory;
import org.apache.olingo.client.api.op.ODataWriter;
import org.apache.olingo.client.core.domain.ODataGeospatialValueImpl;
import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
index d088e97..44f7c45 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
@@ -43,9 +43,9 @@ import org.apache.olingo.client.api.communication.header.ODataHeaders;
import org.apache.olingo.client.api.communication.request.ODataRequest;
import org.apache.olingo.client.api.communication.request.ODataStreamer;
import org.apache.olingo.client.api.communication.response.ODataResponse;
-import org.apache.olingo.client.api.format.ODataMediaFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.commons.api.format.ODataMediaFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.data.JSONErrorImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
index 4659d15..cb82cbd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
@@ -29,10 +29,10 @@ import org.apache.olingo.client.api.communication.request.cud.ODataLinkCreateReq
import org.apache.olingo.client.api.communication.request.cud.ODataLinkUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
import org.apache.olingo.client.api.http.HttpMethod;
public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFactory {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java
index 720c5b6..fccfa3d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java
@@ -26,7 +26,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
index 6cf1927..c22b5de 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
@@ -28,8 +28,8 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
index 012d975..565c59e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
@@ -28,8 +28,8 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
index 0f91864..e64579d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkCreateRequestImpl.java
@@ -28,8 +28,8 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataLinkCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataLinkOperationResponse;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
index 0fea3a9..2644189 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataLinkUpdateRequestImpl.java
@@ -28,8 +28,8 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataLinkUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataLinkOperationResponse;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
index 04c87cc..b3be3eb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
@@ -28,8 +28,8 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateResponse;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
index dc3a727..d424d62 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
@@ -28,8 +28,8 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
index a9c6dfc..eb0d45b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
@@ -22,7 +22,7 @@ import java.net.URI;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
-import org.apache.olingo.client.api.domain.ODataInvokeResult;
+import org.apache.olingo.commons.api.domain.ODataInvokeResult;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
index c6355e4..f15879e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
@@ -35,13 +35,13 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInvokeResult;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
index 0ccb3c7..2487dd9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
@@ -25,11 +25,11 @@ import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInvokeResult;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.invoke.AbstractInvokeRequestFactory;
import org.apache.olingo.client.core.communication.request.invoke.ODataInvokeRequestImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
index 0e7f4b1..d6f929d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
@@ -24,8 +24,8 @@ import org.apache.commons.lang3.NotImplementedException;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory;
-import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.ODataInvokeResult;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.client.core.communication.request.invoke.AbstractInvokeRequestFactory;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
index 2390ac3..447f543 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
@@ -24,8 +24,8 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData retrieve query request returning a single entity.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
index 261611c..bfdddef 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
@@ -25,7 +25,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
index 1decb54..ef191ba 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
@@ -24,8 +24,8 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java
index b2a0f5d..4460be3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java
@@ -27,7 +27,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.format.ODataMediaFormat;
+import org.apache.olingo.commons.api.format.ODataMediaFormat;
import org.apache.olingo.client.api.http.HttpClientException;
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
index 58c7cb7..d5ee545 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
@@ -26,7 +26,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMetadataRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.edm.Edm;
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
index 5055a75..a768906 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
@@ -25,8 +25,8 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpClientException;
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
index 4226cc2..d6a2a99 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
@@ -27,7 +27,7 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.ODataRequestImpl;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
index 1fb98da..128e250 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
@@ -24,8 +24,8 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.format.ODataFormat;
/**
* This class implements an OData service document request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
index fd4e647..345bc58 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
@@ -25,8 +25,8 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java
index 0cdd38a..70044b1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java
@@ -26,7 +26,7 @@ import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkCollectionRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.core.communication.request.retrieve.AbstractODataRetrieveRequest;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
index d19d0d5..84a2253 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
@@ -23,7 +23,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataStreamedEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataResponse;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
/**
[37/52] [abbrv] [OLINGO-200] Moving Atom and JSON (de)serializer to
commons
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractValue.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractValue.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractValue.java
deleted file mode 100644
index 9f2d19a..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractValue.java
+++ /dev/null
@@ -1,98 +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.client.core.data;
-
-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.client.api.data.CollectionValue;
-import org.apache.olingo.client.api.data.ComplexValue;
-import org.apache.olingo.client.api.data.GeospatialValue;
-import org.apache.olingo.client.api.data.NullValue;
-import org.apache.olingo.client.api.data.PrimitiveValue;
-import org.apache.olingo.client.api.data.Value;
-
-public abstract class AbstractValue implements Value {
-
- @Override
- public boolean isNull() {
- return false;
- }
-
- @Override
- public boolean isSimple() {
- return false;
- }
-
- @Override
- public boolean isGeospatial() {
- return false;
- }
-
- @Override
- public boolean isComplex() {
- return false;
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public NullValue asNull() {
- return isNull() ? (NullValue) this : null;
- }
-
- @Override
- public PrimitiveValue asSimple() {
- return isSimple() ? (PrimitiveValue) this : null;
- }
-
- @Override
- public GeospatialValue asGeospatial() {
- return isGeospatial() ? (GeospatialValue) this : null;
- }
-
- @Override
- public ComplexValue asComplex() {
- return isComplex() ? (ComplexValue) this : null;
- }
-
- @Override
- public CollectionValue asCollection() {
- return isCollection() ? (CollectionValue) this : null;
- }
-
- @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/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
deleted file mode 100644
index 74d98a6..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
+++ /dev/null
@@ -1,370 +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.client.core.data;
-
-import org.apache.olingo.client.core.data.v3.XMLLinkCollectionImpl;
-import java.io.InputStream;
-import java.net.URI;
-import java.text.ParseException;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Attribute;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
-import org.apache.http.entity.ContentType;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.commons.api.domain.ODataOperation;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AtomDeserializer extends AbstractAtomDealer {
-
- private static final Logger LOG = LoggerFactory.getLogger(AtomDeserializer.class);
-
- private static final XMLInputFactory FACTORY = XMLInputFactory.newInstance();
-
- private final AtomPropertyDeserializer propDeserializer;
-
- public AtomDeserializer(final ODataServiceVersion version) {
- super(version);
- this.propDeserializer = new AtomPropertyDeserializer(version);
- }
-
- private AtomPropertyImpl property(final InputStream input) throws XMLStreamException {
- final XMLEventReader reader = FACTORY.createXMLEventReader(input);
- return propDeserializer.deserialize(reader, skipBeforeFirstStartElement(reader));
- }
-
- private StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
- StartElement startEvent = null;
- while (reader.hasNext() && startEvent == null) {
- final XMLEvent event = reader.nextEvent();
- if (event.isStartElement()) {
- startEvent = event.asStartElement();
- }
- }
- if (startEvent == null) {
- throw new IllegalArgumentException("Cannot find any XML start element");
- }
-
- return startEvent;
- }
-
- private void common(final XMLEventReader reader, final StartElement start,
- final AbstractAtomObject object, final String key) throws XMLStreamException {
-
- boolean foundEndElement = false;
- while (reader.hasNext() && !foundEndElement) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
- try {
- object.setCommonProperty(key, event.asCharacters().getData());
- } catch (ParseException e) {
- throw new XMLStreamException("While parsing Atom entry or feed common elements", e);
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndElement = true;
- }
- }
- }
-
- private void inline(final XMLEventReader reader, final StartElement start, final LinkImpl link)
- throws XMLStreamException {
-
- boolean foundEndElement = false;
- while (reader.hasNext() && !foundEndElement) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && inlineQName.equals(event.asStartElement().getName())) {
- StartElement inline = null;
- while (reader.hasNext() && inline == null) {
- final XMLEvent innerEvent = reader.peek();
- if (innerEvent.isCharacters() && innerEvent.asCharacters().isWhiteSpace()) {
- reader.nextEvent();
- } else if (innerEvent.isStartElement()) {
- inline = innerEvent.asStartElement();
- }
- }
- if (inline != null) {
- if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(inline.getName())) {
- link.setInlineEntry(entry(reader, inline));
- }
- if (Constants.QNAME_ATOM_ELEM_FEED.equals(inline.getName())) {
- link.setInlineFeed(feed(reader, inline));
- }
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndElement = true;
- }
- }
- }
-
- private XMLLinkCollectionImpl linkCollection(final InputStream input) throws XMLStreamException {
- final XMLEventReader reader = FACTORY.createXMLEventReader(input);
-
- final XMLLinkCollectionImpl linkCollection = new XMLLinkCollectionImpl();
-
- boolean isURI = false;
- boolean isNext = false;
- while (reader.hasNext()) {
- final XMLEvent event = reader.nextEvent();
- if (event.isStartElement()) {
- isURI = uriQName.equals(event.asStartElement().getName());
- isNext = nextQName.equals(event.asStartElement().getName());
- }
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
- if (isURI) {
- linkCollection.getLinks().add(URI.create(event.asCharacters().getData()));
- isURI = false;
- } else if (isNext) {
- linkCollection.setNext(URI.create(event.asCharacters().getData()));
- isNext = false;
- }
- }
- }
-
- return linkCollection;
- }
-
- private void properties(final XMLEventReader reader, final StartElement start, final AtomEntryImpl entry)
- throws XMLStreamException {
-
- boolean foundEndProperties = false;
- while (reader.hasNext() && !foundEndProperties) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- entry.getProperties().add(propDeserializer.deserialize(reader, event.asStartElement()));
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperties = true;
- }
- }
- }
-
- private AtomEntryImpl entry(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
- if (!Constants.QNAME_ATOM_ELEM_ENTRY.equals(start.getName())) {
- return null;
- }
-
- final AtomEntryImpl entry = new AtomEntryImpl();
- final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
- if (xmlBase != null) {
- entry.setBaseURI(xmlBase.getValue());
- }
- final Attribute etag = start.getAttributeByName(etagQName);
- if (etag != null) {
- entry.setETag(etag.getValue());
- }
-
- boolean foundEndEntry = false;
- while (reader.hasNext() && !foundEndEntry) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), entry, "id");
- } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), entry, "title");
- } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), entry, "summary");
- } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), entry, "updated");
- } else if (Constants.QNAME_ATOM_ELEM_CATEGORY.equals(event.asStartElement().getName())) {
- final Attribute term = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_TERM));
- if (term != null) {
- entry.setType(term.getValue());
- }
- } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
- final LinkImpl link = new LinkImpl();
- final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
- if (rel != null) {
- link.setRel(rel.getValue());
- }
- final Attribute title = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TITLE));
- if (title != null) {
- link.setTitle(title.getValue());
- }
- final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
- if (href != null) {
- link.setHref(href.getValue());
- }
- final Attribute type = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE));
- if (type != null) {
- link.setType(type.getValue());
- }
-
- if (Constants.SELF_LINK_REL.equals(link.getRel())) {
- entry.setSelfLink(link);
- } else if (Constants.EDIT_LINK_REL.equals(link.getRel())) {
- entry.setEditLink(link);
- } else if (link.getRel().startsWith(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL))) {
- entry.getNavigationLinks().add(link);
- inline(reader, event.asStartElement(), link);
- } else if (link.getRel().startsWith(
- version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL))) {
-
- entry.getAssociationLinks().add(link);
- } else if (link.getRel().startsWith(
- version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL))) {
-
- final Attribute metag = event.asStartElement().getAttributeByName(etagQName);
- if (metag != null) {
- link.setMediaETag(metag.getValue());
- }
- entry.getMediaEditLinks().add(link);
- }
- } else if (actionQName.equals(event.asStartElement().getName())) {
- final ODataOperation operation = new ODataOperation();
- final Attribute metadata = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_METADATA));
- if (metadata != null) {
- operation.setMetadataAnchor(metadata.getValue());
- }
- final Attribute title = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TITLE));
- if (title != null) {
- operation.setTitle(title.getValue());
- }
- final Attribute target = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TARGET));
- if (target != null) {
- operation.setTarget(URI.create(target.getValue()));
- }
-
- entry.getOperations().add(operation);
- } else if (Constants.QNAME_ATOM_ELEM_CONTENT.equals(event.asStartElement().getName())) {
- final Attribute type = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE));
- if (type == null || ContentType.APPLICATION_XML.getMimeType().equals(type.getValue())) {
- properties(reader, skipBeforeFirstStartElement(reader), entry);
- } else {
- entry.setMediaContentType(type.getValue());
- final Attribute src = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_SRC));
- if (src != null) {
- entry.setMediaContentSource(src.getValue());
- }
- }
- } else if (propertiesQName.equals(event.asStartElement().getName())) {
- properties(reader, event.asStartElement(), entry);
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndEntry = true;
- }
- }
-
- return entry;
- }
-
- private AtomEntryImpl entry(final InputStream input) throws XMLStreamException {
- final XMLEventReader reader = FACTORY.createXMLEventReader(input);
- return entry(reader, skipBeforeFirstStartElement(reader));
- }
-
- private void count(final XMLEventReader reader, final StartElement start, final AtomFeedImpl feed)
- throws XMLStreamException {
-
- boolean foundEndElement = false;
- while (reader.hasNext() && !foundEndElement) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
- feed.setCount(Integer.valueOf(event.asCharacters().getData()));
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndElement = true;
- }
- }
- }
-
- private AtomFeedImpl feed(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
- if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) {
- return null;
- }
-
- final AtomFeedImpl feed = new AtomFeedImpl();
- final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
- if (xmlBase != null) {
- feed.setBaseURI(xmlBase.getValue());
- }
-
- boolean foundEndFeed = false;
- while (reader.hasNext() && !foundEndFeed) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- if (countQName.equals(event.asStartElement().getName())) {
- count(reader, event.asStartElement(), feed);
- } else if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), feed, "id");
- } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), feed, "title");
- } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), feed, "summary");
- } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), feed, "updated");
- } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
- final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
- if (rel != null && Constants.NEXT_LINK_REL.equals(rel.getValue())) {
- final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
- if (href != null) {
- feed.setNext(URI.create(href.getValue()));
- }
- }
- } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(event.asStartElement().getName())) {
- feed.getEntries().add(entry(reader, event.asStartElement()));
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndFeed = true;
- }
- }
-
- return feed;
- }
-
- private AtomFeedImpl feed(final InputStream input) throws XMLStreamException {
- final XMLEventReader reader = FACTORY.createXMLEventReader(input);
- return feed(reader, skipBeforeFirstStartElement(reader));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T read(final InputStream input, final Class<T> reference) throws XMLStreamException {
- if (AtomFeedImpl.class.equals(reference)) {
- return (T) feed(input);
- } else if (AtomEntryImpl.class.equals(reference)) {
- return (T) entry(input);
- } else if (AtomPropertyImpl.class.equals(reference)) {
- return (T) property(input);
- } else if (XMLLinkCollectionImpl.class.equals(reference)) {
- return (T) linkCollection(input);
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomEntryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomEntryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomEntryImpl.java
deleted file mode 100644
index aa7c0c1..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomEntryImpl.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.client.core.data;
-
-public class AtomEntryImpl extends AbstractEntry {
-
- private static final long serialVersionUID = 6973729343868293279L;
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomFeedImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomFeedImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomFeedImpl.java
deleted file mode 100644
index 94f2540..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomFeedImpl.java
+++ /dev/null
@@ -1,66 +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.client.core.data;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-
-/**
- * List of entries, represented via Atom.
- *
- * @see AtomEntry
- */
-public class AtomFeedImpl extends AbstractAtomObject implements Feed {
-
- private static final long serialVersionUID = 5466590540021319153L;
-
- private Integer count;
-
- private final List<Entry> entries = new ArrayList<Entry>();
-
- private URI next;
-
- @Override
- public void setCount(final Integer count) {
- this.count = count;
- }
-
- @Override
- public Integer getCount() {
- return count;
- }
-
- @Override
- public List<Entry> getEntries() {
- return entries;
- }
-
- @Override
- public void setNext(final URI next) {
- this.next = next;
- }
-
- @Override
- public URI getNext() {
- return next;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
deleted file mode 100644
index 1187a81..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
+++ /dev/null
@@ -1,261 +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.client.core.data;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Attribute;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.GeoUtils;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-import org.apache.olingo.commons.api.edm.geo.LineString;
-import org.apache.olingo.commons.api.edm.geo.MultiLineString;
-import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
-import org.apache.olingo.commons.api.edm.geo.Point;
-import org.apache.olingo.commons.api.edm.geo.Polygon;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
-
-class AtomGeoValueDeserializer {
-
- private List<Point> points(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
-
- final List<Point> result = new ArrayList<Point>();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
- final String[] pointInfo = event.asCharacters().getData().split(" ");
-
- final Point point = new Point(GeoUtils.getDimension(type), crs);
- try {
- point.setX(EdmDouble.getInstance().valueOfString(pointInfo[0], null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
- point.setY(EdmDouble.getInstance().valueOfString(pointInfo[1], null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
- } catch (EdmPrimitiveTypeException e) {
- throw new XMLStreamException("While deserializing point coordinates as double", e);
- }
- result.add(point);
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return result;
- }
-
- private MultiPoint multipoint(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
-
- List<Point> points = Collections.<Point>emptyList();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_POINTMEMBERS)) {
- points = points(reader, event.asStartElement(), type, null);
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return new MultiPoint(GeoUtils.getDimension(type), crs, points);
- }
-
- private LineString lineString(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
-
- return new LineString(GeoUtils.getDimension(type), crs, points(reader, start, type, null));
- }
-
- private Polygon polygon(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
-
- List<Point> extPoints = null;
- List<Point> intPoints = null;
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- if (event.asStartElement().getName().equals(Constants.QNAME_POLYGON_EXTERIOR)) {
- extPoints = points(reader, event.asStartElement(), type, null);
- }
- if (event.asStartElement().getName().equals(Constants.QNAME_POLYGON_INTERIOR)) {
- intPoints = points(reader, event.asStartElement(), type, null);
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints);
- }
-
- private MultiLineString multiLineString(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
-
- final List<LineString> lineStrings = new ArrayList<LineString>();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_LINESTRING)) {
- lineStrings.add(lineString(reader, event.asStartElement(), type, null));
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return new MultiLineString(GeoUtils.getDimension(type), crs, lineStrings);
- }
-
- private MultiPolygon multiPolygon(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
-
- final List<Polygon> polygons = new ArrayList<Polygon>();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_POLYGON)) {
- polygons.add(polygon(reader, event.asStartElement(), type, null));
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return new MultiPolygon(GeoUtils.getDimension(type), crs, polygons);
- }
-
- private GeospatialCollection collection(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
-
- final List<Geospatial> geospatials = new ArrayList<Geospatial>();
-
- boolean foundEndCollection = false;
- while (reader.hasNext() && !foundEndCollection) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_GEOMEMBERS)) {
- boolean foundEndMembers = false;
- while (reader.hasNext() && !foundEndMembers) {
- final XMLEvent subevent = reader.nextEvent();
-
- if (subevent.isStartElement()) {
- geospatials.add(deserialize(reader, subevent.asStartElement(),
- GeoUtils.getType(GeoUtils.getDimension(type), subevent.asStartElement().getName().getLocalPart())));
- }
-
- if (subevent.isEndElement() && Constants.QNAME_GEOMEMBERS.equals(subevent.asEndElement().getName())) {
- foundEndMembers = true;
- }
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndCollection = true;
- }
- }
-
- return new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials);
- }
-
- public Geospatial deserialize(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type) throws XMLStreamException {
-
- String crs = null;
- final Attribute srsName = start.getAttributeByName(Constants.QNAME_ATTR_SRSNAME);
- if (srsName != null) {
- crs = StringUtils.substringAfterLast(srsName.getValue(), "/");
- }
-
- Geospatial value;
-
- switch (type) {
- case GeographyPoint:
- case GeometryPoint:
- value = points(reader, start, type, crs).get(0);
- break;
-
- case GeographyMultiPoint:
- case GeometryMultiPoint:
- value = multipoint(reader, start, type, crs);
- break;
-
- case GeographyLineString:
- case GeometryLineString:
- value = lineString(reader, start, type, crs);
- break;
-
- case GeographyMultiLineString:
- case GeometryMultiLineString:
- value = multiLineString(reader, start, type, crs);
- break;
-
- case GeographyPolygon:
- case GeometryPolygon:
- value = polygon(reader, start, type, crs);
- break;
-
- case GeographyMultiPolygon:
- case GeometryMultiPolygon:
- value = multiPolygon(reader, start, type, crs);
- break;
-
- case GeographyCollection:
- case GeometryCollection:
- value = collection(reader, start, type, crs);
- break;
-
- default:
- value = null;
- }
-
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
deleted file mode 100644
index 02425b4..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
+++ /dev/null
@@ -1,221 +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.client.core.data;
-
-import java.util.Collections;
-import java.util.Iterator;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-import org.apache.olingo.commons.api.edm.geo.LineString;
-import org.apache.olingo.commons.api.edm.geo.MultiLineString;
-import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
-import org.apache.olingo.commons.api.edm.geo.Point;
-import org.apache.olingo.commons.api.edm.geo.Polygon;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
-
-class AtomGeoValueSerializer {
-
- private void points(final XMLStreamWriter writer, final Iterator<Point> itor, final boolean wrap)
- throws XMLStreamException {
-
- while (itor.hasNext()) {
- final Point point = itor.next();
-
- if (wrap) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINT, Constants.NS_GML);
- }
-
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POS, Constants.NS_GML);
- try {
- writer.writeCharacters(EdmDouble.getInstance().valueToString(point.getX(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
- + " "
- + EdmDouble.getInstance().valueToString(point.getY(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
- } catch (EdmPrimitiveTypeException e) {
- throw new XMLStreamException("While serializing point coordinates as double", e);
- }
- writer.writeEndElement();
-
- if (wrap) {
- writer.writeEndElement();
- }
- }
- }
-
- private void lineStrings(final XMLStreamWriter writer, final Iterator<LineString> itor, final boolean wrap)
- throws XMLStreamException {
-
- while (itor.hasNext()) {
- final LineString lineString = itor.next();
-
- if (wrap) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRING, Constants.NS_GML);
- }
-
- points(writer, lineString.iterator(), false);
-
- if (wrap) {
- writer.writeEndElement();
- }
- }
- }
-
- private void polygons(final XMLStreamWriter writer, final Iterator<Polygon> itor, final boolean wrap)
- throws XMLStreamException {
-
- while (itor.hasNext()) {
- final Polygon polygon = itor.next();
-
- if (wrap) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON, Constants.NS_GML);
- }
-
- if (!polygon.getExterior().isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_EXTERIOR, Constants.NS_GML);
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_LINEARRING, Constants.NS_GML);
-
- points(writer, polygon.getExterior().iterator(), false);
-
- writer.writeEndElement();
- writer.writeEndElement();
- }
- if (!polygon.getInterior().isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_INTERIOR, Constants.NS_GML);
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_LINEARRING, Constants.NS_GML);
-
- points(writer, polygon.getInterior().iterator(), false);
-
- writer.writeEndElement();
- writer.writeEndElement();
- }
-
- if (wrap) {
- writer.writeEndElement();
- }
- }
- }
-
- private void writeSrsName(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
- if (value.getCrs() != null) {
- writer.writeAttribute(Constants.PREFIX_GML, Constants.NS_GML, Constants.ATTR_SRSNAME,
- Constants.SRS_URLPREFIX + value.getCrs());
- }
- }
-
- public void serialize(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
- switch (value.getEdmPrimitiveTypeKind()) {
- case GeographyPoint:
- case GeometryPoint:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINT, Constants.NS_GML);
- writeSrsName(writer, value);
-
- points(writer, Collections.singleton((Point) value).iterator(), false);
-
- writer.writeEndElement();
- break;
-
- case GeometryMultiPoint:
- case GeographyMultiPoint:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTIPOINT, Constants.NS_GML);
- writeSrsName(writer, value);
-
- if (!((MultiPoint) value).isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINTMEMBERS, Constants.NS_GML);
- points(writer, ((MultiPoint) value).iterator(), true);
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- break;
-
- case GeometryLineString:
- case GeographyLineString:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRING, Constants.NS_GML);
- writeSrsName(writer, value);
-
- lineStrings(writer, Collections.singleton((LineString) value).iterator(), false);
-
- writer.writeEndElement();
- break;
-
- case GeometryMultiLineString:
- case GeographyMultiLineString:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTILINESTRING, Constants.NS_GML);
- writeSrsName(writer, value);
-
- if (!((MultiLineString) value).isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRINGMEMBERS, Constants.NS_GML);
- lineStrings(writer, ((MultiLineString) value).iterator(), true);
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- break;
-
- case GeographyPolygon:
- case GeometryPolygon:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON, Constants.NS_GML);
- writeSrsName(writer, value);
-
- polygons(writer, Collections.singleton(((Polygon) value)).iterator(), false);
-
- writer.writeEndElement();
- break;
-
- case GeographyMultiPolygon:
- case GeometryMultiPolygon:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTIPOLYGON, Constants.NS_GML);
- writeSrsName(writer, value);
-
- if (!((MultiPolygon) value).isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_SURFACEMEMBERS, Constants.NS_GML);
- polygons(writer, ((MultiPolygon) value).iterator(), true);
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- break;
-
- case GeographyCollection:
- case GeometryCollection:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_GEOCOLLECTION, Constants.NS_GML);
- writeSrsName(writer, value);
-
- if (!((GeospatialCollection) value).isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_GEOMEMBERS, Constants.NS_GML);
- for (final Iterator<Geospatial> itor = ((GeospatialCollection) value).iterator(); itor.hasNext();) {
- serialize(writer, itor.next());
- }
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- break;
-
- default:
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
deleted file mode 100644
index 736d791..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
+++ /dev/null
@@ -1,214 +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.client.core.data;
-
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Attribute;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.CollectionValue;
-import org.apache.olingo.client.api.data.ComplexValue;
-import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.commons.api.domain.ODataPropertyType;
-import org.apache.olingo.client.core.edm.EdmTypeInfo;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-class AtomPropertyDeserializer extends AbstractAtomDealer {
-
- private final AtomGeoValueDeserializer geoDeserializer;
-
- public AtomPropertyDeserializer(final ODataServiceVersion version) {
- super(version);
- this.geoDeserializer = new AtomGeoValueDeserializer();
- }
-
- private Value fromPrimitive(final XMLEventReader reader, final StartElement start,
- final EdmTypeInfo typeInfo) throws XMLStreamException {
-
- Value value = null;
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
- final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(
- version, typeInfo.getFullQualifiedName().toString());
- value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
- }
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()
- && (typeInfo == null || !typeInfo.getPrimitiveTypeKind().isGeospatial())) {
-
- value = new PrimitiveValueImpl(event.asCharacters().getData());
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return value;
- }
-
- private ComplexValue fromComplex(final XMLEventReader reader, final StartElement start)
- throws XMLStreamException {
-
- final ComplexValue value = new ComplexValueImpl();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- value.get().add(deserialize(reader, event.asStartElement()));
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return value;
- }
-
- private CollectionValue fromCollection(final XMLEventReader reader, final StartElement start,
- final EdmTypeInfo typeInfo) throws XMLStreamException {
-
- final CollectionValueImpl value = new CollectionValueImpl();
-
- final EdmTypeInfo type = typeInfo == null
- ? null
- : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- switch (guessPropertyType(reader)) {
- case COMPLEX:
- value.get().add(fromComplex(reader, event.asStartElement()));
- break;
-
- case PRIMITIVE:
- value.get().add(fromPrimitive(reader, event.asStartElement(), type));
- break;
-
- default:
- // do not add null or empty values
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return value;
- }
-
- private ODataPropertyType guessPropertyType(final XMLEventReader reader) throws XMLStreamException {
- XMLEvent child = null;
- while (reader.hasNext() && child == null) {
- final XMLEvent event = reader.peek();
- if (event.isCharacters() && event.asCharacters().isWhiteSpace()) {
- reader.nextEvent();
- } else {
- child = event;
- }
- }
-
- ODataPropertyType type = null;
- if (child == null) {
- type = ODataPropertyType.PRIMITIVE;
- } else {
- if (child.isStartElement()) {
- if (Constants.NS_GML.equals(child.asStartElement().getName().getNamespaceURI())) {
- type = ODataPropertyType.PRIMITIVE;
- } else if (elementQName.equals(child.asStartElement().getName())) {
- type = ODataPropertyType.COLLECTION;
- } else {
- type = ODataPropertyType.COMPLEX;
- }
- } else if (child.isCharacters()) {
- type = ODataPropertyType.PRIMITIVE;
- } else {
- type = ODataPropertyType.EMPTY;
- }
- }
-
- return type;
- }
-
- public AtomPropertyImpl deserialize(final XMLEventReader reader, final StartElement start)
- throws XMLStreamException {
-
- final AtomPropertyImpl property = new AtomPropertyImpl();
- property.setName(start.getName().getLocalPart());
-
- final Attribute typeAttr = start.getAttributeByName(this.typeQName);
- if (typeAttr != null) {
- property.setType(typeAttr.getValue());
- }
-
- Value value;
- final Attribute nullAttr = start.getAttributeByName(this.nullQName);
- if (nullAttr == null) {
- final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
- ? null
- : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
-
- final ODataPropertyType propType = typeInfo == null
- ? guessPropertyType(reader)
- : typeInfo.isCollection()
- ? ODataPropertyType.COLLECTION
- : typeInfo.isPrimitiveType()
- ? ODataPropertyType.PRIMITIVE
- : ODataPropertyType.COMPLEX;
-
- switch (propType) {
- case COLLECTION:
- value = fromCollection(reader, start, typeInfo);
- break;
-
- case COMPLEX:
- value = fromComplex(reader, start);
- break;
-
- case PRIMITIVE:
- value = fromPrimitive(reader, start, typeInfo);
- break;
-
- case EMPTY:
- default:
- value = new PrimitiveValueImpl(StringUtils.EMPTY);
- }
- } else {
- value = new NullValueImpl();
- }
- property.setValue(value);
-
- return property;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyImpl.java
deleted file mode 100644
index c2a94fb..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyImpl.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.client.core.data;
-
-public class AtomPropertyImpl extends AbstractPropertyImpl {
-
- private static final long serialVersionUID = 48748492242474814L;
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertySerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertySerializer.java
deleted file mode 100644
index b1ef2e6..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertySerializer.java
+++ /dev/null
@@ -1,88 +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.client.core.data;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.CollectionValue;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-class AtomPropertySerializer extends AbstractAtomDealer {
-
- private final AtomGeoValueSerializer geoSerializer;
-
- public AtomPropertySerializer(final ODataServiceVersion version) {
- super(version);
- this.geoSerializer = new AtomGeoValueSerializer();
- }
-
- private void collection(final XMLStreamWriter writer, final CollectionValue value) throws XMLStreamException {
- for (Value item : value.get()) {
- writer.writeStartElement(Constants.PREFIX_DATASERVICES, Constants.ELEM_ELEMENT,
- version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
- value(writer, item);
- writer.writeEndElement();
- }
- }
-
- private void value(final XMLStreamWriter writer, final Value value) throws XMLStreamException {
- if (value.isSimple()) {
- writer.writeCharacters(value.asSimple().get());
- } else if (value.isGeospatial()) {
- this.geoSerializer.serialize(writer, value.asGeospatial().get());
- } else if (value.isCollection()) {
- collection(writer, value.asCollection());
- } else if (value.isComplex()) {
- for (Property property : value.asComplex().get()) {
- property(writer, property, false);
- }
- }
- }
-
- public void property(final XMLStreamWriter writer, final Property property, final boolean standalone)
- throws XMLStreamException {
-
- writer.writeStartElement(Constants.PREFIX_DATASERVICES, property.getName(),
- version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
- if (standalone) {
- namespaces(writer);
- }
- if (StringUtils.isNotBlank(property.getType())) {
- writer.writeAttribute(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
- Constants.ATTR_TYPE, property.getType());
- }
-
- if (property.getValue().isNull()) {
- writer.writeAttribute(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
- Constants.ATTR_NULL, Boolean.TRUE.toString());
- } else {
- value(writer, property.getValue());
- }
-
- writer.writeEndElement();
- }
-
- public void property(final XMLStreamWriter writer, final Property property) throws XMLStreamException {
- property(writer, property, true);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomSerializer.java
deleted file mode 100644
index 8337a72..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomSerializer.java
+++ /dev/null
@@ -1,264 +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.client.core.data;
-
-import java.io.Writer;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.XMLConstants;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.http.entity.ContentType;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-public class AtomSerializer extends AbstractAtomDealer {
-
- private static final XMLOutputFactory FACTORY = XMLOutputFactory.newInstance();
-
- private final AtomPropertySerializer propSerializer;
-
- public AtomSerializer(final ODataServiceVersion version) {
- super(version);
- this.propSerializer = new AtomPropertySerializer(version);
- }
-
- private void startDocument(final XMLStreamWriter writer, final String rootElement) throws XMLStreamException {
- writer.writeStartDocument();
- writer.setDefaultNamespace(Constants.NS_ATOM);
-
- writer.writeStartElement(rootElement);
-
- namespaces(writer);
- }
-
- private void property(final Writer outWriter, final Property property) throws XMLStreamException {
- final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
-
- writer.writeStartDocument();
-
- propSerializer.property(writer, property);
-
- writer.writeEndDocument();
- writer.flush();
- }
-
- private void links(final XMLStreamWriter writer, final List<Link> links) throws XMLStreamException {
- for (Link link : links) {
- writer.writeStartElement(Constants.ATOM_ELEM_LINK);
-
- if (StringUtils.isNotBlank(link.getRel())) {
- writer.writeAttribute(Constants.ATTR_REL, link.getRel());
- }
- if (StringUtils.isNotBlank(link.getTitle())) {
- writer.writeAttribute(Constants.ATTR_TITLE, link.getTitle());
- }
- if (StringUtils.isNotBlank(link.getHref())) {
- writer.writeAttribute(Constants.ATTR_HREF, link.getHref());
- }
- if (StringUtils.isNotBlank(link.getType())) {
- writer.writeAttribute(Constants.ATTR_TYPE, link.getType());
- }
-
- if (link.getInlineEntry() != null || link.getInlineFeed() != null) {
- writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ATOM_ELEM_INLINE,
- version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
-
- if (link.getInlineEntry() != null) {
- writer.writeStartElement(Constants.ATOM_ELEM_ENTRY);
- entry(writer, link.getInlineEntry());
- writer.writeEndElement();
- }
- if (link.getInlineFeed() != null) {
- writer.writeStartElement(Constants.ATOM_ELEM_FEED);
- feed(writer, link.getInlineFeed());
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- }
- }
-
- private void common(final XMLStreamWriter writer, final AbstractAtomObject object) throws XMLStreamException {
- if (StringUtils.isNotBlank(object.getTitle())) {
- writer.writeStartElement(Constants.ATOM_ELEM_TITLE);
- writer.writeAttribute(Constants.ATTR_TYPE, TYPE_TEXT);
- writer.writeCharacters(object.getTitle());
- writer.writeEndElement();
- }
-
- if (StringUtils.isNotBlank(object.getSummary())) {
- writer.writeStartElement(Constants.ATOM_ELEM_SUMMARY);
- writer.writeAttribute(Constants.ATTR_TYPE, "text");
- writer.writeCharacters(object.getSummary());
- writer.writeEndElement();
- }
- }
-
- private void properties(final XMLStreamWriter writer, final List<Property> properties) throws XMLStreamException {
- for (Property property : properties) {
- propSerializer.property(writer, property, false);
- }
- }
-
- private void entry(final XMLStreamWriter writer, final Entry entry) throws XMLStreamException {
- if (entry.getBaseURI() != null) {
- writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, entry.getBaseURI().toASCIIString());
- }
-
- if (StringUtils.isNotBlank(entry.getId())) {
- writer.writeStartElement(Constants.ATOM_ELEM_ID);
- writer.writeCharacters(entry.getId());
- writer.writeEndElement();
- }
-
- writer.writeStartElement(Constants.ATOM_ELEM_CATEGORY);
- writer.writeAttribute(Constants.ATOM_ATTR_SCHEME, version.getNamespaceMap().get(ODataServiceVersion.NS_SCHEME));
- writer.writeAttribute(Constants.ATOM_ATTR_TERM, entry.getType());
- writer.writeEndElement();
-
- if (entry instanceof AbstractAtomObject) {
- common(writer, (AbstractAtomObject) entry);
- }
-
- links(writer, entry.getAssociationLinks());
- links(writer, entry.getNavigationLinks());
- links(writer, entry.getMediaEditLinks());
-
- writer.writeStartElement(Constants.ATOM_ELEM_CONTENT);
- if (entry.isMediaEntry()) {
- if (StringUtils.isNotBlank(entry.getMediaContentType())) {
- writer.writeAttribute(Constants.ATTR_TYPE, entry.getMediaContentType());
- }
- if (StringUtils.isNotBlank(entry.getMediaContentSource())) {
- writer.writeAttribute(Constants.ATOM_ATTR_SRC, entry.getMediaContentSource());
- }
- writer.writeEndElement();
-
- writer.writeStartElement(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.PROPERTIES);
- properties(writer, entry.getProperties());
- } else {
- writer.writeAttribute(Constants.ATTR_TYPE, ContentType.APPLICATION_XML.getMimeType());
- writer.writeStartElement(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.PROPERTIES);
- properties(writer, entry.getProperties());
- writer.writeEndElement();
- }
- writer.writeEndElement();
- }
-
- private void entry(final Writer outWriter, final Entry entry) throws XMLStreamException {
- final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
-
- startDocument(writer, Constants.ATOM_ELEM_ENTRY);
-
- entry(writer, entry);
-
- writer.writeEndElement();
- writer.writeEndDocument();
- writer.flush();
- }
-
- private void feed(final XMLStreamWriter writer, final Feed feed) throws XMLStreamException {
- if (feed.getBaseURI() != null) {
- writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, feed.getBaseURI().toASCIIString());
- }
-
- if (feed.getCount() != null) {
- writer.writeStartElement(
- version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_COUNT);
- writer.writeCharacters(Integer.toString(feed.getCount()));
- writer.writeEndElement();
- }
-
- if (StringUtils.isNotBlank(feed.getId())) {
- writer.writeStartElement(Constants.ATOM_ELEM_ID);
- writer.writeCharacters(feed.getId());
- writer.writeEndElement();
- }
-
- if (feed instanceof AbstractAtomObject) {
- common(writer, (AbstractAtomObject) feed);
- }
-
- for (Entry entry : feed.getEntries()) {
- writer.writeStartElement(Constants.ATOM_ELEM_ENTRY);
- entry(writer, entry);
- writer.writeEndElement();
- }
-
- if (feed.getNext() != null) {
- final LinkImpl next = new LinkImpl();
- next.setRel(Constants.NEXT_LINK_REL);
- next.setHref(feed.getNext().toASCIIString());
-
- links(writer, Collections.<Link>singletonList(next));
- }
- }
-
- private void feed(final Writer outWriter, final Feed feed) throws XMLStreamException {
- final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
-
- startDocument(writer, Constants.ATOM_ELEM_FEED);
-
- feed(writer, feed);
-
- writer.writeEndElement();
- writer.writeEndDocument();
- writer.flush();
- }
-
- private void link(final Writer outWriter, final Link link) throws XMLStreamException {
- final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
-
- writer.writeStartDocument();
-
- writer.writeStartElement(Constants.ELEM_LINKS);
- writer.writeDefaultNamespace(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
-
- writer.writeStartElement(Constants.ELEM_URI);
- writer.writeCharacters(link.getHref());
- writer.writeEndElement();
-
- writer.writeEndElement();
-
- writer.writeEndDocument();
- writer.flush();
- }
-
- public <T> void write(final Writer writer, final T obj) throws XMLStreamException {
- if (obj instanceof Feed) {
- feed(writer, (Feed) obj);
- } else if (obj instanceof Entry) {
- entry(writer, (Entry) obj);
- } else if (obj instanceof Property) {
- property(writer, (Property) obj);
- } else if (obj instanceof Link) {
- link(writer, (Link) obj);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/CollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/CollectionValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/CollectionValueImpl.java
deleted file mode 100644
index fa2e23c..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/CollectionValueImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.client.api.data.CollectionValue;
-import org.apache.olingo.client.api.data.Value;
-
-public class CollectionValueImpl extends AbstractValue implements CollectionValue {
-
- private final List<Value> value = new ArrayList<Value>();
-
- @Override
- public boolean isCollection() {
- return true;
- }
-
- @Override
- public List<Value> get() {
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ComplexValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ComplexValueImpl.java
deleted file mode 100644
index 9f4f5ab..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ComplexValueImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.client.api.data.ComplexValue;
-import org.apache.olingo.client.api.data.Property;
-
-public class ComplexValueImpl extends AbstractValue implements ComplexValue {
-
- private final List<Property> value = new ArrayList<Property>();
-
- @Override
- public boolean isComplex() {
- return true;
- }
-
- @Override
- public List<Property> get() {
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
deleted file mode 100644
index fdb0f44..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
+++ /dev/null
@@ -1,42 +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.client.core.data;
-
-import org.apache.olingo.client.api.data.GeospatialValue;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-
-public class GeospatialValueImpl extends AbstractValue implements GeospatialValue {
-
- private final Geospatial value;
-
- public GeospatialValueImpl(final Geospatial value) {
- this.value = value;
- }
-
- @Override
- public boolean isGeospatial() {
- return true;
- }
-
- @Override
- public Geospatial get() {
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryDeserializer.java
deleted file mode 100644
index 2626a95..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryDeserializer.java
+++ /dev/null
@@ -1,244 +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.client.core.data;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.io.IOException;
-import java.net.URI;
-import java.text.ParseException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataOperation;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-/**
- * Reads JSON string into an entry.
- * <br/>
- * If metadata information is available, the corresponding entry fields and content will be populated.
- */
-public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImpl> {
-
- private String getTitle(final Map.Entry<String, JsonNode> entry) {
- return entry.getKey().substring(0, entry.getKey().indexOf('@'));
- }
-
- private String setInline(final String name, final String suffix, final ObjectNode tree,
- final ObjectCodec codec, final LinkImpl link) throws IOException {
-
- final String entryNamePrefix = name.substring(0, name.indexOf(suffix));
- if (tree.has(entryNamePrefix)) {
- final JsonNode inline = tree.path(entryNamePrefix);
-
- if (inline instanceof ObjectNode) {
- link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
- link.setInlineEntry(inline.traverse(codec).readValuesAs(JSONEntryImpl.class).next());
- }
-
- if (inline instanceof ArrayNode) {
- link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
-
- final JSONFeedImpl feed = new JSONFeedImpl();
- final Iterator<JsonNode> entries = ((ArrayNode) inline).elements();
- while (entries.hasNext()) {
- feed.getEntries().add(entries.next().traverse(codec).readValuesAs(JSONEntryImpl.class).next());
- }
-
- link.setInlineFeed(feed);
- }
- }
- return entryNamePrefix;
- }
-
- @Override
- protected JSONEntryImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
-
- if (tree.has(Constants.JSON_VALUE) && tree.get(Constants.JSON_VALUE).isArray()) {
- throw new JsonParseException("Expected OData Entity, found EntitySet", parser.getCurrentLocation());
- }
-
- final JSONEntryImpl entry = new JSONEntryImpl();
-
- if (tree.hasNonNull(Constants.JSON_METADATA)) {
- entry.setMetadata(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
- tree.remove(Constants.JSON_METADATA);
- }
-
- if (tree.hasNonNull(Constants.JSON_MEDIA_ETAG)) {
- entry.setMediaETag(tree.get(Constants.JSON_MEDIA_ETAG).textValue());
- tree.remove(Constants.JSON_MEDIA_ETAG);
- }
-
- if (tree.hasNonNull(Constants.JSON_ETAG)) {
- entry.setETag(tree.get(Constants.JSON_ETAG).textValue());
- tree.remove(Constants.JSON_ETAG);
- }
-
- if (tree.hasNonNull(Constants.JSON_TYPE)) {
- entry.setType(tree.get(Constants.JSON_TYPE).textValue());
- tree.remove(Constants.JSON_TYPE);
- }
-
- if (tree.hasNonNull(Constants.JSON_ID)) {
- try {
- entry.setId(tree.get(Constants.JSON_ID).textValue());
- } catch (ParseException e) {
- throw new JsonMappingException("While parsing Atom entry or feed common elements", e);
- }
- tree.remove(Constants.JSON_ID);
- }
-
- if (tree.hasNonNull(Constants.JSON_READ_LINK)) {
- final LinkImpl link = new LinkImpl();
- link.setRel(Constants.SELF_LINK_REL);
- link.setHref(tree.get(Constants.JSON_READ_LINK).textValue());
- entry.setSelfLink(link);
-
- tree.remove(Constants.JSON_READ_LINK);
- }
-
- if (tree.hasNonNull(Constants.JSON_EDIT_LINK)) {
- final LinkImpl link = new LinkImpl();
- link.setRel(Constants.EDIT_LINK_REL);
- link.setHref(tree.get(Constants.JSON_EDIT_LINK).textValue());
- entry.setEditLink(link);
-
- tree.remove(Constants.JSON_EDIT_LINK);
- }
-
- if (tree.hasNonNull(Constants.JSON_MEDIAREAD_LINK)) {
- entry.setMediaContentSource(tree.get(Constants.JSON_MEDIAREAD_LINK).textValue());
- tree.remove(Constants.JSON_MEDIAREAD_LINK);
- }
- if (tree.hasNonNull(Constants.JSON_MEDIAEDIT_LINK)) {
- tree.remove(Constants.JSON_MEDIAEDIT_LINK);
- }
- if (tree.hasNonNull(Constants.JSON_MEDIA_CONTENT_TYPE)) {
- entry.setMediaContentType(tree.get(Constants.JSON_MEDIA_CONTENT_TYPE).textValue());
- tree.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
- }
-
- final Set<String> toRemove = new HashSet<String>();
- for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
- final Map.Entry<String, JsonNode> field = itor.next();
-
- if (field.getKey().endsWith(Constants.JSON_NAVIGATION_LINK_SUFFIX)) {
- final LinkImpl link = new LinkImpl();
- link.setTitle(getTitle(field));
- link.setRel(client.getServiceVersion().getNamespaceMap().
- get(ODataServiceVersion.NAVIGATION_LINK_REL) + getTitle(field));
-
- if (field.getValue().isValueNode()) {
- link.setHref(field.getValue().textValue());
- link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
- }
- // NOTE: this should be expected to happen, but it isn't - at least up to OData 4.0
- /* if (field.getValue().isArray()) {
- * link.setHref(field.getValue().asText());
- * link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
- * } */
-
- entry.getNavigationLinks().add(link);
-
- toRemove.add(field.getKey());
- toRemove.add(setInline(field.getKey(), Constants.JSON_NAVIGATION_LINK_SUFFIX, tree, parser.getCodec(), link));
- } else if (field.getKey().endsWith(Constants.JSON_ASSOCIATION_LINK_SUFFIX)) {
- final LinkImpl link = new LinkImpl();
- link.setTitle(getTitle(field));
- link.setRel(client.getServiceVersion().getNamespaceMap().
- get(ODataServiceVersion.ASSOCIATION_LINK_REL) + getTitle(field));
- link.setHref(field.getValue().textValue());
- link.setType(ODataLinkType.ASSOCIATION.toString());
- entry.getAssociationLinks().add(link);
-
- toRemove.add(field.getKey());
- } else if (field.getKey().endsWith(Constants.JSON_MEDIAEDIT_LINK_SUFFIX)) {
- final LinkImpl link = new LinkImpl();
- link.setTitle(getTitle(field));
- link.setRel(client.getServiceVersion().getNamespaceMap().
- get(ODataServiceVersion.MEDIA_EDIT_LINK_REL) + getTitle(field));
- link.setHref(field.getValue().textValue());
- link.setType(ODataLinkType.MEDIA_EDIT.toString());
- entry.getMediaEditLinks().add(link);
-
- if (tree.has(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX)) {
- link.setMediaETag(tree.get(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX).asText());
- toRemove.add(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX);
- }
-
- toRemove.add(field.getKey());
- toRemove.add(setInline(field.getKey(), Constants.JSON_MEDIAEDIT_LINK_SUFFIX, tree, parser.getCodec(), link));
- } else if (field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE)) {
- final String linkTitle = getTitle(field);
- for (Link link : entry.getMediaEditLinks()) {
- if (linkTitle.equals(link.getTitle())) {
- ((LinkImpl) link).setType(field.getValue().asText());
- }
- }
- toRemove.add(field.getKey());
- } else if (field.getKey().charAt(0) == '#') {
- final ODataOperation operation = new ODataOperation();
- operation.setMetadataAnchor(field.getKey());
-
- final ObjectNode opNode = (ObjectNode) tree.get(field.getKey());
- operation.setTitle(opNode.get(Constants.ATTR_TITLE).asText());
- operation.setTarget(URI.create(opNode.get(Constants.ATTR_TARGET).asText()));
-
- entry.getOperations().add(operation);
-
- toRemove.add(field.getKey());
- }
- }
- tree.remove(toRemove);
-
- String type = null;
- for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
- final Map.Entry<String, JsonNode> field = itor.next();
-
- if (type == null && field.getKey().endsWith(Constants.JSON_TYPE_SUFFIX)) {
- type = field.getValue().asText();
- } else {
- final JSONPropertyImpl property = new JSONPropertyImpl();
- property.setName(field.getKey());
- property.setType(type);
- type = null;
-
- value(property, field.getValue());
- entry.getProperties().add(property);
- }
- }
-
- return entry;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryImpl.java
deleted file mode 100644
index cafe289..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntryImpl.java
+++ /dev/null
@@ -1,92 +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.client.core.data;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import java.net.URI;
-import java.text.ParseException;
-import org.apache.olingo.client.api.uri.SegmentType;
-
-/**
- * A single entry, represented via JSON.
- */
-@JsonSerialize(using = JSONEntrySerializer.class)
-@JsonDeserialize(using = JSONEntryDeserializer.class)
-public class JSONEntryImpl extends AbstractEntry {
-
- private static final long serialVersionUID = -5275365545400797758L;
-
- private URI metadata;
-
- private String mediaETag;
-
- public void setId(final String id) throws ParseException {
- this.setCommonProperty("id", id);
- }
-
- @Override
- public URI getBaseURI() {
- URI baseURI = null;
- if (metadata != null) {
- final String metadataURI = getMetadata().toASCIIString();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(SegmentType.METADATA.getValue())));
- }
-
- return baseURI;
- }
-
- /**
- * Gets the metadata URI.
- *
- * @return the metadata URI
- */
- public URI getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the metadata URI.
- *
- * @param metadata metadata URI.
- */
- public void setMetadata(final URI metadata) {
- this.metadata = metadata;
- }
-
- /**
- * The odata.mediaEtag annotation MAY be included; its value MUST be the ETag of the binary stream represented by this
- * media entity or named stream property.
- *
- * @return odata.mediaEtag annotation value.
- */
- public String getMediaETag() {
- return mediaETag;
- }
-
- /**
- * The odata.mediaEtag annotation MAY be included; its value MUST be the ETag of the binary stream represented by this
- * media entity or named stream property.
- *
- * @param eTag odata.mediaEtag annotation value.
- */
- public void setMediaETag(final String eTag) {
- this.mediaETag = eTag;
- }
-}
[05/52] [abbrv] Consistently using package name to differentiate V3
and V4
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
index 67e240c..1fb98da 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.communication.request.retrieve;
import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataServiceDocument;
@@ -39,7 +39,7 @@ public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveReques
* @param odataClient client instance getting this request
* @param uri request URI.
*/
- ODataServiceDocumentRequestImpl(final ODataClient odataClient, final URI uri) {
+ ODataServiceDocumentRequestImpl(final CommonODataClient odataClient, final URI uri) {
super(odataClient, ODataFormat.class, uri);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
index db48449..964ec42 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
@@ -23,7 +23,7 @@ import java.net.URI;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
@@ -44,7 +44,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataVal
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataValueRequestImpl(final ODataClient odataClient, final URI query) {
+ ODataValueRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataValueFormat.class, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V3RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V3RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V3RetrieveRequestFactoryImpl.java
deleted file mode 100644
index 4f91b61..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V3RetrieveRequestFactoryImpl.java
+++ /dev/null
@@ -1,39 +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.client.core.communication.request.retrieve;
-
-import java.net.URI;
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataLinkCollectionRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.V3RetrieveRequestFactory;
-
-public class V3RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
- implements V3RetrieveRequestFactory {
-
- private static final long serialVersionUID = 6602745001042802479L;
-
- public V3RetrieveRequestFactoryImpl(final ODataV3Client client) {
- super(client);
- }
-
- @Override
- public ODataLinkCollectionRequest getLinkCollectionRequest(final URI targetURI, final String linkName) {
- return new ODataLinkCollectionRequestImpl((ODataV3Client) client, targetURI, linkName);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V4RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V4RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V4RetrieveRequestFactoryImpl.java
deleted file mode 100644
index 5bb58a8..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/V4RetrieveRequestFactoryImpl.java
+++ /dev/null
@@ -1,32 +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.client.core.communication.request.retrieve;
-
-import org.apache.olingo.client.api.ODataV4Client;
-import org.apache.olingo.client.api.communication.request.retrieve.V4RetrieveRequestFactory;
-
-public class V4RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
- implements V4RetrieveRequestFactory {
-
- private static final long serialVersionUID = 546577958047902917L;
-
- public V4RetrieveRequestFactoryImpl(final ODataV4Client client) {
- super(client);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java
new file mode 100644
index 0000000..0cdd38a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.communication.request.retrieve.v3;
+
+import java.io.IOException;
+import java.net.URI;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkCollectionRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.client.core.communication.request.retrieve.AbstractODataRetrieveRequest;
+
+/**
+ * This class implements an OData link query request.
+ */
+public class ODataLinkCollectionRequestImpl extends AbstractODataRetrieveRequest<ODataLinkCollection, ODataFormat>
+ implements ODataLinkCollectionRequest {
+
+ /**
+ * Private constructor.
+ *
+ * @param odataClient client instance getting this request
+ * @param targetURI target URI.
+ * @param linkName link name.
+ */
+ ODataLinkCollectionRequestImpl(final ODataClient odataClient, final URI targetURI, final String linkName) {
+ super(odataClient, ODataFormat.class,
+ odataClient.getURIBuilder(targetURI.toASCIIString()).appendLinksSegment(linkName).build());
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public ODataRetrieveResponse<ODataLinkCollection> execute() {
+ return new ODataLinkCollectionResponseImpl(httpClient, doExecute());
+ }
+
+ protected class ODataLinkCollectionResponseImpl extends ODataRetrieveResponseImpl {
+
+ private ODataLinkCollection links = null;
+
+ /**
+ * Constructor.
+ * <p>
+ * Just to create response templates to be initialized from batch.
+ */
+ private ODataLinkCollectionResponseImpl() {
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param client HTTP client.
+ * @param res HTTP response.
+ */
+ private ODataLinkCollectionResponseImpl(final HttpClient client, final HttpResponse res) {
+ super(client, res);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public ODataLinkCollection getBody() {
+ if (links == null) {
+ try {
+ links = ((ODataClient) odataClient).getReader().readLinks(
+ res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
+ } catch (IOException e) {
+ throw new HttpClientException(e);
+ } finally {
+ this.close();
+ }
+ }
+ return links;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
new file mode 100644
index 0000000..3e07579
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.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.client.core.communication.request.retrieve.v3;
+
+import org.apache.olingo.client.core.communication.request.retrieve.v3.ODataLinkCollectionRequestImpl;
+import java.net.URI;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkCollectionRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
+import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
+
+public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
+ implements RetrieveRequestFactory {
+
+ private static final long serialVersionUID = 6602745001042802479L;
+
+ public RetrieveRequestFactoryImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public ODataLinkCollectionRequest getLinkCollectionRequest(final URI targetURI, final String linkName) {
+ return new ODataLinkCollectionRequestImpl((ODataClient) client, targetURI, linkName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
new file mode 100644
index 0000000..016320f
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.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.client.core.communication.request.retrieve.v4;
+
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRequestFactory;
+import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
+
+public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
+ implements RetrieveRequestFactory {
+
+ private static final long serialVersionUID = 546577958047902917L;
+
+ public RetrieveRequestFactoryImpl(final ODataClient client) {
+ super(client);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
index 02445ae..d19d0d5 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core.communication.request.streamed;
import java.net.URI;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataStreamedEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataResponse;
@@ -45,7 +45,7 @@ public abstract class AbstractODataStreamedEntityRequest<V extends ODataResponse
* @param method HTTP request method.
* @param uri request URI.
*/
- public AbstractODataStreamedEntityRequest(final ODataClient odataClient, final HttpMethod method,
+ public AbstractODataStreamedEntityRequest(final CommonODataClient odataClient, final HttpMethod method,
URI uri) {
super(odataClient, method, uri);
setAccept(getFormat().toString());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
index 7929398..3726e60 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
@@ -28,7 +28,7 @@ import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.entity.ContentType;
import org.apache.olingo.client.api.ODataBatchConstants;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
import org.apache.olingo.client.api.communication.request.ODataStreamer;
@@ -37,7 +37,7 @@ import org.apache.olingo.client.api.communication.response.ODataResponse;
import org.apache.olingo.client.api.format.ODataMediaFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.utils.URIUtils;
-import org.apache.olingo.client.core.Wrapper;
+import org.apache.olingo.client.core.communication.request.Wrapper;
import org.apache.olingo.client.core.communication.request.ODataRequestImpl;
import org.apache.commons.io.IOUtils;
@@ -68,7 +68,7 @@ public abstract class AbstractODataStreamedRequest<V extends ODataResponse, T ex
* @param method OData request HTTP method.
* @param uri OData request URI.
*/
- public AbstractODataStreamedRequest(final ODataClient odataClient,
+ public AbstractODataStreamedRequest(final CommonODataClient odataClient,
final HttpMethod method, final URI uri) {
super(odataClient, ODataMediaFormat.class, method, uri);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractStreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractStreamedRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractStreamedRequestFactory.java
index b90db57..014e1bc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractStreamedRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractStreamedRequestFactory.java
@@ -20,20 +20,20 @@ package org.apache.olingo.client.core.communication.request.streamed;
import java.io.InputStream;
import java.net.URI;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest;
-import org.apache.olingo.client.api.communication.request.streamed.StreamedRequestFactory;
+import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
import org.apache.olingo.client.api.http.HttpMethod;
-public abstract class AbstractStreamedRequestFactory implements StreamedRequestFactory {
+public abstract class AbstractStreamedRequestFactory implements CommonStreamedRequestFactory {
private static final long serialVersionUID = -2438839640443961168L;
- protected final ODataClient client;
+ protected final CommonODataClient client;
- protected AbstractStreamedRequestFactory(final ODataClient client) {
+ protected AbstractStreamedRequestFactory(final CommonODataClient client) {
this.client = client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
index b99e4f9..b69a35a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
@@ -23,7 +23,7 @@ import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityCreateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
@@ -49,7 +49,7 @@ public class ODataMediaEntityCreateRequestImpl
* @param targetURI target entity set.
* @param media media entity blob to be created.
*/
- ODataMediaEntityCreateRequestImpl(final ODataClient odataClient, final URI targetURI, final InputStream media) {
+ ODataMediaEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI, final InputStream media) {
super(odataClient, HttpMethod.POST, targetURI);
this.media = media;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
index 4da4896..f6dc09b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
@@ -23,7 +23,7 @@ import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityUpdateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
@@ -50,7 +50,7 @@ public class ODataMediaEntityUpdateRequestImpl
* @param editURI edit URI of the entity to be updated.
* @param media media entity blob to be created.
*/
- ODataMediaEntityUpdateRequestImpl(final ODataClient odataClient,
+ ODataMediaEntityUpdateRequestImpl(final CommonODataClient odataClient,
final HttpMethod method, final URI editURI, final InputStream media) {
super(odataClient, method, editURI);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java
index 0481557..aa27b2e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataStreamUpdateRequestImpl.java
@@ -23,7 +23,7 @@ import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest;
import org.apache.olingo.client.api.communication.request.streamed.StreamUpdateStreamManager;
@@ -49,7 +49,7 @@ public class ODataStreamUpdateRequestImpl
* @param targetURI target URI.
* @param stream stream to be updated.
*/
- ODataStreamUpdateRequestImpl(final ODataClient odataClient,
+ ODataStreamUpdateRequestImpl(final CommonODataClient odataClient,
final HttpMethod method, final URI targetURI, final InputStream stream) {
super(odataClient, method, targetURI);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/V3StreamedRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/V3StreamedRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/V3StreamedRequestFactoryImpl.java
deleted file mode 100644
index aea4fdb..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/V3StreamedRequestFactoryImpl.java
+++ /dev/null
@@ -1,32 +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.client.core.communication.request.streamed;
-
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.api.communication.request.streamed.V3StreamedRequestFactory;
-
-public class V3StreamedRequestFactoryImpl extends AbstractStreamedRequestFactory
- implements V3StreamedRequestFactory {
-
- private static final long serialVersionUID = 2255688283995758441L;
-
- public V3StreamedRequestFactoryImpl(final ODataV3Client client) {
- super(client);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/V4StreamedRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/V4StreamedRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/V4StreamedRequestFactoryImpl.java
deleted file mode 100644
index 4c59364..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/V4StreamedRequestFactoryImpl.java
+++ /dev/null
@@ -1,32 +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.client.core.communication.request.streamed;
-
-import org.apache.olingo.client.api.ODataV4Client;
-import org.apache.olingo.client.api.communication.request.streamed.V4StreamedRequestFactory;
-
-public class V4StreamedRequestFactoryImpl extends AbstractStreamedRequestFactory
- implements V4StreamedRequestFactory {
-
- private static final long serialVersionUID = 960862845654673053L;
-
- public V4StreamedRequestFactoryImpl(final ODataV4Client client) {
- super(client);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/v3/StreamedRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/v3/StreamedRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/v3/StreamedRequestFactoryImpl.java
new file mode 100644
index 0000000..77446ce
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/v3/StreamedRequestFactoryImpl.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.client.core.communication.request.streamed.v3;
+
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory;
+import org.apache.olingo.client.core.communication.request.streamed.AbstractStreamedRequestFactory;
+
+public class StreamedRequestFactoryImpl extends AbstractStreamedRequestFactory
+ implements StreamedRequestFactory {
+
+ private static final long serialVersionUID = 2255688283995758441L;
+
+ public StreamedRequestFactoryImpl(final ODataClient client) {
+ super(client);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/v4/StreamedRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/v4/StreamedRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/v4/StreamedRequestFactoryImpl.java
new file mode 100644
index 0000000..608c0ef
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/v4/StreamedRequestFactoryImpl.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.client.core.communication.request.streamed.v4;
+
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.api.communication.request.streamed.v4.StreamedRequestFactory;
+import org.apache.olingo.client.core.communication.request.streamed.AbstractStreamedRequestFactory;
+
+public class StreamedRequestFactoryImpl extends AbstractStreamedRequestFactory
+ implements StreamedRequestFactory {
+
+ private static final long serialVersionUID = 960862845654673053L;
+
+ public StreamedRequestFactoryImpl(final ODataClient client) {
+ super(client);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
index 86289f3..8893b91 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomDeserializer.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.data;
+import org.apache.olingo.client.core.data.v3.XMLLinkCollectionImpl;
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONLinkCollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONLinkCollectionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONLinkCollectionImpl.java
deleted file mode 100644
index ea99940..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONLinkCollectionImpl.java
+++ /dev/null
@@ -1,117 +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.client.core.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.client.api.data.LinkCollection;
-
-/**
- * Link from an entry, represented via JSON.
- */
-public class JSONLinkCollectionImpl extends AbstractPayloadObject implements LinkCollection {
-
- private static final long serialVersionUID = -5006368367235783907L;
-
- /**
- * JSON link URL representation.
- */
- static class JSONLinkURL extends AbstractPayloadObject {
-
- private static final long serialVersionUID = 5365055617973271468L;
-
- private URI url;
-
- public URI getUrl() {
- return url;
- }
-
- public void setUrl(final URI url) {
- this.url = url;
- }
- }
-
- @JsonProperty(value = "odata.metadata", required = false)
- private URI metadata;
-
- @JsonProperty(required = false)
- private URI url;
-
- @JsonProperty(value = "value", required = false)
- private final List<JSONLinkURL> links = new ArrayList<JSONLinkURL>();
-
- @JsonProperty(value = "odata.nextLink", required = false)
- private String next;
-
- /**
- * Gets the metadata URI.
- */
- public URI getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the metadata URI.
- *
- * @param metadata metadata URI.
- */
- public void setMetadata(final URI metadata) {
- this.metadata = metadata;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public List<URI> getLinks() {
- final List<URI> result = new ArrayList<URI>();
-
- if (this.url == null) {
- for (JSONLinkURL link : links) {
- result.add(link.getUrl());
- }
- } else {
- result.add(this.url);
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public void setNext(final URI next) {
- this.next = next == null ? null : next.toASCIIString();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public URI getNext() {
- return next == null ? null : URI.create(next);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
index 7ed323e..49c85fb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
@@ -25,11 +25,11 @@ import com.fasterxml.jackson.databind.JsonDeserializer;
import java.io.IOException;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
- protected ODataClient client;
+ protected CommonODataClient client;
protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException;
@@ -38,7 +38,7 @@ abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
public T deserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- client = (ODataClient) ctxt.findInjectableValue(ODataClient.class.getName(), null, null);
+ client = (CommonODataClient) ctxt.findInjectableValue(CommonODataClient.class.getName(), null, null);
return doDeserialize(jp, ctxt);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
index 7802116..4638c18 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
@@ -25,11 +25,11 @@ import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
abstract class ODataJacksonSerializer<T> extends JsonSerializer<T> {
- protected ODataClient client;
+ protected CommonODataClient client;
protected abstract void doSerialize(T value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException;
@@ -38,7 +38,7 @@ abstract class ODataJacksonSerializer<T> extends JsonSerializer<T> {
public void serialize(final T value, final JsonGenerator jgen, final SerializerProvider provider)
throws IOException, JsonProcessingException {
- client = (ODataClient) provider.getAttribute(ODataClient.class);
+ client = (CommonODataClient) provider.getAttribute(CommonODataClient.class);
doSerialize(value, jgen, provider);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLLinkCollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLLinkCollectionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLLinkCollectionImpl.java
deleted file mode 100644
index 05977ea..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLLinkCollectionImpl.java
+++ /dev/null
@@ -1,70 +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.client.core.data;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.client.api.data.LinkCollection;
-
-public class XMLLinkCollectionImpl implements LinkCollection {
-
- private final List<URI> links = new ArrayList<URI>();
-
- private URI next;
-
- /**
- * Constructor.
- */
- public XMLLinkCollectionImpl() {
- }
-
- /**
- * Constructor.
- *
- * @param next next page link.
- */
- public XMLLinkCollectionImpl(final URI next) {
- this.next = next;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public List<URI> getLinks() {
- return links;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public void setNext(final URI next) {
- this.next = next;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public URI getNext() {
- return next;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java
new file mode 100644
index 0000000..00b8361
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.data.v3;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.client.api.data.v3.LinkCollection;
+import org.apache.olingo.client.core.data.AbstractPayloadObject;
+
+/**
+ * Link from an entry, represented via JSON.
+ */
+public class JSONLinkCollectionImpl extends AbstractPayloadObject implements LinkCollection {
+
+ private static final long serialVersionUID = -5006368367235783907L;
+
+ /**
+ * JSON link URL representation.
+ */
+ static class JSONLinkURL extends AbstractPayloadObject {
+
+ private static final long serialVersionUID = 5365055617973271468L;
+
+ private URI url;
+
+ public URI getUrl() {
+ return url;
+ }
+
+ public void setUrl(final URI url) {
+ this.url = url;
+ }
+ }
+
+ @JsonProperty(value = "odata.metadata", required = false)
+ private URI metadata;
+
+ @JsonProperty(required = false)
+ private URI url;
+
+ @JsonProperty(value = "value", required = false)
+ private final List<JSONLinkURL> links = new ArrayList<JSONLinkURL>();
+
+ @JsonProperty(value = "odata.nextLink", required = false)
+ private String next;
+
+ /**
+ * Gets the metadata URI.
+ */
+ public URI getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata URI.
+ *
+ * @param metadata metadata URI.
+ */
+ public void setMetadata(final URI metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @JsonIgnore
+ @Override
+ public List<URI> getLinks() {
+ final List<URI> result = new ArrayList<URI>();
+
+ if (this.url == null) {
+ for (JSONLinkURL link : links) {
+ result.add(link.getUrl());
+ }
+ } else {
+ result.add(this.url);
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @JsonIgnore
+ @Override
+ public void setNext(final URI next) {
+ this.next = next == null ? null : next.toASCIIString();
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @JsonIgnore
+ @Override
+ public URI getNext() {
+ return next == null ? null : URI.create(next);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.java
new file mode 100644
index 0000000..d5dc442
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.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.client.core.data.v3;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.client.api.data.v3.LinkCollection;
+
+public class XMLLinkCollectionImpl implements LinkCollection {
+
+ private final List<URI> links = new ArrayList<URI>();
+
+ private URI next;
+
+ /**
+ * Constructor.
+ */
+ public XMLLinkCollectionImpl() {
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param next next page link.
+ */
+ public XMLLinkCollectionImpl(final URI next) {
+ this.next = next;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public List<URI> getLinks() {
+ return links;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public void setNext(final URI next) {
+ this.next = next;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public URI getNext() {
+ return next;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
index 7ab12ee..da6f0fd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
@@ -31,7 +31,7 @@ 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.client.api.UnsupportedInV3Exception;
+import org.apache.olingo.client.api.v3.UnsupportedInV3Exception;
import org.apache.olingo.client.api.edm.xml.CommonParameter;
import org.apache.olingo.client.api.edm.xml.ComplexType;
import org.apache.olingo.client.api.edm.xml.EntityContainer;
@@ -45,7 +45,7 @@ import org.apache.olingo.client.api.edm.xml.v4.Function;
import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
import org.apache.olingo.client.core.edm.v3.EdmActionProxy;
import org.apache.olingo.client.core.edm.v3.EdmFunctionProxy;
-import org.apache.olingo.client.core.edm.v3.V3FunctionImportUtils;
+import org.apache.olingo.client.core.edm.v3.FunctionImportUtils;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
@@ -190,7 +190,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
boolean found = false;
for (final Iterator<FunctionImport> itor = functionImports.iterator(); itor.hasNext() && !found;) {
final FunctionImport functionImport = itor.next();
- if (!V3FunctionImportUtils.canProxyFunction(functionImport) && !functionImport.isBindable()) {
+ if (!FunctionImportUtils.canProxyFunction(functionImport) && !functionImport.isBindable()) {
found = functionImport.getParameters().isEmpty();
result = EdmActionProxy.getInstance(this, actionName, functionImport);
}
@@ -231,7 +231,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
boolean found = false;
for (final Iterator<FunctionImport> itor = functionImports.iterator(); itor.hasNext() && !found;) {
final FunctionImport functionImport = itor.next();
- if (V3FunctionImportUtils.canProxyFunction(functionImport) && !functionImport.isBindable()) {
+ if (FunctionImportUtils.canProxyFunction(functionImport) && !functionImport.isBindable()) {
final Set<String> functionParamNames = new HashSet<String>();
for (CommonParameter param : functionImport.getParameters()) {
functionParamNames.add(param.getName());
@@ -280,7 +280,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
boolean found = false;
for (final Iterator<FunctionImport> itor = functionImports.iterator(); itor.hasNext() && !found;) {
final FunctionImport functionImport = itor.next();
- if (!V3FunctionImportUtils.canProxyFunction(functionImport) && functionImport.isBindable()) {
+ if (!FunctionImportUtils.canProxyFunction(functionImport) && functionImport.isBindable()) {
final EdmTypeInfo boundParam = new EdmTypeInfo.Builder().setEdm(this).
setTypeExpression(functionImport.getParameters().get(0).getType()).build();
if (bindingParameterTypeName.equals(boundParam.getFullQualifiedName())
@@ -336,7 +336,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
boolean found = false;
for (final Iterator<FunctionImport> itor = functionImports.iterator(); itor.hasNext() && !found;) {
final FunctionImport functionImport = itor.next();
- if (!V3FunctionImportUtils.canProxyFunction(functionImport) && functionImport.isBindable()) {
+ if (!FunctionImportUtils.canProxyFunction(functionImport) && functionImport.isBindable()) {
final EdmTypeInfo boundParam = new EdmTypeInfo.Builder().setEdm(this).
setTypeExpression(functionImport.getParameters().get(0).getType()).build();
if (bindingParameterTypeName.equals(boundParam.getFullQualifiedName())
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
index 169aaf9..03385f8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.core.edm;
import java.util.List;
-import org.apache.olingo.client.api.UnsupportedInV3Exception;
+import org.apache.olingo.client.api.v3.UnsupportedInV3Exception;
import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
import org.apache.olingo.client.api.edm.xml.EntityContainer;
import org.apache.olingo.client.api.edm.xml.EntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java
index d036d90..d1f5393 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.edm.v3;
import java.util.ArrayList;
import java.util.List;
-import org.apache.olingo.client.api.UnsupportedInV3Exception;
+import org.apache.olingo.client.api.v3.UnsupportedInV3Exception;
import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
import org.apache.olingo.client.api.edm.xml.EntityContainer;
import org.apache.olingo.client.api.edm.xml.Schema;
@@ -62,7 +62,7 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
for (EntityContainer entityContainer : schema.getEntityContainers()) {
for (CommonFunctionImport functionImport : entityContainer.getFunctionImports()) {
final FunctionImport _funFunctionImport = (FunctionImport) functionImport;
- if (V3FunctionImportUtils.canProxyFunction(_funFunctionImport)) {
+ if (FunctionImportUtils.canProxyFunction(_funFunctionImport)) {
functionImportInfos.add(
new EdmFunctionImportInfoImpl(entityContainer.getName(), functionImport.getName()));
}
@@ -83,7 +83,7 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
for (EntityContainer entityContainer : schema.getEntityContainers()) {
for (CommonFunctionImport functionImport : entityContainer.getFunctionImports()) {
final FunctionImport _funFunctionImport = (FunctionImport) functionImport;
- if (!V3FunctionImportUtils.canProxyFunction(_funFunctionImport)) {
+ if (!FunctionImportUtils.canProxyFunction(_funFunctionImport)) {
actionImportInfos.add(
new EdmActionImportInfoImpl(entityContainer.getName(), functionImport.getName()));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/FunctionImportUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/FunctionImportUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/FunctionImportUtils.java
new file mode 100644
index 0000000..26e6a95
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/FunctionImportUtils.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.client.core.edm.v3;
+
+import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
+import org.apache.olingo.client.api.http.HttpMethod;
+
+public final class FunctionImportUtils {
+
+ public static boolean canProxyFunction(final FunctionImport functionImport) {
+ return functionImport.getHttpMethod() == null
+ ? !functionImport.isSideEffecting()
+ : HttpMethod.GET.name().equals(functionImport.getHttpMethod());
+ }
+
+ private FunctionImportUtils() {
+ // empty constructor for static utility classes
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/V3FunctionImportUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/V3FunctionImportUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/V3FunctionImportUtils.java
deleted file mode 100644
index 9453d63..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/V3FunctionImportUtils.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.edm.v3;
-
-import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
-import org.apache.olingo.client.api.http.HttpMethod;
-
-public final class V3FunctionImportUtils {
-
- public static boolean canProxyFunction(final FunctionImport functionImport) {
- return functionImport.getHttpMethod() == null
- ? !functionImport.isSideEffecting()
- : HttpMethod.GET.name().equals(functionImport.getHttpMethod());
- }
-
- private V3FunctionImportUtils() {
- // empty constructor for static utility classes
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java
index 71dcb7c..5850a2d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java
@@ -26,13 +26,13 @@ import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
import java.io.IOException;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.core.edm.xml.v4.ReturnTypeImpl;
import org.apache.olingo.client.core.edm.xml.v4.annotation.ConstExprConstructImpl;
public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
- protected ODataClient client;
+ protected CommonODataClient client;
protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
return ConstExprConstructImpl.Type.fromString(jp.getCurrentName()) != null;
@@ -64,7 +64,7 @@ public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
public T deserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- client = (ODataClient) ctxt.findInjectableValue(ODataClient.class.getName(), null, null);
+ client = (CommonODataClient) ctxt.findInjectableValue(CommonODataClient.class.getName(), null, null);
return doDeserialize(jp, ctxt);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java
index 2c5e0cb..eb26d95 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java
@@ -34,7 +34,7 @@ import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import java.io.IOException;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,19 +42,19 @@ abstract class AbstractJacksonTool {
protected static final Logger LOG = LoggerFactory.getLogger(AbstractJacksonTool.class);
- protected final ODataClient client;
+ protected final CommonODataClient client;
- protected AbstractJacksonTool(final ODataClient client) {
+ protected AbstractJacksonTool(final CommonODataClient 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.setInjectableValues(new InjectableValues.Std().addValue(CommonODataClient.class, client));
mapper.setSerializerProvider(new InjectableSerializerProvider(mapper.getSerializerProvider(),
- mapper.getSerializationConfig().withAttribute(ODataClient.class, client),
+ mapper.getSerializationConfig().withAttribute(CommonODataClient.class, client),
mapper.getSerializerFactory()));
return mapper;
@@ -64,7 +64,7 @@ abstract class AbstractJacksonTool {
final XmlMapper xmlMapper = new XmlMapper(
new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());
- xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(ODataClient.class, client));
+ xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(CommonODataClient.class, client));
xmlMapper.addHandler(new DeserializationProblemHandler() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
index 9be7636..69a278f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
@@ -23,11 +23,10 @@ import java.net.URI;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.data.Feed;
import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.LinkCollection;
import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
@@ -41,14 +40,13 @@ import org.apache.olingo.client.api.domain.ODataInlineEntity;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataLinkCollection;
import org.apache.olingo.client.api.domain.ODataOperation;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.op.ODataBinder;
+import org.apache.olingo.client.api.op.CommonODataBinder;
import org.apache.olingo.client.api.utils.URIUtils;
import org.apache.olingo.client.core.data.CollectionValueImpl;
import org.apache.olingo.client.core.data.ComplexValueImpl;
@@ -60,7 +58,7 @@ import org.apache.olingo.client.core.data.PrimitiveValueImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class AbstractODataBinder implements ODataBinder {
+public abstract class AbstractODataBinder implements CommonODataBinder {
private static final long serialVersionUID = 454285889193689536L;
@@ -69,9 +67,9 @@ public abstract class AbstractODataBinder implements ODataBinder {
*/
protected final Logger LOG = LoggerFactory.getLogger(AbstractODataBinder.class);
- protected final ODataClient client;
+ protected final CommonODataClient client;
- protected AbstractODataBinder(final ODataClient client) {
+ protected AbstractODataBinder(final CommonODataClient client) {
this.client = client;
}
@@ -261,13 +259,6 @@ public abstract class AbstractODataBinder implements ODataBinder {
}
@Override
- public ODataLinkCollection getLinkCollection(final LinkCollection linkCollection) {
- final ODataLinkCollection collection = new ODataLinkCollection(linkCollection.getNext());
- collection.setLinks(linkCollection.getLinks());
- return collection;
- }
-
- @Override
public ODataEntitySet getODataEntitySet(final Feed resource) {
return getODataEntitySet(resource, null);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java
index 12dfa61..67acc09 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataDeserializer.java
@@ -19,15 +19,14 @@
package org.apache.olingo.client.core.op.impl;
import java.io.InputStream;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.data.ODataError;
import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.LinkCollection;
import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.op.ODataDeserializer;
+import org.apache.olingo.client.api.op.CommonODataDeserializer;
import org.apache.olingo.client.core.data.AtomDeserializer;
import org.apache.olingo.client.core.data.AtomEntryImpl;
import org.apache.olingo.client.core.data.AtomFeedImpl;
@@ -35,18 +34,16 @@ import org.apache.olingo.client.core.data.AtomPropertyImpl;
import org.apache.olingo.client.core.data.JSONEntryImpl;
import org.apache.olingo.client.core.data.JSONErrorBundle;
import org.apache.olingo.client.core.data.JSONFeedImpl;
-import org.apache.olingo.client.core.data.JSONLinkCollectionImpl;
import org.apache.olingo.client.core.data.JSONPropertyImpl;
import org.apache.olingo.client.core.data.XMLErrorImpl;
-import org.apache.olingo.client.core.data.XMLLinkCollectionImpl;
-public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements ODataDeserializer {
+public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements CommonODataDeserializer {
private static final long serialVersionUID = -4244158979195609909L;
private final AtomDeserializer atomDeserializer;
- public AbstractODataDeserializer(final ODataClient client) {
+ public AbstractODataDeserializer(final CommonODataClient client) {
super(client);
this.atomDeserializer = new AtomDeserializer(client.getServiceVersion());
@@ -74,13 +71,6 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
}
@Override
- public LinkCollection toLinkCollection(final InputStream input, final ODataFormat format) {
- return format == ODataFormat.XML
- ? atom(input, XMLLinkCollectionImpl.class)
- : json(input, JSONLinkCollectionImpl.class);
- }
-
- @Override
public ODataError toError(final InputStream input, final boolean isXML) {
return isXML
? xml(input, XMLErrorImpl.class)
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
index 17eee47..cfe08ec 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
@@ -20,14 +20,13 @@ package org.apache.olingo.client.core.op.impl;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.data.ODataError;
import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.ODataLinkCollection;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.domain.ODataValue;
@@ -35,11 +34,11 @@ import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.format.ODataValueFormat;
-import org.apache.olingo.client.api.op.ODataReader;
+import org.apache.olingo.client.api.op.CommonODataReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class AbstractODataReader implements ODataReader {
+public abstract class AbstractODataReader implements CommonODataReader {
private static final long serialVersionUID = -1988865870981207079L;
@@ -48,9 +47,9 @@ public abstract class AbstractODataReader implements ODataReader {
*/
protected static final Logger LOG = LoggerFactory.getLogger(AbstractODataReader.class);
- protected final ODataClient client;
+ protected final CommonODataClient client;
- protected AbstractODataReader(final ODataClient client) {
+ protected AbstractODataReader(final CommonODataClient client) {
this.client = client;
}
@@ -71,12 +70,6 @@ public abstract class AbstractODataReader implements ODataReader {
}
@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().toError(inputStream, isXML);
}
@@ -95,8 +88,6 @@ public abstract class AbstractODataReader implements ODataReader {
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
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataSerializer.java
index b847354..4c43052 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataSerializer.java
@@ -25,7 +25,7 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.data.Feed;
import org.apache.olingo.client.api.data.Link;
@@ -46,7 +46,7 @@ public abstract class AbstractODataSerializer extends AbstractJacksonTool implem
private final AtomSerializer atomSerializer;
- public AbstractODataSerializer(final ODataClient client) {
+ public AbstractODataSerializer(final CommonODataClient client) {
super(client);
this.atomSerializer = new AtomSerializer(client.getServiceVersion());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
index 023ac9e..3104b8e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataObjectFactoryImpl.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core.op.impl;
import java.net.URI;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.domain.ODataLinkType;
import org.apache.olingo.client.api.domain.ODataCollectionValue;
import org.apache.olingo.client.api.domain.ODataComplexValue;
@@ -36,9 +36,9 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
private static final long serialVersionUID = -3769695665946919447L;
- protected final ODataClient client;
+ protected final CommonODataClient client;
- public ODataObjectFactoryImpl(final ODataClient client) {
+ public ODataObjectFactoryImpl(final CommonODataClient client) {
this.client = client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3BinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3BinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3BinderImpl.java
deleted file mode 100644
index cf48c94..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3BinderImpl.java
+++ /dev/null
@@ -1,30 +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.client.core.op.impl;
-
-import org.apache.olingo.client.core.ODataV3ClientImpl;
-
-public class ODataV3BinderImpl extends AbstractODataBinder {
-
- private static final long serialVersionUID = 8970843539708952308L;
-
- public ODataV3BinderImpl(final ODataV3ClientImpl client) {
- super(client);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3DeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3DeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3DeserializerImpl.java
deleted file mode 100644
index 814874e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3DeserializerImpl.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.op.impl;
-
-import java.io.InputStream;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.op.ODataV3Deserializer;
-import org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl;
-import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
-import org.apache.olingo.client.core.edm.xml.v3.EdmxImpl;
-import org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl;
-
-public class ODataV3DeserializerImpl extends AbstractODataDeserializer implements ODataV3Deserializer {
-
- private static final long serialVersionUID = -8221085862548914611L;
-
- public ODataV3DeserializerImpl(final ODataClient client) {
- super(client);
- }
-
- @Override
- public XMLMetadataImpl toMetadata(final InputStream input) {
- try {
- return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not parse as Edmx document", e);
- }
- }
-
- @Override
- public ServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
- return format == ODataFormat.XML
- ? xml(input, XMLServiceDocumentImpl.class)
- : json(input, JSONServiceDocumentImpl.class);
- }
-
-}
[30/52] [abbrv] git commit: [OLINGO-200] Moving domain objects to
commons-api
Posted by sk...@apache.org.
[OLINGO-200] Moving domain objects to commons-api
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/0b4b86c0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/0b4b86c0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/0b4b86c0
Branch: refs/heads/olingo-206-validator
Commit: 0b4b86c0b28ab47ad04c846c02175cfeab8454b3
Parents: 9b3e4eb
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 24 08:50:16 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 24 08:50:16 2014 +0100
----------------------------------------------------------------------
lib/client-api/pom.xml | 5 -
.../olingo/client/api/CommonConfiguration.java | 8 +-
.../olingo/client/api/CommonODataClient.java | 6 +-
.../org/apache/olingo/client/api/Constants.java | 2 +-
.../request/cud/CommonCUDRequestFactory.java | 8 +-
.../request/cud/ODataDeleteRequest.java | 2 +-
.../request/cud/ODataEntityCreateRequest.java | 2 +-
.../request/cud/ODataEntityUpdateRequest.java | 2 +-
.../request/cud/ODataLinkCreateRequest.java | 2 +-
.../request/cud/ODataLinkUpdateRequest.java | 2 +-
.../request/cud/ODataPropertyUpdateRequest.java | 2 +-
.../request/cud/ODataValueUpdateRequest.java | 2 +-
.../invoke/CommonInvokeRequestFactory.java | 4 +-
.../request/invoke/ODataInvokeRequest.java | 6 +-
.../request/invoke/ODataNoContent.java | 2 +-
.../request/retrieve/ODataEntityRequest.java | 4 +-
.../retrieve/ODataEntitySetIteratorRequest.java | 2 +-
.../request/retrieve/ODataEntitySetRequest.java | 4 +-
.../request/retrieve/ODataMediaRequest.java | 2 +-
.../request/retrieve/ODataMetadataRequest.java | 2 +-
.../request/retrieve/ODataPropertyRequest.java | 4 +-
.../retrieve/ODataServiceDocumentRequest.java | 4 +-
.../request/retrieve/ODataValueRequest.java | 4 +-
.../retrieve/v3/ODataLinkCollectionRequest.java | 2 +-
.../streamed/ODataStreamedEntityRequest.java | 2 +-
.../response/ODataEntityCreateResponse.java | 2 +-
.../response/ODataEntityUpdateResponse.java | 2 +-
.../response/ODataInvokeResponse.java | 2 +-
.../ODataMediaEntityCreateResponse.java | 2 +-
.../ODataMediaEntityUpdateResponse.java | 2 +-
.../response/ODataPropertyUpdateResponse.java | 2 +-
.../response/ODataValueUpdateResponse.java | 2 +-
.../apache/olingo/client/api/data/Entry.java | 2 +-
.../client/api/domain/AbstractODataValue.java | 127 --------
.../client/api/domain/ODataCollectionValue.java | 98 ------
.../client/api/domain/ODataComplexValue.java | 97 ------
.../olingo/client/api/domain/ODataEntity.java | 316 -------------------
.../client/api/domain/ODataEntitySet.java | 120 -------
.../api/domain/ODataEntitySetIterator.java | 4 +-
.../client/api/domain/ODataGeospatialValue.java | 57 ----
.../client/api/domain/ODataInlineEntity.java | 74 -----
.../client/api/domain/ODataInlineEntitySet.java | 74 -----
.../client/api/domain/ODataInvokeResult.java | 30 --
.../olingo/client/api/domain/ODataItem.java | 111 -------
.../olingo/client/api/domain/ODataLink.java | 190 -----------
.../olingo/client/api/domain/ODataLinkType.java | 93 ------
.../client/api/domain/ODataObjectFactory.java | 218 -------------
.../client/api/domain/ODataOperation.java | 88 ------
.../client/api/domain/ODataPrimitiveValue.java | 67 ----
.../olingo/client/api/domain/ODataProperty.java | 186 -----------
.../client/api/domain/ODataPropertyType.java | 40 ---
.../client/api/domain/ODataServiceDocument.java | 183 -----------
.../olingo/client/api/domain/ODataValue.java | 84 -----
.../olingo/client/api/format/ODataFormat.java | 97 ------
.../client/api/format/ODataMediaFormat.java | 71 -----
.../client/api/format/ODataPubFormat.java | 97 ------
.../client/api/format/ODataValueFormat.java | 76 -----
.../olingo/client/api/op/CommonODataBinder.java | 10 +-
.../client/api/op/CommonODataDeserializer.java | 4 +-
.../olingo/client/api/op/CommonODataReader.java | 12 +-
.../olingo/client/api/op/ODataSerializer.java | 2 +-
.../olingo/client/api/op/ODataWriter.java | 10 +-
.../client/api/op/v3/ODataDeserializer.java | 2 +-
.../olingo/client/api/op/v3/ODataReader.java | 2 +-
.../client/core/AbstractConfiguration.java | 8 +-
.../olingo/client/core/AbstractODataClient.java | 2 +-
.../communication/request/ODataRequestImpl.java | 6 +-
.../request/cud/AbstractCUDRequestFactory.java | 8 +-
.../request/cud/ODataDeleteRequestImpl.java | 2 +-
.../cud/ODataEntityCreateRequestImpl.java | 4 +-
.../cud/ODataEntityUpdateRequestImpl.java | 4 +-
.../request/cud/ODataLinkCreateRequestImpl.java | 4 +-
.../request/cud/ODataLinkUpdateRequestImpl.java | 4 +-
.../cud/ODataPropertyUpdateRequestImpl.java | 4 +-
.../cud/ODataValueUpdateRequestImpl.java | 4 +-
.../invoke/AbstractInvokeRequestFactory.java | 2 +-
.../request/invoke/ODataInvokeRequestImpl.java | 14 +-
.../invoke/v3/InvokeRequestFactoryImpl.java | 10 +-
.../invoke/v4/InvokeRequestFactoryImpl.java | 4 +-
.../retrieve/ODataEntityRequestImpl.java | 4 +-
.../ODataEntitySetIteratorRequestImpl.java | 2 +-
.../retrieve/ODataEntitySetRequestImpl.java | 4 +-
.../request/retrieve/ODataMediaRequestImpl.java | 2 +-
.../retrieve/ODataMetadataRequestImpl.java | 2 +-
.../retrieve/ODataPropertyRequestImpl.java | 4 +-
.../request/retrieve/ODataRawRequestImpl.java | 2 +-
.../ODataServiceDocumentRequestImpl.java | 4 +-
.../request/retrieve/ODataValueRequestImpl.java | 4 +-
.../v3/ODataLinkCollectionRequestImpl.java | 2 +-
.../AbstractODataStreamedEntityRequest.java | 2 +-
.../streamed/AbstractODataStreamedRequest.java | 2 +-
.../ODataMediaEntityCreateRequestImpl.java | 2 +-
.../ODataMediaEntityUpdateRequestImpl.java | 2 +-
.../olingo/client/core/data/AbstractEntry.java | 2 +-
.../core/data/AbstractJsonDeserializer.java | 2 +-
.../client/core/data/AtomDeserializer.java | 2 +-
.../core/data/AtomPropertyDeserializer.java | 2 +-
.../client/core/data/JSONEntryDeserializer.java | 4 +-
.../client/core/data/JSONEntrySerializer.java | 2 +-
.../core/domain/ODataGeospatialValueImpl.java | 4 +-
.../core/domain/ODataPrimitiveValueImpl.java | 4 +-
.../client/core/op/AbstractODataBinder.java | 24 +-
.../core/op/AbstractODataDeserializer.java | 4 +-
.../client/core/op/AbstractODataReader.java | 16 +-
.../client/core/op/AbstractODataSerializer.java | 2 +-
.../client/core/op/ODataObjectFactoryImpl.java | 24 +-
.../olingo/client/core/op/ODataWriterImpl.java | 10 +-
.../olingo/client/core/op/ResourceFactory.java | 2 +-
.../core/op/impl/v3/ODataDeserializerImpl.java | 2 +-
.../client/core/op/impl/v3/ODataReaderImpl.java | 4 +-
.../client/core/op/impl/v4/ODataBinderImpl.java | 2 +-
.../core/op/impl/v4/ODataDeserializerImpl.java | 2 +-
.../client/core/op/impl/v4/ODataReaderImpl.java | 4 +-
.../client/core/AbstractPrimitiveTest.java | 8 +-
.../client/core/AbstractPropertyTest.java | 12 +-
.../apache/olingo/client/core/AbstractTest.java | 4 +-
.../client/core/it/AbstractTestITCase.java | 20 +-
.../client/core/it/v3/AsyncTestITCase.java | 4 +-
.../client/core/it/v3/CountTestITCase.java | 4 +-
.../core/it/v3/EntityCreateTestITCase.java | 12 +-
.../core/it/v3/EntityRetrieveTestITCase.java | 14 +-
.../client/core/it/v3/EntitySetTestITCase.java | 4 +-
.../core/it/v3/EntityUpdateTestITCase.java | 4 +-
.../client/core/it/v3/ErrorTestITCase.java | 4 +-
.../core/it/v3/FilterFactoryTestITCase.java | 2 +-
.../client/core/it/v3/FilterTestITCase.java | 2 +-
.../core/it/v3/KeyAsSegmentTestITCase.java | 4 +-
.../client/core/it/v3/LinkTestITCase.java | 4 +-
.../core/it/v3/MediaEntityTestITCase.java | 8 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 20 +-
.../client/core/it/v3/OpenTypeTestITCase.java | 6 +-
.../core/it/v3/PrimitiveKeysTestITCase.java | 4 +-
.../core/it/v3/PropertyRetrieveTestITCase.java | 14 +-
.../client/core/it/v3/PropertyTestITCase.java | 10 +-
.../core/it/v3/PropertyValueTestITCase.java | 6 +-
.../core/it/v3/QueryOptionsTestITCase.java | 8 +-
.../v3/ServiceDocumentRetrieveTestITCase.java | 4 +-
.../core/it/v3/ServiceDocumentTestITCase.java | 4 +-
.../apache/olingo/client/core/v3/AtomTest.java | 4 +-
.../olingo/client/core/v3/EntitySetTest.java | 4 +-
.../olingo/client/core/v3/EntityTest.java | 8 +-
.../apache/olingo/client/core/v3/ErrorTest.java | 2 +-
.../apache/olingo/client/core/v3/JSONTest.java | 4 +-
.../client/core/v3/PrimitiveValueTest.java | 2 +-
.../client/core/v3/ServiceDocumentTest.java | 4 +-
.../client/core/v4/PrimitiveValueTest.java | 2 +-
.../client/core/v4/ServiceDocumentTest.java | 4 +-
lib/commons-api/pom.xml | 5 +
.../commons/api/domain/AbstractODataValue.java | 127 ++++++++
.../api/domain/ODataCollectionValue.java | 98 ++++++
.../commons/api/domain/ODataComplexValue.java | 97 ++++++
.../olingo/commons/api/domain/ODataEntity.java | 316 +++++++++++++++++++
.../commons/api/domain/ODataEntitySet.java | 120 +++++++
.../api/domain/ODataGeospatialValue.java | 57 ++++
.../commons/api/domain/ODataInlineEntity.java | 74 +++++
.../api/domain/ODataInlineEntitySet.java | 74 +++++
.../commons/api/domain/ODataInvokeResult.java | 30 ++
.../olingo/commons/api/domain/ODataItem.java | 111 +++++++
.../olingo/commons/api/domain/ODataLink.java | 190 +++++++++++
.../commons/api/domain/ODataLinkType.java | 93 ++++++
.../commons/api/domain/ODataObjectFactory.java | 218 +++++++++++++
.../commons/api/domain/ODataOperation.java | 88 ++++++
.../commons/api/domain/ODataPrimitiveValue.java | 67 ++++
.../commons/api/domain/ODataProperty.java | 186 +++++++++++
.../commons/api/domain/ODataPropertyType.java | 40 +++
.../api/domain/ODataServiceDocument.java | 183 +++++++++++
.../olingo/commons/api/domain/ODataValue.java | 84 +++++
.../olingo/commons/api/format/ContentType.java | 47 +++
.../olingo/commons/api/format/ODataFormat.java | 95 ++++++
.../commons/api/format/ODataMediaFormat.java | 69 ++++
.../commons/api/format/ODataPubFormat.java | 95 ++++++
.../commons/api/format/ODataValueFormat.java | 74 +++++
172 files changed, 2938 insertions(+), 2897 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/client-api/pom.xml b/lib/client-api/pom.xml
index eb3f9e3..017ec12 100644
--- a/lib/client-api/pom.xml
+++ b/lib/client-api/pom.xml
@@ -49,11 +49,6 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java
index 48f2614..59786f3 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonConfiguration.java
@@ -18,10 +18,10 @@
*/
package org.apache.olingo.client.api;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataMediaFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataMediaFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientFactory;
import org.apache.olingo.client.api.http.HttpUriRequestFactory;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
index 6c44360..4b708d9 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
@@ -24,9 +24,9 @@ import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFa
import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
-import org.apache.olingo.client.api.domain.ODataObjectFactory;
-import org.apache.olingo.client.api.domain.ODataGeospatialValue;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.op.CommonODataBinder;
import org.apache.olingo.client.api.op.CommonODataDeserializer;
import org.apache.olingo.client.api.op.CommonODataReader;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java
index 6f94915..b4c3d6b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/Constants.java
@@ -24,7 +24,7 @@ import javax.xml.namespace.QName;
/**
* Constant values related to the OData protocol.
*/
-public class Constants {
+public interface Constants {
// Other stuff
public final static String UTF8 = "UTF-8";
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
index c0f5b2e..6f6f502 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
@@ -21,10 +21,10 @@ package org.apache.olingo.client.api.communication.request.cud;
import java.io.Serializable;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.UpdateType;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
/**
* OData request factory class.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataDeleteRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataDeleteRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataDeleteRequest.java
index 7206f50..79b2641 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataDeleteRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataDeleteRequest.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.api.communication.request.cud;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData delete request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
index 357ed9a..02f41e7 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.api.communication.request.cud;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData create request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityUpdateRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityUpdateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityUpdateRequest.java
index bff13dc..11bc797 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityUpdateRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityUpdateRequest.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.api.communication.request.cud;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData update request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataLinkCreateRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataLinkCreateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataLinkCreateRequest.java
index 65c070d..adf6f0d 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataLinkCreateRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataLinkCreateRequest.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.api.communication.request.cud;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataLinkOperationResponse;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
/**
* This class implements an insert link OData request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataLinkUpdateRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataLinkUpdateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataLinkUpdateRequest.java
index 624c693..00f9216 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataLinkUpdateRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataLinkUpdateRequest.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.api.communication.request.cud;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataLinkOperationResponse;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
/**
* This class implements an update link OData request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataPropertyUpdateRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataPropertyUpdateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataPropertyUpdateRequest.java
index 683c3e3..53fa447 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataPropertyUpdateRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataPropertyUpdateRequest.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.api.communication.request.cud;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateResponse;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
/**
* This class implements an OData update entity property request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataValueUpdateRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataValueUpdateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataValueUpdateRequest.java
index 7085788..753fde8 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataValueUpdateRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataValueUpdateRequest.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.api.communication.request.cud;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
-import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
/**
* This class implements an OData update entity property value request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
index e7104bc..0198b92 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
@@ -21,8 +21,8 @@ package org.apache.olingo.client.api.communication.request.invoke;
import java.io.Serializable;
import java.net.URI;
import java.util.LinkedHashMap;
-import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.ODataInvokeResult;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataInvokeRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataInvokeRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataInvokeRequest.java
index 22360fb..986a13b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataInvokeRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataInvokeRequest.java
@@ -21,9 +21,9 @@ package org.apache.olingo.client.api.communication.request.invoke;
import java.util.Map;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
-import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataInvokeResult;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData invoke operation request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataNoContent.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataNoContent.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataNoContent.java
index e9c0379..4f32516 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataNoContent.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataNoContent.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.api.communication.request.invoke;
import java.io.Serializable;
-import org.apache.olingo.client.api.domain.ODataInvokeResult;
+import org.apache.olingo.commons.api.domain.ODataInvokeResult;
/**
* Marker class for invoke with no return type.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
index 9dd7104..a22f82c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
@@ -18,8 +18,8 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData retrieve query request returning a single entity.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
index 2d7c369..dd2cf46 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.api.communication.request.retrieve;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
index d76d04a..fbafafd 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
@@ -18,8 +18,8 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMediaRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMediaRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMediaRequest.java
index 4500152..a4bbf3c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMediaRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMediaRequest.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.api.communication.request.retrieve;
import java.io.InputStream;
-import org.apache.olingo.client.api.format.ODataMediaFormat;
+import org.apache.olingo.commons.api.format.ODataMediaFormat;
/**
* This class implements an OData media query request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java
index c87e449..3dcc81b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.edm.Edm;
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
index 9806a2e..7492e11 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
@@ -18,8 +18,8 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
/**
* This class implements an OData entity property query request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataServiceDocumentRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataServiceDocumentRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataServiceDocumentRequest.java
index 862ed49..580798c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataServiceDocumentRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataServiceDocumentRequest.java
@@ -18,8 +18,8 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.format.ODataFormat;
/**
* This class implements an OData service document request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
index e731dfe..e78067a 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java
@@ -18,8 +18,8 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.format.ODataValueFormat;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
/**
* This class implements an OData entity property value query request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/ODataLinkCollectionRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/ODataLinkCollectionRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/ODataLinkCollectionRequest.java
index 7cfba7b..1494aea 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/ODataLinkCollectionRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/ODataLinkCollectionRequest.java
@@ -20,7 +20,7 @@ package org.apache.olingo.client.api.communication.request.retrieve.v3;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRetrieveRequest;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
-import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataFormat;
/**
* This class implements an OData link query request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java
index 3753016..7d898f5 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.api.communication.request.streamed;
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
import org.apache.olingo.client.api.communication.response.ODataResponse;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* Abstract class representing a request concerning a streamed entity.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
index c4eaf22..5fd7fb8 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntity;
/**
* This class implements the response to an OData entity create request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
index fec48d6..6b84630 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntity;
/**
* This class implements the response to an OData update request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataInvokeResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataInvokeResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataInvokeResponse.java
index 8a5cdaa..ab1d890 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataInvokeResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataInvokeResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.client.api.domain.ODataInvokeResult;
+import org.apache.olingo.commons.api.domain.ODataInvokeResult;
/**
* This class implements a response to a specific invoke request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
index 98bd90e..ea3b8b7 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntity;
/**
* This class implements the response to an Odata media entity create request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
index e24b615..f55dac8 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntity;
/**
* This class implements the response to an Odata media entity update request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
index c398aa2..23bfc1e 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataProperty;
/**
* This class implements the response to an OData update entity property request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
index 9d8855b..8a0ab1b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
/**
* This class implements the response to an OData update entity property request.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Entry.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Entry.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Entry.java
index 78a7b93..0fcf77c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Entry.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/Entry.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.data;
-import org.apache.olingo.client.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.domain.ODataOperation;
import java.net.URI;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java
deleted file mode 100644
index 37ca0da..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractODataValue.java
+++ /dev/null
@@ -1,127 +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.client.api.domain;
-
-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 AbstractODataValue implements ODataValue {
-
- private static final long serialVersionUID = 7445422004232581877L;
-
- /**
- * Check is is a primitive value.
- *
- * @return 'TRUE' if primitive; 'FALSE' otherwise.
- */
- @Override
- public boolean isPrimitive() {
- return (this instanceof ODataPrimitiveValue);
- }
-
- /**
- * Casts to primitive value.
- *
- * @return primitive value.
- */
- @Override
- public ODataPrimitiveValue asPrimitive() {
- return isPrimitive() ? (ODataPrimitiveValue) this : null;
- }
-
- /**
- * Check is is a geospatail value.
- *
- * @return 'TRUE' if geospatail; 'FALSE' otherwise.
- */
- @Override
- public boolean isGeospatial() {
- return (this instanceof ODataGeospatialValue);
- }
-
- /**
- * Casts to geospatail value.
- *
- * @return geospatail value.
- */
- @Override
- public ODataGeospatialValue asGeospatial() {
- return isGeospatial() ? (ODataGeospatialValue) this : null;
- }
-
- /**
- * Check is is a complex value.
- *
- * @return 'TRUE' if complex; 'FALSE' otherwise.
- */
- @Override
- public boolean isComplex() {
- return (this instanceof ODataComplexValue);
- }
-
- /**
- * Casts to complex value.
- *
- * @return complex value.
- */
- @Override
- public ODataComplexValue asComplex() {
- return isComplex() ? (ODataComplexValue) this : null;
- }
-
- /**
- * Check is is a collection value.
- *
- * @return 'TRUE' if collection; 'FALSE' otherwise.
- */
- @Override
- public boolean isCollection() {
- return (this instanceof ODataCollectionValue);
- }
-
- /**
- * Casts to collection value.
- *
- * @return collection value.
- */
- @Override
- public ODataCollectionValue asCollection() {
- return isCollection() ? (ODataCollectionValue) this : null;
- }
-
- @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/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java
deleted file mode 100644
index df743df..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataCollectionValue.java
+++ /dev/null
@@ -1,98 +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.client.api.domain;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * OData collection property value.
- */
-public class ODataCollectionValue extends AbstractODataValue 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 getType() {
- 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/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java
deleted file mode 100644
index d9b8a24..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataComplexValue.java
+++ /dev/null
@@ -1,97 +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.client.api.domain;
-
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * OData complex property value.
- */
-public class ODataComplexValue extends AbstractODataValue 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 type 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 getType() {
- return typeName;
- }
-
- /**
- * Gets number of fields.
- *
- * @return number of fields.
- */
- public int size() {
- return fields.size();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntity.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntity.java
deleted file mode 100644
index e06ca62..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntity.java
+++ /dev/null
@@ -1,316 +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.client.api.domain;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * OData entity.
- */
-public class ODataEntity extends ODataItem implements ODataInvokeResult {
-
- private static final long serialVersionUID = 8360640095932811034L;
-
- /**
- * ETag.
- */
- private String eTag;
-
- /**
- * Media entity flag.
- */
- private boolean mediaEntity = false;
-
- /**
- * In case of media entity, media content type.
- */
- private String mediaContentType;
-
- /**
- * In case of media entity, media content source.
- */
- private String mediaContentSource;
-
- /**
- * Edit link.
- */
- protected URI editLink;
-
- /**
- * Navigation links (might contain in-line entities or feeds).
- */
- protected final List<ODataLink> navigationLinks = new ArrayList<ODataLink>();
-
- /**
- * Association links.
- */
- protected final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
-
- /**
- * Media edit links.
- */
- protected final List<ODataLink> editMediaLinks = new ArrayList<ODataLink>();
-
- /**
- * Operations (legacy, functions, actions).
- */
- protected final List<ODataOperation> operations = new ArrayList<ODataOperation>();
-
- /**
- * Entity properties.
- */
- protected final List<ODataProperty> properties = new ArrayList<ODataProperty>();
-
- /**
- * Constructor.
- *
- * @param name OData entity name.
- */
- public ODataEntity(final String name) {
- super(name);
- }
-
- /**
- * Gets ETag.
- *
- * @return ETag.
- */
- public String getETag() {
- return eTag;
- }
-
- /**
- * Sets ETag.
- *
- * @param eTag ETag.
- */
- public void setETag(final String eTag) {
- this.eTag = eTag;
- }
-
- /**
- * Searches for operation with given title.
- *
- * @param title operation to look for
- * @return operation if found with given title, <tt>null</tt> otherwise
- */
- public ODataOperation getOperation(final String title) {
- ODataOperation result = null;
- for (ODataOperation operation : operations) {
- if (title.equals(operation.getTitle())) {
- result = operation;
- }
- }
-
- return result;
- }
-
- /**
- * Gets operations.
- *
- * @return operations.
- */
- public List<ODataOperation> getOperations() {
- return this.operations;
- }
-
- /**
- * Searches for property with given name.
- *
- * @param name property to look for
- * @return property if found with given name, <tt>null</tt> otherwise
- */
- public ODataProperty getProperty(final String name) {
- ODataProperty result = null;
-
- if (StringUtils.isNotBlank(name)) {
- for (ODataProperty property : properties) {
- if (name.equals(property.getName())) {
- result = property;
- }
- }
- }
-
- return result;
- }
-
- /**
- * Returns OData entity properties.
- *
- * @return OData entity properties.
- */
- public List<ODataProperty> getProperties() {
- return properties;
- }
-
- /**
- * Puts the given link into one of available lists, based on its type.
- *
- * @param link to be added
- * @return <tt>true</tt> if the given link was added in one of available lists
- */
- public boolean addLink(final ODataLink link) {
- boolean result = false;
-
- switch (link.getType()) {
- case ASSOCIATION:
- result = associationLinks.contains(link) ? false : associationLinks.add(link);
- break;
-
- case ENTITY_NAVIGATION:
- case ENTITY_SET_NAVIGATION:
- result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
- break;
-
- case MEDIA_EDIT:
- result = editMediaLinks.contains(link) ? false : editMediaLinks.add(link);
- break;
-
- default:
- }
-
- return result;
- }
-
- /**
- * Removes the given link from any list (association, navigation, edit-media).
- *
- * @param link to be removed
- * @return <tt>true</tt> if the given link was contained in one of available lists
- */
- public boolean removeLink(final ODataLink link) {
- return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
- }
-
- /**
- * Returns all entity navigation links (including inline entities / feeds).
- *
- * @return OData entity links.
- */
- public List<ODataLink> getNavigationLinks() {
- return navigationLinks;
- }
-
- /**
- * Returns all entity association links.
- *
- * @return OData entity links.
- */
- public List<ODataLink> getAssociationLinks() {
- return associationLinks;
- }
-
- /**
- * Returns all entity media edit links.
- *
- * @return OData entity links.
- */
- public List<ODataLink> getEditMediaLinks() {
- return editMediaLinks;
- }
-
- /**
- * Returns OData entity edit link.
- *
- * @return entity edit link.
- */
- public URI getEditLink() {
- return editLink;
- }
-
- /**
- * Sets OData entity edit link.
- *
- * @param editLink edit link.
- */
- public void setEditLink(final URI editLink) {
- this.editLink = editLink;
- }
-
- @Override
- public URI getLink() {
- return super.getLink() == null ? getEditLink() : super.getLink();
- }
-
- /**
- * TRUE if read-only entity.
- *
- * @return TRUE if read-only; FALSE otherwise.
- */
- public boolean isReadOnly() {
- return super.getLink() != null;
- }
-
- /**
- * Checks if the current entity is a media entity.
- *
- * @return 'TRUE' if media entity; 'FALSE' otherwise.
- */
- public boolean isMediaEntity() {
- return mediaEntity;
- }
-
- /**
- * Sets media entity flag.
- *
- * @param isMediaEntity media entity flag value.
- */
- public void setMediaEntity(final boolean isMediaEntity) {
- this.mediaEntity = isMediaEntity;
- }
-
- /**
- * Gets media content type.
- *
- * @return media content type.
- */
- public String getMediaContentType() {
- return mediaContentType;
- }
-
- /**
- * Sets media content type.
- *
- * @param mediaContentType media content type.
- */
- public void setMediaContentType(final String mediaContentType) {
- this.mediaContentType = mediaContentType;
- }
-
- /**
- * Gets media content source.
- *
- * @return media content source.
- */
- public String getMediaContentSource() {
- return mediaContentSource;
- }
-
- /**
- * Sets media content source.
- *
- * @param mediaContentSource media content source.
- */
- public void setMediaContentSource(final String mediaContentSource) {
- this.mediaContentSource = mediaContentSource;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySet.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySet.java
deleted file mode 100644
index 22aff1f..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySet.java
+++ /dev/null
@@ -1,120 +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.client.api.domain;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * OData entity collection. If pagination was used to get this instance, forward page navigation URI will be available.
- */
-public class ODataEntitySet extends ODataItem implements ODataInvokeResult {
-
- private static final long serialVersionUID = 9039605899821494024L;
-
- /**
- * Link to the next page.
- */
- protected URI next;
-
- /**
- * Number of ODataEntities contained in this feed. If <tt>$inlinecount</tt> was requested, this value comes from
- * there.
- */
- protected Integer count;
-
- /**
- * OData entities contained in this feed.
- */
- protected List<ODataEntity> entities = new ArrayList<ODataEntity>();
-
- /**
- * Constructor.
- */
- public ODataEntitySet() {
- super(null);
- }
-
- /**
- * Constructor.
- *
- * @param next next link.
- */
- public ODataEntitySet(final URI next) {
- super(null);
- this.next = next;
- }
-
- /**
- * Gets next page link.
- *
- * @return next page link; null value if single page or last page reached.
- */
- public URI getNext() {
- return next;
- }
-
- /**
- * Sets in-line count.
- *
- * @param count in-line count value.
- */
- public void setCount(final int count) {
- this.count = count;
- }
-
- /**
- * Gets in-line count.
- *
- * @return in-line count value.
- */
- public int getCount() {
- return count == null ? entities.size() : count;
- }
-
- /**
- * Adds entity to the current feed.
- *
- * @param entity entity to be added.
- * @return 'FALSE' if already exists; 'TRUE' otherwise.
- */
- public boolean addEntity(final ODataEntity entity) {
- return entities.contains(entity) ? false : entities.add(entity);
- }
-
- /**
- * Removes an entity.
- *
- * @param entity entity to be removed.
- * @return 'TRUE' in case of success; 'FALSE' otherwise.
- */
- public boolean removeEntity(final ODataEntity entity) {
- return entities.remove(entity);
- }
-
- /**
- * Gets contained entities.
- *
- * @return feed entries.
- */
- public List<ODataEntity> getEntities() {
- return entities;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
index 26ef195..8c1db4d 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
@@ -31,7 +31,9 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
deleted file mode 100644
index af1c545..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
+++ /dev/null
@@ -1,57 +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.client.api.domain;
-
-import org.apache.olingo.commons.api.edm.EdmGeospatialType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-
-public interface ODataGeospatialValue extends ODataValue {
-
- interface Builder {
-
- Builder setType(EdmPrimitiveTypeKind type);
-
- Builder setValue(Geospatial value);
-
- ODataGeospatialValue build();
-
- }
-
- EdmPrimitiveTypeKind getTypeKind();
-
- EdmGeospatialType getType();
-
- /**
- * Returns the current geospatial value.
- *
- * @return the current geospatial value.
- */
- Geospatial toValue();
-
- /**
- * Returns the current value casted to the given type.
- *
- * @param <T> cast type
- * @param reference class reference
- * @return the current value as typed java instance
- */
- <T extends Geospatial> T toCastValue(Class<T> reference);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInlineEntity.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInlineEntity.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInlineEntity.java
deleted file mode 100644
index 0d030e0..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInlineEntity.java
+++ /dev/null
@@ -1,74 +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.client.api.domain;
-
-import java.net.URI;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-/**
- * OData in-line entity.
- */
-public class ODataInlineEntity extends ODataLink {
-
- private static final long serialVersionUID = -4763341581843700743L;
-
- private final ODataEntity entity;
-
- /**
- * Constructor.
- *
- * @param version OData service version.
- * @param uri edit link.
- * @param type type.
- * @param title title.
- * @param entity entity.
- */
- public ODataInlineEntity(final ODataServiceVersion version,
- final URI uri, final ODataLinkType type, final String title, final ODataEntity entity) {
-
- super(version, uri, type, title);
- this.entity = entity;
- }
-
- /**
- * Constructor.
- *
- * @param version OData service version.
- * @param baseURI base URI.
- * @param href href.
- * @param type type.
- * @param title title.
- * @param entity entity.
- */
- public ODataInlineEntity(final ODataServiceVersion version, final URI baseURI, final String href,
- final ODataLinkType type, final String title, final ODataEntity entity) {
-
- super(version, baseURI, href, type, title);
- this.entity = entity;
- }
-
- /**
- * Gets wrapped entity.
- *
- * @return wrapped entity.
- */
- public ODataEntity getEntity() {
- return entity;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInlineEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInlineEntitySet.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInlineEntitySet.java
deleted file mode 100644
index 331839c..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInlineEntitySet.java
+++ /dev/null
@@ -1,74 +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.client.api.domain;
-
-import java.net.URI;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-/**
- * OData in-line entity set.
- */
-public class ODataInlineEntitySet extends ODataLink {
-
- private static final long serialVersionUID = -77628001615355449L;
-
- private ODataEntitySet entitySet;
-
- /**
- * Constructor.
- *
- * @param version OData service version.
- * @param uri edit link.
- * @param type type.
- * @param title title.
- * @param entitySet entity set.
- */
- public ODataInlineEntitySet(final ODataServiceVersion version, final URI uri, final ODataLinkType type,
- final String title, final ODataEntitySet entitySet) {
-
- super(version, uri, type, title);
- this.entitySet = entitySet;
- }
-
- /**
- * Constructor.
- *
- * @param version OData service version.
- * @param baseURI base URI.
- * @param href href.
- * @param type type.
- * @param title title.
- * @param entitySet entity set.
- */
- public ODataInlineEntitySet(final ODataServiceVersion version, final URI baseURI, final String href,
- final ODataLinkType type, final String title, final ODataEntitySet entitySet) {
-
- super(version, baseURI, href, type, title);
- this.entitySet = entitySet;
- }
-
- /**
- * Gets wrapped entity set.
- *
- * @return wrapped entity set.
- */
- public ODataEntitySet getEntitySet() {
- return entitySet;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInvokeResult.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInvokeResult.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInvokeResult.java
deleted file mode 100644
index c55dfe6..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataInvokeResult.java
+++ /dev/null
@@ -1,30 +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.client.api.domain;
-
-/**
- * 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/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataItem.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataItem.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataItem.java
deleted file mode 100644
index f427aa6..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataItem.java
+++ /dev/null
@@ -1,111 +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.client.api.domain;
-
-import java.io.Serializable;
-import java.net.URI;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Abstract representation of OData entities and links.
- */
-public abstract class ODataItem implements Serializable {
-
- private static final long serialVersionUID = -2600707722689304686L;
-
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(ODataItem.class);
-
- /**
- * OData item self link.
- */
- protected URI link;
-
- /**
- * OData entity name/type.
- */
- private final String name;
-
- /**
- * Constructor.
- *
- * @param name OData entity name.
- */
- public ODataItem(final String name) {
- this.name = name;
- }
-
- /**
- * Returns self link.
- *
- * @return entity edit link.
- */
- public URI getLink() {
- return link;
- }
-
- /**
- * Sets self link.
- *
- * @param link link.
- */
- public void setLink(final URI link) {
- this.link = link;
- }
-
- /**
- * Returns OData entity name.
- *
- * @return entity name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * {@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/olingo-odata4/blob/0b4b86c0/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java
deleted file mode 100644
index 11005a7..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLink.java
+++ /dev/null
@@ -1,190 +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.client.api.domain;
-
-import java.net.URI;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-/**
- * OData link.
- */
-public class ODataLink extends ODataItem {
-
- private static final long serialVersionUID = 7274966414277952124L;
-
- public static class Builder {
-
- private ODataServiceVersion version;
-
- private URI uri;
-
- private ODataLinkType type;
-
- private String title;
-
- private String mediaETag;
-
- public Builder setVersion(final ODataServiceVersion version) {
- this.version = version;
- return this;
- }
-
- public Builder setURI(final URI uri) {
- this.uri = uri;
- return this;
- }
-
- public Builder setURI(final URI baseURI, final String href) {
- this.uri = getURI(baseURI, href);
- return this;
- }
-
- public Builder setType(final ODataLinkType type) {
- this.type = type;
- return this;
- }
-
- public Builder setTitle(final String title) {
- this.title = title;
- return this;
- }
-
- public void setMediaETag(final String mediaETag) {
- this.mediaETag = mediaETag;
- }
-
- public ODataLink build() {
- ODataLink instance = new ODataLink(version, uri, type, title);
- instance.mediaETag = this.mediaETag;
- return instance;
- }
- }
-
- /**
- * Build URI starting from the given base and href.
- * <br/>
- * If href is absolute or base is null then base will be ignored.
- *
- * @param base URI prefix.
- * @param href URI suffix.
- * @return built URI.
- */
- private static URI getURI(final URI base, final String href) {
- if (href == null) {
- throw new IllegalArgumentException("Null link provided");
- }
-
- URI uri = URI.create(href);
-
- if (!uri.isAbsolute() && base != null) {
- uri = URI.create(base.toASCIIString() + "/" + href);
- }
-
- return uri.normalize();
- }
-
- /**
- * Link type.
- */
- protected final ODataLinkType type;
-
- /**
- * Link rel.
- */
- protected final String rel;
-
- /**
- * ETag for media edit links.
- */
- private String mediaETag;
-
- /**
- * Constructor.
- *
- * @param version OData service version.
- * @param uri URI.
- * @param type type.
- * @param title title.
- */
- protected ODataLink(final ODataServiceVersion version, final URI uri, final ODataLinkType type, final String title) {
- super(title);
-
- this.link = uri;
- this.type = type;
-
- switch (this.type) {
- case ASSOCIATION:
- this.rel = version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL) + title;
- break;
-
- case ENTITY_NAVIGATION:
- case ENTITY_SET_NAVIGATION:
- this.rel = version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL) + title;
- break;
-
- case MEDIA_EDIT:
- default:
- this.rel = version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL) + title;
- break;
- }
- }
-
- /**
- * Constructor.
- *
- * @param version OData service version.
- * @param baseURI base URI.
- * @param href href.
- * @param type type.
- * @param title title.
- */
- protected ODataLink(final ODataServiceVersion version,
- final URI baseURI, final String href, final ODataLinkType type, final String title) {
-
- this(version, getURI(baseURI, href), type, title);
- }
-
- /**
- * Gets link type.
- *
- * @return link type;
- */
- public ODataLinkType getType() {
- return type;
- }
-
- /**
- * Gets link rel.
- *
- * @return link rel
- */
- public String getRel() {
- return rel;
- }
-
- /**
- * Gets Media ETag.
- *
- * @return media ETag
- */
- public String getMediaETag() {
- return mediaETag;
- }
-
-}
[16/52] [abbrv] git commit: [OLINGO-65] Former ODataJClient's main
type management classes removed
Posted by sk...@apache.org.
[OLINGO-65] Former ODataJClient's main type management classes removed
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/5a15155c
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/5a15155c
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/5a15155c
Branch: refs/heads/olingo-206-validator
Commit: 5a15155ca9311e9af847bab5d9ee2c49fe2f153a
Parents: 559698d
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Mar 21 13:17:37 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Mar 21 13:17:37 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/CommonODataClient.java | 2 +-
.../invoke/CommonInvokeRequestFactory.java | 19 +-
.../request/invoke/v3/InvokeRequestFactory.java | 3 +-
.../request/invoke/v4/InvokeRequestFactory.java | 3 +-
.../domain/ODataJClientEdmPrimitiveType.java | 271 -------------------
.../client/api/domain/ODataJClientEdmType.java | 252 -----------------
.../olingo/client/api/utils/URIUtils.java | 7 +-
.../invoke/AbstractInvokeRequestFactory.java | 22 +-
.../invoke/v3/InvokeRequestFactoryImpl.java | 76 ++++--
.../invoke/v4/InvokeRequestFactoryImpl.java | 18 +-
.../core/data/AtomPropertyDeserializer.java | 24 +-
11 files changed, 95 insertions(+), 602 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
index d0aef17..1ad480a 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
@@ -70,7 +70,7 @@ public interface CommonODataClient {
CommonStreamedRequestFactory getStreamedRequestFactory();
- CommonInvokeRequestFactory<?> getInvokeRequestFactory();
+ CommonInvokeRequestFactory getInvokeRequestFactory();
CommonBatchRequestFactory getBatchRequestFactory();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
index 8449798..e7104bc 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/CommonInvokeRequestFactory.java
@@ -20,39 +20,42 @@ package org.apache.olingo.client.api.communication.request.invoke;
import java.io.Serializable;
import java.net.URI;
-import java.util.Map;
+import java.util.LinkedHashMap;
import org.apache.olingo.client.api.domain.ODataInvokeResult;
import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
/**
* OData request factory class.
*/
-public interface CommonInvokeRequestFactory<FI extends CommonFunctionImport> extends Serializable {
+public interface CommonInvokeRequestFactory extends Serializable {
/**
* Gets an invoke request instance.
*
* @param <RES> OData domain object result, derived from return type defined in the function import
* @param uri URI that identifies the function import
- * @param metadata Edm metadata
+ * @param edm Edm metadata
+ * @param container Entity container
* @param functionImport function import to be invoked
* @return new ODataInvokeRequest instance.
*/
<RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
- URI uri, XMLMetadata metadata, FI functionImport);
+ URI uri, Edm edm, FullQualifiedName container, String functionImport);
/**
* Gets an invoke request instance.
*
* @param <RES> OData domain object result, derived from return type defined in the function import
* @param uri URI that identifies the function import
- * @param metadata Edm metadata
+ * @param edm Edm metadata
+ * @param container Entity container
* @param functionImport function import to be invoked
* @param parameters parameters to pass to function import invocation
* @return new ODataInvokeRequest instance.
*/
<RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
- URI uri, XMLMetadata metadata, FI functionImport, Map<String, ODataValue> parameters);
+ URI uri, Edm edm, FullQualifiedName container, String functionImport,
+ LinkedHashMap<String, ODataValue> parameters);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java
index 12d5b24..476678e 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java
@@ -19,7 +19,6 @@
package org.apache.olingo.client.api.communication.request.invoke.v3;
import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
-import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
-public interface InvokeRequestFactory extends CommonInvokeRequestFactory<FunctionImport> {
+public interface InvokeRequestFactory extends CommonInvokeRequestFactory {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java
index c2f194d..c9278f4 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java
@@ -19,7 +19,6 @@
package org.apache.olingo.client.api.communication.request.invoke.v4;
import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
-import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
-public interface InvokeRequestFactory extends CommonInvokeRequestFactory<FunctionImport> {
+public interface InvokeRequestFactory extends CommonInvokeRequestFactory {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
deleted file mode 100644
index 5ea5edf..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
+++ /dev/null
@@ -1,271 +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.client.api.domain;
-
-import java.math.BigDecimal;
-import java.net.URI;
-import java.util.UUID;
-
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-import org.apache.olingo.commons.api.edm.geo.LineString;
-import org.apache.olingo.commons.api.edm.geo.MultiLineString;
-import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
-import org.apache.olingo.commons.api.edm.geo.Point;
-import org.apache.olingo.commons.api.edm.geo.Polygon;
-
-/**
- * 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>
- * TODO: MERGE / REMOVE (OLINGO-65)!
- */
-public enum ODataJClientEdmPrimitiveType {
-
- /**
- * 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.
- */
- ODataJClientEdmPrimitiveType(final Class<?> clazz) {
- this(ODataServiceVersion.values(), clazz, null);
- }
-
- /**
- * Constructor.
- *
- * @param versions supported OData versions.
- * @param clazz type.
- */
- ODataJClientEdmPrimitiveType(final ODataServiceVersion[] versions, final Class<?> clazz) {
- this(versions, clazz, null);
- }
-
- /**
- * Constructor (all OData versions).
- *
- * @param clazz type.
- * @param pattern pattern.
- */
- ODataJClientEdmPrimitiveType(final Class<?> clazz, final String pattern) {
- this(ODataServiceVersion.values(), clazz, pattern);
- }
-
- /**
- * Constructor.
- *
- * @param versions supported OData versions.
- * @param clazz type.
- * @param pattern pattern.
- */
- ODataJClientEdmPrimitiveType(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 ODataJClientEdmPrimitiveType fromValue(final String value) {
- final String noNsValue = value.substring(4);
- for (ODataJClientEdmPrimitiveType edmSimpleType : ODataJClientEdmPrimitiveType.values()) {
- if (edmSimpleType.name().equals(noNsValue)) {
- return edmSimpleType;
- }
- }
- throw new IllegalArgumentException(value);
- }
-
- /**
- * Gets namespace.
- *
- * @return namespace.
- */
- public static String namespace() {
- return "Edm";
- }
-
- public ODataServiceVersion[] getSupportedVersions() {
- return versions.clone();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmType.java
deleted file mode 100644
index 7fcfad6..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmType.java
+++ /dev/null
@@ -1,252 +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.client.api.domain;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.edm.xml.ComplexType;
-import org.apache.olingo.client.api.edm.xml.EntityType;
-import org.apache.olingo.client.api.edm.xml.EnumType;
-import org.apache.olingo.client.api.edm.xml.Schema;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-
-/**
- * Parse type information from metadata into semantic data. TODO: REMOVE! (OLINGO-165)
- */
-public class ODataJClientEdmType {
-
- private final String typeExpression;
-
- private final String baseType;
-
- private final String namespaceOrAlias;
-
- private boolean collection;
-
- private ODataJClientEdmPrimitiveType primitiveType;
-
- private EnumType enumType;
-
- private ComplexType complexType;
-
- private EntityType entityType;
-
- /**
- * Constructor.
- *
- * @param typeExpression type expression.
- */
- public ODataJClientEdmType(final String typeExpression) {
- this(null, typeExpression);
- }
-
- /**
- * Constructor.
- *
- * @param metadata metadata.
- * @param typeExpression type expression.
- */
- public ODataJClientEdmType(final XMLMetadata metadata, final String typeExpression) {
- this.typeExpression = typeExpression;
-
- final int collectionStartIdx = typeExpression.indexOf("Collection(");
- final int collectionEndIdx = typeExpression.lastIndexOf(')');
- if (collectionStartIdx == -1) {
- baseType = typeExpression;
- } else {
- if (collectionEndIdx == -1) {
- throw new IllegalArgumentException("Malformed type: " + typeExpression);
- }
-
- this.collection = true;
- baseType = typeExpression.substring(collectionStartIdx + 11, collectionEndIdx);
- }
-
- final int lastDotIdx = baseType.lastIndexOf('.');
- if (lastDotIdx == -1) {
- throw new IllegalArgumentException("Cannot find namespace or alias in " + typeExpression);
- }
- namespaceOrAlias = baseType.substring(0, lastDotIdx);
- final String typeName = baseType.substring(lastDotIdx + 1);
- if (StringUtils.isBlank(typeName)) {
- throw new IllegalArgumentException("Null or empty type name in " + typeExpression);
- }
-
- if (namespaceOrAlias.equals(ODataJClientEdmPrimitiveType.namespace())) {
- this.primitiveType = ODataJClientEdmPrimitiveType.fromValue(
- ODataJClientEdmPrimitiveType.namespace() + "." + typeName);
- } else if (metadata != null) {
- if (!metadata.isNsOrAlias(namespaceOrAlias)) {
- throw new IllegalArgumentException("Illegal namespace or alias: " + namespaceOrAlias);
- }
- final Schema schema = metadata.getSchema(namespaceOrAlias);
-
- for (EnumType type : schema.getEnumTypes()) {
- if (typeName.equals(type.getName())) {
- this.enumType = type;
- }
- }
- if (this.enumType == null) {
- for (ComplexType type : schema.getComplexTypes()) {
- if (typeName.equals(type.getName())) {
- this.complexType = type;
- }
- }
- if (this.complexType == null) {
- for (EntityType type : schema.getEntityTypes()) {
- if (typeName.equals(type.getName())) {
- this.entityType = type;
- }
- }
- }
- }
-
- if (!isPrimitiveType() && !isEnumType() && !isComplexType() && !isEntityType()) {
- throw new IllegalArgumentException("Could not parse type information out of " + typeExpression);
- }
- }
- }
-
- /**
- * Checks if is a collection.
- *
- * @return 'TRUE' if is a collection; 'FALSE' otherwise.
- */
- public final boolean isCollection() {
- return this.collection;
- }
-
- /**
- * Checks if is a simple type.
- *
- * @return 'TRUE' if is a simple type; 'FALSE' otherwise.
- */
- public final boolean isPrimitiveType() {
- return this.primitiveType != null;
- }
-
- public boolean isGeospatialType() {
- return isPrimitiveType() && this.primitiveType.isGeospatial();
- }
-
- /**
- * Gets type as a simple type.
- *
- * @return simple type. An <tt>EdmTypeNotFoundException</tt> will be raised if it is not a simple type.
- */
- public final ODataJClientEdmPrimitiveType getPrimitiveType() {
- if (!isPrimitiveType()) {
- throw new IllegalArgumentException("Cannot find Primitive in " + this.typeExpression);
- }
-
- return this.primitiveType;
- }
-
- /**
- * Checks if is an enum type.
- *
- * @return 'TRUE' if is an enum type; 'FALSE' otherwise.
- */
- public final boolean isEnumType() {
- return this.enumType != null;
- }
-
- /**
- * Gets type as enum type.
- *
- * @return enum type. An <tt>EdmTypeNotFoundException</tt> will be raised if it is not an enum type.
- */
- public final EnumType getEnumType() {
- if (!isEnumType()) {
- throw new IllegalArgumentException("Cannot find Enum in " + this.typeExpression);
- }
-
- return this.enumType;
- }
-
- /**
- * Checks if is a complex type.
- *
- * @return 'TRUE' if is a complex type; 'FALSE' otherwise.
- */
- public final boolean isComplexType() {
- return this.complexType != null;
- }
-
- /**
- * Gets type as complex type.
- *
- * @return complex type. An <tt>EdmTypeNotFoundException</tt> will be raised if it is not a complex type.
- */
- public final ComplexType getComplexType() {
- if (!isComplexType()) {
- throw new IllegalArgumentException("Cannot find Complex in " + this.typeExpression);
- }
-
- return this.complexType;
- }
-
- /**
- * Checks if is an entity type.
- *
- * @return 'TRUE' if is an entity type; 'FALSE' otherwise.
- */
- public final boolean isEntityType() {
- return this.entityType != null;
- }
-
- /**
- * Gets type as entity type.
- *
- * @return entity type. An <tt>EdmTypeNotFoundException</tt> will be raised if it is not an entity type.
- */
- public final EntityType getEntityType() {
- if (!isEntityType()) {
- throw new IllegalArgumentException("Cannot find Entity in " + this.typeExpression);
- }
-
- return this.entityType;
- }
-
- /**
- * Gets base type.
- *
- * @return base type.
- */
- public String getBaseType() {
- return baseType;
- }
-
- /**
- * Gets type expression.
- *
- * @return type expression.
- */
- public String getTypeExpression() {
- return typeExpression;
- }
-
- /**
- * Gets namespace or alias retrieved from the provided type expression.
- *
- * @return namespace or alias.
- */
- public String getNamespaceOrAlias() {
- return namespaceOrAlias;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5a15155c/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
index 3885ead..9ba47da 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/URIUtils.java
@@ -32,7 +32,6 @@ import org.apache.commons.io.IOUtils;
import org.apache.http.entity.InputStreamEntity;
import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataDuration;
import org.apache.olingo.client.api.domain.ODataTimestamp;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
@@ -158,11 +157,11 @@ public final class URIUtils {
: (obj instanceof ODataDuration)
? "time'" + ((ODataDuration) obj).toString() + "'"
: (obj instanceof BigDecimal)
- ? new DecimalFormat(ODataJClientEdmPrimitiveType.Decimal.pattern()).format((BigDecimal) obj) + "M"
+ ? new DecimalFormat("#.#######################").format((BigDecimal) obj) + "M"
: (obj instanceof Double)
- ? new DecimalFormat(ODataJClientEdmPrimitiveType.Double.pattern()).format((Double) obj) + "D"
+ ? new DecimalFormat("#.#######################E0").format((Double) obj) + "D"
: (obj instanceof Float)
- ? new DecimalFormat(ODataJClientEdmPrimitiveType.Single.pattern()).format((Float) obj) + "f"
+ ? new DecimalFormat("#.#######E0").format((Float) obj) + "f"
: (obj instanceof Long)
? ((Long) obj).toString() + "L"
: (obj instanceof String)
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5a15155c/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
index 64aa550..a9c6dfc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java
@@ -19,17 +19,14 @@
package org.apache.olingo.client.core.communication.request.invoke;
import java.net.URI;
-import java.util.Map;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
-public abstract class AbstractInvokeRequestFactory<FI extends CommonFunctionImport>
- implements CommonInvokeRequestFactory<FI> {
+public abstract class AbstractInvokeRequestFactory implements CommonInvokeRequestFactory {
private static final long serialVersionUID = -906760270085197249L;
@@ -40,13 +37,10 @@ public abstract class AbstractInvokeRequestFactory<FI extends CommonFunctionImpo
}
@Override
- public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
- final URI uri,
- final XMLMetadata metadata,
- final FI functionImport,
- final Map<String, ODataValue> parameters) {
- final ODataInvokeRequest<RES> result = getInvokeRequest(uri, metadata, functionImport);
- result.setParameters(parameters);
- return result;
+ public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(final URI uri, final Edm edm,
+ final FullQualifiedName container, final String functionImport) {
+
+ return getInvokeRequest(uri, edm, container, functionImport, null);
}
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5a15155c/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
index e387b2e..f5cb270 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
@@ -19,7 +19,8 @@
package org.apache.olingo.client.core.communication.request.invoke.v3;
import java.net.URI;
-import org.apache.commons.lang3.StringUtils;
+import java.util.LinkedHashMap;
+import java.util.List;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
@@ -27,16 +28,22 @@ import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeReques
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.domain.ODataJClientEdmType;
import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
+import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.invoke.AbstractInvokeRequestFactory;
import org.apache.olingo.client.core.communication.request.invoke.ODataInvokeRequestImpl;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmActionImport;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.EdmReturnType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<FunctionImport>
- implements InvokeRequestFactory {
+public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory implements InvokeRequestFactory {
private static final long serialVersionUID = -659256862901915496L;
@@ -44,40 +51,53 @@ public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<Funct
super(client);
}
- /**
- * {@inheritDoc}
- */
@Override
- @SuppressWarnings("unchecked")
- public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
- final URI uri,
- final XMLMetadata metadata,
- final FunctionImport functionImport) {
+ public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(final URI uri, final Edm edm,
+ final FullQualifiedName container, final String functionImport,
+ final LinkedHashMap<String, ODataValue> parameters) {
+
+ final EdmEntityContainer edmContainer = edm.getEntityContainer(container);
+ if (edmContainer == null) {
+ throw new IllegalArgumentException("Could not find container " + container.toString());
+ }
+
+ final HttpMethod method;
+ final EdmReturnType returnType;
+ final EdmFunctionImport edmFunctionImport = edmContainer.getFunctionImport(functionImport);
+ final EdmActionImport edmActionImport = edmContainer.getActionImport(functionImport);
+ if (edmFunctionImport == null && edmActionImport == null) {
+ throw new IllegalArgumentException("Could not find function import " + functionImport
+ + " in the given container");
+ } else if (edmFunctionImport == null) {
+ final EdmAction action = edmActionImport.getAction();
+ if (action == null) {
+ throw new IllegalArgumentException("Could not find function import " + functionImport
+ + " in the given container");
+ }
- HttpMethod method = null;
- if (HttpMethod.GET.name().equals(functionImport.getHttpMethod())) {
- method = HttpMethod.GET;
- } else if (HttpMethod.POST.name().equals(functionImport.getHttpMethod())) {
method = HttpMethod.POST;
- } else if (functionImport.getHttpMethod() == null) {
- if (functionImport.isSideEffecting()) {
- method = HttpMethod.POST;
- } else {
- method = HttpMethod.GET;
+ returnType = action.getReturnType();
+ } else {
+ final EdmFunction function = edmFunctionImport.getFunction(
+ parameters == null ? null : (List<String>) parameters.keySet());
+ if (function == null) {
+ throw new IllegalArgumentException("Could not find function import " + functionImport
+ + " in the given container");
}
+
+ method = HttpMethod.GET;
+ returnType = function.getReturnType();
}
ODataInvokeRequest<RES> result;
- if (StringUtils.isBlank(functionImport.getReturnType())) {
+ if (returnType == null) {
result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataNoContent>(
client, ODataNoContent.class, method, uri);
} else {
- final ODataJClientEdmType returnType = new ODataJClientEdmType(metadata, functionImport.getReturnType());
-
- if (returnType.isCollection() && returnType.isEntityType()) {
+ if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntitySet>(
client, ODataEntitySet.class, method, uri);
- } else if (!returnType.isCollection() && returnType.isEntityType()) {
+ } else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntity>(
client, ODataEntity.class, method, uri);
} else {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5a15155c/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
index ab35401..0e7f4b1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/InvokeRequestFactoryImpl.java
@@ -19,16 +19,18 @@
package org.apache.olingo.client.core.communication.request.invoke.v4;
import java.net.URI;
+import java.util.LinkedHashMap;
+import org.apache.commons.lang3.NotImplementedException;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory;
import org.apache.olingo.client.api.domain.ODataInvokeResult;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
+import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.core.communication.request.invoke.AbstractInvokeRequestFactory;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
-public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<FunctionImport>
- implements InvokeRequestFactory {
+public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory implements InvokeRequestFactory {
private static final long serialVersionUID = 8452737360003104372L;
@@ -37,8 +39,10 @@ public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory<Funct
}
@Override
- public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
- final URI uri, final XMLMetadata metadata, final FunctionImport functionImport) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(final URI uri, final Edm edm,
+ final FullQualifiedName container, final String functionImport,
+ final LinkedHashMap<String, ODataValue> parameters) {
+
+ throw new NotImplementedException("Not available yet.");
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5a15155c/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
index 00e6ac7..9780e12 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
@@ -28,8 +28,8 @@ import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.CollectionValue;
import org.apache.olingo.client.api.data.ComplexValue;
import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataJClientEdmType;
import org.apache.olingo.client.api.domain.ODataPropertyType;
+import org.apache.olingo.client.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -43,7 +43,7 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
}
private Value fromPrimitive(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmType typeInfo) throws XMLStreamException {
+ final EdmTypeInfo typeInfo) throws XMLStreamException {
Value value = null;
@@ -52,14 +52,15 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
final XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
- if (typeInfo != null && typeInfo.isGeospatialType()) {
- final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getBaseType());
+ if (typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+ final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(
+ version, typeInfo.getFullQualifiedName().toString());
value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
}
}
if (event.isCharacters() && !event.asCharacters().isWhiteSpace()
- && (typeInfo == null || !typeInfo.isGeospatialType())) {
+ && (typeInfo == null || !typeInfo.getPrimitiveTypeKind().isGeospatial())) {
value = new PrimitiveValueImpl(event.asCharacters().getData());
}
@@ -94,13 +95,13 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
}
private CollectionValue fromCollection(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmType typeInfo) throws XMLStreamException {
+ final EdmTypeInfo typeInfo) throws XMLStreamException {
final CollectionValueImpl value = new CollectionValueImpl();
- final ODataJClientEdmType type = typeInfo == null
+ final EdmTypeInfo type = typeInfo == null
? null
- : new ODataJClientEdmType(typeInfo.getBaseType());
+ : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
boolean foundEndProperty = false;
while (reader.hasNext() && !foundEndProperty) {
@@ -176,12 +177,9 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
Value value;
final Attribute nullAttr = start.getAttributeByName(this.nullQName);
if (nullAttr == null) {
- final ODataJClientEdmType typeInfo = StringUtils.isBlank(property.getType())
+ final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
? null
- : new ODataJClientEdmType(property.getType());
-// final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
-// ? null
-// : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
+ : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
final ODataPropertyType propType = typeInfo == null
? guessPropertyType(reader)
[46/52] [abbrv] [OLINGO-205, OLINGO-200, OLINGO-65] merge
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --cc lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index 0000000,f42fe00..b8775d5
mode 000000,100644..100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@@ -1,0 -1,370 +1,368 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ package org.apache.olingo.commons.core.data;
+
+ import java.io.InputStream;
+ import java.net.URI;
+ import java.text.ParseException;
+ import javax.xml.namespace.QName;
+ import javax.xml.stream.XMLEventReader;
+ import javax.xml.stream.XMLInputFactory;
+ import javax.xml.stream.XMLStreamException;
+ import javax.xml.stream.events.Attribute;
+ import javax.xml.stream.events.StartElement;
+ import javax.xml.stream.events.XMLEvent;
+ import org.apache.olingo.commons.api.Constants;
+ import org.apache.olingo.commons.api.domain.ODataOperation;
+ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+ import org.apache.olingo.commons.api.format.ContentType;
+ import org.apache.olingo.commons.core.data.v3.XMLLinkCollectionImpl;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
+
+ public class AtomDeserializer extends AbstractAtomDealer {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AtomDeserializer.class);
+
+ private static final XMLInputFactory FACTORY = XMLInputFactory.newInstance();
+
+ private final AtomPropertyDeserializer propDeserializer;
+
+ public AtomDeserializer(final ODataServiceVersion version) {
+ super(version);
+ this.propDeserializer = new AtomPropertyDeserializer(version);
+ }
+
+ private AtomPropertyImpl property(final InputStream input) throws XMLStreamException {
+ final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+ return propDeserializer.deserialize(reader, skipBeforeFirstStartElement(reader));
+ }
+
+ private StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
+ StartElement startEvent = null;
+ while (reader.hasNext() && startEvent == null) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ startEvent = event.asStartElement();
+ }
+ }
+ if (startEvent == null) {
+ throw new IllegalArgumentException("Cannot find any XML start element");
+ }
+
+ return startEvent;
+ }
+
+ private void common(final XMLEventReader reader, final StartElement start,
+ final AbstractAtomObject object, final String key) throws XMLStreamException {
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ try {
+ object.setCommonProperty(key, event.asCharacters().getData());
+ } catch (ParseException e) {
+ throw new XMLStreamException("While parsing Atom entry or feed common elements", e);
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private void inline(final XMLEventReader reader, final StartElement start, final LinkImpl link)
+ throws XMLStreamException {
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && inlineQName.equals(event.asStartElement().getName())) {
+ StartElement inline = null;
+ while (reader.hasNext() && inline == null) {
+ final XMLEvent innerEvent = reader.peek();
+ if (innerEvent.isCharacters() && innerEvent.asCharacters().isWhiteSpace()) {
+ reader.nextEvent();
+ } else if (innerEvent.isStartElement()) {
+ inline = innerEvent.asStartElement();
+ }
+ }
+ if (inline != null) {
+ if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(inline.getName())) {
+ link.setInlineEntry(entry(reader, inline));
+ }
+ if (Constants.QNAME_ATOM_ELEM_FEED.equals(inline.getName())) {
+ link.setInlineFeed(feed(reader, inline));
+ }
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private XMLLinkCollectionImpl linkCollection(final InputStream input) throws XMLStreamException {
+ final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+
+ final XMLLinkCollectionImpl linkCollection = new XMLLinkCollectionImpl();
+
+ boolean isURI = false;
+ boolean isNext = false;
+ while (reader.hasNext()) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ isURI = uriQName.equals(event.asStartElement().getName());
+ isNext = nextQName.equals(event.asStartElement().getName());
+ }
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ if (isURI) {
+ linkCollection.getLinks().add(URI.create(event.asCharacters().getData()));
+ isURI = false;
+ } else if (isNext) {
+ linkCollection.setNext(URI.create(event.asCharacters().getData()));
+ isNext = false;
+ }
+ }
+ }
+
+ return linkCollection;
+ }
+
+ private void properties(final XMLEventReader reader, final StartElement start, final AtomEntryImpl entry)
+ throws XMLStreamException {
-
+ boolean foundEndProperties = false;
+ while (reader.hasNext() && !foundEndProperties) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ entry.getProperties().add(propDeserializer.deserialize(reader, event.asStartElement()));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperties = true;
+ }
+ }
+ }
+
+ private AtomEntryImpl entry(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
+ if (!Constants.QNAME_ATOM_ELEM_ENTRY.equals(start.getName())) {
+ return null;
+ }
+
+ final AtomEntryImpl entry = new AtomEntryImpl();
+ final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
+ if (xmlBase != null) {
+ entry.setBaseURI(xmlBase.getValue());
+ }
+ final Attribute etag = start.getAttributeByName(etagQName);
+ if (etag != null) {
+ entry.setETag(etag.getValue());
+ }
+
+ boolean foundEndEntry = false;
+ while (reader.hasNext() && !foundEndEntry) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entry, "id");
+ } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entry, "title");
+ } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entry, "summary");
+ } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entry, "updated");
+ } else if (Constants.QNAME_ATOM_ELEM_CATEGORY.equals(event.asStartElement().getName())) {
+ final Attribute term = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_TERM));
+ if (term != null) {
+ entry.setType(term.getValue());
+ }
+ } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
+ final LinkImpl link = new LinkImpl();
+ final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
+ if (rel != null) {
+ link.setRel(rel.getValue());
+ }
+ final Attribute title = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TITLE));
+ if (title != null) {
+ link.setTitle(title.getValue());
+ }
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ link.setHref(href.getValue());
+ }
+ final Attribute type = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE));
+ if (type != null) {
+ link.setType(type.getValue());
+ }
+
+ if (Constants.SELF_LINK_REL.equals(link.getRel())) {
+ entry.setSelfLink(link);
+ } else if (Constants.EDIT_LINK_REL.equals(link.getRel())) {
+ entry.setEditLink(link);
+ } else if (link.getRel().startsWith(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL))) {
+ entry.getNavigationLinks().add(link);
+ inline(reader, event.asStartElement(), link);
+ } else if (link.getRel().startsWith(
+ version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL))) {
+
+ entry.getAssociationLinks().add(link);
+ } else if (link.getRel().startsWith(
+ version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL))) {
+
+ final Attribute metag = event.asStartElement().getAttributeByName(etagQName);
+ if (metag != null) {
+ link.setMediaETag(metag.getValue());
+ }
+ entry.getMediaEditLinks().add(link);
+ }
+ } else if (actionQName.equals(event.asStartElement().getName())) {
+ final ODataOperation operation = new ODataOperation();
+ final Attribute metadata = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_METADATA));
+ if (metadata != null) {
+ operation.setMetadataAnchor(metadata.getValue());
+ }
+ final Attribute title = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TITLE));
+ if (title != null) {
+ operation.setTitle(title.getValue());
+ }
+ final Attribute target = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TARGET));
+ if (target != null) {
+ operation.setTarget(URI.create(target.getValue()));
+ }
+
+ entry.getOperations().add(operation);
+ } else if (Constants.QNAME_ATOM_ELEM_CONTENT.equals(event.asStartElement().getName())) {
+ final Attribute type = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE));
+ if (type == null || ContentType.APPLICATION_XML.equals(type.getValue())) {
+ properties(reader, skipBeforeFirstStartElement(reader), entry);
+ } else {
+ entry.setMediaContentType(type.getValue());
+ final Attribute src = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_SRC));
+ if (src != null) {
+ entry.setMediaContentSource(src.getValue());
+ }
+ }
+ } else if (propertiesQName.equals(event.asStartElement().getName())) {
+ properties(reader, event.asStartElement(), entry);
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndEntry = true;
+ }
+ }
+
+ return entry;
+ }
+
+ private AtomEntryImpl entry(final InputStream input) throws XMLStreamException {
+ final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+ return entry(reader, skipBeforeFirstStartElement(reader));
+ }
+
+ private void count(final XMLEventReader reader, final StartElement start, final AtomFeedImpl feed)
+ throws XMLStreamException {
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ feed.setCount(Integer.valueOf(event.asCharacters().getData()));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private AtomFeedImpl feed(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
+ if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) {
+ return null;
+ }
+
+ final AtomFeedImpl feed = new AtomFeedImpl();
+ final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
+ if (xmlBase != null) {
+ feed.setBaseURI(xmlBase.getValue());
+ }
+
+ boolean foundEndFeed = false;
+ while (reader.hasNext() && !foundEndFeed) {
+ final XMLEvent event = reader.nextEvent();
-
+ if (event.isStartElement()) {
+ if (countQName.equals(event.asStartElement().getName())) {
+ count(reader, event.asStartElement(), feed);
+ } else if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), feed, "id");
+ } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), feed, "title");
+ } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), feed, "summary");
+ } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), feed, "updated");
+ } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
+ final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
+ if (rel != null && Constants.NEXT_LINK_REL.equals(rel.getValue())) {
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ feed.setNext(URI.create(href.getValue()));
+ }
+ }
+ } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(event.asStartElement().getName())) {
+ feed.getEntries().add(entry(reader, event.asStartElement()));
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndFeed = true;
+ }
+ }
+
+ return feed;
+ }
+
+ private AtomFeedImpl feed(final InputStream input) throws XMLStreamException {
+ final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+ return feed(reader, skipBeforeFirstStartElement(reader));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T read(final InputStream input, final Class<T> reference) throws XMLStreamException {
+ if (AtomFeedImpl.class.equals(reference)) {
+ return (T) feed(input);
+ } else if (AtomEntryImpl.class.equals(reference)) {
+ return (T) entry(input);
+ } else if (AtomPropertyImpl.class.equals(reference)) {
+ return (T) property(input);
+ } else if (XMLLinkCollectionImpl.class.equals(reference)) {
+ return (T) linkCollection(input);
+ }
+ return null;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --cc lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
index 0000000,99231b4..91ad49a
mode 000000,100644..100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
@@@ -1,0 -1,214 +1,218 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ package org.apache.olingo.commons.core.data;
+
+ import javax.xml.stream.XMLEventReader;
+ import javax.xml.stream.XMLStreamException;
+ import javax.xml.stream.events.Attribute;
+ import javax.xml.stream.events.StartElement;
+ import javax.xml.stream.events.XMLEvent;
+ import org.apache.commons.lang3.StringUtils;
+ import org.apache.olingo.commons.api.Constants;
+ import org.apache.olingo.commons.api.data.CollectionValue;
+ import org.apache.olingo.commons.api.data.ComplexValue;
+ import org.apache.olingo.commons.api.data.Value;
+ import org.apache.olingo.commons.api.domain.ODataPropertyType;
+ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+ import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+ class AtomPropertyDeserializer extends AbstractAtomDealer {
+
+ private final AtomGeoValueDeserializer geoDeserializer;
+
+ public AtomPropertyDeserializer(final ODataServiceVersion version) {
+ super(version);
+ this.geoDeserializer = new AtomGeoValueDeserializer();
+ }
+
+ private Value fromPrimitive(final XMLEventReader reader, final StartElement start,
+ final EdmTypeInfo typeInfo) throws XMLStreamException {
+
+ Value value = null;
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+ final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(
+ version, typeInfo.getFullQualifiedName().toString());
+ value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
+ }
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()
+ && (typeInfo == null || !typeInfo.getPrimitiveTypeKind().isGeospatial())) {
+
+ value = new PrimitiveValueImpl(event.asCharacters().getData());
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return value;
+ }
+
+ private ComplexValue fromComplex(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException {
+
+ final ComplexValue value = new ComplexValueImpl();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ value.get().add(deserialize(reader, event.asStartElement()));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return value;
+ }
+
+ private CollectionValue fromCollection(final XMLEventReader reader, final StartElement start,
+ final EdmTypeInfo typeInfo) throws XMLStreamException {
+
+ final CollectionValueImpl value = new CollectionValueImpl();
+
+ final EdmTypeInfo type = typeInfo == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ switch (guessPropertyType(reader)) {
+ case COMPLEX:
+ value.get().add(fromComplex(reader, event.asStartElement()));
+ break;
+
+ case PRIMITIVE:
+ value.get().add(fromPrimitive(reader, event.asStartElement(), type));
+ break;
+
+ default:
+ // do not add null or empty values
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return value;
+ }
+
+ private ODataPropertyType guessPropertyType(final XMLEventReader reader) throws XMLStreamException {
+ XMLEvent child = null;
+ while (reader.hasNext() && child == null) {
+ final XMLEvent event = reader.peek();
+ if (event.isCharacters() && event.asCharacters().isWhiteSpace()) {
+ reader.nextEvent();
+ } else {
+ child = event;
+ }
+ }
+
- ODataPropertyType type = null;
++ final ODataPropertyType type;
+ if (child == null) {
+ type = ODataPropertyType.PRIMITIVE;
+ } else {
+ if (child.isStartElement()) {
+ if (Constants.NS_GML.equals(child.asStartElement().getName().getNamespaceURI())) {
+ type = ODataPropertyType.PRIMITIVE;
+ } else if (elementQName.equals(child.asStartElement().getName())) {
+ type = ODataPropertyType.COLLECTION;
+ } else {
+ type = ODataPropertyType.COMPLEX;
+ }
+ } else if (child.isCharacters()) {
+ type = ODataPropertyType.PRIMITIVE;
+ } else {
+ type = ODataPropertyType.EMPTY;
+ }
+ }
+
+ return type;
+ }
+
+ public AtomPropertyImpl deserialize(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException {
+
+ final AtomPropertyImpl property = new AtomPropertyImpl();
+ property.setName(start.getName().getLocalPart());
+
+ final Attribute typeAttr = start.getAttributeByName(this.typeQName);
- if (typeAttr != null) {
- property.setType(typeAttr.getValue());
- }
+
+ Value value;
+ final Attribute nullAttr = start.getAttributeByName(this.nullQName);
++ final String typeAttrValue = typeAttr == null ? null : typeAttr.getValue();
++
+ if (nullAttr == null) {
- final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
++ final EdmTypeInfo typeInfo = StringUtils.isBlank(typeAttrValue)
+ ? null
- : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
++ : new EdmTypeInfo.Builder().setTypeExpression(typeAttrValue).build();
++
++ if (typeInfo != null) {
++ property.setType(typeInfo.getTypeExpression());
++ }
+
+ final ODataPropertyType propType = typeInfo == null
+ ? guessPropertyType(reader)
+ : typeInfo.isCollection()
+ ? ODataPropertyType.COLLECTION
+ : typeInfo.isPrimitiveType()
+ ? ODataPropertyType.PRIMITIVE
+ : ODataPropertyType.COMPLEX;
+
+ switch (propType) {
+ case COLLECTION:
+ value = fromCollection(reader, start, typeInfo);
+ break;
+
+ case COMPLEX:
+ value = fromComplex(reader, start);
+ break;
+
+ case PRIMITIVE:
+ value = fromPrimitive(reader, start, typeInfo);
+ break;
+
+ case EMPTY:
+ default:
+ value = new PrimitiveValueImpl(StringUtils.EMPTY);
+ }
+ } else {
+ value = new NullValueImpl();
+ }
++
+ property.setValue(value);
+
+ return property;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java
----------------------------------------------------------------------
diff --cc lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java
index 0000000,f1863a7..c544f73
mode 000000,100644..100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java
@@@ -1,0 -1,274 +1,273 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ package org.apache.olingo.commons.core.data;
+
+ import com.fasterxml.jackson.databind.JsonNode;
+ import java.util.ArrayList;
+ import java.util.Collections;
+ import java.util.Iterator;
+ import java.util.List;
+ import org.apache.olingo.commons.api.Constants;
+ import org.apache.olingo.commons.api.data.GeoUtils;
+ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+ import org.apache.olingo.commons.api.edm.geo.Geospatial;
+ import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+ import org.apache.olingo.commons.api.edm.geo.LineString;
+ import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+ import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+ import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+ import org.apache.olingo.commons.api.edm.geo.Point;
+ import org.apache.olingo.commons.api.edm.geo.Polygon;
+ import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+ import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
+
+ class JSONGeoValueDeserializer {
+
+ private final ODataServiceVersion version;
+
+ public JSONGeoValueDeserializer(final ODataServiceVersion version) {
+ this.version = version;
+ }
+
+ private Point point(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final String crs) {
+ Point point = null;
+
+ if (itor.hasNext()) {
+ point = new Point(GeoUtils.getDimension(type), crs);
+ try {
+ point.setX(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ point.setY(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException("While deserializing point coordinates as double", e);
+ }
+ }
+
+ return point;
+ }
+
+ private MultiPoint multipoint(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
- MultiPoint multiPoint = null;
++ final MultiPoint multiPoint;
+
+ if (itor.hasNext()) {
+ final List<Point> points = new ArrayList<Point>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mpItor = itor.next().elements();
+ points.add(point(mpItor, type, crs));
+ }
+ multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, points);
+ } else {
+ multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, Collections.<Point>emptyList());
+ }
+
+ return multiPoint;
+ }
+
+ private LineString lineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
- LineString lineString = null;
++ final LineString lineString;
+
+ if (itor.hasNext()) {
+ final List<Point> points = new ArrayList<Point>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mpItor = itor.next().elements();
+ points.add(point(mpItor, type, crs));
+ }
+ lineString = new LineString(GeoUtils.getDimension(type), crs, points);
+ } else {
+ lineString = new LineString(GeoUtils.getDimension(type), crs, Collections.<Point>emptyList());
+ }
+
+ return lineString;
+ }
+
+ private MultiLineString multiLineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
- MultiLineString multiLineString = null;
++ final MultiLineString multiLineString;
+
+ if (itor.hasNext()) {
+ final List<LineString> lineStrings = new ArrayList<LineString>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mlsItor = itor.next().elements();
+ lineStrings.add(lineString(mlsItor, type, crs));
+ }
+ multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, lineStrings);
+ } else {
+ multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, Collections.<LineString>emptyList());
+ }
+
+ return multiLineString;
+ }
+
+ private Polygon polygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
+ List<Point> extPoints = null;
+ if (itor.hasNext()) {
+ final Iterator<JsonNode> extItor = itor.next().elements();
+ if (extItor.hasNext()) {
+ extPoints = new ArrayList<Point>();
+ while (extItor.hasNext()) {
+ final Iterator<JsonNode> mpItor = extItor.next().elements();
+ extPoints.add(point(mpItor, type, crs));
+ }
+ }
+ }
+
+ List<Point> intPoints = null;
+ if (itor.hasNext()) {
+ final Iterator<JsonNode> intItor = itor.next().elements();
+ if (intItor.hasNext()) {
+ intPoints = new ArrayList<Point>();
+ while (intItor.hasNext()) {
+ final Iterator<JsonNode> mpItor = intItor.next().elements();
+ intPoints.add(point(mpItor, type, crs));
+ }
+ }
+ }
+
+ return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints);
+ }
+
+ private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
- MultiPolygon multiPolygon = null;
++ final MultiPolygon multiPolygon;
+
+ if (itor.hasNext()) {
+ final List<Polygon> polygons = new ArrayList<Polygon>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mpItor = itor.next().elements();
+ polygons.add(polygon(mpItor, type, crs));
+ }
+ multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, polygons);
+ } else {
+ multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, Collections.<Polygon>emptyList());
+ }
+
+ return multiPolygon;
+ }
+
+ private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
- GeospatialCollection collection = null;
++ final GeospatialCollection collection;
+
+ if (itor.hasNext()) {
+ final List<Geospatial> geospatials = new ArrayList<Geospatial>();
+
+ while (itor.hasNext()) {
+ final JsonNode geo = itor.next();
+ final String collItemType = geo.get(Constants.ATTR_TYPE).asText();
+ final String callAsType;
+ if (EdmPrimitiveTypeKind.GeographyCollection.name().equals(collItemType)
+ || EdmPrimitiveTypeKind.GeometryCollection.name().equals(collItemType)) {
+
+ callAsType = collItemType;
+ } else {
+ callAsType = (type == EdmPrimitiveTypeKind.GeographyCollection ? "Geography" : "Geometry")
+ + collItemType;
+ }
+
+ geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build()));
+ }
+
+ collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials);
+ } else {
+ collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, Collections.<Geospatial>emptyList());
+ }
+
+ return collection;
+ }
+
+ public Geospatial deserialize(final JsonNode node, final EdmTypeInfo typeInfo) {
+ final EdmPrimitiveTypeKind actualType;
+ if ((typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geography
+ || typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geometry)
+ && node.has(Constants.ATTR_TYPE)) {
+
+ String nodeType = node.get(Constants.ATTR_TYPE).asText();
+ if (nodeType.startsWith("Geo")) {
+ final int yIdx = nodeType.indexOf('y');
+ nodeType = nodeType.substring(yIdx + 1);
+ }
+ actualType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getFullQualifiedName().toString() + nodeType);
+ } else {
+ actualType = typeInfo.getPrimitiveTypeKind();
+ }
+
+ final Iterator<JsonNode> cooItor = node.has(Constants.JSON_COORDINATES)
+ ? node.get(Constants.JSON_COORDINATES).elements()
+ : Collections.<JsonNode>emptyList().iterator();
+
+ String crs = null;
+ if (node.has(Constants.JSON_CRS)) {
+ crs = node.get(Constants.JSON_CRS).get(Constants.PROPERTIES).get(Constants.JSON_NAME).asText().split(":")[1];
+ }
+
+ Geospatial value = null;
+ switch (actualType) {
+ case GeographyPoint:
+ case GeometryPoint:
+ value = point(cooItor, actualType, crs);
+ break;
+
+ case GeographyMultiPoint:
+ case GeometryMultiPoint:
+ value = multipoint(cooItor, actualType, crs);
+ break;
+
+ case GeographyLineString:
+ case GeometryLineString:
+ value = lineString(cooItor, actualType, crs);
+ break;
+
+ case GeographyMultiLineString:
+ case GeometryMultiLineString:
+ value = multiLineString(cooItor, actualType, crs);
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ value = polygon(cooItor, actualType, crs);
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ value = multiPolygon(cooItor, actualType, crs);
+ break;
+
+ case GeographyCollection:
+ case GeometryCollection:
+ value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, crs);
+ break;
+
+ default:
+ }
+
+ return value;
+ }
-
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
----------------------------------------------------------------------
diff --cc lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
index 0000000,567950d..09e70cb
mode 000000,100644..100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
@@@ -1,0 -1,172 +1,184 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ package org.apache.olingo.commons.core.edm;
+
+ import org.apache.commons.lang3.StringUtils;
+ import org.apache.olingo.commons.api.edm.Edm;
+ import org.apache.olingo.commons.api.edm.EdmComplexType;
+ import org.apache.olingo.commons.api.edm.EdmEntityType;
+ import org.apache.olingo.commons.api.edm.EdmEnumType;
++import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+ import org.apache.olingo.commons.api.edm.FullQualifiedName;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
+
+ public class EdmTypeInfo {
+
+ private static final Logger LOG = LoggerFactory.getLogger(EdmTypeInfo.class);
+
+ public static class Builder {
+
+ private String typeExpression;
+
+ private String defaultNamespace;
+
+ private Edm edm;
+
+ public Builder setTypeExpression(final String typeExpression) {
+ this.typeExpression = typeExpression;
+ return this;
+ }
+
+ public Builder setDefaultNamespace(final String defaultNamespace) {
+ this.defaultNamespace = defaultNamespace;
+ return this;
+ }
+
+ public Builder setEdm(final Edm edm) {
+ this.edm = edm;
+ return this;
+ }
+
+ public EdmTypeInfo build() {
- return new EdmTypeInfo(edm, typeExpression.indexOf('.') == -1
++ return new EdmTypeInfo(edm, typeExpression.indexOf('.') == -1 && StringUtils.isNotBlank(defaultNamespace)
+ ? defaultNamespace + "." + typeExpression
+ : typeExpression);
+ }
+ }
-
+ private final Edm edm;
+
+ private final String typeExpression;
+
+ private final boolean collection;
+
+ private final FullQualifiedName fullQualifiedName;
+
+ private EdmPrimitiveTypeKind primitiveType;
+
+ private EdmEnumType enumType;
+
+ private EdmComplexType complexType;
+
+ private EdmEntityType entityType;
+
+ private EdmTypeInfo(final Edm edm, final String typeExpression) {
+ this.edm = edm;
- this.typeExpression = typeExpression;
+
+ String baseType;
+ final int collStartIdx = typeExpression.indexOf("Collection(");
+ final int collEndIdx = typeExpression.lastIndexOf(')');
+ if (collStartIdx == -1) {
+ baseType = typeExpression;
+ this.collection = false;
+ } else {
+ if (collEndIdx == -1) {
+ throw new IllegalArgumentException("Malformed type: " + typeExpression);
+ }
+
+ this.collection = true;
+ baseType = typeExpression.substring(collStartIdx + 11, collEndIdx);
+ }
+
++
++ baseType = baseType.replaceAll("^#", "");
++
++ final String typeName;
++ final String namespace;
++
+ final int lastDotIdx = baseType.lastIndexOf('.');
+ if (lastDotIdx == -1) {
- throw new IllegalArgumentException("Cannot find namespace or alias in " + typeExpression);
++ namespace = EdmPrimitiveType.EDM_NAMESPACE;
++ typeName = baseType;
++ baseType = new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, baseType).toString();
++ } else {
++ namespace = baseType.substring(0, lastDotIdx);
++ typeName = baseType.substring(lastDotIdx + 1);
+ }
- final String namespace = baseType.substring(0, lastDotIdx);
- final String typeName = baseType.substring(lastDotIdx + 1);
++
+ if (StringUtils.isBlank(typeName)) {
+ throw new IllegalArgumentException("Null or empty type name in " + typeExpression);
+ }
+
++ final StringBuilder exp = new StringBuilder();
++ exp.append(baseType);
++
++ this.typeExpression = (this.collection ? exp.insert(0, "Collection(").append(")") : exp).toString();
+ this.fullQualifiedName = new FullQualifiedName(namespace, typeName);
+
+ try {
+ this.primitiveType = EdmPrimitiveTypeKind.valueOf(this.fullQualifiedName.getName());
+ } catch (IllegalArgumentException e) {
+ LOG.debug("{} does not appear to refer to an Edm primitive type", this.fullQualifiedName);
+ }
+ if (this.primitiveType == null && this.edm != null) {
+ this.enumType = this.edm.getEnumType(this.fullQualifiedName);
+ if (this.enumType == null) {
+ this.complexType = this.edm.getComplexType(this.fullQualifiedName);
+ if (this.complexType == null) {
+ this.entityType = this.edm.getEntityType(this.fullQualifiedName);
+ }
+ }
+ }
+ }
+
+ public String getTypeExpression() {
+ return typeExpression;
+ }
+
+ public boolean isCollection() {
+ return collection;
+ }
+
+ public FullQualifiedName getFullQualifiedName() {
+ return fullQualifiedName;
+ }
+
+ public boolean isPrimitiveType() {
+ return this.primitiveType != null;
+ }
+
+ public EdmPrimitiveTypeKind getPrimitiveTypeKind() {
+ return primitiveType;
+ }
+
+ public boolean isEnumType() {
+ return this.enumType != null;
+ }
+
+ public EdmEnumType getEnumType() {
+ return enumType;
+ }
+
+ public boolean isComplexType() {
+ return this.complexType != null;
+ }
+
+ public EdmComplexType getComplexType() {
+ return complexType;
+ }
+
+ public boolean isEntityType() {
+ return this.entityType != null;
+ }
+
+ public EdmEntityType getEntityType() {
+ return entityType;
+ }
-
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5b5576f8/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --cc lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
index 0000000,94c43da..991e723
mode 000000,100644..100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
@@@ -1,0 -1,107 +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.commons.core.op;
+
+ import java.io.InputStream;
+ import org.apache.olingo.commons.api.data.Entry;
+ import org.apache.olingo.commons.api.domain.ODataError;
+ import org.apache.olingo.commons.api.data.Feed;
+ import org.apache.olingo.commons.api.data.Property;
+ import org.apache.olingo.commons.api.format.ODataFormat;
+ import org.apache.olingo.commons.api.format.ODataPubFormat;
+ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+ import org.apache.olingo.commons.api.op.CommonODataDeserializer;
+ import org.apache.olingo.commons.core.data.AtomDeserializer;
+ import org.apache.olingo.commons.core.data.AtomEntryImpl;
+ import org.apache.olingo.commons.core.data.AtomFeedImpl;
+ import org.apache.olingo.commons.core.data.AtomPropertyImpl;
+ import org.apache.olingo.commons.core.data.JSONEntryImpl;
+ import org.apache.olingo.commons.core.data.JSONErrorBundle;
+ import org.apache.olingo.commons.core.data.JSONFeedImpl;
+ import org.apache.olingo.commons.core.data.JSONPropertyImpl;
+ import org.apache.olingo.commons.core.data.XMLErrorImpl;
+
+ public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements CommonODataDeserializer {
+
+ private static final long serialVersionUID = -4244158979195609909L;
+
+ private final AtomDeserializer atomDeserializer;
+
+ public AbstractODataDeserializer(final ODataServiceVersion version) {
+ super(version);
+
+ this.atomDeserializer = new AtomDeserializer(version);
+ }
+
+ @Override
+ public Feed toFeed(final InputStream input, final ODataPubFormat format) {
+ return format == ODataPubFormat.ATOM
+ ? atom(input, AtomFeedImpl.class)
+ : json(input, JSONFeedImpl.class);
+ }
+
+ @Override
+ public Entry toEntry(final InputStream input, final ODataPubFormat format) {
+ return format == ODataPubFormat.ATOM
+ ? atom(input, AtomEntryImpl.class)
+ : json(input, JSONEntryImpl.class);
+ }
+
+ @Override
+ public Property toProperty(final InputStream input, final ODataFormat format) {
+ return format == ODataFormat.XML
+ ? atom(input, AtomPropertyImpl.class)
+ : json(input, JSONPropertyImpl.class);
+ }
+
+ @Override
+ public ODataError toError(final InputStream input, final boolean isXML) {
+ return isXML
+ ? xml(input, XMLErrorImpl.class)
+ : json(input, JSONErrorBundle.class).getError();
+ }
+
+ /*
+ * ------------------ Protected methods ------------------
+ */
+ protected <T> T xml(final InputStream input, final Class<T> reference) {
+ try {
+ return getXmlMapper().readValue(input, reference);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
+ }
+ }
+
+ protected <T> T atom(final InputStream input, final Class<T> reference) {
+ try {
+ return atomDeserializer.read(input, reference);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
+ }
+ }
+
+ protected <T> T json(final InputStream input, final Class<T> reference) {
+ try {
+ return getObjectMapper().readValue(input, reference);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
+ }
+ }
-
+ }
[33/52] [abbrv] [OLINGO-200] Moving Atom and JSON (de)serializer to
commons
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
new file mode 100644
index 0000000..99231b4
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.CollectionValue;
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.Value;
+import org.apache.olingo.commons.api.domain.ODataPropertyType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+class AtomPropertyDeserializer extends AbstractAtomDealer {
+
+ private final AtomGeoValueDeserializer geoDeserializer;
+
+ public AtomPropertyDeserializer(final ODataServiceVersion version) {
+ super(version);
+ this.geoDeserializer = new AtomGeoValueDeserializer();
+ }
+
+ private Value fromPrimitive(final XMLEventReader reader, final StartElement start,
+ final EdmTypeInfo typeInfo) throws XMLStreamException {
+
+ Value value = null;
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+ final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(
+ version, typeInfo.getFullQualifiedName().toString());
+ value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
+ }
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()
+ && (typeInfo == null || !typeInfo.getPrimitiveTypeKind().isGeospatial())) {
+
+ value = new PrimitiveValueImpl(event.asCharacters().getData());
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return value;
+ }
+
+ private ComplexValue fromComplex(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException {
+
+ final ComplexValue value = new ComplexValueImpl();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ value.get().add(deserialize(reader, event.asStartElement()));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return value;
+ }
+
+ private CollectionValue fromCollection(final XMLEventReader reader, final StartElement start,
+ final EdmTypeInfo typeInfo) throws XMLStreamException {
+
+ final CollectionValueImpl value = new CollectionValueImpl();
+
+ final EdmTypeInfo type = typeInfo == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ switch (guessPropertyType(reader)) {
+ case COMPLEX:
+ value.get().add(fromComplex(reader, event.asStartElement()));
+ break;
+
+ case PRIMITIVE:
+ value.get().add(fromPrimitive(reader, event.asStartElement(), type));
+ break;
+
+ default:
+ // do not add null or empty values
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return value;
+ }
+
+ private ODataPropertyType guessPropertyType(final XMLEventReader reader) throws XMLStreamException {
+ XMLEvent child = null;
+ while (reader.hasNext() && child == null) {
+ final XMLEvent event = reader.peek();
+ if (event.isCharacters() && event.asCharacters().isWhiteSpace()) {
+ reader.nextEvent();
+ } else {
+ child = event;
+ }
+ }
+
+ ODataPropertyType type = null;
+ if (child == null) {
+ type = ODataPropertyType.PRIMITIVE;
+ } else {
+ if (child.isStartElement()) {
+ if (Constants.NS_GML.equals(child.asStartElement().getName().getNamespaceURI())) {
+ type = ODataPropertyType.PRIMITIVE;
+ } else if (elementQName.equals(child.asStartElement().getName())) {
+ type = ODataPropertyType.COLLECTION;
+ } else {
+ type = ODataPropertyType.COMPLEX;
+ }
+ } else if (child.isCharacters()) {
+ type = ODataPropertyType.PRIMITIVE;
+ } else {
+ type = ODataPropertyType.EMPTY;
+ }
+ }
+
+ return type;
+ }
+
+ public AtomPropertyImpl deserialize(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException {
+
+ final AtomPropertyImpl property = new AtomPropertyImpl();
+ property.setName(start.getName().getLocalPart());
+
+ final Attribute typeAttr = start.getAttributeByName(this.typeQName);
+ if (typeAttr != null) {
+ property.setType(typeAttr.getValue());
+ }
+
+ Value value;
+ final Attribute nullAttr = start.getAttributeByName(this.nullQName);
+ if (nullAttr == null) {
+ final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
+
+ final ODataPropertyType propType = typeInfo == null
+ ? guessPropertyType(reader)
+ : typeInfo.isCollection()
+ ? ODataPropertyType.COLLECTION
+ : typeInfo.isPrimitiveType()
+ ? ODataPropertyType.PRIMITIVE
+ : ODataPropertyType.COMPLEX;
+
+ switch (propType) {
+ case COLLECTION:
+ value = fromCollection(reader, start, typeInfo);
+ break;
+
+ case COMPLEX:
+ value = fromComplex(reader, start);
+ break;
+
+ case PRIMITIVE:
+ value = fromPrimitive(reader, start, typeInfo);
+ break;
+
+ case EMPTY:
+ default:
+ value = new PrimitiveValueImpl(StringUtils.EMPTY);
+ }
+ } else {
+ value = new NullValueImpl();
+ }
+ property.setValue(value);
+
+ return property;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
new file mode 100644
index 0000000..9688db2
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.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.commons.core.data;
+
+public class AtomPropertyImpl extends AbstractPropertyImpl {
+
+ private static final long serialVersionUID = 48748492242474814L;
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java
new file mode 100644
index 0000000..8d2a8e1
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.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.commons.core.data;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.CollectionValue;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Value;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+class AtomPropertySerializer extends AbstractAtomDealer {
+
+ private final AtomGeoValueSerializer geoSerializer;
+
+ public AtomPropertySerializer(final ODataServiceVersion version) {
+ super(version);
+ this.geoSerializer = new AtomGeoValueSerializer();
+ }
+
+ private void collection(final XMLStreamWriter writer, final CollectionValue value) throws XMLStreamException {
+ for (Value item : value.get()) {
+ writer.writeStartElement(Constants.PREFIX_DATASERVICES, Constants.ELEM_ELEMENT,
+ version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
+ value(writer, item);
+ writer.writeEndElement();
+ }
+ }
+
+ private void value(final XMLStreamWriter writer, final Value value) throws XMLStreamException {
+ if (value.isSimple()) {
+ writer.writeCharacters(value.asSimple().get());
+ } else if (value.isGeospatial()) {
+ this.geoSerializer.serialize(writer, value.asGeospatial().get());
+ } else if (value.isCollection()) {
+ collection(writer, value.asCollection());
+ } else if (value.isComplex()) {
+ for (Property property : value.asComplex().get()) {
+ property(writer, property, false);
+ }
+ }
+ }
+
+ public void property(final XMLStreamWriter writer, final Property property, final boolean standalone)
+ throws XMLStreamException {
+
+ writer.writeStartElement(Constants.PREFIX_DATASERVICES, property.getName(),
+ version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
+ if (standalone) {
+ namespaces(writer);
+ }
+ if (StringUtils.isNotBlank(property.getType())) {
+ writer.writeAttribute(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
+ Constants.ATTR_TYPE, property.getType());
+ }
+
+ if (property.getValue().isNull()) {
+ writer.writeAttribute(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
+ Constants.ATTR_NULL, Boolean.TRUE.toString());
+ } else {
+ value(writer, property.getValue());
+ }
+
+ writer.writeEndElement();
+ }
+
+ public void property(final XMLStreamWriter writer, final Property property) throws XMLStreamException {
+ property(writer, property, true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
new file mode 100644
index 0000000..4c6fb3a
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import java.io.Writer;
+import java.util.Collections;
+import java.util.List;
+import javax.xml.XMLConstants;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class AtomSerializer extends AbstractAtomDealer {
+
+ private static final XMLOutputFactory FACTORY = XMLOutputFactory.newInstance();
+
+ private final AtomPropertySerializer propSerializer;
+
+ public AtomSerializer(final ODataServiceVersion version) {
+ super(version);
+ this.propSerializer = new AtomPropertySerializer(version);
+ }
+
+ private void startDocument(final XMLStreamWriter writer, final String rootElement) throws XMLStreamException {
+ writer.writeStartDocument();
+ writer.setDefaultNamespace(Constants.NS_ATOM);
+
+ writer.writeStartElement(rootElement);
+
+ namespaces(writer);
+ }
+
+ private void property(final Writer outWriter, final Property property) throws XMLStreamException {
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
+
+ writer.writeStartDocument();
+
+ propSerializer.property(writer, property);
+
+ writer.writeEndDocument();
+ writer.flush();
+ }
+
+ private void links(final XMLStreamWriter writer, final List<Link> links) throws XMLStreamException {
+ for (Link link : links) {
+ writer.writeStartElement(Constants.ATOM_ELEM_LINK);
+
+ if (StringUtils.isNotBlank(link.getRel())) {
+ writer.writeAttribute(Constants.ATTR_REL, link.getRel());
+ }
+ if (StringUtils.isNotBlank(link.getTitle())) {
+ writer.writeAttribute(Constants.ATTR_TITLE, link.getTitle());
+ }
+ if (StringUtils.isNotBlank(link.getHref())) {
+ writer.writeAttribute(Constants.ATTR_HREF, link.getHref());
+ }
+ if (StringUtils.isNotBlank(link.getType())) {
+ writer.writeAttribute(Constants.ATTR_TYPE, link.getType());
+ }
+
+ if (link.getInlineEntry() != null || link.getInlineFeed() != null) {
+ writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ATOM_ELEM_INLINE,
+ version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
+
+ if (link.getInlineEntry() != null) {
+ writer.writeStartElement(Constants.ATOM_ELEM_ENTRY);
+ entry(writer, link.getInlineEntry());
+ writer.writeEndElement();
+ }
+ if (link.getInlineFeed() != null) {
+ writer.writeStartElement(Constants.ATOM_ELEM_FEED);
+ feed(writer, link.getInlineFeed());
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ }
+ }
+
+ private void common(final XMLStreamWriter writer, final AbstractAtomObject object) throws XMLStreamException {
+ if (StringUtils.isNotBlank(object.getTitle())) {
+ writer.writeStartElement(Constants.ATOM_ELEM_TITLE);
+ writer.writeAttribute(Constants.ATTR_TYPE, TYPE_TEXT);
+ writer.writeCharacters(object.getTitle());
+ writer.writeEndElement();
+ }
+
+ if (StringUtils.isNotBlank(object.getSummary())) {
+ writer.writeStartElement(Constants.ATOM_ELEM_SUMMARY);
+ writer.writeAttribute(Constants.ATTR_TYPE, "text");
+ writer.writeCharacters(object.getSummary());
+ writer.writeEndElement();
+ }
+ }
+
+ private void properties(final XMLStreamWriter writer, final List<Property> properties) throws XMLStreamException {
+ for (Property property : properties) {
+ propSerializer.property(writer, property, false);
+ }
+ }
+
+ private void entry(final XMLStreamWriter writer, final Entry entry) throws XMLStreamException {
+ if (entry.getBaseURI() != null) {
+ writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, entry.getBaseURI().toASCIIString());
+ }
+
+ if (StringUtils.isNotBlank(entry.getId())) {
+ writer.writeStartElement(Constants.ATOM_ELEM_ID);
+ writer.writeCharacters(entry.getId());
+ writer.writeEndElement();
+ }
+
+ writer.writeStartElement(Constants.ATOM_ELEM_CATEGORY);
+ writer.writeAttribute(Constants.ATOM_ATTR_SCHEME, version.getNamespaceMap().get(ODataServiceVersion.NS_SCHEME));
+ writer.writeAttribute(Constants.ATOM_ATTR_TERM, entry.getType());
+ writer.writeEndElement();
+
+ if (entry instanceof AbstractAtomObject) {
+ common(writer, (AbstractAtomObject) entry);
+ }
+
+ links(writer, entry.getAssociationLinks());
+ links(writer, entry.getNavigationLinks());
+ links(writer, entry.getMediaEditLinks());
+
+ writer.writeStartElement(Constants.ATOM_ELEM_CONTENT);
+ if (entry.isMediaEntry()) {
+ if (StringUtils.isNotBlank(entry.getMediaContentType())) {
+ writer.writeAttribute(Constants.ATTR_TYPE, entry.getMediaContentType());
+ }
+ if (StringUtils.isNotBlank(entry.getMediaContentSource())) {
+ writer.writeAttribute(Constants.ATOM_ATTR_SRC, entry.getMediaContentSource());
+ }
+ writer.writeEndElement();
+
+ writer.writeStartElement(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.PROPERTIES);
+ properties(writer, entry.getProperties());
+ } else {
+ writer.writeAttribute(Constants.ATTR_TYPE, ContentType.APPLICATION_XML);
+ writer.writeStartElement(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.PROPERTIES);
+ properties(writer, entry.getProperties());
+ writer.writeEndElement();
+ }
+ writer.writeEndElement();
+ }
+
+ private void entry(final Writer outWriter, final Entry entry) throws XMLStreamException {
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
+
+ startDocument(writer, Constants.ATOM_ELEM_ENTRY);
+
+ entry(writer, entry);
+
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ }
+
+ private void feed(final XMLStreamWriter writer, final Feed feed) throws XMLStreamException {
+ if (feed.getBaseURI() != null) {
+ writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, feed.getBaseURI().toASCIIString());
+ }
+
+ if (feed.getCount() != null) {
+ writer.writeStartElement(
+ version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_COUNT);
+ writer.writeCharacters(Integer.toString(feed.getCount()));
+ writer.writeEndElement();
+ }
+
+ if (StringUtils.isNotBlank(feed.getId())) {
+ writer.writeStartElement(Constants.ATOM_ELEM_ID);
+ writer.writeCharacters(feed.getId());
+ writer.writeEndElement();
+ }
+
+ if (feed instanceof AbstractAtomObject) {
+ common(writer, (AbstractAtomObject) feed);
+ }
+
+ for (Entry entry : feed.getEntries()) {
+ writer.writeStartElement(Constants.ATOM_ELEM_ENTRY);
+ entry(writer, entry);
+ writer.writeEndElement();
+ }
+
+ if (feed.getNext() != null) {
+ final LinkImpl next = new LinkImpl();
+ next.setRel(Constants.NEXT_LINK_REL);
+ next.setHref(feed.getNext().toASCIIString());
+
+ links(writer, Collections.<Link>singletonList(next));
+ }
+ }
+
+ private void feed(final Writer outWriter, final Feed feed) throws XMLStreamException {
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
+
+ startDocument(writer, Constants.ATOM_ELEM_FEED);
+
+ feed(writer, feed);
+
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ }
+
+ private void link(final Writer outWriter, final Link link) throws XMLStreamException {
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
+
+ writer.writeStartDocument();
+
+ writer.writeStartElement(Constants.ELEM_LINKS);
+ writer.writeDefaultNamespace(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
+
+ writer.writeStartElement(Constants.ELEM_URI);
+ writer.writeCharacters(link.getHref());
+ writer.writeEndElement();
+
+ writer.writeEndElement();
+
+ writer.writeEndDocument();
+ writer.flush();
+ }
+
+ public <T> void write(final Writer writer, final T obj) throws XMLStreamException {
+ if (obj instanceof Feed) {
+ feed(writer, (Feed) obj);
+ } else if (obj instanceof Entry) {
+ entry(writer, (Entry) obj);
+ } else if (obj instanceof Property) {
+ property(writer, (Property) obj);
+ } else if (obj instanceof Link) {
+ link(writer, (Link) obj);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/CollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/CollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/CollectionValueImpl.java
new file mode 100644
index 0000000..02c6d43
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/CollectionValueImpl.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.commons.core.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.data.CollectionValue;
+import org.apache.olingo.commons.api.data.Value;
+
+public class CollectionValueImpl extends AbstractValue implements CollectionValue {
+
+ private final List<Value> value = new ArrayList<Value>();
+
+ @Override
+ public boolean isCollection() {
+ return true;
+ }
+
+ @Override
+ public List<Value> get() {
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ComplexValueImpl.java
new file mode 100644
index 0000000..0144f83
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ComplexValueImpl.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.commons.core.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.Property;
+
+public class ComplexValueImpl extends AbstractValue implements ComplexValue {
+
+ private final List<Property> value = new ArrayList<Property>();
+
+ @Override
+ public boolean isComplex() {
+ return true;
+ }
+
+ @Override
+ public List<Property> get() {
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/GeospatialValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/GeospatialValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/GeospatialValueImpl.java
new file mode 100644
index 0000000..e278334
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/GeospatialValueImpl.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.commons.core.data;
+
+import org.apache.olingo.commons.api.data.GeospatialValue;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+
+public class GeospatialValueImpl extends AbstractValue implements GeospatialValue {
+
+ private final Geospatial value;
+
+ public GeospatialValueImpl(final Geospatial value) {
+ this.value = value;
+ }
+
+ @Override
+ public boolean isGeospatial() {
+ return true;
+ }
+
+ @Override
+ public Geospatial get() {
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
new file mode 100644
index 0000000..3647fac
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
@@ -0,0 +1,241 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.ObjectCodec;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import java.net.URI;
+import java.text.ParseException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+/**
+ * Reads JSON string into an entry.
+ * <br/>
+ * If metadata information is available, the corresponding entry fields and content will be populated.
+ */
+public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImpl> {
+
+ private String getTitle(final Map.Entry<String, JsonNode> entry) {
+ return entry.getKey().substring(0, entry.getKey().indexOf('@'));
+ }
+
+ private String setInline(final String name, final String suffix, final ObjectNode tree,
+ final ObjectCodec codec, final LinkImpl link) throws IOException {
+
+ final String entryNamePrefix = name.substring(0, name.indexOf(suffix));
+ if (tree.has(entryNamePrefix)) {
+ final JsonNode inline = tree.path(entryNamePrefix);
+
+ if (inline instanceof ObjectNode) {
+ link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
+ link.setInlineEntry(inline.traverse(codec).readValuesAs(JSONEntryImpl.class).next());
+ }
+
+ if (inline instanceof ArrayNode) {
+ link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
+
+ final JSONFeedImpl feed = new JSONFeedImpl();
+ final Iterator<JsonNode> entries = ((ArrayNode) inline).elements();
+ while (entries.hasNext()) {
+ feed.getEntries().add(entries.next().traverse(codec).readValuesAs(JSONEntryImpl.class).next());
+ }
+
+ link.setInlineFeed(feed);
+ }
+ }
+ return entryNamePrefix;
+ }
+
+ @Override
+ protected JSONEntryImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
+
+ if (tree.has(Constants.JSON_VALUE) && tree.get(Constants.JSON_VALUE).isArray()) {
+ throw new JsonParseException("Expected OData Entity, found EntitySet", parser.getCurrentLocation());
+ }
+
+ final JSONEntryImpl entry = new JSONEntryImpl();
+
+ if (tree.hasNonNull(Constants.JSON_METADATA)) {
+ entry.setMetadata(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
+ tree.remove(Constants.JSON_METADATA);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_MEDIA_ETAG)) {
+ entry.setMediaETag(tree.get(Constants.JSON_MEDIA_ETAG).textValue());
+ tree.remove(Constants.JSON_MEDIA_ETAG);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_ETAG)) {
+ entry.setETag(tree.get(Constants.JSON_ETAG).textValue());
+ tree.remove(Constants.JSON_ETAG);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_TYPE)) {
+ entry.setType(tree.get(Constants.JSON_TYPE).textValue());
+ tree.remove(Constants.JSON_TYPE);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_ID)) {
+ try {
+ entry.setId(tree.get(Constants.JSON_ID).textValue());
+ } catch (ParseException e) {
+ throw new JsonMappingException("While parsing Atom entry or feed common elements", e);
+ }
+ tree.remove(Constants.JSON_ID);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_READ_LINK)) {
+ final LinkImpl link = new LinkImpl();
+ link.setRel(Constants.SELF_LINK_REL);
+ link.setHref(tree.get(Constants.JSON_READ_LINK).textValue());
+ entry.setSelfLink(link);
+
+ tree.remove(Constants.JSON_READ_LINK);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_EDIT_LINK)) {
+ final LinkImpl link = new LinkImpl();
+ link.setRel(Constants.EDIT_LINK_REL);
+ link.setHref(tree.get(Constants.JSON_EDIT_LINK).textValue());
+ entry.setEditLink(link);
+
+ tree.remove(Constants.JSON_EDIT_LINK);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_MEDIAREAD_LINK)) {
+ entry.setMediaContentSource(tree.get(Constants.JSON_MEDIAREAD_LINK).textValue());
+ tree.remove(Constants.JSON_MEDIAREAD_LINK);
+ }
+ if (tree.hasNonNull(Constants.JSON_MEDIAEDIT_LINK)) {
+ tree.remove(Constants.JSON_MEDIAEDIT_LINK);
+ }
+ if (tree.hasNonNull(Constants.JSON_MEDIA_CONTENT_TYPE)) {
+ entry.setMediaContentType(tree.get(Constants.JSON_MEDIA_CONTENT_TYPE).textValue());
+ tree.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+ }
+
+ final Set<String> toRemove = new HashSet<String>();
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+
+ if (field.getKey().endsWith(Constants.JSON_NAVIGATION_LINK_SUFFIX)) {
+ final LinkImpl link = new LinkImpl();
+ link.setTitle(getTitle(field));
+ link.setRel(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL) + getTitle(field));
+
+ if (field.getValue().isValueNode()) {
+ link.setHref(field.getValue().textValue());
+ link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
+ }
+ // NOTE: this should be expected to happen, but it isn't - at least up to OData 4.0
+ /* if (field.getValue().isArray()) {
+ * link.setHref(field.getValue().asText());
+ * link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
+ * } */
+
+ entry.getNavigationLinks().add(link);
+
+ toRemove.add(field.getKey());
+ toRemove.add(setInline(field.getKey(), Constants.JSON_NAVIGATION_LINK_SUFFIX, tree, parser.getCodec(), link));
+ } else if (field.getKey().endsWith(Constants.JSON_ASSOCIATION_LINK_SUFFIX)) {
+ final LinkImpl link = new LinkImpl();
+ link.setTitle(getTitle(field));
+ link.setRel(version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL) + getTitle(field));
+ link.setHref(field.getValue().textValue());
+ link.setType(ODataLinkType.ASSOCIATION.toString());
+ entry.getAssociationLinks().add(link);
+
+ toRemove.add(field.getKey());
+ } else if (field.getKey().endsWith(Constants.JSON_MEDIAEDIT_LINK_SUFFIX)) {
+ final LinkImpl link = new LinkImpl();
+ link.setTitle(getTitle(field));
+ link.setRel(version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL) + getTitle(field));
+ link.setHref(field.getValue().textValue());
+ link.setType(ODataLinkType.MEDIA_EDIT.toString());
+ entry.getMediaEditLinks().add(link);
+
+ if (tree.has(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX)) {
+ link.setMediaETag(tree.get(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX).asText());
+ toRemove.add(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX);
+ }
+
+ toRemove.add(field.getKey());
+ toRemove.add(setInline(field.getKey(), Constants.JSON_MEDIAEDIT_LINK_SUFFIX, tree, parser.getCodec(), link));
+ } else if (field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE)) {
+ final String linkTitle = getTitle(field);
+ for (Link link : entry.getMediaEditLinks()) {
+ if (linkTitle.equals(link.getTitle())) {
+ ((LinkImpl) link).setType(field.getValue().asText());
+ }
+ }
+ toRemove.add(field.getKey());
+ } else if (field.getKey().charAt(0) == '#') {
+ final ODataOperation operation = new ODataOperation();
+ operation.setMetadataAnchor(field.getKey());
+
+ final ObjectNode opNode = (ObjectNode) tree.get(field.getKey());
+ operation.setTitle(opNode.get(Constants.ATTR_TITLE).asText());
+ operation.setTarget(URI.create(opNode.get(Constants.ATTR_TARGET).asText()));
+
+ entry.getOperations().add(operation);
+
+ toRemove.add(field.getKey());
+ }
+ }
+ tree.remove(toRemove);
+
+ String type = null;
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+
+ if (type == null && field.getKey().endsWith(Constants.JSON_TYPE_SUFFIX)) {
+ type = field.getValue().asText();
+ } else {
+ final JSONPropertyImpl property = new JSONPropertyImpl();
+ property.setName(field.getKey());
+ property.setType(type);
+ type = null;
+
+ value(property, field.getValue());
+ entry.getProperties().add(property);
+ }
+ }
+
+ return entry;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
new file mode 100644
index 0000000..765c18a
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import java.net.URI;
+import java.text.ParseException;
+import org.apache.olingo.commons.api.Constants;
+
+/**
+ * A single entry, represented via JSON.
+ */
+@JsonSerialize(using = JSONEntrySerializer.class)
+@JsonDeserialize(using = JSONEntryDeserializer.class)
+public class JSONEntryImpl extends AbstractEntry {
+
+ private static final long serialVersionUID = -5275365545400797758L;
+
+ private URI metadata;
+
+ private String mediaETag;
+
+ public void setId(final String id) throws ParseException {
+ this.setCommonProperty("id", id);
+ }
+
+ @Override
+ public URI getBaseURI() {
+ URI baseURI = null;
+ if (metadata != null) {
+ final String metadataURI = getMetadata().toASCIIString();
+ baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
+ }
+
+ return baseURI;
+ }
+
+ /**
+ * Gets the metadata URI.
+ *
+ * @return the metadata URI
+ */
+ public URI getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata URI.
+ *
+ * @param metadata metadata URI.
+ */
+ public void setMetadata(final URI metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * The odata.mediaEtag annotation MAY be included; its value MUST be the ETag of the binary stream represented by this
+ * media entity or named stream property.
+ *
+ * @return odata.mediaEtag annotation value.
+ */
+ public String getMediaETag() {
+ return mediaETag;
+ }
+
+ /**
+ * The odata.mediaEtag annotation MAY be included; its value MUST be the ETag of the binary stream represented by this
+ * media entity or named stream property.
+ *
+ * @param eTag odata.mediaEtag annotation value.
+ */
+ public void setMediaETag(final String eTag) {
+ this.mediaETag = eTag;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
new file mode 100644
index 0000000..4041748
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.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.commons.core.data;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+
+/**
+ * Writes out JSON string from an entry.
+ */
+public class JSONEntrySerializer extends AbstractJsonSerializer<JSONEntryImpl> {
+
+ @Override
+ protected void doSerialize(final JSONEntryImpl entry, final JsonGenerator jgen, final SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+
+ jgen.writeStartObject();
+
+ if (entry.getMetadata() != null) {
+ jgen.writeStringField(Constants.JSON_METADATA, entry.getMetadata().toASCIIString());
+ }
+ if (entry.getId() != null) {
+ jgen.writeStringField(Constants.JSON_ID, entry.getId());
+ }
+
+ final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
+
+ for (Link link : entry.getNavigationLinks()) {
+ ODataLinkType type = null;
+ try {
+ type = ODataLinkType.fromString(version, link.getRel(), link.getType());
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+
+ if (type == ODataLinkType.ENTITY_SET_NAVIGATION) {
+ final List<String> uris;
+ if (entitySetLinks.containsKey(link.getTitle())) {
+ uris = entitySetLinks.get(link.getTitle());
+ } else {
+ uris = new ArrayList<String>();
+ entitySetLinks.put(link.getTitle(), uris);
+ }
+ uris.add(link.getHref());
+ } else {
+ if (StringUtils.isNotBlank(link.getHref())) {
+ jgen.writeStringField(link.getTitle() + Constants.JSON_BIND_LINK_SUFFIX, link.getHref());
+ }
+ }
+
+ if (link.getInlineEntry() != null) {
+ jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
+ } else if (link.getInlineFeed() != null) {
+ jgen.writeArrayFieldStart(link.getTitle());
+ for (Entry subEntry : link.getInlineFeed().getEntries()) {
+ jgen.writeObject(subEntry);
+ }
+ jgen.writeEndArray();
+ }
+ }
+ for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) {
+ jgen.writeArrayFieldStart(entitySetLink.getKey() + Constants.JSON_BIND_LINK_SUFFIX);
+ for (String uri : entitySetLink.getValue()) {
+ jgen.writeString(uri);
+ }
+ jgen.writeEndArray();
+ }
+
+ for (Link link : entry.getMediaEditLinks()) {
+ if (link.getTitle() == null) {
+ jgen.writeStringField(Constants.JSON_MEDIAEDIT_LINK, link.getHref());
+ }
+
+ if (link.getInlineEntry() != null) {
+ jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
+ }
+ if (link.getInlineFeed() != null) {
+ jgen.writeArrayFieldStart(link.getTitle());
+ for (Entry subEntry : link.getInlineFeed().getEntries()) {
+ jgen.writeObject(subEntry);
+ }
+ jgen.writeEndArray();
+ }
+ }
+
+ for (Property property : entry.getProperties()) {
+ property(jgen, property, property.getName());
+ }
+
+ jgen.writeEndObject();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java
new file mode 100644
index 0000000..433b754
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.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.commons.core.data;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * This class represents a bundle for an OData error returned as JSON.
+ */
+public class JSONErrorBundle extends AbstractPayloadObject {
+
+ private static final long serialVersionUID = -4784910226259754450L;
+
+ @JsonProperty("odata.error")
+ private JSONErrorImpl error;
+
+ /**
+ * Gets error.
+ *
+ * @return OData error object.
+ */
+ public JSONErrorImpl getError() {
+ return error;
+ }
+
+ /**
+ * Sets error.
+ *
+ * @param error OData error object.
+ */
+ public void setError(final JSONErrorImpl error) {
+ this.error = error;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
new file mode 100644
index 0000000..4c6cb4a
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
@@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.commons.api.domain.ODataError;
+
+/**
+ * This class represents an OData error returned as JSON.
+ */
+public class JSONErrorImpl extends AbstractPayloadObject implements ODataError {
+
+ private static final long serialVersionUID = -3476499168507242932L;
+
+ /**
+ * Error message.
+ */
+ public static class Message extends AbstractPayloadObject {
+
+ private static final long serialVersionUID = 2577818040815637859L;
+
+ private String lang;
+
+ private String value;
+
+ /**
+ * Gets language.
+ *
+ * @return language.
+ */
+ public String getLang() {
+ return lang;
+ }
+
+ /**
+ * Sets language.
+ *
+ * @param lang language.
+ */
+ public void setLang(final String lang) {
+ this.lang = lang;
+ }
+
+ /**
+ * Gets message.
+ *
+ * @return message.
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets message.
+ *
+ * @param value message.
+ */
+ public void setValue(final String value) {
+ this.value = value;
+ }
+ }
+
+ /**
+ * Inner error.
+ */
+ static class InnerError extends AbstractPayloadObject {
+
+ private static final long serialVersionUID = -3920947476143537640L;
+
+ private String message;
+
+ private String type;
+
+ private String stacktrace;
+
+ private InnerError internalexception;
+
+ /**
+ * Gets inner message.
+ *
+ * @return message.
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets inner message.
+ *
+ * @param message message.
+ */
+ public void setMessage(final String message) {
+ this.message = message;
+ }
+
+ /**
+ * Gets type.
+ *
+ * @return type.
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets type.
+ *
+ * @param type type.
+ */
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ /**
+ * Gets stack-trace.
+ *
+ * @return stack-trace.
+ */
+ public String getStacktrace() {
+ return stacktrace;
+ }
+
+ /**
+ * Sets stack-trace.
+ *
+ * @param stacktrace stack-trace.
+ */
+ public void setStacktrace(final String stacktrace) {
+ this.stacktrace = stacktrace;
+ }
+
+ public InnerError getInternalexception() {
+ return internalexception;
+ }
+
+ public void setInternalexception(final InnerError internalexception) {
+ this.internalexception = internalexception;
+ }
+ }
+
+ private String code;
+
+ @JsonProperty(value = "message")
+ private Message message;
+
+ @JsonProperty(value = "innererror", required = false)
+ private InnerError innererror;
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String getCode() {
+ return code;
+ }
+
+ /**
+ * Sets error code.
+ *
+ * @param code error code.
+ */
+ public void setCode(final String code) {
+ this.code = code;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @JsonIgnore
+ @Override
+ public String getMessageLang() {
+ return this.message == null ? null : this.message.getLang();
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @JsonIgnore
+ @Override
+ public String getMessageValue() {
+ return this.message == null ? null : this.message.getValue();
+ }
+
+ /**
+ * Sets the value of the message property.
+ *
+ * @param value allowed object is {@link Error.Message }
+ *
+ */
+ public void setMessage(final Message value) {
+ this.message = value;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @JsonIgnore
+ @Override
+ public String getInnerErrorMessage() {
+ return this.innererror == null ? null : this.innererror.getMessage();
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @JsonIgnore
+ @Override
+ public String getInnerErrorType() {
+ return this.innererror == null ? null : this.innererror.getType();
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @JsonIgnore
+ @Override
+ public String getInnerErrorStacktrace() {
+ return this.innererror == null ? null : this.innererror.getStacktrace();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
new file mode 100644
index 0000000..81a8d47
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.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.commons.core.data;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Iterator;
+import org.apache.olingo.commons.api.Constants;
+
+/**
+ * Reads JSON string into a feed.
+ * <br/>
+ * If metadata information is available, the corresponding entry fields and content will be populated.
+ */
+public class JSONFeedDeserializer extends AbstractJsonDeserializer<JSONFeedImpl> {
+
+ @Override
+ protected JSONFeedImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
+
+ if (!tree.has(Constants.JSON_VALUE)) {
+ return null;
+ }
+
+ final JSONFeedImpl feed = new JSONFeedImpl();
+
+ if (tree.hasNonNull(Constants.JSON_METADATA)) {
+ feed.setMetadata(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
+ }
+ if (tree.hasNonNull(Constants.JSON_COUNT)) {
+ feed.setCount(tree.get(Constants.JSON_COUNT).asInt());
+ }
+ if (tree.hasNonNull(Constants.JSON_NEXT_LINK)) {
+ feed.setNext(URI.create(tree.get(Constants.JSON_NEXT_LINK).textValue()));
+ }
+
+ if (tree.hasNonNull(Constants.JSON_VALUE)) {
+ for (final Iterator<JsonNode> itor = tree.get(Constants.JSON_VALUE).iterator(); itor.hasNext();) {
+ feed.getEntries().add(itor.next().traverse(parser.getCodec()).readValueAs(JSONEntryImpl.class));
+ }
+ }
+
+ return feed;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
new file mode 100644
index 0000000..f41e21c
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.Constants;
+
+/**
+ * List of entries, represented via JSON.
+ *
+ * @see JSONEntry
+ */
+@JsonDeserialize(using = JSONFeedDeserializer.class)
+@JsonSerialize(using = JSONFeedSerializer.class)
+public class JSONFeedImpl extends AbstractPayloadObject implements Feed {
+
+ private static final long serialVersionUID = -3576372289800799417L;
+
+ private String id;
+
+ private URI metadata;
+
+ private Integer count;
+
+ private final List<Entry> entries = new ArrayList<Entry>();
+
+ private String next;
+
+ @Override
+ public URI getBaseURI() {
+ URI baseURI = null;
+ if (metadata != null) {
+ final String metadataURI = getMetadata().toASCIIString();
+ baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
+ }
+
+ return baseURI;
+ }
+
+ /**
+ * Gets the metadata URI.
+ *
+ * @return the metadata URI
+ */
+ public URI getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata URI.
+ *
+ * @param metadata metadata URI.
+ */
+ public void setMetadata(final URI metadata) {
+ this.metadata = metadata;
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ @Override
+ public Integer getCount() {
+ return count;
+ }
+
+ @Override
+ public void setCount(final Integer count) {
+ this.count = count;
+ }
+
+ @Override
+ public List<Entry> getEntries() {
+ return entries;
+ }
+
+ @Override
+ public void setNext(final URI next) {
+ this.next = next.toASCIIString();
+ }
+
+ @Override
+ public URI getNext() {
+ return next == null ? null : URI.create(next);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java
new file mode 100644
index 0000000..25a7358
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.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.commons.core.data;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import java.io.IOException;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Entry;
+
+public class JSONFeedSerializer extends AbstractJsonSerializer<JSONFeedImpl> {
+
+ @Override
+ protected void doSerialize(final JSONFeedImpl feed, final JsonGenerator jgen, final SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+
+ jgen.writeStartObject();
+
+ if (feed.getMetadata() != null) {
+ jgen.writeStringField(Constants.JSON_METADATA, feed.getMetadata().toASCIIString());
+ }
+ if (feed.getId() != null) {
+ jgen.writeStringField(Constants.JSON_ID, feed.getId());
+ }
+ if (feed.getCount() != null) {
+ jgen.writeNumberField(Constants.JSON_COUNT, feed.getCount());
+ }
+ if (feed.getNext() != null) {
+ jgen.writeStringField(Constants.JSON_NEXT_LINK, feed.getNext().toASCIIString());
+ }
+
+ jgen.writeArrayFieldStart(Constants.JSON_VALUE);
+ for (Entry entry : feed.getEntries()) {
+ jgen.writeObject(entry);
+ }
+
+ jgen.writeEndArray();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java
new file mode 100644
index 0000000..f1863a7
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java
@@ -0,0 +1,274 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.GeoUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
+
+class JSONGeoValueDeserializer {
+
+ private final ODataServiceVersion version;
+
+ public JSONGeoValueDeserializer(final ODataServiceVersion version) {
+ this.version = version;
+ }
+
+ private Point point(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final String crs) {
+ Point point = null;
+
+ if (itor.hasNext()) {
+ point = new Point(GeoUtils.getDimension(type), crs);
+ try {
+ point.setX(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ point.setY(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException("While deserializing point coordinates as double", e);
+ }
+ }
+
+ return point;
+ }
+
+ private MultiPoint multipoint(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
+ MultiPoint multiPoint = null;
+
+ if (itor.hasNext()) {
+ final List<Point> points = new ArrayList<Point>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mpItor = itor.next().elements();
+ points.add(point(mpItor, type, crs));
+ }
+ multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, points);
+ } else {
+ multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, Collections.<Point>emptyList());
+ }
+
+ return multiPoint;
+ }
+
+ private LineString lineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
+ LineString lineString = null;
+
+ if (itor.hasNext()) {
+ final List<Point> points = new ArrayList<Point>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mpItor = itor.next().elements();
+ points.add(point(mpItor, type, crs));
+ }
+ lineString = new LineString(GeoUtils.getDimension(type), crs, points);
+ } else {
+ lineString = new LineString(GeoUtils.getDimension(type), crs, Collections.<Point>emptyList());
+ }
+
+ return lineString;
+ }
+
+ private MultiLineString multiLineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
+ MultiLineString multiLineString = null;
+
+ if (itor.hasNext()) {
+ final List<LineString> lineStrings = new ArrayList<LineString>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mlsItor = itor.next().elements();
+ lineStrings.add(lineString(mlsItor, type, crs));
+ }
+ multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, lineStrings);
+ } else {
+ multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, Collections.<LineString>emptyList());
+ }
+
+ return multiLineString;
+ }
+
+ private Polygon polygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
+ List<Point> extPoints = null;
+ if (itor.hasNext()) {
+ final Iterator<JsonNode> extItor = itor.next().elements();
+ if (extItor.hasNext()) {
+ extPoints = new ArrayList<Point>();
+ while (extItor.hasNext()) {
+ final Iterator<JsonNode> mpItor = extItor.next().elements();
+ extPoints.add(point(mpItor, type, crs));
+ }
+ }
+ }
+
+ List<Point> intPoints = null;
+ if (itor.hasNext()) {
+ final Iterator<JsonNode> intItor = itor.next().elements();
+ if (intItor.hasNext()) {
+ intPoints = new ArrayList<Point>();
+ while (intItor.hasNext()) {
+ final Iterator<JsonNode> mpItor = intItor.next().elements();
+ intPoints.add(point(mpItor, type, crs));
+ }
+ }
+ }
+
+ return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints);
+ }
+
+ private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
+ MultiPolygon multiPolygon = null;
+
+ if (itor.hasNext()) {
+ final List<Polygon> polygons = new ArrayList<Polygon>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mpItor = itor.next().elements();
+ polygons.add(polygon(mpItor, type, crs));
+ }
+ multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, polygons);
+ } else {
+ multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, Collections.<Polygon>emptyList());
+ }
+
+ return multiPolygon;
+ }
+
+ private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final String crs) {
+
+ GeospatialCollection collection = null;
+
+ if (itor.hasNext()) {
+ final List<Geospatial> geospatials = new ArrayList<Geospatial>();
+
+ while (itor.hasNext()) {
+ final JsonNode geo = itor.next();
+ final String collItemType = geo.get(Constants.ATTR_TYPE).asText();
+ final String callAsType;
+ if (EdmPrimitiveTypeKind.GeographyCollection.name().equals(collItemType)
+ || EdmPrimitiveTypeKind.GeometryCollection.name().equals(collItemType)) {
+
+ callAsType = collItemType;
+ } else {
+ callAsType = (type == EdmPrimitiveTypeKind.GeographyCollection ? "Geography" : "Geometry")
+ + collItemType;
+ }
+
+ geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build()));
+ }
+
+ collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials);
+ } else {
+ collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, Collections.<Geospatial>emptyList());
+ }
+
+ return collection;
+ }
+
+ public Geospatial deserialize(final JsonNode node, final EdmTypeInfo typeInfo) {
+ final EdmPrimitiveTypeKind actualType;
+ if ((typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geography
+ || typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geometry)
+ && node.has(Constants.ATTR_TYPE)) {
+
+ String nodeType = node.get(Constants.ATTR_TYPE).asText();
+ if (nodeType.startsWith("Geo")) {
+ final int yIdx = nodeType.indexOf('y');
+ nodeType = nodeType.substring(yIdx + 1);
+ }
+ actualType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getFullQualifiedName().toString() + nodeType);
+ } else {
+ actualType = typeInfo.getPrimitiveTypeKind();
+ }
+
+ final Iterator<JsonNode> cooItor = node.has(Constants.JSON_COORDINATES)
+ ? node.get(Constants.JSON_COORDINATES).elements()
+ : Collections.<JsonNode>emptyList().iterator();
+
+ String crs = null;
+ if (node.has(Constants.JSON_CRS)) {
+ crs = node.get(Constants.JSON_CRS).get(Constants.PROPERTIES).get(Constants.JSON_NAME).asText().split(":")[1];
+ }
+
+ Geospatial value = null;
+ switch (actualType) {
+ case GeographyPoint:
+ case GeometryPoint:
+ value = point(cooItor, actualType, crs);
+ break;
+
+ case GeographyMultiPoint:
+ case GeometryMultiPoint:
+ value = multipoint(cooItor, actualType, crs);
+ break;
+
+ case GeographyLineString:
+ case GeometryLineString:
+ value = lineString(cooItor, actualType, crs);
+ break;
+
+ case GeographyMultiLineString:
+ case GeometryMultiLineString:
+ value = multiLineString(cooItor, actualType, crs);
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ value = polygon(cooItor, actualType, crs);
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ value = multiPolygon(cooItor, actualType, crs);
+ break;
+
+ case GeographyCollection:
+ case GeometryCollection:
+ value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, crs);
+ break;
+
+ default:
+ }
+
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java
new file mode 100644
index 0000000..95c30d4
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import java.io.IOException;
+import java.util.Iterator;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.ComposedGeospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
+
+class JSONGeoValueSerializer {
+
+ private void crs(final JsonGenerator jgen, final String crs) throws IOException {
+ jgen.writeObjectFieldStart(Constants.JSON_CRS);
+ jgen.writeStringField(Constants.ATTR_TYPE, Constants.JSON_NAME);
+ jgen.writeObjectFieldStart(Constants.PROPERTIES);
+ jgen.writeStringField(Constants.JSON_NAME, "EPSG:" + crs);
+ jgen.writeEndObject();
+ jgen.writeEndObject();
+ }
+
+ private void point(final JsonGenerator jgen, final Point point) throws IOException {
+ try {
+ jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getX(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
+ jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getY(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException("While serializing point coordinates as double", e);
+ }
+ }
+
+ private void multipoint(final JsonGenerator jgen, final MultiPoint multiPoint) throws IOException {
+ for (final Iterator<Point> itor = multiPoint.iterator(); itor.hasNext();) {
+ jgen.writeStartArray();
+ point(jgen, itor.next());
+ jgen.writeEndArray();
+ }
+ }
+
+ private void lineString(final JsonGenerator jgen, final ComposedGeospatial<Point> lineString) throws IOException {
+ for (final Iterator<Point> itor = lineString.iterator(); itor.hasNext();) {
+ jgen.writeStartArray();
+ point(jgen, itor.next());
+ jgen.writeEndArray();
+ }
+ }
+
+ private void multiLineString(final JsonGenerator jgen, final MultiLineString multiLineString) throws IOException {
+ for (final Iterator<LineString> itor = multiLineString.iterator(); itor.hasNext();) {
+ jgen.writeStartArray();
+ lineString(jgen, itor.next());
+ jgen.writeEndArray();
+ }
+ }
+
+ private void polygon(final JsonGenerator jgen, final Polygon polygon) throws IOException {
+ if (!polygon.getExterior().isEmpty()) {
+ jgen.writeStartArray();
+ lineString(jgen, polygon.getExterior());
+ jgen.writeEndArray();
+ }
+ if (!polygon.getInterior().isEmpty()) {
+ jgen.writeStartArray();
+ lineString(jgen, polygon.getInterior());
+ jgen.writeEndArray();
+ }
+ }
+
+ private void multiPolygon(final JsonGenerator jgen, final MultiPolygon multiPolygon) throws IOException {
+ for (final Iterator<Polygon> itor = multiPolygon.iterator(); itor.hasNext();) {
+ final Polygon polygon = itor.next();
+ jgen.writeStartArray();
+ polygon(jgen, polygon);
+ jgen.writeEndArray();
+ }
+ }
+
+ private void collection(final JsonGenerator jgen, final GeospatialCollection collection) throws IOException {
+ jgen.writeArrayFieldStart(Constants.JSON_GEOMETRIES);
+ for (final Iterator<Geospatial> itor = collection.iterator(); itor.hasNext();) {
+ jgen.writeStartObject();
+ serialize(jgen, itor.next());
+ jgen.writeEndObject();
+ }
+ jgen.writeEndArray();
+ }
+
+ public void serialize(final JsonGenerator jgen, final Geospatial value) throws IOException {
+ if (value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeographyCollection)
+ || value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) {
+
+ jgen.writeStringField(Constants.ATTR_TYPE, EdmPrimitiveTypeKind.GeometryCollection.name());
+ } else {
+ final int yIdx = value.getEdmPrimitiveTypeKind().name().indexOf('y');
+ final String itemType = value.getEdmPrimitiveTypeKind().name().substring(yIdx + 1);
+ jgen.writeStringField(Constants.ATTR_TYPE, itemType);
+ }
+
+ switch (value.getEdmPrimitiveTypeKind()) {
+ case GeographyPoint:
+ case GeometryPoint:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ point(jgen, (Point) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyMultiPoint:
+ case GeometryMultiPoint:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ multipoint(jgen, (MultiPoint) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyLineString:
+ case GeometryLineString:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ lineString(jgen, (LineString) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyMultiLineString:
+ case GeometryMultiLineString:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ multiLineString(jgen, (MultiLineString) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ polygon(jgen, (Polygon) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ multiPolygon(jgen, (MultiPolygon) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyCollection:
+ case GeometryCollection:
+ collection(jgen, (GeospatialCollection) value);
+ break;
+
+ default:
+ }
+
+ if (value.getCrs() != null) {
+ crs(jgen, value.getCrs());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fac84b3e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
new file mode 100644
index 0000000..b68d998
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.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.commons.core.data;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import java.net.URI;
+import org.apache.olingo.commons.api.Constants;
+
+/**
+ * Parse JSON string into <tt>JSONPropertyImpl</tt>.
+ *
+ * @see JSONPropertyImpl
+ */
+public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPropertyImpl> {
+
+ @Override
+ protected JSONPropertyImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
+
+ final JSONPropertyImpl property = new JSONPropertyImpl();
+
+ if (tree.hasNonNull(Constants.JSON_METADATA)) {
+ property.setMetadata(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
+ tree.remove(Constants.JSON_METADATA);
+ }
+
+ if (property.getMetadata() != null) {
+ final String metadataURI = property.getMetadata().toASCIIString();
+ final int dashIdx = metadataURI.lastIndexOf('#');
+ if (dashIdx != -1) {
+ property.setType(metadataURI.substring(dashIdx + 1));
+ }
+ }
+
+ if (tree.has(Constants.JSON_TYPE) && property.getType() == null) {
+ property.setType(tree.get(Constants.JSON_TYPE).asText());
+ }
+
+ if (tree.has(Constants.JSON_NULL) && tree.get(Constants.JSON_NULL).asBoolean()) {
+ property.setValue(new NullValueImpl());
+ }
+
+ if (property.getValue() == null) {
+ value(property, tree.has(Constants.JSON_VALUE) ? tree.get(Constants.JSON_VALUE) : tree);
+ }
+
+ return property;
+ }
+}
[52/52] [abbrv] git commit: [OLINGO-206] Merge branch 'master' into
olingo-206-val
Posted by sk...@apache.org.
[OLINGO-206] Merge branch 'master' into olingo-206-val
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/b2508035
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/b2508035
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/b2508035
Branch: refs/heads/olingo-206-validator
Commit: b2508035907271bc4e5b7250670602bbeea2c597
Parents: fbafc3a 4a19c8d
Author: Stephan Klevenz <st...@sap.com>
Authored: Tue Apr 1 10:56:28 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Tue Apr 1 10:56:28 2014 +0200
----------------------------------------------------------------------
ODataJClient/engine/pom.xml | 2 +-
.../odatajclient/engine/AllGeoTypesSet_-8.xml | 156 +-
.../odatajclient/testservice/utils/Commons.java | 4 +-
fit/pom.xml | 140 +-
.../org/apache/olingo/fit/AbstractServices.java | 1255 +++++++++++++++
.../fit/UnsupportedMediaTypeException.java | 41 +
.../java/org/apache/olingo/fit/V3Services.java | 38 +
.../java/org/apache/olingo/fit/V4Services.java | 38 +
.../org/apache/olingo/fit/methods/MERGE.java | 31 +
.../org/apache/olingo/fit/methods/PATCH.java | 31 +
.../apache/olingo/fit/rproxy/LinkRewrite.java | 54 +
.../olingo/fit/rproxy/LinkRewriteRenderer.java | 56 +
.../olingo/fit/utils/AbstractJSONUtilities.java | 503 ++++++
.../olingo/fit/utils/AbstractUtilities.java | 791 ++++++++++
.../olingo/fit/utils/AbstractXMLUtilities.java | 1302 ++++++++++++++++
.../org/apache/olingo/fit/utils/Accept.java | 96 ++
.../org/apache/olingo/fit/utils/Commons.java | 273 ++++
.../org/apache/olingo/fit/utils/Constants.java | 107 ++
.../org/apache/olingo/fit/utils/FSManager.java | 169 ++
.../org/apache/olingo/fit/utils/LinkInfo.java | 54 +
.../olingo/fit/utils/MetadataLinkInfo.java | 175 +++
.../olingo/fit/utils/NavigationLinks.java | 120 ++
.../apache/olingo/fit/utils/ODataVersion.java | 35 +
.../fit/utils/XHTTPMethodInterceptor.java | 43 +
.../olingo/fit/utils/XMLEventReaderWrapper.java | 136 ++
.../org/apache/olingo/fit/utils/XmlElement.java | 99 ++
.../olingo/fit/utils/v3/JSONUtilities.java | 28 +
.../olingo/fit/utils/v3/XMLUtilities.java | 191 +++
.../olingo/fit/utils/v4/JSONUtilities.java | 28 +
.../olingo/fit/utils/v4/XMLUtilities.java | 142 ++
.../main/resources/META-INF/vfs-providers.xml | 27 +
fit/src/main/resources/context.xml | 25 +
fit/src/main/resources/esigate.properties | 25 +
.../org/esigate/rewrite-proxy.properties | 23 +
fit/src/main/resources/tomcat-users.xml | 27 +
fit/src/main/resources/v3/Car/12/$value.bin | 0
.../main/resources/v3/Car/12/entity.full.json | 13 +
fit/src/main/resources/v3/Car/12/entity.xml | 39 +
fit/src/main/resources/v3/Car/14/$value.bin | 0
.../main/resources/v3/Car/14/entity.full.json | 13 +
fit/src/main/resources/v3/Car/14/entity.xml | 39 +
fit/src/main/resources/v3/Car/15/$value.bin | 0
.../main/resources/v3/Car/15/entity.full.json | 13 +
fit/src/main/resources/v3/Car/15/entity.xml | 39 +
.../main/resources/v3/Car/16/entity.full.json | 14 +
fit/src/main/resources/v3/Car/16/entity.xml | 45 +
fit/src/main/resources/v3/Car/feed.full.json | 297 ++++
fit/src/main/resources/v3/Car/feed.xml | 459 ++++++
.../v3/Car/filter/((1 add VIN) eq 16).full.json | 1 +
.../v3/Car/filter/((1 add VIN) eq 16).xml | 45 +
.../v3/Car/filter/((VIN add 1) eq 16).full.json | 1 +
.../v3/Car/filter/((VIN add 1) eq 16).xml | 45 +
.../((VIN lt 16) and (VIN gt 12)).full.json | 1 +
.../filter/((VIN lt 16) and (VIN gt 12)).xml | 81 +
.../v3/Car/filter/(16 eq (1 add VIN)).full.json | 1 +
.../v3/Car/filter/(16 eq (1 add VIN)).xml | 45 +
.../v3/Car/filter/(VIN lt 16).full.json | 1 +
.../resources/v3/Car/filter/(VIN lt 16).xml | 117 ++
...ngth(Description) gt (VIN add 10)).full.json | 1 +
.../(length(Description) gt (VIN add 10)).xml | 117 ++
.../v3/Car/filter/VIN add 5 lt 11.full.json | 1 +
.../resources/v3/Car/filter/VIN add 5 lt 11.xml | 41 +
.../v3/Car/filter/VIN div 2 le 8.full.json | 1 +
.../resources/v3/Car/filter/VIN div 2 le 8.xml | 41 +
.../filter/VIN le 18 and VIN gt 12.full.json | 1 +
.../v3/Car/filter/VIN le 18 and VIN gt 12.xml | 41 +
.../v3/Car/filter/VIN mul 2 le 30.full.json | 1 +
.../resources/v3/Car/filter/VIN mul 2 le 30.xml | 41 +
...not (((VIN ge 16) or (VIN le 12))).full.json | 1 +
.../not (((VIN ge 16) or (VIN le 12))).xml | 81 +
.../startswith(Description,'cen').full.json | 1 +
.../filter/startswith(Description,'cen').xml | 45 +
.../VIN desc/filter/(VIN lt 16).full.json | 9 +
.../Car/orderby/VIN desc/filter/(VIN lt 16).xml | 117 ++
.../v3/ComputerDetail/-10/entity.full.json | 23 +
.../resources/v3/ComputerDetail/-10/entity.xml | 44 +
.../(month(PurchaseDate) eq 12).full.json | 1 +
.../filter/(month(PurchaseDate) eq 12).xml | 64 +
.../filter/day(PurchaseDate) eq 15.full.json | 1 +
.../filter/day(PurchaseDate) eq 15.xml | 41 +
.../filter/hour(PurchaseDate) eq 1.full.json | 1 +
.../filter/hour(PurchaseDate) eq 1.xml | 41 +
.../filter/minute(PurchaseDate) eq 33.full.json | 1 +
.../filter/minute(PurchaseDate) eq 33.xml | 41 +
.../filter/month(PurchaseDate) eq 12.full.json | 1 +
.../filter/month(PurchaseDate) eq 12.xml | 41 +
.../filter/second(PurchaseDate) eq 35.full.json | 1 +
.../filter/second(PurchaseDate) eq 35.xml | 41 +
.../filter/year(PurchaseDate) eq 2020.full.json | 1 +
.../filter/year(PurchaseDate) eq 2020.xml | 41 +
.../resources/v3/Customer/-10/entity.full.json | 673 ++++++++
.../main/resources/v3/Customer/-10/entity.xml | 516 +++++++
.../v3/Customer/-10/links/Info.full.json | 4 +
.../resources/v3/Customer/-10/links/Info.xml | 22 +
.../v3/Customer/-10/links/Logins('3').full.json | 4 +
.../v3/Customer/-10/links/Logins.full.json | 12 +
.../resources/v3/Customer/-10/links/Logins.xml | 25 +
.../v3/Customer/-10/links/Orders(-10).full.json | 4 +
.../v3/Customer/-10/links/Orders.full.json | 13 +
.../resources/v3/Customer/-10/links/Orders.xml | 26 +
.../resources/v3/Customer/-7/entity.full.json | 487 ++++++
.../main/resources/v3/Customer/-7/entity.xml | 381 +++++
.../resources/v3/Customer/-9/entity.full.json | 750 +++++++++
.../main/resources/v3/Customer/-9/entity.xml | 565 +++++++
.../main/resources/v3/Customer/feed.full.json | 893 +++++++++++
fit/src/main/resources/v3/Customer/feed.xml | 704 +++++++++
....PhoneNumber,'ODataJClient') eq 1).full.json | 1 +
...ePhone.PhoneNumber,'ODataJClient') eq 1).xml | 30 +
...ne.PhoneNumber,'lccvussrv') ne -1).full.json | 1 +
...omePhone.PhoneNumber,'lccvussrv') ne -1).xml | 600 ++++++++
.../Customer/filter/CustomerId eq -10.full.json | 678 ++++++++
.../v3/Customer/filter/CustomerId eq -10.xml | 522 +++++++
.../Customer/filter/CustomerId gt -10.full.json | 1 +
.../v3/Customer/filter/CustomerId gt -10.xml | 740 +++++++++
.../Customer/filter/CustomerId lt -10.full.json | 1 +
.../v3/Customer/filter/CustomerId lt -10.xml | 30 +
.../isof(Name,'Edm.String') eq true.full.json | 1 +
.../filter/isof(Name,'Edm.String') eq true.xml | 1085 +++++++++++++
.../not endswith(Name,'Chandan').full.json | 1 +
.../filter/not endswith(Name,'Chandan').xml | 1065 +++++++++++++
.../v3/Customer/skiptoken/-1.full.json | 6 +
.../main/resources/v3/Customer/skiptoken/-1.xml | 30 +
.../v3/Customer/skiptoken/-10.full.json | 978 ++++++++++++
.../resources/v3/Customer/skiptoken/-10.xml | 953 ++++++++++++
.../v3/Customer/skiptoken/-3.full.json | 776 ++++++++++
.../main/resources/v3/Customer/skiptoken/-3.xml | 613 ++++++++
.../v3/Customer/skiptoken/-5.full.json | 1444 ++++++++++++++++++
.../main/resources/v3/Customer/skiptoken/-5.xml | 1104 +++++++++++++
.../v3/Customer/skiptoken/-7.full.json | 1296 ++++++++++++++++
.../main/resources/v3/Customer/skiptoken/-7.xml | 990 ++++++++++++
.../v3/Customer/skiptoken/-9.full.json | 715 +++++++++
.../main/resources/v3/Customer/skiptoken/-9.xml | 559 +++++++
.../v3/CustomerInfo/11/entity.full.json | 11 +
.../resources/v3/CustomerInfo/11/entity.xml | 37 +
.../v3/CustomerInfo/12/entity.full.json | 11 +
.../resources/v3/CustomerInfo/12/entity.xml | 37 +
.../v3/EdmBooleanSet/true/entity.full.json | 1 +
.../resources/v3/EdmBooleanSet/true/entity.xml | 36 +
.../v3/EdmByteSet/255/entity.full.json | 1 +
.../main/resources/v3/EdmByteSet/255/entity.xml | 36 +
.../entity.full.json | 1 +
.../79228162514264337593543950335M/entity.xml | 36 +
.../1.7976931348623157E308D/entity.full.json | 1 +
.../1.7976931348623157E308D/entity.xml | 36 +
.../entity.full.json | 1 +
.../entity.xml | 36 +
.../v3/EdmInt16Set/32767/entity.full.json | 1 +
.../resources/v3/EdmInt16Set/32767/entity.xml | 36 +
.../v3/EdmInt32Set/-2147483648/entity.full.json | 1 +
.../v3/EdmInt32Set/-2147483648/entity.xml | 36 +
.../9223372036854775807L/entity.full.json | 1 +
.../EdmInt64Set/9223372036854775807L/entity.xml | 36 +
.../EdmSingleSet/3.4028235E38f/entity.full.json | 1 +
.../v3/EdmSingleSet/3.4028235E38f/entity.xml | 36 +
.../v3/EdmStringSet/'$'/entity.full.json | 1 +
.../resources/v3/EdmStringSet/'$'/entity.xml | 36 +
.../entity.full.json | 1 +
.../entity.xml | 36 +
.../v3/InStreamErrorGetCustomer.full.json | 1 +
.../resources/v3/InStreamErrorGetCustomer.xml | 525 +++++++
.../resources/v3/Login/'3'/entity.full.json | 13 +
fit/src/main/resources/v3/Login/'3'/entity.xml | 42 +
.../resources/v3/Message/1 -10/entity.full.json | 17 +
.../main/resources/v3/Message/1 -10/entity.xml | 46 +
.../resources/v3/Order/-10/entity.full.json | 11 +
fit/src/main/resources/v3/Order/-10/entity.xml | 40 +
.../main/resources/v3/Order/-7/entity.full.json | 17 +
fit/src/main/resources/v3/Order/-7/entity.xml | 43 +
.../main/resources/v3/Order/-8/entity.full.json | 17 +
fit/src/main/resources/v3/Order/-8/entity.xml | 43 +
.../main/resources/v3/Order/-9/entity.full.json | 17 +
fit/src/main/resources/v3/Order/-9/entity.xml | 43 +
.../v3/OrderLine/-10 -10/entity.full.json | 14 +
.../resources/v3/OrderLine/-10 -10/entity.xml | 42 +
.../resources/v3/OrderLine/-10 -10/etag.txt | 1 +
.../filter/PersonId sub 2 lt -10.full.json | 1 +
.../v3/Person/filter/PersonId sub 2 lt -10.xml | 79 +
...iaDefaultService.SpecialEmployee').full.json | 1 +
....AstoriaDefaultService.SpecialEmployee').xml | 131 ++
.../resources/v3/Product/-10/entity.full.json | 51 +
.../main/resources/v3/Product/-10/entity.xml | 61 +
fit/src/main/resources/v3/Product/-10/etag.txt | 1 +
.../resources/v3/Product/-6/entity.full.json | 51 +
fit/src/main/resources/v3/Product/-6/entity.xml | 61 +
fit/src/main/resources/v3/Product/-6/etag.txt | 1 +
.../resources/v3/Product/-7/entity.full.json | 51 +
fit/src/main/resources/v3/Product/-7/entity.xml | 61 +
fit/src/main/resources/v3/Product/-7/etag.txt | 1 +
.../v3/Product/-7/links/Photos.full.json | 12 +
.../resources/v3/Product/-9/entity.full.json | 60 +
fit/src/main/resources/v3/Product/-9/entity.xml | 68 +
fit/src/main/resources/v3/Product/-9/etag.txt | 1 +
.../main/resources/v3/Product/feed.full.json | 452 ++++++
fit/src/main/resources/v3/Product/feed.xml | 410 +++++
.../ceiling(Dimensions.Width) eq 7338.full.json | 1 +
.../ceiling(Dimensions.Width) eq 7338.xml | 68 +
...', newname') eq 'kdcuklu, newname'.full.json | 1 +
...tion, ', newname') eq 'kdcuklu, newname'.xml | 74 +
.../floor(Dimensions.Width) eq 7337.full.json | 1 +
.../filter/floor(Dimensions.Width) eq 7337.xml | 68 +
.../indexof(Description, 'k') eq 0.full.json | 1 +
.../filter/indexof(Description, 'k') eq 0.xml | 117 ++
.../filter/length(Description) eq 7.full.json | 1 +
.../Product/filter/length(Description) eq 7.xml | 74 +
.../round(Dimensions.Width) eq 7338.full.json | 1 +
.../filter/round(Dimensions.Width) eq 7338.xml | 68 +
...artswith(Description, 'k') eq true.full.json | 1 +
.../startswith(Description, 'k') eq true.xml | 117 ++
...of('kdcuklu', Description) eq true.full.json | 1 +
...stringof('kdcuklu', Description) eq true.xml | 74 +
.../toupper(Description) eq 'KDCUKLU'.full.json | 1 +
.../toupper(Description) eq 'KDCUKLU'.xml | 74 +
.../v3/ProductPhoto/-2 -2/entity.full.json | 10 +
.../resources/v3/ProductPhoto/-2 -2/entity.xml | 39 +
.../v3/ProductPhoto/-3 -3/entity.full.json | 10 +
.../resources/v3/ProductPhoto/-3 -3/entity.xml | 38 +
fit/src/main/resources/v3/badRequest.json | 17 +
fit/src/main/resources/v3/badRequest.xml | 30 +
fit/src/main/resources/v3/largeMetadata.xml | 42 +
fit/src/main/resources/v3/metadata.xml | 719 +++++++++
fit/src/main/resources/v3/notFound.json | 11 +
fit/src/main/resources/v3/notFound.xml | 25 +
fit/src/main/resources/v3/services.full.json | 102 ++
fit/src/main/resources/v3/services.xml | 98 ++
.../main/resources/v3/unsupportedMediaType.json | 17 +
.../main/resources/v3/unsupportedMediaType.xml | 34 +
fit/src/main/resources/v4/People/feed.full.json | 333 ++++
fit/src/main/resources/v4/People/feed.xml | 219 +++
fit/src/main/resources/v4/metadata.xml | 438 ++++++
.../main/webapp/WEB-INF/applicationContext.xml | 50 +
fit/src/main/webapp/WEB-INF/web.xml | 75 +
lib/client-api/pom.xml | 4 +-
.../olingo/client/api/CommonConfiguration.java | 184 +++
.../olingo/client/api/CommonODataClient.java | 76 +
.../apache/olingo/client/api/Configuration.java | 184 ---
.../org/apache/olingo/client/api/Constants.java | 217 ---
.../olingo/client/api/ODataBatchConstants.java | 56 +
.../apache/olingo/client/api/ODataClient.java | 55 -
.../olingo/client/api/ODataConstants.java | 219 ---
.../apache/olingo/client/api/ODataError.java | 67 -
.../apache/olingo/client/api/ODataV3Client.java | 39 -
.../apache/olingo/client/api/ODataV4Client.java | 39 -
.../client/api/UnsupportedInV3Exception.java | 31 -
.../olingo/client/api/V3Configuration.java | 44 -
.../olingo/client/api/V4Configuration.java | 24 -
.../ODataClientErrorException.java | 110 ++
.../ODataServerErrorException.java | 38 +
.../api/communication/header/HeaderName.java | 147 ++
.../communication/header/ODataHeaderValues.java | 45 +
.../api/communication/header/ODataHeaders.java | 59 +
.../request/ODataBasicRequest.java | 55 +
.../request/ODataBatchableRequest.java | 46 +
.../api/communication/request/ODataRequest.java | 191 +++
.../request/ODataStreamManager.java | 57 +
.../request/ODataStreamedRequest.java | 38 +
.../communication/request/ODataStreamer.java | 39 +
.../api/communication/request/UpdateType.java | 55 +
.../request/batch/BatchStreamManager.java | 42 +
.../batch/CommonBatchRequestFactory.java | 35 +
.../request/batch/ODataBatchLineIterator.java | 57 +
.../request/batch/ODataBatchRequest.java | 57 +
.../request/batch/ODataBatchRequestItem.java | 46 +
.../request/batch/ODataBatchResponseItem.java | 56 +
.../request/batch/ODataChangeset.java | 39 +
.../request/batch/ODataRetrieve.java | 37 +
.../request/batch/v3/BatchRequestFactory.java | 24 +
.../request/batch/v4/BatchRequestFactory.java | 24 +
.../request/cud/CommonCUDRequestFactory.java | 145 ++
.../request/cud/ODataDeleteRequest.java | 29 +
.../request/cud/ODataEntityCreateRequest.java | 29 +
.../request/cud/ODataEntityUpdateRequest.java | 29 +
.../request/cud/ODataLinkCreateRequest.java | 29 +
.../request/cud/ODataLinkUpdateRequest.java | 29 +
.../request/cud/ODataPropertyUpdateRequest.java | 29 +
.../request/cud/ODataValueUpdateRequest.java | 29 +
.../request/cud/v3/CUDRequestFactory.java | 24 +
.../request/cud/v4/CUDRequestFactory.java | 24 +
.../invoke/CommonInvokeRequestFactory.java | 61 +
.../request/invoke/ODataInvokeRequest.java | 40 +
.../request/invoke/ODataNoContent.java | 31 +
.../request/invoke/v3/InvokeRequestFactory.java | 24 +
.../request/invoke/v4/InvokeRequestFactory.java | 24 +
.../retrieve/CommonRetrieveRequestFactory.java | 105 ++
.../request/retrieve/ODataEntityRequest.java | 28 +
.../retrieve/ODataEntitySetIteratorRequest.java | 28 +
.../request/retrieve/ODataEntitySetRequest.java | 28 +
.../request/retrieve/ODataMediaRequest.java | 28 +
.../request/retrieve/ODataMetadataRequest.java | 28 +
.../request/retrieve/ODataPropertyRequest.java | 28 +
.../request/retrieve/ODataRawRequest.java | 42 +
.../request/retrieve/ODataRetrieveRequest.java | 29 +
.../retrieve/ODataServiceDocumentRequest.java | 28 +
.../request/retrieve/ODataValueRequest.java | 28 +
.../retrieve/v3/ODataLinkCollectionRequest.java | 29 +
.../retrieve/v3/RetrieveRequestFactory.java | 34 +
.../retrieve/v4/RetrieveRequestFactory.java | 24 +
.../streamed/CommonStreamedRequestFactory.java | 62 +
.../MediaEntityCreateStreamManager.java | 28 +
.../MediaEntityUpdateStreamManager.java | 28 +
.../streamed/ODataMediaEntityCreateRequest.java | 28 +
.../streamed/ODataMediaEntityUpdateRequest.java | 28 +
.../streamed/ODataStreamUpdateRequest.java | 30 +
.../streamed/ODataStreamedEntityRequest.java | 50 +
.../streamed/StreamUpdateStreamManager.java | 28 +
.../streamed/v3/StreamedRequestFactory.java | 24 +
.../streamed/v4/StreamedRequestFactory.java | 24 +
.../response/ODataBatchResponse.java | 37 +
.../response/ODataDeleteResponse.java | 27 +
.../response/ODataEntityCreateResponse.java | 36 +
.../response/ODataEntityUpdateResponse.java | 36 +
.../response/ODataInvokeResponse.java | 36 +
.../response/ODataLinkOperationResponse.java | 28 +
.../ODataMediaEntityCreateResponse.java | 36 +
.../ODataMediaEntityUpdateResponse.java | 36 +
.../response/ODataPropertyUpdateResponse.java | 36 +
.../response/ODataRawResponse.java | 33 +
.../communication/response/ODataResponse.java | 117 ++
.../response/ODataRetrieveResponse.java | 34 +
.../response/ODataStreamUpdateResponse.java | 36 +
.../response/ODataValueUpdateResponse.java | 36 +
.../api/deserializer/AnnotationProperty.java | 24 -
.../api/deserializer/ClientException.java | 36 -
.../client/api/deserializer/ComplexValue.java | 35 -
.../olingo/client/api/deserializer/Entity.java | 59 -
.../client/api/deserializer/EntitySet.java | 34 -
.../api/deserializer/NavigationProperty.java | 27 -
.../client/api/deserializer/Property.java | 24 -
.../olingo/client/api/deserializer/Reader.java | 30 -
.../api/deserializer/StructuralProperty.java | 30 -
.../olingo/client/api/deserializer/Value.java | 28 -
.../olingo/client/api/domain/EdmSimpleType.java | 289 ----
.../client/api/domain/ODataCollectionValue.java | 98 --
.../client/api/domain/ODataComplexValue.java | 97 --
.../olingo/client/api/domain/ODataDuration.java | 79 -
.../api/domain/ODataEntitySetIterator.java | 311 ++++
.../client/api/domain/ODataGeospatialValue.java | 488 ------
.../client/api/domain/ODataInvokeResult.java | 30 -
.../client/api/domain/ODataPrimitiveValue.java | 378 -----
.../olingo/client/api/domain/ODataProperty.java | 192 ---
.../client/api/domain/ODataServiceDocument.java | 183 ---
.../client/api/domain/ODataTimestamp.java | 138 --
.../olingo/client/api/domain/ODataValue.java | 111 --
.../domain/geospatial/ComposedGeospatial.java | 75 -
.../api/domain/geospatial/Geospatial.java | 157 --
.../domain/geospatial/GeospatialCollection.java | 48 -
.../api/domain/geospatial/LineString.java | 39 -
.../api/domain/geospatial/MultiLineString.java | 39 -
.../api/domain/geospatial/MultiPoint.java | 39 -
.../api/domain/geospatial/MultiPolygon.java | 39 -
.../client/api/domain/geospatial/Point.java | 77 -
.../client/api/domain/geospatial/Polygon.java | 73 -
.../api/domain/v3/ODataLinkCollection.java | 100 ++
.../olingo/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/op/ClientODataDeserializer.java | 39 +
.../olingo/client/api/op/CommonODataBinder.java | 132 ++
.../olingo/client/api/op/CommonODataReader.java | 104 ++
.../olingo/client/api/op/ODataBinder.java | 122 --
.../olingo/client/api/op/ODataDeserializer.java | 94 --
.../olingo/client/api/op/ODataReader.java | 104 --
.../olingo/client/api/op/ODataSerializer.java | 118 --
.../client/api/op/ODataV3Deserializer.java | 23 -
.../client/api/op/ODataV4Deserializer.java | 30 -
.../olingo/client/api/op/ODataWriter.java | 94 ++
.../olingo/client/api/op/v3/ODataBinder.java | 35 +
.../client/api/op/v3/ODataDeserializer.java | 37 +
.../olingo/client/api/op/v3/ODataReader.java | 37 +
.../olingo/client/api/op/v4/ODataBinder.java | 25 +
.../client/api/op/v4/ODataDeserializer.java | 31 +
.../olingo/client/api/op/v4/ODataReader.java | 25 +
.../client/api/uri/CommonFilterArgFactory.java | 83 +
.../client/api/uri/CommonFilterFactory.java | 61 +
.../olingo/client/api/uri/CommonURIBuilder.java | 224 +++
.../apache/olingo/client/api/uri/FilterArg.java | 30 +
.../olingo/client/api/uri/URIBuilder.java | 225 ---
.../apache/olingo/client/api/uri/URIFilter.java | 32 +
.../olingo/client/api/uri/V3URIBuilder.java | 47 -
.../olingo/client/api/uri/V4URIBuilder.java | 87 --
.../olingo/client/api/uri/filter/FilterArg.java | 30 -
.../client/api/uri/filter/FilterArgFactory.java | 83 -
.../client/api/uri/filter/FilterFactory.java | 61 -
.../olingo/client/api/uri/filter/URIFilter.java | 32 -
.../api/uri/filter/V3FilterArgFactory.java | 25 -
.../client/api/uri/filter/V3FilterFactory.java | 26 -
.../api/uri/filter/V4FilterArgFactory.java | 55 -
.../client/api/uri/filter/V4FilterFactory.java | 32 -
.../client/api/uri/v3/FilterArgFactory.java | 28 +
.../olingo/client/api/uri/v3/FilterFactory.java | 28 +
.../olingo/client/api/uri/v3/URIBuilder.java | 49 +
.../client/api/uri/v4/FilterArgFactory.java | 59 +
.../olingo/client/api/uri/v4/FilterFactory.java | 35 +
.../olingo/client/api/uri/v4/URIBuilder.java | 89 ++
.../olingo/client/api/utils/XMLUtils.java | 178 ---
.../olingo/client/api/v3/Configuration.java | 46 +
.../olingo/client/api/v3/ODataClient.java | 67 +
.../client/api/v3/UnsupportedInV3Exception.java | 31 +
.../olingo/client/api/v4/Configuration.java | 26 +
.../olingo/client/api/v4/ODataClient.java | 67 +
lib/client-core/pom.xml | 97 +-
.../client/core/AbstractConfiguration.java | 15 +-
.../olingo/client/core/AbstractODataClient.java | 36 +-
.../olingo/client/core/ODataClientFactory.java | 11 +-
.../olingo/client/core/ODataV3ClientImpl.java | 146 --
.../olingo/client/core/ODataV4ClientImpl.java | 146 --
.../olingo/client/core/V3ConfigurationImpl.java | 57 -
.../olingo/client/core/V4ConfigurationImpl.java | 31 -
.../communication/header/ODataHeadersImpl.java | 111 ++
.../request/AbstractODataBasicRequest.java | 126 ++
.../request/AbstractODataStreamManager.java | 182 +++
.../request/AbstractODataStreamer.java | 101 ++
.../communication/request/ODataRequestImpl.java | 489 ++++++
.../core/communication/request/Wrapper.java | 41 +
.../batch/AbstractBatchRequestFactory.java | 36 +
.../batch/AbstractODataBatchRequestItem.java | 124 ++
.../batch/AbstractODataBatchResponseItem.java | 146 ++
.../request/batch/ODataBatchController.java | 89 ++
.../batch/ODataBatchLineIteratorImpl.java | 93 ++
.../request/batch/ODataBatchRequestImpl.java | 255 ++++
.../request/batch/ODataBatchUtilities.java | 329 ++++
.../request/batch/ODataChangesetImpl.java | 128 ++
.../batch/ODataChangesetResponseItem.java | 129 ++
.../request/batch/ODataRetrieveImpl.java | 81 +
.../batch/ODataRetrieveResponseItem.java | 85 ++
.../batch/v3/BatchRequestFactoryImpl.java | 33 +
.../batch/v4/BatchRequestFactoryImpl.java | 33 +
.../request/cud/AbstractCUDRequestFactory.java | 197 +++
.../request/cud/ODataDeleteRequestImpl.java | 93 ++
.../cud/ODataEntityCreateRequestImpl.java | 125 ++
.../cud/ODataEntityUpdateRequestImpl.java | 131 ++
.../request/cud/ODataLinkCreateRequestImpl.java | 108 ++
.../request/cud/ODataLinkUpdateRequestImpl.java | 111 ++
.../cud/ODataPropertyUpdateRequestImpl.java | 129 ++
.../cud/ODataValueUpdateRequestImpl.java | 139 ++
.../request/cud/v3/CUDRequestFactoryImpl.java | 33 +
.../request/cud/v4/CUDRequestFactoryImpl.java | 33 +
.../invoke/AbstractInvokeRequestFactory.java | 46 +
.../request/invoke/ODataInvokeRequestImpl.java | 235 +++
.../invoke/v3/InvokeRequestFactoryImpl.java | 112 ++
.../invoke/v4/InvokeRequestFactoryImpl.java | 48 +
.../retrieve/AbstractODataRetrieveRequest.java | 98 ++
.../AbstractRetrieveRequestFactory.java | 92 ++
.../retrieve/ODataEntityRequestImpl.java | 95 ++
.../ODataEntitySetIteratorRequestImpl.java | 86 ++
.../retrieve/ODataEntitySetRequestImpl.java | 97 ++
.../request/retrieve/ODataMediaRequestImpl.java | 109 ++
.../retrieve/ODataMetadataRequestImpl.java | 108 ++
.../retrieve/ODataPropertyRequestImpl.java | 97 ++
.../request/retrieve/ODataRawRequestImpl.java | 101 ++
.../ODataServiceDocumentRequestImpl.java | 93 ++
.../request/retrieve/ODataValueRequestImpl.java | 107 ++
.../v3/ODataLinkCollectionRequestImpl.java | 99 ++
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 41 +
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 33 +
.../AbstractODataStreamedEntityRequest.java | 70 +
.../streamed/AbstractODataStreamedRequest.java | 153 ++
.../AbstractStreamedRequestFactory.java | 76 +
.../ODataMediaEntityCreateRequestImpl.java | 134 ++
.../ODataMediaEntityUpdateRequestImpl.java | 137 ++
.../streamed/ODataStreamUpdateRequestImpl.java | 133 ++
.../streamed/v3/StreamedRequestFactoryImpl.java | 33 +
.../streamed/v4/StreamedRequestFactoryImpl.java | 33 +
.../response/AbstractODataResponse.java | 276 ++++
.../batch/ODataBatchResponseManager.java | 151 ++
.../data/JSONServiceDocumentDeserializer.java | 15 +-
.../core/data/ODataJacksonDeserializer.java | 45 -
.../core/data/ODataJacksonSerializer.java | 45 -
.../data/XMLServiceDocumentDeserializer.java | 3 +-
.../core/data/v3/JSONServiceDocumentImpl.java | 4 +-
.../core/data/v4/JSONServiceDocumentImpl.java | 4 +-
.../deserializer/AnnotationPropertyImpl.java | 53 -
.../core/deserializer/ComplexValueImpl.java | 82 -
.../client/core/deserializer/EntityImpl.java | 126 --
.../core/deserializer/EntitySetBuilder.java | 72 -
.../client/core/deserializer/EntitySetImpl.java | 120 --
.../client/core/deserializer/JsonReader.java | 89 --
.../deserializer/NavigationPropertyImpl.java | 89 --
.../core/deserializer/PrimitiveValue.java | 51 -
.../core/deserializer/PropertyCollection.java | 96 --
.../deserializer/PropertyCollectionBuilder.java | 221 ---
.../deserializer/StructuralPropertyImpl.java | 83 -
.../core/domain/ODataGeospatialValueImpl.java | 130 ++
.../core/domain/ODataPrimitiveValueImpl.java | 177 +++
.../client/core/edm/EdmActionImportImpl.java | 3 +-
.../olingo/client/core/edm/EdmClientImpl.java | 25 +-
.../client/core/edm/EdmComplexTypeImpl.java | 1 +
.../client/core/edm/EdmEntityContainerImpl.java | 3 +-
.../client/core/edm/EdmEntityTypeImpl.java | 1 +
.../olingo/client/core/edm/EdmEnumTypeImpl.java | 14 +-
.../client/core/edm/EdmFunctionImportImpl.java | 1 +
.../core/edm/EdmNavigationPropertyImpl.java | 1 +
.../client/core/edm/EdmOperationImpl.java | 8 +-
.../client/core/edm/EdmParameterImpl.java | 1 +
.../olingo/client/core/edm/EdmPropertyImpl.java | 1 +
.../client/core/edm/EdmReturnTypeImpl.java | 1 +
.../olingo/client/core/edm/EdmSchemaImpl.java | 15 +-
.../client/core/edm/EdmTypeDefinitionImpl.java | 12 +-
.../olingo/client/core/edm/EdmTypeInfo.java | 174 ---
.../core/edm/v3/EdmActionImportProxy.java | 2 +-
.../core/edm/v3/EdmFunctionImportProxy.java | 2 +-
.../core/edm/v3/EdmServiceMetadataImpl.java | 6 +-
.../client/core/edm/v3/FunctionImportUtils.java | 36 +
.../core/edm/v3/V3FunctionImportUtils.java | 36 -
.../core/edm/xml/AbstractComplexType.java | 1 -
.../core/edm/xml/AbstractEdmDeserializer.java | 71 +
.../core/edm/xml/AbstractEntityContainer.java | 1 -
.../client/core/edm/xml/AbstractEntitySet.java | 1 -
.../client/core/edm/xml/AbstractEntityType.java | 1 -
.../client/core/edm/xml/AbstractEnumType.java | 1 -
.../client/core/edm/xml/AbstractSchema.java | 1 -
.../core/edm/xml/ComplexTypeDeserializer.java | 82 +
.../core/edm/xml/DataServicesDeserializer.java | 3 +-
.../client/core/edm/xml/EdmxDeserializer.java | 6 +-
.../edm/xml/EntityContainerDeserializer.java | 101 ++
.../core/edm/xml/EntityKeyDeserializer.java | 47 +
.../client/core/edm/xml/EntityKeyImpl.java | 1 -
.../core/edm/xml/EntitySetDeserializer.java | 69 +
.../core/edm/xml/EntityTypeDeserializer.java | 90 ++
.../core/edm/xml/EnumTypeDeserializer.java | 72 +
.../core/edm/xml/ParameterDeserializer.java | 3 +-
.../core/edm/xml/PropertyDeserializer.java | 3 +-
.../client/core/edm/xml/SchemaDeserializer.java | 148 ++
.../edm/xml/v3/AnnotationsDeserializer.java | 2 +-
.../edm/xml/v3/AssociationDeserializer.java | 2 +-
.../edm/xml/v3/AssociationSetDeserializer.java | 2 +-
.../edm/xml/v3/FunctionImportDeserializer.java | 2 +-
.../ReferentialConstraintRoleDeserializer.java | 2 +-
.../edm/xml/v3/TypeAnnotationDeserializer.java | 2 +-
.../core/edm/xml/v4/ActionDeserializer.java | 2 +-
.../core/edm/xml/v4/AnnotationDeserializer.java | 4 +-
.../edm/xml/v4/AnnotationsDeserializer.java | 2 +-
.../core/edm/xml/v4/FunctionDeserializer.java | 2 +-
.../xml/v4/NavigationPropertyDeserializer.java | 2 +-
.../core/edm/xml/v4/ReferenceDeserializer.java | 2 +-
.../core/edm/xml/v4/ReturnTypeDeserializer.java | 2 +-
.../core/edm/xml/v4/SingletonDeserializer.java | 2 +-
.../core/edm/xml/v4/TermDeserializer.java | 2 +-
.../edm/xml/v4/TypeDefinitionDeserializer.java | 2 +-
.../xml/v4/annotation/ApplyDeserializer.java | 2 +-
.../edm/xml/v4/annotation/CastDeserializer.java | 2 +-
.../v4/annotation/CollectionDeserializer.java | 2 +-
.../DynExprConstructDeserializer.java | 2 +-
.../edm/xml/v4/annotation/IsOfDeserializer.java | 2 +-
.../annotation/LabeledElementDeserializer.java | 2 +-
.../edm/xml/v4/annotation/NullDeserializer.java | 2 +-
.../annotation/PropertyValueDeserializer.java | 2 +-
.../xml/v4/annotation/RecordDeserializer.java | 2 +-
.../xml/v4/annotation/UrlRefDeserializer.java | 2 +-
.../client/core/op/AbstractODataBinder.java | 405 +++++
.../client/core/op/AbstractODataReader.java | 117 ++
.../olingo/client/core/op/ODataWriterImpl.java | 102 ++
.../core/op/impl/AbstractEdmDeserializer.java | 71 -
.../core/op/impl/AbstractJacksonTool.java | 85 --
.../core/op/impl/AbstractODataBinder.java | 582 -------
.../core/op/impl/AbstractODataDeserializer.java | 178 ---
.../core/op/impl/AbstractODataReader.java | 138 --
.../core/op/impl/AbstractODataSerializer.java | 161 --
.../core/op/impl/ComplexTypeDeserializer.java | 83 -
.../op/impl/EntityContainerDeserializer.java | 102 --
.../core/op/impl/EntityKeyDeserializer.java | 50 -
.../core/op/impl/EntitySetDeserializer.java | 70 -
.../core/op/impl/EntityTypeDeserializer.java | 92 --
.../core/op/impl/EnumTypeDeserializer.java | 73 -
.../op/impl/InjectableSerializerProvider.java | 43 -
.../client/core/op/impl/ODataV3BinderImpl.java | 37 -
.../core/op/impl/ODataV3DeserializerImpl.java | 70 -
.../client/core/op/impl/ODataV3ReaderImpl.java | 48 -
.../core/op/impl/ODataV3SerializerImpl.java | 32 -
.../client/core/op/impl/ODataV4BinderImpl.java | 62 -
.../core/op/impl/ODataV4DeserializerImpl.java | 71 -
.../client/core/op/impl/ODataV4ReaderImpl.java | 48 -
.../core/op/impl/ODataV4SerializerImpl.java | 32 -
.../client/core/op/impl/SchemaDeserializer.java | 149 --
.../client/core/op/impl/v3/ODataBinderImpl.java | 42 +
.../core/op/impl/v3/ODataDeserializerImpl.java | 67 +
.../client/core/op/impl/v3/ODataReaderImpl.java | 66 +
.../core/op/impl/v3/ODataSerializerImpl.java | 32 +
.../client/core/op/impl/v4/ODataBinderImpl.java | 59 +
.../core/op/impl/v4/ODataDeserializerImpl.java | 58 +
.../client/core/op/impl/v4/ODataReaderImpl.java | 49 +
.../core/op/impl/v4/ODataSerializerImpl.java | 32 +
.../core/uri/AbstractComparingFilter.java | 45 +
.../core/uri/AbstractFilterArgFactory.java | 178 +++
.../client/core/uri/AbstractFilterFactory.java | 108 ++
.../client/core/uri/AbstractURIBuilder.java | 8 +-
.../olingo/client/core/uri/AndFilter.java | 42 +
.../apache/olingo/client/core/uri/EqFilter.java | 33 +
.../olingo/client/core/uri/FilterConst.java | 40 +
.../olingo/client/core/uri/FilterFunction.java | 48 +
.../olingo/client/core/uri/FilterLambda.java | 46 +
.../olingo/client/core/uri/FilterLiteral.java | 40 +
.../apache/olingo/client/core/uri/FilterOp.java | 45 +
.../olingo/client/core/uri/FilterProperty.java | 40 +
.../apache/olingo/client/core/uri/GeFilter.java | 33 +
.../apache/olingo/client/core/uri/GtFilter.java | 33 +
.../olingo/client/core/uri/HasFilter.java | 34 +
.../apache/olingo/client/core/uri/LeFilter.java | 33 +
.../apache/olingo/client/core/uri/LtFilter.java | 33 +
.../olingo/client/core/uri/MatchFilter.java | 36 +
.../apache/olingo/client/core/uri/NeFilter.java | 33 +
.../olingo/client/core/uri/NotFilter.java | 35 +
.../apache/olingo/client/core/uri/OrFilter.java | 42 +
.../apache/olingo/client/core/uri/URIUtils.java | 64 +-
.../client/core/uri/V3URIBuilderImpl.java | 94 --
.../client/core/uri/V4URIBuilderImpl.java | 101 --
.../uri/filter/AbstractComparingFilter.java | 45 -
.../uri/filter/AbstractFilterArgFactory.java | 178 ---
.../core/uri/filter/AbstractFilterFactory.java | 108 --
.../client/core/uri/filter/AndFilter.java | 42 -
.../olingo/client/core/uri/filter/EqFilter.java | 33 -
.../client/core/uri/filter/FilterConst.java | 41 -
.../client/core/uri/filter/FilterFunction.java | 48 -
.../client/core/uri/filter/FilterLambda.java | 46 -
.../client/core/uri/filter/FilterLiteral.java | 41 -
.../olingo/client/core/uri/filter/FilterOp.java | 45 -
.../client/core/uri/filter/FilterProperty.java | 40 -
.../olingo/client/core/uri/filter/GeFilter.java | 33 -
.../olingo/client/core/uri/filter/GtFilter.java | 33 -
.../client/core/uri/filter/HasFilter.java | 34 -
.../olingo/client/core/uri/filter/LeFilter.java | 33 -
.../olingo/client/core/uri/filter/LtFilter.java | 33 -
.../client/core/uri/filter/MatchFilter.java | 36 -
.../olingo/client/core/uri/filter/NeFilter.java | 33 -
.../client/core/uri/filter/NotFilter.java | 35 -
.../olingo/client/core/uri/filter/OrFilter.java | 42 -
.../core/uri/filter/V3FilterArgFactoryImpl.java | 31 -
.../core/uri/filter/V3FilterFactoryImpl.java | 33 -
.../core/uri/filter/V4FilterArgFactoryImpl.java | 107 --
.../core/uri/filter/V4FilterFactoryImpl.java | 46 -
.../core/uri/v3/FilterArgFactoryImpl.java | 33 +
.../client/core/uri/v3/FilterFactoryImpl.java | 34 +
.../client/core/uri/v3/URIBuilderImpl.java | 96 ++
.../core/uri/v4/FilterArgFactoryImpl.java | 110 ++
.../client/core/uri/v4/FilterFactoryImpl.java | 49 +
.../client/core/uri/v4/URIBuilderImpl.java | 102 ++
.../client/core/v3/ConfigurationImpl.java | 58 +
.../olingo/client/core/v3/ODataClientImpl.java | 150 ++
.../client/core/v4/ConfigurationImpl.java | 32 +
.../olingo/client/core/v4/ODataClientImpl.java | 149 ++
.../client/core/xml/AbstractDOMParser.java | 46 -
.../client/core/xml/AndroidDOMParserImpl.java | 53 -
.../client/core/xml/DefaultDOMParserImpl.java | 78 -
.../olingo/client/core/xml/XMLParser.java | 37 -
.../client/core/AbstractPrimitiveTest.java | 429 ++++++
.../client/core/AbstractPropertyTest.java | 175 +++
.../apache/olingo/client/core/AbstractTest.java | 25 +-
.../olingo/client/core/AtomLinksQualifier.java | 40 +
.../olingo/client/core/ODataClientTest.java | 4 +-
.../deserializer/JsonReaderPerformance.java | 76 -
.../core/deserializer/JsonReaderTest.java | 372 -----
.../core/it/AbstractMetadataTestITCase.java | 31 +
.../client/core/it/AbstractTestITCase.java | 550 +++++++
.../client/core/it/v3/AbstractTestITCase.java | 52 +
.../core/it/v3/ActionOverloadingTestITCase.java | 133 ++
.../client/core/it/v3/AsyncTestITCase.java | 134 ++
.../it/v3/AuthEntityRetrieveTestITCase.java | 54 +
.../client/core/it/v3/BatchTestITCase.java | 406 +++++
.../client/core/it/v3/CountTestITCase.java | 60 +
.../core/it/v3/EntityCreateTestITCase.java | 485 ++++++
.../core/it/v3/EntityRetrieveTestITCase.java | 239 +++
.../client/core/it/v3/EntitySetTestITCase.java | 149 ++
.../core/it/v3/EntityUpdateTestITCase.java | 241 +++
.../client/core/it/v3/ErrorTestITCase.java | 172 +++
.../core/it/v3/FilterFactoryTestITCase.java | 167 ++
.../client/core/it/v3/FilterTestITCase.java | 94 ++
.../client/core/it/v3/InvokeTestITCase.java | 275 ++++
.../core/it/v3/KeyAsSegmentTestITCase.java | 110 ++
.../client/core/it/v3/LinkTestITCase.java | 177 +++
.../core/it/v3/MediaEntityTestITCase.java | 187 +++
.../client/core/it/v3/MetadataTestITCase.java | 41 +
.../it/v3/NavigationLinkCreateTestITCase.java | 521 +++++++
.../client/core/it/v3/OpenTypeTestITCase.java | 266 ++++
.../core/it/v3/PrimitiveKeysTestITCase.java | 69 +
.../core/it/v3/PropertyRetrieveTestITCase.java | 277 ++++
.../client/core/it/v3/PropertyTestITCase.java | 355 +++++
.../core/it/v3/PropertyValueTestITCase.java | 166 ++
.../core/it/v3/QueryOptionsTestITCase.java | 199 +++
.../v3/ServiceDocumentRetrieveTestITCase.java | 73 +
.../core/it/v3/ServiceDocumentTestITCase.java | 56 +
.../v3/XHTTPMethodEntityUpdateTestITCase.java | 38 +
.../v3/XHTTPMethodPropertyUpdateTestITCase.java | 38 +
.../client/core/it/v4/AbstractTestITCase.java | 52 +
.../client/core/it/v4/EntitySetTestITCase.java | 155 ++
.../client/core/it/v4/MetadataTestITCase.java | 41 +
.../apache/olingo/client/core/v3/AtomTest.java | 132 ++
.../olingo/client/core/v3/EntitySetTest.java | 63 +
.../olingo/client/core/v3/EntityTest.java | 189 +++
.../apache/olingo/client/core/v3/ErrorTest.java | 74 +
.../client/core/v3/FilterFactoryTest.java | 14 +-
.../apache/olingo/client/core/v3/JSONTest.java | 106 ++
.../olingo/client/core/v3/MetadataTest.java | 17 +-
.../client/core/v3/PrimitiveValueTest.java | 569 +++++++
.../client/core/v3/ServiceDocumentTest.java | 8 +-
.../olingo/client/core/v3/URIBuilderTest.java | 18 +-
.../client/core/v4/FilterFactoryTest.java | 17 +-
.../olingo/client/core/v4/MetadataTest.java | 13 +-
.../client/core/v4/PrimitiveValueTest.java | 73 +
.../client/core/v4/ServiceDocumentTest.java | 8 +-
.../olingo/client/core/v4/URIBuilderTest.java | 22 +-
.../src/test/resources/complexProperty.json | 8 -
.../src/test/resources/fullEntity.json | 22 -
.../src/test/resources/fullEntitySet.json | 29 -
.../resources/fullEntitySetWithTwoEntities.json | 49 -
...fullEntityWithCollectionOfComplexValues.json | 28 -
.../src/test/resources/minimalEntity.json | 21 -
.../apache/olingo/client/core/atom_cleanup.xsl | 48 +
.../core/v3/AllGeoTypesSet_-10_GeogLine.json | 1 +
.../core/v3/AllGeoTypesSet_-10_GeogLine.xml | 22 +
.../core/v3/AllGeoTypesSet_-10_GeogPoint.json | 1 +
.../core/v3/AllGeoTypesSet_-10_GeogPoint.xml | 22 +
.../client/core/v3/AllGeoTypesSet_-10_Geom.json | 1 +
.../client/core/v3/AllGeoTypesSet_-10_Geom.xml | 33 +
.../v3/AllGeoTypesSet_-3_GeomMultiPolygon.json | 1 +
.../v3/AllGeoTypesSet_-3_GeomMultiPolygon.xml | 61 +
.../client/core/v3/AllGeoTypesSet_-5.json | 1 +
.../olingo/client/core/v3/AllGeoTypesSet_-5.xml | 181 +++
.../v3/AllGeoTypesSet_-5_GeogCollection.json | 1 +
.../v3/AllGeoTypesSet_-5_GeogCollection.xml | 39 +
.../core/v3/AllGeoTypesSet_-5_GeogPolygon.json | 1 +
.../core/v3/AllGeoTypesSet_-5_GeogPolygon.xml | 38 +
.../v3/AllGeoTypesSet_-6_GeomMultiLine.json | 1 +
.../core/v3/AllGeoTypesSet_-6_GeomMultiLine.xml | 42 +
.../v3/AllGeoTypesSet_-7_GeomMultiPoint.json | 1 +
.../v3/AllGeoTypesSet_-7_GeomMultiPoint.xml | 34 +
.../client/core/v3/AllGeoTypesSet_-8.json | 1 +
.../olingo/client/core/v3/AllGeoTypesSet_-8.xml | 177 +++
.../v3/AllGeoTypesSet_-8_GeomCollection.json | 1 +
.../v3/AllGeoTypesSet_-8_GeomCollection.xml | 38 +
.../apache/olingo/client/core/v3/Car_16.json | 1 +
.../org/apache/olingo/client/core/v3/Car_16.xml | 48 +
.../client/core/v3/ComputerDetail_-10.json | 1 +
.../client/core/v3/ComputerDetail_-10.xml | 22 +
.../apache/olingo/client/core/v3/Customer.json | 3 +
.../apache/olingo/client/core/v3/Customer.xml | 22 +
.../olingo/client/core/v3/Customer_-10.json | 1 +
.../olingo/client/core/v3/Customer_-10.xml | 528 +++++++
.../core/v3/Customer_-10_BackupContactInfo.json | 1 +
.../core/v3/Customer_-10_BackupContactInfo.xml | 22 +
.../client/core/v3/Customer_-10_CustomerId.json | 1 +
.../client/core/v3/Customer_-10_CustomerId.xml | 22 +
.../core/v3/Customer_-10_CustomerId_value.txt | 1 +
.../v3/Customer_-10_PrimaryContactInfo.json | 1 +
.../core/v3/Customer_-10_PrimaryContactInfo.xml | 22 +
...a4af-4bbd-bf0a-2b2c22635565'_Attachment.json | 1 +
...-a4af-4bbd-bf0a-2b2c22635565'_Attachment.xml | 22 +
...af-4bbd-bf0a-2b2c22635565'_AttachmentId.json | 1 +
...4af-4bbd-bf0a-2b2c22635565'_AttachmentId.xml | 22 +
.../client/core/v3/PersonDetails_0_Person.json | 1 +
.../client/core/v3/PersonDetails_0_Person.xml | 75 +
..._-10_ComplexConcurrency_QueriedDateTime.json | 1 +
...t_-10_ComplexConcurrency_QueriedDateTime.xml | 22 +
.../core/v3/Product_-10_Dimensions_Width.json | 1 +
.../core/v3/Product_-10_Dimensions_Width.xml | 22 +
.../client/core/v3/Product_-9_Description.json | 1 +
.../client/core/v3/Product_-9_Description.xml | 22 +
.../client/core/v3/Products_0_Categories.json | 1 +
.../client/core/v3/Products_0_Categories.xml | 79 +
.../olingo/client/core/v3/Products_1.json | 1 +
.../apache/olingo/client/core/v3/Products_1.xml | 51 +
.../core/v3/Products_1_DiscontinuedDate.json | 1 +
.../core/v3/Products_1_DiscontinuedDate.xml | 24 +
.../org/apache/olingo/client/core/v3/error.json | 9 +
.../org/apache/olingo/client/core/v3/error.xml | 25 +
.../apache/olingo/client/core/v3/metadata.xml | 701 +--------
.../olingo/client/core/v3/stacktrace.json | 14 +
.../apache/olingo/client/core/v3/stacktrace.xml | 35 +
.../olingo/client/core/v4/complexProperty.json | 8 +
.../olingo/client/core/v4/fullEntity.json | 22 +
.../olingo/client/core/v4/fullEntitySet.json | 29 +
.../core/v4/fullEntitySetWithTwoEntities.json | 49 +
...fullEntityWithCollectionOfComplexValues.json | 28 +
.../olingo/client/core/v4/minimalEntity.json | 21 +
.../client/core/v4/primitiveNullValue.json | 3 +
.../client/core/v4/setOfComplexProperties.json | 13 +
.../core/v4/setOfPrimitiveProperties.json | 8 +
.../src/test/resources/primitiveNullValue.json | 3 -
lib/client-core/src/test/resources/sample.png | Bin 0 -> 25566 bytes
.../test/resources/setOfComplexProperties.json | 13 -
.../resources/setOfPrimitiveProperties.json | 8 -
lib/commons-api/pom.xml | 16 +-
.../apache/olingo/commons/api/Constants.java | 243 +++
.../commons/api/data/CollectionValue.java | 27 +
.../olingo/commons/api/data/ComplexValue.java | 27 +
.../apache/olingo/commons/api/data/Entry.java | 167 ++
.../apache/olingo/commons/api/data/Feed.java | 75 +
.../olingo/commons/api/data/GeoUtils.java | 90 ++
.../commons/api/data/GeospatialValue.java | 28 +
.../apache/olingo/commons/api/data/Link.java | 121 ++
.../olingo/commons/api/data/NullValue.java | 26 +
.../olingo/commons/api/data/PrimitiveValue.java | 25 +
.../olingo/commons/api/data/Property.java | 34 +
.../apache/olingo/commons/api/data/Value.java | 44 +
.../commons/api/data/v3/LinkCollection.java | 52 +
.../commons/api/domain/AbstractODataValue.java | 127 ++
.../api/domain/ODataCollectionValue.java | 98 ++
.../commons/api/domain/ODataComplexValue.java | 97 ++
.../olingo/commons/api/domain/ODataEntity.java | 316 ++++
.../commons/api/domain/ODataEntitySet.java | 120 ++
.../olingo/commons/api/domain/ODataError.java | 67 +
.../api/domain/ODataGeospatialValue.java | 57 +
.../commons/api/domain/ODataInlineEntity.java | 74 +
.../api/domain/ODataInlineEntitySet.java | 74 +
.../commons/api/domain/ODataInvokeResult.java | 30 +
.../olingo/commons/api/domain/ODataItem.java | 111 ++
.../olingo/commons/api/domain/ODataLink.java | 190 +++
.../commons/api/domain/ODataLinkType.java | 93 ++
.../commons/api/domain/ODataObjectFactory.java | 218 +++
.../commons/api/domain/ODataOperation.java | 88 ++
.../commons/api/domain/ODataPrimitiveValue.java | 67 +
.../commons/api/domain/ODataProperty.java | 186 +++
.../commons/api/domain/ODataPropertyType.java | 40 +
.../api/domain/ODataServiceDocument.java | 183 +++
.../olingo/commons/api/domain/ODataValue.java | 84 +
.../org/apache/olingo/commons/api/edm/Edm.java | 161 +-
.../olingo/commons/api/edm/EdmActionImport.java | 2 +-
.../commons/api/edm/EdmGeospatialType.java | 34 +
.../commons/api/edm/EdmPrimitiveTypeKind.java | 139 ++
.../api/edm/constants/ODataServiceVersion.java | 8 +-
.../commons/api/edm/geo/ComposedGeospatial.java | 78 +
.../olingo/commons/api/edm/geo/Geospatial.java | 169 ++
.../api/edm/geo/GeospatialCollection.java | 48 +
.../olingo/commons/api/edm/geo/LineString.java | 38 +
.../commons/api/edm/geo/MultiLineString.java | 39 +
.../olingo/commons/api/edm/geo/MultiPoint.java | 39 +
.../commons/api/edm/geo/MultiPolygon.java | 38 +
.../olingo/commons/api/edm/geo/Point.java | 77 +
.../olingo/commons/api/edm/geo/Polygon.java | 73 +
.../olingo/commons/api/format/ContentType.java | 47 +
.../olingo/commons/api/format/Format.java | 26 +
.../olingo/commons/api/format/ODataFormat.java | 102 ++
.../commons/api/format/ODataMediaFormat.java | 76 +
.../commons/api/format/ODataPubFormat.java | 121 ++
.../commons/api/format/ODataValueFormat.java | 81 +
.../commons/api/op/CommonODataDeserializer.java | 71 +
.../olingo/commons/api/op/ODataSerializer.java | 100 ++
lib/commons-core/pom.xml | 112 +-
.../commons/core/data/AbstractAtomDealer.java | 87 ++
.../commons/core/data/AbstractAtomObject.java | 78 +
.../olingo/commons/core/data/AbstractEntry.java | 159 ++
.../core/data/AbstractJsonDeserializer.java | 175 +++
.../core/data/AbstractJsonSerializer.java | 94 ++
.../core/data/AbstractPayloadObject.java | 48 +
.../commons/core/data/AbstractPropertyImpl.java | 80 +
.../olingo/commons/core/data/AbstractValue.java | 98 ++
.../commons/core/data/AtomDeserializer.java | 368 +++++
.../olingo/commons/core/data/AtomEntryImpl.java | 25 +
.../olingo/commons/core/data/AtomFeedImpl.java | 66 +
.../core/data/AtomGeoValueDeserializer.java | 261 ++++
.../core/data/AtomGeoValueSerializer.java | 221 +++
.../core/data/AtomPropertyDeserializer.java | 218 +++
.../commons/core/data/AtomPropertyImpl.java | 25 +
.../core/data/AtomPropertySerializer.java | 88 ++
.../commons/core/data/AtomSerializer.java | 264 ++++
.../commons/core/data/CollectionValueImpl.java | 40 +
.../commons/core/data/ComplexValueImpl.java | 40 +
.../commons/core/data/GeospatialValueImpl.java | 42 +
.../core/data/JSONEntryDeserializer.java | 241 +++
.../olingo/commons/core/data/JSONEntryImpl.java | 92 ++
.../commons/core/data/JSONEntrySerializer.java | 120 ++
.../commons/core/data/JSONErrorBundle.java | 50 +
.../olingo/commons/core/data/JSONErrorImpl.java | 237 +++
.../commons/core/data/JSONFeedDeserializer.java | 68 +
.../olingo/commons/core/data/JSONFeedImpl.java | 113 ++
.../commons/core/data/JSONFeedSerializer.java | 57 +
.../core/data/JSONGeoValueDeserializer.java | 273 ++++
.../core/data/JSONGeoValueSerializer.java | 183 +++
.../core/data/JSONPropertyDeserializer.java | 71 +
.../commons/core/data/JSONPropertyImpl.java | 53 +
.../core/data/JSONPropertySerializer.java | 59 +
.../olingo/commons/core/data/LinkImpl.java | 112 ++
.../olingo/commons/core/data/NullValueImpl.java | 35 +
.../core/data/ODataJacksonDeserializer.java | 44 +
.../core/data/ODataJacksonSerializer.java | 45 +
.../commons/core/data/PrimitiveValueImpl.java | 41 +
.../olingo/commons/core/data/XMLErrorImpl.java | 213 +++
.../core/data/v3/JSONLinkCollectionImpl.java | 118 ++
.../core/data/v3/XMLLinkCollectionImpl.java | 70 +
.../core/edm/AbstractEdmComplexType.java | 39 +-
.../core/edm/AbstractEdmEntityContainer.java | 176 +--
.../commons/core/edm/AbstractEdmOperation.java | 131 +-
.../core/edm/AbstractEdmOperationImport.java | 65 +-
.../commons/core/edm/AbstractEdmParameter.java | 5 +-
.../commons/core/edm/AbstractEdmProperty.java | 5 +-
.../commons/core/edm/AbstractEdmReturnType.java | 5 +-
.../core/edm/AbstractEdmStructuredType.java | 159 +-
.../olingo/commons/core/edm/EdmNamedImpl.java | 21 +-
.../olingo/commons/core/edm/EdmTypeImpl.java | 31 +-
.../olingo/commons/core/edm/EdmTypeInfo.java | 184 +++
.../AbstractEdmGeospatialType.java | 76 +
.../commons/core/edm/primitivetype/EdmDate.java | 5 +-
.../core/edm/primitivetype/EdmDateTime.java | 137 ++
.../edm/primitivetype/EdmDateTimeOffset.java | 68 +-
.../core/edm/primitivetype/EdmGeography.java | 36 +
.../primitivetype/EdmGeographyCollection.java | 37 +
.../primitivetype/EdmGeographyLineString.java | 37 +
.../EdmGeographyMultiLineString.java | 37 +
.../primitivetype/EdmGeographyMultiPoint.java | 37 +
.../primitivetype/EdmGeographyMultiPolygon.java | 37 +
.../edm/primitivetype/EdmGeographyPoint.java | 37 +
.../edm/primitivetype/EdmGeographyPolygon.java | 37 +
.../core/edm/primitivetype/EdmGeometry.java | 36 +
.../primitivetype/EdmGeometryCollection.java | 37 +
.../primitivetype/EdmGeometryLineString.java | 37 +
.../EdmGeometryMultiLineString.java | 37 +
.../primitivetype/EdmGeometryMultiPoint.java | 37 +
.../primitivetype/EdmGeometryMultiPolygon.java | 37 +
.../edm/primitivetype/EdmGeometryPoint.java | 37 +
.../edm/primitivetype/EdmGeometryPolygon.java | 37 +
.../commons/core/edm/primitivetype/EdmNull.java | 75 -
.../primitivetype/EdmPrimitiveTypeFactory.java | 138 ++
.../edm/primitivetype/EdmPrimitiveTypeKind.java | 95 --
.../core/edm/primitivetype/EdmStream.java | 88 ++
.../commons/core/edm/primitivetype/EdmTime.java | 77 +
.../core/edm/primitivetype/EdmTimeOfDay.java | 45 +-
.../commons/core/op/AbstractJacksonTool.java | 83 +
.../core/op/AbstractODataDeserializer.java | 106 ++
.../core/op/AbstractODataSerializer.java | 141 ++
.../core/op/InjectableSerializerProvider.java | 43 +
.../commons/core/op/ODataObjectFactoryImpl.java | 162 ++
.../olingo/commons/core/op/ResourceFactory.java | 125 ++
.../primitivetype/CommonPrimitiveTypeTest.java | 191 ++-
.../core/edm/primitivetype/EdmBinaryTest.java | 30 +-
.../core/edm/primitivetype/EdmBooleanTest.java | 4 +-
.../core/edm/primitivetype/EdmByteTest.java | 5 +-
.../core/edm/primitivetype/EdmDateTest.java | 4 +-
.../primitivetype/EdmDateTimeOffsetTest.java | 4 +-
.../core/edm/primitivetype/EdmDecimalTest.java | 19 +-
.../core/edm/primitivetype/EdmDoubleTest.java | 17 +-
.../core/edm/primitivetype/EdmDurationTest.java | 4 +-
.../core/edm/primitivetype/EdmGuidTest.java | 4 +-
.../core/edm/primitivetype/EdmInt16Test.java | 9 +-
.../core/edm/primitivetype/EdmInt32Test.java | 11 +-
.../core/edm/primitivetype/EdmInt64Test.java | 13 +-
.../core/edm/primitivetype/EdmNullTest.java | 24 +-
.../core/edm/primitivetype/EdmSByteTest.java | 5 +-
.../core/edm/primitivetype/EdmSingleTest.java | 15 +-
.../core/edm/primitivetype/EdmStringTest.java | 4 +-
.../edm/primitivetype/EdmTimeOfDayTest.java | 4 +-
.../core/edm/primitivetype/UInt7Test.java | 6 +-
lib/server-core/pom.xml | 38 +-
.../core/edm/provider/EdmEnumTypeImpl.java | 9 +-
.../edm/provider/EdmTypeDefinitionImpl.java | 9 +-
.../core/uri/UriResourceLambdaAllImpl.java | 16 +-
.../core/uri/UriResourceLambdaAnyImpl.java | 15 +-
.../olingo/server/core/uri/parser/Parser.java | 1 -
.../server/core/uri/parser/UriContext.java | 4 -
.../core/uri/parser/UriParseTreeVisitor.java | 302 ++--
.../core/uri/queryoption/ExpandItemImpl.java | 1 -
.../edm/provider/EdmComplexTypeImplTest.java | 13 +-
.../edm/provider/EdmEntityTypeImplTest.java | 14 +-
.../server/core/edm/provider/EdmEnumTest.java | 9 +-
.../edm/provider/EdmFunctionImportImplTest.java | 31 +-
.../core/edm/provider/EdmParameterImplTest.java | 6 +-
.../core/edm/provider/EdmPropertyImplTest.java | 4 +-
.../edm/provider/EdmReturnTypeImplTest.java | 9 +-
.../edm/provider/EdmTypeDefinitionImplTest.java | 23 +-
.../server/core/testutil/EdmTechProvider.java | 2 +-
.../server/core/uri/UriResourceImplTest.java | 43 +-
.../core/uri/testutil/ExpandValidator.java | 1 -
.../core/uri/testutil/ResourceValidator.java | 1 -
pom.xml | 157 +-
962 files changed, 72675 insertions(+), 13952 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b2508035/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
----------------------------------------------------------------------
[08/52] [abbrv] Consistently using package name to differentiate V3
and V4
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.java
new file mode 100644
index 0000000..12d5b24
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v3/InvokeRequestFactory.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.client.api.communication.request.invoke.v3;
+
+import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
+import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
+
+public interface InvokeRequestFactory extends CommonInvokeRequestFactory<FunctionImport> {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.java
new file mode 100644
index 0000000..c2f194d
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/v4/InvokeRequestFactory.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.client.api.communication.request.invoke.v4;
+
+import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
+import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
+
+public interface InvokeRequestFactory extends CommonInvokeRequestFactory<FunctionImport> {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
new file mode 100644
index 0000000..89777da
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.communication.request.retrieve;
+
+import java.io.Serializable;
+import java.net.URI;
+
+/**
+ * OData request factory class.
+ */
+public interface CommonRetrieveRequestFactory extends Serializable {
+
+ /**
+ * Gets a service document request instance.
+ *
+ * @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
+ * service.
+ * @return new ODataServiceDocumentRequest instance.
+ */
+ ODataServiceDocumentRequest getServiceDocumentRequest(String serviceRoot);
+
+ /**
+ * Gets a metadata request instance.
+ *
+ * @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
+ * service.
+ * @return new ODataMetadataRequest instance.
+ */
+ ODataMetadataRequest getMetadataRequest(String serviceRoot);
+
+ /**
+ * Gets a query request returning a set of one or more OData entities.
+ *
+ * @param query query to be performed.
+ * @return new ODataEntitySetRequest instance.
+ */
+ ODataEntitySetRequest getEntitySetRequest(URI query);
+
+ /**
+ * Gets a query request returning a set of one or more OData entities.
+ * <br/>
+ * Returned request gives the possibility to consume entities iterating on them without parsing and loading in memory
+ * the entire entity set.
+ *
+ * @param query query to be performed.
+ * @return new ODataEntitySetIteratorRequest instance.
+ */
+ ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI query);
+
+ /**
+ * Gets a query request returning a single OData entity.
+ *
+ * @param query query to be performed.
+ * @return new ODataEntityRequest instance.
+ */
+ ODataEntityRequest getEntityRequest(URI query);
+
+ /**
+ * Gets a query request returning a single OData entity property.
+ *
+ * @param query query to be performed.
+ * @return new ODataPropertyRequest instance.
+ */
+ ODataPropertyRequest getPropertyRequest(URI query);
+
+ /**
+ * Gets a query request returning a single OData entity property value.
+ *
+ * @param query query to be performed.
+ * @return new ODataValueRequest instance.
+ */
+ ODataValueRequest getValueRequest(URI query);
+
+ /**
+ * Gets a query request returning a media stream.
+ *
+ * @param query query to be performed.
+ * @return new ODataMediaRequest instance.
+ */
+ ODataMediaRequest getMediaRequest(URI query);
+
+ /**
+ * Implements a raw request request without specifying any return type.
+ *
+ * @param uri query to be performed.
+ * @return new ODataRawRequest instance.
+ */
+ ODataRawRequest getRawRequest(URI uri);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataLinkCollectionRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataLinkCollectionRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataLinkCollectionRequest.java
deleted file mode 100644
index 080f92a..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataLinkCollectionRequest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.communication.request.retrieve;
-
-import org.apache.olingo.client.api.domain.ODataLinkCollection;
-import org.apache.olingo.client.api.format.ODataFormat;
-
-/**
- * This class implements an OData link query request.
- */
-public interface ODataLinkCollectionRequest extends ODataRetrieveRequest<ODataLinkCollection, ODataFormat> {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/RetrieveRequestFactory.java
deleted file mode 100644
index 79b6459..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/RetrieveRequestFactory.java
+++ /dev/null
@@ -1,105 +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.client.api.communication.request.retrieve;
-
-import java.io.Serializable;
-import java.net.URI;
-
-/**
- * OData request factory class.
- */
-public interface RetrieveRequestFactory extends Serializable {
-
- /**
- * Gets a service document request instance.
- *
- * @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
- * service.
- * @return new ODataServiceDocumentRequest instance.
- */
- ODataServiceDocumentRequest getServiceDocumentRequest(String serviceRoot);
-
- /**
- * Gets a metadata request instance.
- *
- * @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
- * service.
- * @return new ODataMetadataRequest instance.
- */
- ODataMetadataRequest getMetadataRequest(String serviceRoot);
-
- /**
- * Gets a query request returning a set of one or more OData entities.
- *
- * @param query query to be performed.
- * @return new ODataEntitySetRequest instance.
- */
- ODataEntitySetRequest getEntitySetRequest(URI query);
-
- /**
- * Gets a query request returning a set of one or more OData entities.
- * <br/>
- * Returned request gives the possibility to consume entities iterating on them without parsing and loading in memory
- * the entire entity set.
- *
- * @param query query to be performed.
- * @return new ODataEntitySetIteratorRequest instance.
- */
- ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI query);
-
- /**
- * Gets a query request returning a single OData entity.
- *
- * @param query query to be performed.
- * @return new ODataEntityRequest instance.
- */
- ODataEntityRequest getEntityRequest(URI query);
-
- /**
- * Gets a query request returning a single OData entity property.
- *
- * @param query query to be performed.
- * @return new ODataPropertyRequest instance.
- */
- ODataPropertyRequest getPropertyRequest(URI query);
-
- /**
- * Gets a query request returning a single OData entity property value.
- *
- * @param query query to be performed.
- * @return new ODataValueRequest instance.
- */
- ODataValueRequest getValueRequest(URI query);
-
- /**
- * Gets a query request returning a media stream.
- *
- * @param query query to be performed.
- * @return new ODataMediaRequest instance.
- */
- ODataMediaRequest getMediaRequest(URI query);
-
- /**
- * Implements a raw request request without specifying any return type.
- *
- * @param uri query to be performed.
- * @return new ODataRawRequest instance.
- */
- ODataRawRequest getRawRequest(URI uri);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/V3RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/V3RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/V3RetrieveRequestFactory.java
deleted file mode 100644
index 5089073..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/V3RetrieveRequestFactory.java
+++ /dev/null
@@ -1,33 +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.client.api.communication.request.retrieve;
-
-import java.net.URI;
-
-public interface V3RetrieveRequestFactory extends RetrieveRequestFactory {
-
- /**
- * Gets a query request returning a single OData link.
- *
- * @param targetURI target URI.
- * @param linkName link name.
- * @return new ODataLinkRequest instance.
- */
- ODataLinkCollectionRequest getLinkCollectionRequest(URI targetURI, String linkName);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/V4RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/V4RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/V4RetrieveRequestFactory.java
deleted file mode 100644
index 272ed86..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/V4RetrieveRequestFactory.java
+++ /dev/null
@@ -1,22 +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.client.api.communication.request.retrieve;
-
-public interface V4RetrieveRequestFactory extends RetrieveRequestFactory {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/ODataLinkCollectionRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/ODataLinkCollectionRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/ODataLinkCollectionRequest.java
new file mode 100644
index 0000000..7cfba7b
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/ODataLinkCollectionRequest.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.client.api.communication.request.retrieve.v3;
+
+import org.apache.olingo.client.api.communication.request.retrieve.ODataRetrieveRequest;
+import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
+import org.apache.olingo.client.api.format.ODataFormat;
+
+/**
+ * This class implements an OData link query request.
+ */
+public interface ODataLinkCollectionRequest extends ODataRetrieveRequest<ODataLinkCollection, ODataFormat> {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
new file mode 100644
index 0000000..a0d667a
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.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.client.api.communication.request.retrieve.v3;
+
+import java.net.URI;
+import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
+
+public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
+
+ /**
+ * Gets a query request returning a single OData link.
+ *
+ * @param targetURI target URI.
+ * @param linkName link name.
+ * @return new ODataLinkRequest instance.
+ */
+ ODataLinkCollectionRequest getLinkCollectionRequest(URI targetURI, String linkName);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
new file mode 100644
index 0000000..55005cd
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.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.client.api.communication.request.retrieve.v4;
+
+import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
+
+public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/CommonStreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/CommonStreamedRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/CommonStreamedRequestFactory.java
new file mode 100644
index 0000000..1518fe8
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/CommonStreamedRequestFactory.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.client.api.communication.request.streamed;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import java.net.URI;
+
+/**
+ * OData request factory class.
+ */
+public interface CommonStreamedRequestFactory extends Serializable {
+
+ /**
+ * Gets a media entity create request object instance.
+ * <br/>
+ * Use this kind of request to create a new media entity.
+ *
+ * @param targetURI entity set URI.
+ * @param media entity blob to be created.
+ * @return new ODataMediaEntityCreateRequest instance.
+ */
+ ODataMediaEntityCreateRequest getMediaEntityCreateRequest(URI targetURI, InputStream media);
+
+ /**
+ * Gets a stream update request object instance.
+ * <br/>
+ * Use this kind of request to update a named stream property.
+ *
+ * @param targetURI target URI.
+ * @param stream stream to be updated.
+ * @return new ODataStreamUpdateRequest instance.
+ */
+ ODataStreamUpdateRequest getStreamUpdateRequest(URI targetURI, InputStream stream);
+
+ /**
+ * Gets a media entity update request object instance.
+ * <br/>
+ * Use this kind of request to update a media entity.
+ *
+ * @param editURI media entity edit link URI.
+ * @param media entity blob to be updated.
+ * @return new ODataMediaEntityUpdateRequest instance.
+ */
+ ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest(URI editURI, InputStream media);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/StreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/StreamedRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/StreamedRequestFactory.java
deleted file mode 100644
index 04ac27c..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/StreamedRequestFactory.java
+++ /dev/null
@@ -1,62 +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.client.api.communication.request.streamed;
-
-import java.io.InputStream;
-import java.io.Serializable;
-import java.net.URI;
-
-/**
- * OData request factory class.
- */
-public interface StreamedRequestFactory extends Serializable {
-
- /**
- * Gets a media entity create request object instance.
- * <br/>
- * Use this kind of request to create a new media entity.
- *
- * @param targetURI entity set URI.
- * @param media entity blob to be created.
- * @return new ODataMediaEntityCreateRequest instance.
- */
- ODataMediaEntityCreateRequest getMediaEntityCreateRequest(URI targetURI, InputStream media);
-
- /**
- * Gets a stream update request object instance.
- * <br/>
- * Use this kind of request to update a named stream property.
- *
- * @param targetURI target URI.
- * @param stream stream to be updated.
- * @return new ODataStreamUpdateRequest instance.
- */
- ODataStreamUpdateRequest getStreamUpdateRequest(URI targetURI, InputStream stream);
-
- /**
- * Gets a media entity update request object instance.
- * <br/>
- * Use this kind of request to update a media entity.
- *
- * @param editURI media entity edit link URI.
- * @param media entity blob to be updated.
- * @return new ODataMediaEntityUpdateRequest instance.
- */
- ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest(URI editURI, InputStream media);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/V3StreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/V3StreamedRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/V3StreamedRequestFactory.java
deleted file mode 100644
index fd6a99c..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/V3StreamedRequestFactory.java
+++ /dev/null
@@ -1,22 +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.client.api.communication.request.streamed;
-
-public interface V3StreamedRequestFactory extends StreamedRequestFactory {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/V4StreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/V4StreamedRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/V4StreamedRequestFactory.java
deleted file mode 100644
index b8f28ac..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/V4StreamedRequestFactory.java
+++ /dev/null
@@ -1,22 +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.client.api.communication.request.streamed;
-
-public interface V4StreamedRequestFactory extends StreamedRequestFactory {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/v3/StreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/v3/StreamedRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/v3/StreamedRequestFactory.java
new file mode 100644
index 0000000..db3ff84
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/v3/StreamedRequestFactory.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.client.api.communication.request.streamed.v3;
+
+import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
+
+public interface StreamedRequestFactory extends CommonStreamedRequestFactory {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/v4/StreamedRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/v4/StreamedRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/v4/StreamedRequestFactory.java
new file mode 100644
index 0000000..7319e33
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/v4/StreamedRequestFactory.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.client.api.communication.request.streamed.v4;
+
+import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
+
+public interface StreamedRequestFactory extends CommonStreamedRequestFactory {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/data/LinkCollection.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/LinkCollection.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/LinkCollection.java
deleted file mode 100644
index 36c9c16..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/LinkCollection.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.api.data;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * REST resource for an <tt>ODataLinkCollection</tt>.
- *
- * @see org.apache.olingo.client.api.domain.ODataLinkCollection
- */
-public interface LinkCollection {
-
- /**
- * Smart management of different JSON format produced by OData services when
- * <tt>$links</tt> is a single or a collection property.
- *
- * @return list of URIs for <tt>$links</tt>
- */
- List<URI> getLinks();
-
- /**
- * Sets next link.
- *
- * @param next next link.
- */
- void setNext(final URI next);
-
- /**
- * Gets next link if exists.
- *
- * @return next link if exists; null otherwise.
- */
- URI getNext();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/data/v3/LinkCollection.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/v3/LinkCollection.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/v3/LinkCollection.java
new file mode 100644
index 0000000..dfcaa35
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/v3/LinkCollection.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.client.api.data.v3;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * REST resource for an <tt>ODataLinkCollection</tt>.
+ *
+ * @see org.apache.olingo.client.api.domain.ODataLinkCollection
+ */
+public interface LinkCollection {
+
+ /**
+ * Smart management of different JSON format produced by OData services when
+ * <tt>$links</tt> is a single or a collection property.
+ *
+ * @return list of URIs for <tt>$links</tt>
+ */
+ List<URI> getLinks();
+
+ /**
+ * Sets next link.
+ *
+ * @param next next link.
+ */
+ void setNext(final URI next);
+
+ /**
+ * Gets next link if exists.
+ *
+ * @return next link if exists; null otherwise.
+ */
+ URI getNext();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
index 8c10c10..26ef195 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
@@ -28,7 +28,7 @@ import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.Entry;
import org.apache.olingo.client.api.format.ODataPubFormat;
@@ -49,7 +49,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> {
private static final long serialVersionUID = 9039605899821494025L;
- private final ODataClient odataClient;
+ private final CommonODataClient odataClient;
private final InputStream stream;
@@ -72,7 +72,9 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> {
* @param stream source stream.
* @param format OData format.
*/
- public ODataEntitySetIterator(final ODataClient odataClient, final InputStream stream, final ODataPubFormat format) {
+ public ODataEntitySetIterator(final CommonODataClient odataClient, final InputStream stream,
+ final ODataPubFormat format) {
+
this.odataClient = odataClient;
this.stream = stream;
this.format = format;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
index 47db41c..93c4cfb 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.domain;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.domain.geospatial.Geospatial;
public class ODataGeospatialValue extends ODataPrimitiveValue {
@@ -35,7 +35,7 @@ public class ODataGeospatialValue extends ODataPrimitiveValue {
/**
* Constructor.
*/
- public Builder(final ODataClient client) {
+ public Builder(final CommonODataClient client) {
super(client);
this.ogv = new ODataGeospatialValue(client);
}
@@ -98,7 +98,7 @@ public class ODataGeospatialValue extends ODataPrimitiveValue {
*
* @see Builder
*/
- protected ODataGeospatialValue(final ODataClient client) {
+ protected ODataGeospatialValue(final CommonODataClient client) {
super(client);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkCollection.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkCollection.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkCollection.java
deleted file mode 100644
index bf75495..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataLinkCollection.java
+++ /dev/null
@@ -1,100 +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.client.api.domain;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * Link collection wrapper.
- */
-public class ODataLinkCollection {
-
- /**
- * Link to the next page.
- */
- private URI next;
-
- /**
- * Contained links.
- */
- private List<URI> links;
-
- /**
- * Constructor.
- */
- public ODataLinkCollection() {
- }
-
- /**
- * Adds link to the collection.
- *
- * @param link link to be added.
- * @return 'TRUE' in case of success; 'FALSE' otherwise.
- */
- public boolean addLink(final URI link) {
- return links.add(link);
- }
-
- /**
- * Removes a link.
- *
- * @param link link to be removed.
- * @return 'TRUE' in case of success; 'FALSE' otherwise.
- */
- public boolean removeLink(final URI link) {
- return links.remove(link);
- }
-
- /**
- * Set links.
- *
- * @param links links.
- */
- public void setLinks(final List<URI> links) {
- this.links = links;
- }
-
- /**
- * Gets contained links.
- *
- * @return list of links.
- */
- public List<URI> getLinks() {
- return links;
- }
-
- /**
- * Constructor.
- *
- * @param next next page link.
- */
- public ODataLinkCollection(final URI next) {
- this.next = next;
- }
-
- /**
- * Gets next page link.
- *
- * @return next page link; null value if single page or last page reached.
- */
- public URI getNext() {
- return next;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
index 9181695..df69d1f 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
@@ -30,7 +30,7 @@ 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.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
/**
* OData primitive property value.
@@ -41,12 +41,12 @@ public class ODataPrimitiveValue extends ODataValue {
protected abstract static class AbstractBuilder {
- private final ODataClient client;
+ private final CommonODataClient client;
/**
* Constructor.
*/
- public AbstractBuilder(final ODataClient client) {
+ public AbstractBuilder(final CommonODataClient client) {
this.client = client;
}
@@ -70,7 +70,7 @@ public class ODataPrimitiveValue extends ODataValue {
/**
* Constructor.
*/
- public Builder(final ODataClient client) {
+ public Builder(final CommonODataClient client) {
super(client);
this.opv = new ODataPrimitiveValue(client);
}
@@ -162,7 +162,7 @@ public class ODataPrimitiveValue extends ODataValue {
}
}
- protected ODataClient client;
+ protected CommonODataClient client;
/**
* Text value.
@@ -184,7 +184,7 @@ public class ODataPrimitiveValue extends ODataValue {
*
* @see Builder
*/
- protected ODataPrimitiveValue(final ODataClient client) {
+ protected ODataPrimitiveValue(final CommonODataClient client) {
super();
this.client = client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/v3/ODataLinkCollection.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/v3/ODataLinkCollection.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/v3/ODataLinkCollection.java
new file mode 100644
index 0000000..846b31e
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/v3/ODataLinkCollection.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.client.api.domain.v3;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * Link collection wrapper.
+ */
+public class ODataLinkCollection {
+
+ /**
+ * Link to the next page.
+ */
+ private URI next;
+
+ /**
+ * Contained links.
+ */
+ private List<URI> links;
+
+ /**
+ * Constructor.
+ */
+ public ODataLinkCollection() {
+ }
+
+ /**
+ * Adds link to the collection.
+ *
+ * @param link link to be added.
+ * @return 'TRUE' in case of success; 'FALSE' otherwise.
+ */
+ public boolean addLink(final URI link) {
+ return links.add(link);
+ }
+
+ /**
+ * Removes a link.
+ *
+ * @param link link to be removed.
+ * @return 'TRUE' in case of success; 'FALSE' otherwise.
+ */
+ public boolean removeLink(final URI link) {
+ return links.remove(link);
+ }
+
+ /**
+ * Set links.
+ *
+ * @param links links.
+ */
+ public void setLinks(final List<URI> links) {
+ this.links = links;
+ }
+
+ /**
+ * Gets contained links.
+ *
+ * @return list of links.
+ */
+ public List<URI> getLinks() {
+ return links;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param next next page link.
+ */
+ public ODataLinkCollection(final URI next) {
+ this.next = next;
+ }
+
+ /**
+ * Gets next page link.
+ *
+ * @return next page link; null value if single page or last page reached.
+ */
+ public URI getNext() {
+ return next;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
new file mode 100644
index 0000000..94375f6
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.op;
+
+import java.io.Serializable;
+import java.net.URI;
+import org.apache.olingo.client.api.data.Entry;
+import org.apache.olingo.client.api.data.Feed;
+import org.apache.olingo.client.api.data.Link;
+import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.domain.ODataLink;
+import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.client.api.domain.ODataServiceDocument;
+
+public interface CommonODataBinder extends Serializable {
+
+ /**
+ * Gets a <tt>Feed</tt> from the given OData entity set.
+ *
+ * @param feed OData entity set.
+ * @param reference reference class.
+ * @return <tt>Feed</tt> object.
+ */
+ Feed getFeed(ODataEntitySet feed, Class<? extends Feed> reference);
+
+ /**
+ * Gets an <tt>Entry</tt> from the given OData entity.
+ *
+ * @param entity OData entity.
+ * @param reference reference class.
+ * @return <tt>Entry</tt> object.
+ */
+ Entry getEntry(ODataEntity entity, Class<? extends Entry> reference);
+
+ /**
+ * Gets an <tt>Entry</tt> from the given OData entity.
+ *
+ * @param entity OData entity.
+ * @param reference reference class.
+ * @param setType whether to explicitly output type information.
+ * @return <tt>Entry</tt> object.
+ */
+ Entry getEntry(ODataEntity entity, Class<? extends Entry> reference, boolean setType);
+
+ /**
+ * Gets a <tt>Link</tt> from the given OData link.
+ *
+ * @param link OData link.
+ * @param isXML whether it is JSON or XML / Atom
+ * @return <tt>Link</tt> object.
+ */
+ Link getLink(ODataLink link, boolean isXML);
+
+ /**
+ * Gets a <tt>Property</tt> from the given OData property.
+ *
+ * @param property OData property.
+ * @param reference reference class.
+ * @param setType whether to explicitly output type information.
+ * @return <tt>Property</tt> object.
+ */
+ Property getProperty(ODataProperty property, Class<? extends Entry> reference, boolean setType);
+
+ /**
+ * Gets <tt>ODataServiceDocument</tt> from the given service document resource.
+ *
+ * @param resource service document resource.
+ * @return <tt>ODataServiceDocument</tt> object.
+ */
+ ODataServiceDocument getODataServiceDocument(ServiceDocument resource);
+
+ /**
+ * Gets <tt>ODataEntitySet</tt> from the given feed resource.
+ *
+ * @param resource feed resource.
+ * @return <tt>ODataEntitySet</tt> object.
+ */
+ ODataEntitySet getODataEntitySet(Feed resource);
+
+ /**
+ * Gets <tt>ODataEntitySet</tt> from the given feed resource.
+ *
+ * @param resource feed resource.
+ * @param defaultBaseURI default base URI.
+ * @return <tt>ODataEntitySet</tt> object.
+ */
+ ODataEntitySet getODataEntitySet(Feed resource, URI defaultBaseURI);
+
+ /**
+ * Gets <tt>ODataEntity</tt> from the given entry resource.
+ *
+ * @param resource entry resource.
+ * @return <tt>ODataEntity</tt> object.
+ */
+ ODataEntity getODataEntity(Entry resource);
+
+ /**
+ * Gets <tt>ODataEntity</tt> from the given entry resource.
+ *
+ * @param resource entry resource.
+ * @param defaultBaseURI default base URI.
+ * @return <tt>ODataEntity</tt> object.
+ */
+ ODataEntity getODataEntity(Entry resource, URI defaultBaseURI);
+
+ /**
+ * Gets an <tt>ODataProperty</tt> from the given property resource.
+ *
+ * @param property property resource.
+ * @return <tt>ODataProperty</tt> object.
+ */
+ ODataProperty getODataProperty(Property property);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
new file mode 100644
index 0000000..d0edb3b
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.op;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import org.apache.olingo.client.api.data.Entry;
+import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.client.api.data.Feed;
+import org.apache.olingo.client.api.data.Property;
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+
+/**
+ * Utility class for serialization.
+ */
+public interface CommonODataDeserializer extends Serializable {
+
+ XMLMetadata toMetadata(InputStream input);
+
+ /**
+ * Gets the ServiceDocument object represented by the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @param format OData service document format.
+ * @return <tt>ServiceDocument</tt> object.
+ */
+ ServiceDocument toServiceDocument(InputStream input, ODataFormat format);
+
+ /**
+ * Gets a feed object from the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @param format Atom or JSON
+ * @return Feed instance.
+ */
+ Feed toFeed(InputStream input, ODataPubFormat format);
+
+ /**
+ * Gets an entry object from the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @param format Atom or JSON
+ * @return Entry instance.
+ */
+ Entry toEntry(InputStream input, ODataPubFormat format);
+
+ /**
+ * Gets a property object from the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @param format XML or JSON
+ * @return Property instance.
+ */
+ Property toProperty(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 toError(InputStream input, boolean isXML);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
new file mode 100644
index 0000000..ceb7f6b
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.op;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import org.apache.olingo.client.api.data.ODataError;
+import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.edm.Edm;
+
+/**
+ * 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 CommonODataReader extends Serializable {
+
+ /**
+ * Parses a stream into metadata representation.
+ *
+ * @param input stream to de-serialize.
+ * @return metadata representation.
+ */
+ Edm 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 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/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataBinder.java
deleted file mode 100644
index 947fd6b..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataBinder.java
+++ /dev/null
@@ -1,142 +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.client.api.op;
-
-import java.io.Serializable;
-import java.net.URI;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.LinkCollection;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataLinkCollection;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-
-public interface ODataBinder extends Serializable {
-
- /**
- * Gets a <tt>Feed</tt> from the given OData entity set.
- *
- * @param feed OData entity set.
- * @param reference reference class.
- * @return <tt>Feed</tt> object.
- */
- Feed getFeed(ODataEntitySet feed, Class<? extends Feed> reference);
-
- /**
- * Gets an <tt>Entry</tt> from the given OData entity.
- *
- * @param entity OData entity.
- * @param reference reference class.
- * @return <tt>Entry</tt> object.
- */
- Entry getEntry(ODataEntity entity, Class<? extends Entry> reference);
-
- /**
- * Gets an <tt>Entry</tt> from the given OData entity.
- *
- * @param entity OData entity.
- * @param reference reference class.
- * @param setType whether to explicitly output type information.
- * @return <tt>Entry</tt> object.
- */
- Entry getEntry(ODataEntity entity, Class<? extends Entry> reference, boolean setType);
-
- /**
- * Gets a <tt>Link</tt> from the given OData link.
- *
- * @param link OData link.
- * @param isXML whether it is JSON or XML / Atom
- * @return <tt>Link</tt> object.
- */
- Link getLink(ODataLink link, boolean isXML);
-
- /**
- * Gets a <tt>Property</tt> from the given OData property.
- *
- * @param property OData property.
- * @param reference reference class.
- * @param setType whether to explicitly output type information.
- * @return <tt>Property</tt> object.
- */
- Property getProperty(ODataProperty property, Class<? extends Entry> reference, boolean setType);
-
- /**
- * Gets <tt>ODataServiceDocument</tt> from the given service document resource.
- *
- * @param resource service document resource.
- * @return <tt>ODataServiceDocument</tt> object.
- */
- ODataServiceDocument getODataServiceDocument(ServiceDocument resource);
-
- /**
- * Gets <tt>ODataEntitySet</tt> from the given feed resource.
- *
- * @param resource feed resource.
- * @return <tt>ODataEntitySet</tt> object.
- */
- ODataEntitySet getODataEntitySet(Feed resource);
-
- /**
- * Gets <tt>ODataEntitySet</tt> from the given feed resource.
- *
- * @param resource feed resource.
- * @param defaultBaseURI default base URI.
- * @return <tt>ODataEntitySet</tt> object.
- */
- ODataEntitySet getODataEntitySet(Feed resource, URI defaultBaseURI);
-
- /**
- * Gets <tt>ODataEntity</tt> from the given entry resource.
- *
- * @param resource entry resource.
- * @return <tt>ODataEntity</tt> object.
- */
- ODataEntity getODataEntity(Entry resource);
-
- /**
- * Gets <tt>ODataEntity</tt> from the given entry resource.
- *
- * @param resource entry resource.
- * @param defaultBaseURI default base URI.
- * @return <tt>ODataEntity</tt> object.
- */
- ODataEntity getODataEntity(Entry resource, URI defaultBaseURI);
-
- /**
- * Gets an <tt>ODataProperty</tt> from the given property resource.
- *
- * @param property property resource.
- * @return <tt>ODataProperty</tt> object.
- */
- ODataProperty getODataProperty(Property property);
-
- /**
- * Gets <tt>ODataLinkCollection</tt> from the given link collection resource.
- *
- * @param resource link collection resource.
- * @return <tt>ODataLinkCollection</tt> object.
- */
- ODataLinkCollection getLinkCollection(LinkCollection resource);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataDeserializer.java
deleted file mode 100644
index f8bebda..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataDeserializer.java
+++ /dev/null
@@ -1,94 +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.client.api.op;
-
-import java.io.InputStream;
-import java.io.Serializable;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.ODataError;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.LinkCollection;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-
-/**
- * Utility class for serialization.
- */
-public interface ODataDeserializer extends Serializable {
-
- XMLMetadata toMetadata(InputStream input);
-
- /**
- * Gets the ServiceDocument object represented by the given InputStream.
- *
- * @param input stream to be de-serialized.
- * @param format OData service document format.
- * @return <tt>ServiceDocument</tt> object.
- */
- ServiceDocument toServiceDocument(InputStream input, ODataFormat format);
-
- /**
- * Gets a feed object from the given InputStream.
- *
- * @param input stream to be de-serialized.
- * @param format Atom or JSON
- * @return Feed instance.
- */
- Feed toFeed(InputStream input, ODataPubFormat format);
-
- /**
- * Gets an entry object from the given InputStream.
- *
- * @param input stream to be de-serialized.
- * @param format Atom or JSON
- * @return Entry instance.
- */
- Entry toEntry(InputStream input, ODataPubFormat format);
-
- /**
- * Gets a property object from the given InputStream.
- *
- * @param input stream to be de-serialized.
- * @param format XML or JSON
- * @return Property instance.
- */
- Property toProperty(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 toError(InputStream input, boolean isXML);
-
- /**
- * 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);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataReader.java
deleted file mode 100644
index 8bfe68e..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataReader.java
+++ /dev/null
@@ -1,114 +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.client.api.op;
-
-import java.io.InputStream;
-import java.io.Serializable;
-import org.apache.olingo.client.api.data.ODataError;
-import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataLinkCollection;
-import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.edm.Edm;
-
-/**
- * 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.
- */
- Edm 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/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataV3Deserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataV3Deserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataV3Deserializer.java
deleted file mode 100644
index 725e2e1..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataV3Deserializer.java
+++ /dev/null
@@ -1,31 +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.client.api.op;
-
-public interface ODataV3Deserializer extends ODataDeserializer {
- /**
- * 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);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataV4Deserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataV4Deserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataV4Deserializer.java
deleted file mode 100644
index c782cd5..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataV4Deserializer.java
+++ /dev/null
@@ -1,30 +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.client.api.op;
-
-import java.io.InputStream;
-
-import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
-
-public interface ODataV4Deserializer extends ODataDeserializer {
-
- @Override
- XMLMetadata toMetadata(InputStream input);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
new file mode 100644
index 0000000..118a002
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.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.client.api.op.v3;
+
+import org.apache.olingo.client.api.data.v3.LinkCollection;
+import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
+import org.apache.olingo.client.api.op.CommonODataBinder;
+
+public interface ODataBinder extends CommonODataBinder {
+
+ /**
+ * Gets <tt>ODataLinkCollection</tt> from the given link collection resource.
+ *
+ * @param resource link collection resource.
+ * @return <tt>ODataLinkCollection</tt> object.
+ */
+ ODataLinkCollection getLinkCollection(LinkCollection resource);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
new file mode 100644
index 0000000..1b4a98b
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.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.client.api.op.v3;
+
+import java.io.InputStream;
+import org.apache.olingo.client.api.data.v3.LinkCollection;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.op.CommonODataDeserializer;
+
+public interface ODataDeserializer extends CommonODataDeserializer {
+
+ /**
+ * 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);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
new file mode 100644
index 0000000..bb436ad
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.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.client.api.op.v3;
+
+import java.io.InputStream;
+import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.op.CommonODataReader;
+
+public interface ODataReader extends CommonODataReader {
+
+ /**
+ * 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);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
new file mode 100644
index 0000000..1397c47
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.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.client.api.op.v4;
+
+import org.apache.olingo.client.api.op.CommonODataBinder;
+
+public interface ODataBinder extends CommonODataBinder {
+
+}
[18/52] [abbrv] [OLINGO-65] Implementation completed
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index c39335f..56eb4fb 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -38,11 +38,11 @@ import org.apache.olingo.client.api.communication.response.ODataValueUpdateRespo
import org.apache.olingo.client.api.domain.ODataCollectionValue;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
@@ -56,17 +56,17 @@ public class PropertyTestITCase extends AbstractTestITCase {
}
@Test
- public void replacePropertyValue() throws IOException {
+ public void replacePropertyValue() throws Exception {
updatePropertyValue(ODataValueFormat.TEXT, UpdateType.REPLACE);
}
@Test
- public void replacePrimitivePropertyAsXML() throws IOException {
+ public void replacePrimitivePropertyAsXML() throws IOException, EdmPrimitiveTypeException {
updatePrimitiveProperty(ODataFormat.XML);
}
@Test
- public void replacePrimitivePropertyAsJSON() throws IOException {
+ public void replacePrimitivePropertyAsJSON() throws IOException, EdmPrimitiveTypeException {
updatePrimitiveProperty(ODataFormat.JSON_FULL_METADATA);
}
@@ -128,10 +128,10 @@ public class PropertyTestITCase extends AbstractTestITCase {
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
req.setFormat(ODataValueFormat.TEXT);
- final ODataRetrieveResponse<ODataValue> res = req.execute();
+ final ODataRetrieveResponse<ODataPrimitiveValue> res = req.execute();
assertEquals(200, res.getStatusCode());
- final ODataValue value = res.getBody();
+ final ODataPrimitiveValue value = res.getBody();
debugODataValue(value, "Retrieved property");
assertNotNull(value);
@@ -157,7 +157,9 @@ public class PropertyTestITCase extends AbstractTestITCase {
execute();
}
- private void updatePropertyValue(final ODataValueFormat format, final UpdateType type) throws IOException {
+ private void updatePropertyValue(final ODataValueFormat format, final UpdateType type)
+ throws IOException, EdmPrimitiveTypeException {
+
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-9).
appendPropertySegment("PrimaryContactInfo").
@@ -168,13 +170,13 @@ public class PropertyTestITCase extends AbstractTestITCase {
ODataValueRequest retrieveReq = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
retrieveReq.setFormat(format);
- ODataRetrieveResponse<ODataValue> retrieveRes = retrieveReq.execute();
+ ODataRetrieveResponse<ODataPrimitiveValue> retrieveRes = retrieveReq.execute();
assertEquals(200, retrieveRes.getStatusCode());
- ODataValue phoneNumber = retrieveRes.getBody();
+ ODataPrimitiveValue phoneNumber = retrieveRes.getBody();
assertNotNull(phoneNumber);
- final String oldMsg = phoneNumber.asPrimitive().<String>toCastValue();
+ final String oldMsg = phoneNumber.toCastValue(String.class);
final String newMsg = "new msg (" + System.currentTimeMillis() + ")";
assertNotEquals(newMsg, oldMsg);
@@ -197,7 +199,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
phoneNumber = retrieveRes.getBody();
assertNotNull(phoneNumber);
- assertEquals(newMsg, phoneNumber.asPrimitive().<String>toCastValue());
+ assertEquals(newMsg, phoneNumber.asPrimitive().toCastValue(String.class));
}
private void updateComplexProperty(final ODataFormat format, final UpdateType type) throws IOException {
@@ -293,7 +295,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
assertEquals(origSize + 1, alternativeNames.getCollectionValue().size());
}
- private void updatePrimitiveProperty(final ODataFormat format) throws IOException {
+ private void updatePrimitiveProperty(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(-9).
appendPropertySegment("PrimaryContactInfo").
@@ -307,7 +309,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
ODataProperty phoneNumber = retrieveRes.getBody();
- final String oldMsg = phoneNumber.getPrimitiveValue().<String>toCastValue();
+ final String oldMsg = phoneNumber.getPrimitiveValue().toCastValue(String.class);
final String newMsg = "new item " + System.currentTimeMillis();
assertNotEquals(newMsg, oldMsg);
@@ -334,7 +336,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
assertEquals(200, retrieveRes.getStatusCode());
phoneNumber = retrieveRes.getBody();
- assertEquals(newMsg, phoneNumber.getPrimitiveValue().<String>toCastValue());
+ assertEquals(newMsg, phoneNumber.getPrimitiveValue().toCastValue(String.class));
}
private void rawRequest(final ODataFormat format) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
index 3b47ef0..3501482 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
@@ -36,6 +36,7 @@ import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.uri.v3.URIBuilder.InlineCount;
import org.apache.olingo.client.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.junit.Test;
/**
@@ -58,7 +59,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
* @see org.apache.olingo.client.core.v3.FilterFactoryTest for more tests.
*/
@Test
- public void filterOrderby() {
+ public void filterOrderby() throws EdmPrimitiveTypeException {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").filter("(VIN lt 16)");
@@ -71,7 +72,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
// 2. extract VIN values - sorted ASC by default
final List<Integer> vinsASC = new ArrayList<Integer>(5);
for (ODataEntity entity : feed.getEntities()) {
- final Integer vin = entity.getProperty("VIN").getPrimitiveValue().<Integer>toCastValue();
+ final Integer vin = entity.getProperty("VIN").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(vin < 16);
vinsASC.add(vin);
}
@@ -85,7 +86,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
// 4. extract again VIN value - now they were required to be sorted DESC
final List<Integer> vinsDESC = new ArrayList<Integer>(5);
for (ODataEntity entity : feed.getEntities()) {
- vinsDESC.add(entity.getProperty("VIN").getPrimitiveValue().<Integer>toCastValue());
+ vinsDESC.add(entity.getProperty("VIN").getPrimitiveValue().toCastValue(Integer.class));
}
// 5. reverse vinsASC and expect to be equal to vinsDESC
@@ -131,7 +132,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
* Test <tt>$skiptoken</tt>.
*/
@Test
- public void skiptoken() {
+ public void skiptoken() throws EdmPrimitiveTypeException {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").skipToken("-10");
@@ -141,7 +142,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
assertEquals(2, feed.getEntities().size());
for (ODataEntity entity : feed.getEntities()) {
- assertTrue(entity.getProperty("CustomerId").getPrimitiveValue().<Integer>toCastValue() > -10);
+ assertTrue(entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class) > -10);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 903adf8..0147fc0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -88,9 +88,8 @@ public class EntityTest extends AbstractTest {
for (ODataProperty property : entity.getProperties()) {
if ("GeogMultiLine".equals(property.getName())) {
found = true;
- assertTrue(property.hasPrimitiveValue());
- assertEquals(EdmPrimitiveTypeKind.GeographyMultiLineString.getFullQualifiedName().toString(),
- property.getPrimitiveValue().getTypeName());
+ assertTrue(property.hasGeospatialValue());
+ assertEquals(EdmPrimitiveTypeKind.GeographyMultiLineString, property.getGeospatialValue().getTypeKind());
}
}
assertTrue(found);
@@ -168,11 +167,10 @@ public class EntityTest extends AbstractTest {
assertNotNull(entity);
final ODataProperty geogCollection = entity.getProperty("GeogCollection");
- assertEquals(EdmPrimitiveTypeKind.GeographyCollection.getFullQualifiedName().toString(),
- geogCollection.getPrimitiveValue().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeographyCollection, geogCollection.getGeospatialValue().getTypeKind());
int count = 0;
- for (Geospatial g : geogCollection.getPrimitiveValue().<GeospatialCollection>toCastValue()) {
+ for (Geospatial g : geogCollection.getGeospatialValue().toCastValue(GeospatialCollection.class)) {
assertNotNull(g);
count++;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
index c5e4aee..d950d2e 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
@@ -23,18 +23,19 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.math.BigDecimal;
+import java.sql.Timestamp;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
+import java.util.TimeZone;
import java.util.UUID;
+import javax.xml.datatype.Duration;
import org.apache.commons.codec.binary.Base64;
-import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.domain.ODataDuration;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataTimestamp;
import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
@@ -44,6 +45,7 @@ import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
+
import org.junit.Test;
public class PrimitiveValueTest extends AbstractTest {
@@ -54,119 +56,129 @@ public class PrimitiveValueTest extends AbstractTest {
}
@Test
- public void manageInt32() {
+ public void manageInt32() throws EdmPrimitiveTypeException {
final int primitive = -10;
ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.Int32.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
- assertEquals(Integer.valueOf(primitive), value.asPrimitive().<Integer>toCastValue());
+ assertEquals(EdmPrimitiveTypeKind.Int32, value.asPrimitive().getTypeKind());
+ assertEquals(Integer.valueOf(primitive), value.asPrimitive().toCastValue(Integer.class));
value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).setText("9").build();
- assertEquals("9", value.asPrimitive().<Integer>toCastValue().toString());
+ assertEquals("9", value.asPrimitive().toCastValue(Integer.class).toString());
}
@Test
- public void manageString() {
+ public void manageString() throws EdmPrimitiveTypeException {
final String primitive = UUID.randomUUID().toString();
ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
setText(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.String, value.asPrimitive().getTypeKind());
assertEquals(primitive, value.toString());
value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
- assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().<String>toCastValue().toString());
+ assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().toCastValue(String.class).toString());
}
@Test
- public void manageDecimal() {
+ public void manageDecimal() throws EdmPrimitiveTypeException {
final BigDecimal primitive = new BigDecimal("-79228162514264337593543950335");
ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.Decimal.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
- assertEquals(primitive, value.asPrimitive().<BigDecimal>toCastValue());
+ assertEquals(EdmPrimitiveTypeKind.Decimal, value.asPrimitive().getTypeKind());
+ assertEquals(primitive, value.asPrimitive().toCastValue(BigDecimal.class));
value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
setText("-79228162514264337593543950335").build();
- assertEquals("-79228162514264337593543950335", value.asPrimitive().<BigDecimal>toCastValue().toString());
+ assertEquals("-79228162514264337593543950335", value.asPrimitive().toCastValue(BigDecimal.class).toString());
}
@Test
- public void manageDateTime() {
- // OData V3 only
- final String primitive = "2013-01-10T06:27:51.1667673";
- try {
- new ODataPrimitiveValue.Builder(ODataClientFactory.getV4()).
- setType(EdmPrimitiveTypeKind.DateTime).setText(primitive).build();
- fail();
- } catch (IllegalArgumentException iae) {
- // ignore
- }
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.DateTime).
- setText(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.DateTime.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
- // performed cast to improve the check
- assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
+ public void manageDateTime() throws EdmPrimitiveTypeException {
+ final Calendar expected = Calendar.getInstance();
+ expected.clear();
+ expected.set(2013, 0, 10, 2, 0, 0);
+ expected.set(Calendar.MILLISECOND, 1667673);
+
+ final ODataValue value = getClient().getPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTime).setValue(expected).build();
+ assertEquals(EdmPrimitiveTypeKind.DateTime, value.asPrimitive().getTypeKind());
+
+ final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
+ assertEquals(expected.get(Calendar.YEAR), actual.get(Calendar.YEAR));
+ assertEquals(expected.get(Calendar.MONTH), actual.get(Calendar.MONTH));
+ assertEquals(expected.get(Calendar.DATE), actual.get(Calendar.DATE));
+ assertEquals(expected.get(Calendar.HOUR), actual.get(Calendar.HOUR));
+ assertEquals(expected.get(Calendar.MINUTE), actual.get(Calendar.MINUTE));
+ assertEquals(expected.get(Calendar.SECOND), actual.get(Calendar.SECOND));
+ assertEquals(expected.get(Calendar.MILLISECOND), actual.get(Calendar.MILLISECOND));
+
+ // Timestamp
+ final Timestamp timestamp = value.asPrimitive().toCastValue(Timestamp.class);
+ assertEquals(expected.get(Calendar.MILLISECOND), timestamp.getNanos());
+
+ assertEquals("2013-01-10T02:27:47.673", value.asPrimitive().toString());
}
@Test
- public void manageTime() {
- // OData V3 only
+ public void manageTime() throws EdmPrimitiveTypeException {
final String primitive = "-P9DT51M10.5063807S";
- try {
- new ODataPrimitiveValue.Builder(ODataClientFactory.getV4()).
- setType(EdmPrimitiveTypeKind.Time).setText(primitive).build();
- fail();
- } catch (IllegalArgumentException iae) {
- // ignore
- }
-
final ODataValue value =
getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Time).
setText(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.Time.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Time, value.asPrimitive().getTypeKind());
// performed cast to improve the check
- assertEquals(primitive, value.asPrimitive().<ODataDuration>toCastValue().toString());
+ assertEquals(primitive, value.asPrimitive().toCastValue(Duration.class).toString());
}
@Test
- public void manageDateTimeOffset() {
- final String primitive = "2013-01-10T02:00:00";
+ public void manageDateTimeOffset() throws EdmPrimitiveTypeException {
+ final Calendar expected = Calendar.getInstance();
+ expected.clear();
+ expected.setTimeZone(TimeZone.getTimeZone("GMT"));
+ expected.set(2013, 0, 10, 2, 0, 0);
+
final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTimeOffset).setText(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName().toString(),
- value.asPrimitive().getTypeName());
- // performed cast to improve the check
- assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(expected).build();
+ assertEquals(EdmPrimitiveTypeKind.DateTimeOffset, value.asPrimitive().getTypeKind());
+
+ final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
+ assertEquals(expected.get(Calendar.YEAR), actual.get(Calendar.YEAR));
+ assertEquals(expected.get(Calendar.MONTH), actual.get(Calendar.MONTH));
+ assertEquals(expected.get(Calendar.DATE), actual.get(Calendar.DATE));
+ assertEquals(expected.get(Calendar.HOUR), actual.get(Calendar.HOUR));
+ assertEquals(expected.get(Calendar.MINUTE), actual.get(Calendar.MINUTE));
+ assertEquals(expected.get(Calendar.SECOND), actual.get(Calendar.SECOND));
+
+ assertEquals("2013-01-10T02:00:00Z", value.asPrimitive().toString());
}
@Test
- public void manageGuid() {
+ public void manageGuid() throws EdmPrimitiveTypeException {
final UUID primitive = UUID.fromString("1126a28b-a4af-4bbd-bf0a-2b2c22635565");
ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.Guid.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
- assertEquals(primitive, value.asPrimitive().<UUID>toCastValue());
+ assertEquals(EdmPrimitiveTypeKind.Guid, value.asPrimitive().getTypeKind());
+ assertEquals(primitive, value.asPrimitive().toCastValue(UUID.class));
value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
- assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().<UUID>toCastValue().toString());
+ assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().toCastValue(UUID.class).toString());
}
@Test
- public void manageBinary() {
+ public void manageBinary() throws EdmPrimitiveTypeException {
final byte[] primitive = UUID.randomUUID().toString().getBytes();
ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.Binary.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Binary, value.asPrimitive().getTypeKind());
assertEquals(
Base64.encodeBase64String(primitive),
- Base64.encodeBase64String(value.asPrimitive().<byte[]>toCastValue()));
+ Base64.encodeBase64String(value.asPrimitive().toCastValue(byte[].class)));
value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
setText(Base64.encodeBase64String("primitive".getBytes())).build();
- assertEquals("primitive", new String(value.asPrimitive().<byte[]>toCastValue()));
+ assertEquals("primitive", new String(value.asPrimitive().toCastValue(byte[].class)));
}
@Test
@@ -187,10 +199,11 @@ public class PrimitiveValueTest extends AbstractTest {
getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(primitive).
build();
- assertEquals(EdmPrimitiveTypeKind.GeographyPoint.getFullQualifiedName().toString(),
- value.asPrimitive().getTypeName());
- assertEquals(Double.valueOf(primitive.getX()), Double.valueOf(value.asPrimitive().<Point>toCastValue().getX()));
- assertEquals(Double.valueOf(primitive.getY()), Double.valueOf(value.asPrimitive().<Point>toCastValue().getY()));
+ assertEquals(EdmPrimitiveTypeKind.GeographyPoint, value.asGeospatial().getTypeKind());
+ assertEquals(Double.valueOf(primitive.getX()),
+ Double.valueOf(value.asGeospatial().toCastValue(Point.class).getX()));
+ assertEquals(Double.valueOf(primitive.getY()),
+ Double.valueOf(value.asGeospatial().toCastValue(Point.class).getY()));
}
@Test
@@ -220,10 +233,9 @@ public class PrimitiveValueTest extends AbstractTest {
final ODataValue value = getClient().getGeospatialValueBuilder().
setType(EdmPrimitiveTypeKind.GeographyLineString).setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeographyLineString.getFullQualifiedName().toString(),
- value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeographyLineString, value.asGeospatial().getTypeKind());
- final Iterator<Point> iter = value.asPrimitive().<LineString>toCastValue().iterator();
+ final Iterator<Point> iter = value.asGeospatial().toCastValue(LineString.class).iterator();
// take the third one and check the point value ...
iter.next();
@@ -246,10 +258,9 @@ public class PrimitiveValueTest extends AbstractTest {
final ODataValue value = getClient().getGeospatialValueBuilder().
setType(EdmPrimitiveTypeKind.GeometryMultiPoint).setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint.getFullQualifiedName().toString(),
- value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint, value.asGeospatial().getTypeKind());
- final Iterator<Point> iter = value.asPrimitive().<MultiPoint>toCastValue().iterator();
+ final Iterator<Point> iter = value.asGeospatial().toCastValue(MultiPoint.class).iterator();
point = iter.next();
assertEquals(Double.valueOf(points.get(0).getX()), Double.valueOf(point.getX()));
@@ -308,10 +319,9 @@ public class PrimitiveValueTest extends AbstractTest {
final ODataValue value =
getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString.getFullQualifiedName().toString(),
- value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString, value.asGeospatial().getTypeKind());
- final Iterator<LineString> lineIter = value.asPrimitive().<MultiLineString>toCastValue().iterator();
+ final Iterator<LineString> lineIter = value.asGeospatial().toCastValue(MultiLineString.class).iterator();
// take the second line and check the third point value ...
lineIter.next();
@@ -362,11 +372,10 @@ public class PrimitiveValueTest extends AbstractTest {
final ODataValue value =
getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeographyPolygon.getFullQualifiedName().toString(),
- value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeographyPolygon, value.asGeospatial().getTypeKind());
- assertTrue(value.asPrimitive().<Polygon>toCastValue().getInterior().isEmpty());
- final Iterator<Point> iter = value.asPrimitive().<Polygon>toCastValue().getExterior().iterator();
+ assertTrue(value.asGeospatial().toCastValue(Polygon.class).getInterior().isEmpty());
+ final Iterator<Point> iter = value.asGeospatial().toCastValue(Polygon.class).getExterior().iterator();
// take the third one ...
iter.next();
@@ -469,10 +478,9 @@ public class PrimitiveValueTest extends AbstractTest {
final ODataValue value =
getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPolygon).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon.getFullQualifiedName().toString(),
- value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon, value.asGeospatial().getTypeKind());
- final Iterator<Polygon> iter = value.asPrimitive().<MultiPolygon>toCastValue().iterator();
+ final Iterator<Polygon> iter = value.asGeospatial().toCastValue(MultiPolygon.class).iterator();
// second one polygon
iter.next();
@@ -516,10 +524,9 @@ public class PrimitiveValueTest extends AbstractTest {
final ODataValue value =
getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryCollection).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeometryCollection.getFullQualifiedName().toString(),
- value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeometryCollection, value.asGeospatial().getTypeKind());
- final Iterator<Geospatial> iter = value.asPrimitive().<GeospatialCollection>toCastValue().iterator();
+ final Iterator<Geospatial> iter = value.asGeospatial().toCastValue(GeospatialCollection.class).iterator();
iter.next();
final Point collectedPoint = (Point) iter.next();
@@ -549,10 +556,9 @@ public class PrimitiveValueTest extends AbstractTest {
final ODataValue value =
getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeographyCollection.getFullQualifiedName().toString(),
- value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeographyCollection, value.asGeospatial().getTypeKind());
- final Iterator<Geospatial> iter = value.asPrimitive().<GeospatialCollection>toCastValue().iterator();
+ final Iterator<Geospatial> iter = value.asGeospatial().toCastValue(GeospatialCollection.class).iterator();
iter.next();
final Point collectedPoint = (Point) iter.next();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4780fc51/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
index d72861d..d879e5b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
@@ -18,16 +18,13 @@
*/
package org.apache.olingo.client.core.v4;
+import java.util.Calendar;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.api.domain.ODataDuration;
-import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.client.api.domain.ODataTimestamp;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
@@ -39,40 +36,38 @@ public class PrimitiveValueTest extends AbstractTest {
}
@Test
- public void manageTimeOfDay() {
- // OData V4 only
- final String primitive = "-P9DT51M12.5063807S";
- try {
- new ODataPrimitiveValue.Builder(ODataClientFactory.getV3()).
- setType(EdmPrimitiveTypeKind.TimeOfDay).setText(primitive).build();
- fail();
- } catch (IllegalArgumentException iae) {
- // ignore
- }
+ public void manageTimeOfDay() throws EdmPrimitiveTypeException {
+ final Calendar expected = Calendar.getInstance();
+ expected.clear();
+ expected.set(2013, 0, 10, 21, 45, 17);
final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.TimeOfDay).setText(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.TimeOfDay.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
- // performed cast to improve the check
- assertEquals(primitive, value.asPrimitive().<ODataDuration>toCastValue().toString());
+ setType(EdmPrimitiveTypeKind.TimeOfDay).setValue(expected).build();
+ assertEquals(EdmPrimitiveTypeKind.TimeOfDay, value.asPrimitive().getTypeKind());
+
+ final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
+ assertEquals(expected.get(Calendar.HOUR), actual.get(Calendar.HOUR));
+ assertEquals(expected.get(Calendar.MINUTE), actual.get(Calendar.MINUTE));
+ assertEquals(expected.get(Calendar.SECOND), actual.get(Calendar.SECOND));
+
+ assertEquals("21:45:17", value.asPrimitive().toString());
}
@Test
- public void manageDate() {
- // OData V4 only
- final String primitive = "2013-01-10";
- try {
- new ODataPrimitiveValue.Builder(ODataClientFactory.getV3()).
- setType(EdmPrimitiveTypeKind.Date).setText(primitive).build();
- fail();
- } catch (IllegalArgumentException iae) {
- // ignore
- }
+ public void manageDate() throws EdmPrimitiveTypeException {
+ final Calendar expected = Calendar.getInstance();
+ expected.clear();
+ expected.set(2013, 0, 10);
final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Date).setText(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.Date.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
- // performed cast to improve the check
- assertEquals(primitive, value.asPrimitive().<ODataTimestamp>toCastValue().toString());
+ setType(EdmPrimitiveTypeKind.Date).setValue(expected).build();
+ assertEquals(EdmPrimitiveTypeKind.Date, value.asPrimitive().getTypeKind());
+
+ final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
+ assertEquals(expected.get(Calendar.YEAR), actual.get(Calendar.YEAR));
+ assertEquals(expected.get(Calendar.MONTH), actual.get(Calendar.MONTH));
+ assertEquals(expected.get(Calendar.DATE), actual.get(Calendar.DATE));
+
+ assertEquals("2013-01-10", value.asPrimitive().toString());
}
}
[02/52] [abbrv] Consistently using package name to differentiate V3
and V4
Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
index 9faa8e2..9133b0e 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
@@ -20,9 +20,7 @@ package org.apache.olingo.client.core;
import java.util.Locale;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.api.ODataV4Client;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.custommonkey.xmlunit.XMLUnit;
@@ -30,11 +28,11 @@ import org.junit.BeforeClass;
public abstract class AbstractTest {
- protected static ODataV3Client v3Client;
+ protected static org.apache.olingo.client.api.v3.ODataClient v3Client;
- protected static ODataV4Client v4Client;
+ protected static org.apache.olingo.client.api.v4.ODataClient v4Client;
- protected abstract ODataClient getClient();
+ protected abstract CommonODataClient getClient();
@BeforeClass
public static void setUp() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java
index 844152a..bb882b8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/ODataClientTest.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.junit.Test;
@@ -30,7 +30,7 @@ public class ODataClientTest {
@Test
public void before() {
- ODataClient client = ODataClientFactory.getV3();
+ CommonODataClient client = ODataClientFactory.getV3();
assertNotNull(client);
assertEquals(ODataServiceVersion.V30, client.getServiceVersion());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
index 6ce8cb6..1293f3c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
@@ -18,12 +18,12 @@
*/
package org.apache.olingo.client.core.it;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
public abstract class AbstractMetadataTestITCase extends AbstractTestITCase {
@Override
- protected abstract ODataClient getClient();
+ protected abstract CommonODataClient getClient();
protected String getTestServiceRoot() {
return "http://localhost:9080/StaticService/" + getClient().getServiceVersion().name() + "/Static.svc";
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index 091698c..589affa 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -39,7 +39,7 @@ import java.util.Locale;
import java.util.Set;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
@@ -64,7 +64,7 @@ import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.utils.URIUtils;
import org.apache.olingo.client.core.data.AtomEntryImpl;
import org.apache.olingo.client.core.data.JSONEntryImpl;
@@ -92,7 +92,7 @@ public abstract class AbstractTestITCase {
Locale.setDefault(Locale.ENGLISH);
}
- protected abstract ODataClient getClient();
+ protected abstract CommonODataClient getClient();
protected void checkLinks(final Collection<ODataLink> original, final Collection<ODataLink> actual) {
assertTrue(original.size() <= actual.size());
@@ -365,7 +365,8 @@ public abstract class AbstractTestITCase {
final ODataEntity original,
final String entitySetName) {
- final URIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).appendEntitySetSegment(entitySetName);
+ final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
+ appendEntitySetSegment(entitySetName);
debugODataEntity(original, "About to create");
@@ -391,7 +392,7 @@ public abstract class AbstractTestITCase {
final int actualObjectId,
final Collection<String> expands) {
- final URIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
+ final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(actualObjectId);
// search expanded
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
new file mode 100644
index 0000000..3dc766e
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.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.client.core.it.v3;
+
+import java.io.IOException;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.junit.BeforeClass;
+
+public abstract class AbstractTestITCase extends org.apache.olingo.client.core.it.AbstractTestITCase {
+
+ protected static ODataClient client;
+
+ protected static String testStaticServiceRootURL;
+
+ protected static String testLargeModelServiceRootURL;
+
+ protected static String testAuthServiceRootURL;
+
+ @BeforeClass
+ public static void setUpODataServiceRoot() throws IOException {
+ testStaticServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc";
+ testLargeModelServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc/large";
+ testAuthServiceRootURL = "http://localhost:9080/DefaultService.svc";
+ }
+
+ @BeforeClass
+ public static void setClientInstance() {
+ client = ODataClientFactory.getV3();
+ }
+
+ @Override
+ protected ODataClient getClient() {
+ return client;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractV3TestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractV3TestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractV3TestITCase.java
deleted file mode 100644
index d965201..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractV3TestITCase.java
+++ /dev/null
@@ -1,53 +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.client.core.it.v3;
-
-import java.io.IOException;
-import org.apache.olingo.client.api.ODataV3Client;
-import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.client.core.it.AbstractTestITCase;
-import org.junit.BeforeClass;
-
-public abstract class AbstractV3TestITCase extends AbstractTestITCase {
-
- protected static ODataV3Client client;
-
- protected static String testStaticServiceRootURL;
-
- protected static String testLargeModelServiceRootURL;
-
- protected static String testAuthServiceRootURL;
-
- @BeforeClass
- public static void setUpODataServiceRoot() throws IOException {
- testStaticServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc";
- testLargeModelServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc/large";
- testAuthServiceRootURL = "http://localhost:9080/DefaultService.svc";
- }
-
- @BeforeClass
- public static void setClientInstance() {
- client = ODataClientFactory.getV3();
- }
-
- @Override
- protected ODataV3Client getClient() {
- return client;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ActionOverloadingTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ActionOverloadingTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ActionOverloadingTestITCase.java
index f1a9dbe..9250ed3 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ActionOverloadingTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ActionOverloadingTestITCase.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.it.v3;
-public class ActionOverloadingTestITCase extends AbstractV3TestITCase {
+public class ActionOverloadingTestITCase extends AbstractTestITCase {
// @Test
// public void retrieveProducts() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index 1936011..4527aa0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -38,15 +38,15 @@ import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreat
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Ignore;
import org.junit.Test;
-public class AsyncTestITCase extends AbstractV3TestITCase {
+public class AsyncTestITCase extends AbstractTestITCase {
@Test
public void retrieveEntitySet() throws InterruptedException, ExecutionException {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product");
final Future<ODataRetrieveResponse<ODataEntitySet>> futureRes =
client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).asyncExecute();
@@ -96,7 +96,7 @@ public class AsyncTestITCase extends AbstractV3TestITCase {
@Test
@Ignore
public void createMediaEntity() throws InterruptedException, ExecutionException, IOException {
- URIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car");
+ CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car");
final String TO_BE_UPDATED = "async buffered stream sample";
final InputStream input = IOUtils.toInputStream(TO_BE_UPDATED);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/BatchTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/BatchTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/BatchTestITCase.java
index 1f3ede1..8ee3efd 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/BatchTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/BatchTestITCase.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.it.v3;
-public class BatchTestITCase extends AbstractV3TestITCase {
+public class BatchTestITCase extends AbstractTestITCase {
// private static String PREFIX = "!!PREFIX!!";
//
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
index e0dc1cd..bcdef88 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/CountTestITCase.java
@@ -25,14 +25,14 @@ import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataValueFormat;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
-public class CountTestITCase extends AbstractV3TestITCase {
+public class CountTestITCase extends AbstractTestITCase {
//counts the total number of customers
@Test
public void entityCount() {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").count();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
req.setFormat(ODataValueFormat.TEXT);
@@ -47,7 +47,7 @@ public class CountTestITCase extends AbstractV3TestITCase {
@Test
public void invalidAccept() {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").count();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
req.setFormat(ODataValueFormat.TEXT);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 32ee8eb..0d7bac2 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -47,7 +47,7 @@ import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.NoContentException;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.utils.URIUtils;
import org.junit.Ignore;
import org.junit.Test;
@@ -55,7 +55,7 @@ import org.junit.Test;
/**
* This is the unit test class to check create entity operations.
*/
-public class EntityCreateTestITCase extends AbstractV3TestITCase {
+public class EntityCreateTestITCase extends AbstractTestITCase {
protected String getServiceRoot() {
return testStaticServiceRootURL;
@@ -254,7 +254,7 @@ public class EntityCreateTestITCase extends AbstractV3TestITCase {
final int id = 2;
final ODataEntity original = getSampleCustomerProfile(id, "Sample customer for issue 135", false);
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer");
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer");
final ODataEntityCreateRequest createReq =
client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
createReq.setFormat(ODataPubFormat.JSON_FULL_METADATA);
@@ -307,7 +307,7 @@ public class EntityCreateTestITCase extends AbstractV3TestITCase {
// now, compare the created one with the actual one and go deeply into the associated customer info.....
final ODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Orders");
final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
@@ -348,7 +348,7 @@ public class EntityCreateTestITCase extends AbstractV3TestITCase {
// now, compare the created one with the actual one and go deeply into the associated customer info.....
final ODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
@@ -459,7 +459,7 @@ public class EntityCreateTestITCase extends AbstractV3TestITCase {
client.getPrimitiveValueBuilder().setValue(false).
setType(ODataJClientEdmPrimitiveType.Boolean).build()));
- final URIBuilder<?> builder =
+ final CommonURIBuilder<?> builder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Message");
final ODataEntityCreateRequest req = client.getCUDRequestFactory().getEntityCreateRequest(builder.build(),
message);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
index a05562b..02a74ae 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
@@ -37,21 +37,21 @@ import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.op.impl.ResourceFactory;
import org.junit.Test;
/**
* This is the unit test class to check entity retrieve operations.
*/
-public class EntityRetrieveTestITCase extends AbstractV3TestITCase {
+public class EntityRetrieveTestITCase extends AbstractTestITCase {
protected String getServiceRoot() {
return testStaticServiceRootURL;
}
private void withInlineEntry(final ODataPubFormat format) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).expand("Info");
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
@@ -104,7 +104,7 @@ public class EntityRetrieveTestITCase extends AbstractV3TestITCase {
}
private void withInlineFeed(final ODataPubFormat format) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).expand("Orders");
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
@@ -143,7 +143,7 @@ public class EntityRetrieveTestITCase extends AbstractV3TestITCase {
}
private void rawRequest(final ODataPubFormat format) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Car").appendKeySegment(16);
final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
@@ -175,7 +175,7 @@ public class EntityRetrieveTestITCase extends AbstractV3TestITCase {
multiKey.put("FromUsername", "1");
multiKey.put("MessageId", -10);
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Message").appendKeySegment(multiKey);
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
@@ -208,7 +208,7 @@ public class EntityRetrieveTestITCase extends AbstractV3TestITCase {
}
private void checkForETag(final ODataPubFormat format) {
- final URIBuilder<?> uriBuilder =
+ final CommonURIBuilder<?> uriBuilder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Product").appendKeySegment(-10);
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
@@ -226,7 +226,7 @@ public class EntityRetrieveTestITCase extends AbstractV3TestITCase {
@Test(expected = IllegalArgumentException.class)
public void issue99() {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Car");
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Car");
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.JSON);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
index 96a0dad..08c414f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.utils.URIUtils;
import org.apache.olingo.client.core.op.impl.ResourceFactory;
import static org.junit.Assert.assertNotNull;
@@ -40,7 +40,7 @@ import org.junit.Test;
/**
* This is the unit test class to check basic feed operations.
*/
-public class EntitySetTestITCase extends AbstractV3TestITCase {
+public class EntitySetTestITCase extends AbstractTestITCase {
protected String getServiceRoot() {
return testStaticServiceRootURL;
@@ -87,7 +87,7 @@ public class EntitySetTestITCase extends AbstractV3TestITCase {
}
private void readEntitySetWithNextLink(final ODataPubFormat format) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer");
final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
@@ -111,7 +111,7 @@ public class EntitySetTestITCase extends AbstractV3TestITCase {
}
private void readODataEntitySetIterator(final ODataPubFormat format) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer");
final ODataEntitySetIteratorRequest req =
@@ -134,7 +134,7 @@ public class EntitySetTestITCase extends AbstractV3TestITCase {
}
private void rawRequest(final ODataPubFormat format) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Car");
final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index c224319..7717226 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -39,7 +39,7 @@ import org.junit.Test;
/**
* This is the unit test class to check entity update operations.
*/
-public class EntityUpdateTestITCase extends AbstractV3TestITCase {
+public class EntityUpdateTestITCase extends AbstractTestITCase {
protected String getServiceRoot() {
return testStaticServiceRootURL;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
index 651dc50..e4b9212 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
@@ -28,14 +28,14 @@ import java.io.InputStream;
import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.utils.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
@@ -47,7 +47,7 @@ import org.junit.Test;
/**
* This is the unit test class to check basic entity operations.
*/
-public class ErrorTestITCase extends AbstractV3TestITCase {
+public class ErrorTestITCase extends AbstractTestITCase {
private class ErrorGeneratingRequest
extends AbstractODataBasicRequest<ODataEntityCreateResponse, ODataPubFormat> {
@@ -69,10 +69,10 @@ public class ErrorTestITCase extends AbstractV3TestITCase {
private class ErrorResponseImpl extends AbstractODataResponse implements ODataEntityCreateResponse {
- private final ODataClient odataClient;
+ private final CommonODataClient odataClient;
public ErrorResponseImpl(
- final ODataClient odataClient, final HttpClient client, final HttpResponse res) {
+ final CommonODataClient odataClient, final HttpClient client, final HttpResponse res) {
super(client, res);
this.odataClient = odataClient;
@@ -86,7 +86,7 @@ public class ErrorTestITCase extends AbstractV3TestITCase {
}
private void stacktraceError(final ODataPubFormat format) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer");
final ErrorGeneratingRequest errorReq = new ErrorGeneratingRequest(HttpMethod.POST, uriBuilder.build());
@@ -114,7 +114,7 @@ public class ErrorTestITCase extends AbstractV3TestITCase {
}
private void notfoundError(final ODataPubFormat format) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer(154)");
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
@@ -148,7 +148,7 @@ public class ErrorTestITCase extends AbstractV3TestITCase {
final EdmEntityContainer container = metadata.getSchemas().get(0).getEntityContainer();
final EdmFunctionImport funcImp = container.getFunctionImport("InStreamErrorGetCustomer");
- final URIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
appendOperationCallSegment(URIUtils.rootFunctionImportURISegment(container, funcImp), null);
// TODO: review invoke
// final ODataInvokeRequest<ODataEntitySet> req =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
index c5910f4..ece7364 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
@@ -19,27 +19,27 @@
package org.apache.olingo.client.core.it.v3;
import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.api.uri.filter.URIFilter;
-import org.apache.olingo.client.api.uri.filter.V3FilterArgFactory;
-import org.apache.olingo.client.api.uri.filter.V3FilterFactory;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.client.api.uri.v3.FilterArgFactory;
+import org.apache.olingo.client.api.uri.v3.FilterFactory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
-public class FilterFactoryTestITCase extends AbstractV3TestITCase {
+public class FilterFactoryTestITCase extends AbstractTestITCase {
- private V3FilterFactory getFilterFactory() {
+ private FilterFactory getFilterFactory() {
return getClient().getFilterFactory();
}
- private V3FilterArgFactory getFilterArgFactory() {
+ private FilterArgFactory getFilterArgFactory() {
return getFilterFactory().getArgFactory();
}
private void match(final String entitySet, final URIFilter filter, final int expected) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment(entitySet).filter(filter);
final ODataEntitySet feed = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
index 6cc217f..a2d9a90 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
@@ -22,13 +22,13 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
import org.apache.olingo.client.api.domain.ODataEntitySet;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Test;
-public class FilterTestITCase extends AbstractV3TestITCase {
+public class FilterTestITCase extends AbstractTestITCase {
private void filterQueryTest(final String entity, final String filter, final int expected) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment(entity).filter(filter);
final ODataEntitySet entitySet = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).
execute().getBody();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/InvokeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/InvokeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/InvokeTestITCase.java
index a296650..101dca7 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/InvokeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/InvokeTestITCase.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.it.v3;
-public class InvokeTestITCase extends AbstractV3TestITCase {
+public class InvokeTestITCase extends AbstractTestITCase {
// private void getWithNoParams(final ODataPubFormat format) {
// final Edm metadata =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
index 0706408..1a3123b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
@@ -23,7 +23,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -31,7 +31,7 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-public class KeyAsSegmentTestITCase extends AbstractV3TestITCase {
+public class KeyAsSegmentTestITCase extends AbstractTestITCase {
@BeforeClass
public static void enableKeyAsSegment() {
@@ -39,7 +39,7 @@ public class KeyAsSegmentTestITCase extends AbstractV3TestITCase {
}
private void read(final ODataPubFormat format) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-10);
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
index 6e08f74..a296f94 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
@@ -29,27 +29,27 @@ import java.util.List;
import org.apache.olingo.client.api.communication.request.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataLinkCreateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataLinkUpdateRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataLinkCollectionRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkCollectionRequest;
import org.apache.olingo.client.api.communication.response.ODataLinkOperationResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataLink;
-import org.apache.olingo.client.api.domain.ODataLinkCollection;
+import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.api.uri.V3URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.api.uri.v3.URIBuilder;
import org.junit.Test;
/**
* This is the unit test class to check basic link operations.
*/
-public class LinkTestITCase extends AbstractV3TestITCase {
+public class LinkTestITCase extends AbstractTestITCase {
protected String getServiceRoot() {
return testStaticServiceRootURL;
}
private ODataLinkCollection doRetrieveLinkURIs(final ODataFormat format, final String linkname) throws IOException {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10);
final ODataLinkCollectionRequest req =
@@ -95,7 +95,7 @@ public class LinkTestITCase extends AbstractV3TestITCase {
final ODataLink newLink = client.getObjectFactory().
newAssociationLink(null, URI.create(getServiceRoot() + "/Login('3')"));
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).appendLinksSegment("Logins");
final ODataLinkCreateRequest req =
@@ -135,7 +135,7 @@ public class LinkTestITCase extends AbstractV3TestITCase {
ODataLink newLink =
client.getObjectFactory().newAssociationLink(null, URI.create(getServiceRoot() + "/CustomerInfo(12)"));
- final V3URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot());
+ final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(-10).appendLinksSegment("Info");
ODataLinkUpdateRequest req =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
index 6f0401f..a043430 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
@@ -40,14 +40,14 @@ import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.format.ODataMediaFormat;
import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Test;
-public class MediaEntityTestITCase extends AbstractV3TestITCase {
+public class MediaEntityTestITCase extends AbstractTestITCase {
@Test
public void read() throws Exception {
- final URIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(12).appendValueSegment();
final ODataMediaRequest retrieveReq = client.getRetrieveRequestFactory().getMediaRequest(builder.build());
@@ -62,7 +62,7 @@ public class MediaEntityTestITCase extends AbstractV3TestITCase {
@Test(expected = ODataClientErrorException.class)
public void readWithXmlError() throws Exception {
- final URIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(12).appendValueSegment();
final ODataMediaRequest retrieveReq = client.getRetrieveRequestFactory().getMediaRequest(builder.build());
@@ -73,7 +73,7 @@ public class MediaEntityTestITCase extends AbstractV3TestITCase {
@Test(expected = ODataClientErrorException.class)
public void readWithJsonError() throws Exception {
- final URIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(12).appendValueSegment();
final ODataMediaRequest retrieveReq = client.getRetrieveRequestFactory().getMediaRequest(builder.build());
@@ -109,7 +109,7 @@ public class MediaEntityTestITCase extends AbstractV3TestITCase {
@Test
public void updateNamedStream() throws Exception {
- URIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(16).appendNavigationSegment("Photo");
final String TO_BE_UPDATED = "buffered stream sample";
@@ -131,7 +131,7 @@ public class MediaEntityTestITCase extends AbstractV3TestITCase {
}
private void updateMediaEntity(final ODataPubFormat format, final int id) throws Exception {
- URIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(id).appendValueSegment();
final String TO_BE_UPDATED = "new buffered stream sample";
@@ -153,7 +153,7 @@ public class MediaEntityTestITCase extends AbstractV3TestITCase {
}
private void createMediaEntity(final ODataPubFormat format, final InputStream input) throws Exception {
- final URIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car");
final ODataMediaEntityCreateRequest createReq =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MetadataTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MetadataTestITCase.java
index 7bcbda6..a26bfb0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MetadataTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MetadataTestITCase.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.it.v3;
-import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.client.core.it.AbstractMetadataTestITCase;
import org.apache.olingo.commons.api.edm.Edm;
@@ -28,7 +28,7 @@ import org.junit.Test;
public class MetadataTestITCase extends AbstractMetadataTestITCase {
@Override
- protected ODataV3Client getClient() {
+ protected ODataClient getClient() {
return ODataClientFactory.getV3();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index b1aa071..6b23f14 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -50,14 +50,14 @@ import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.utils.URIUtils;
import org.junit.Test;
import org.junit.Ignore;
-public class NavigationLinkCreateTestITCase extends AbstractV3TestITCase {
+public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
// create navigation link with ATOM
@Test
@@ -153,7 +153,7 @@ public class NavigationLinkCreateTestITCase extends AbstractV3TestITCase {
final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, created, id, null, "Customer");
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
@@ -176,7 +176,7 @@ public class NavigationLinkCreateTestITCase extends AbstractV3TestITCase {
// create a navigation link
public ODataEntity createNav(final String url, final ODataPubFormat format, final ODataEntity original,
final String entitySetName, final String contentType, final String prefer) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(url);
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(url);
uriBuilder.appendEntitySetSegment(entitySetName);
final ODataEntityCreateRequest createReq =
client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
@@ -227,7 +227,7 @@ public class NavigationLinkCreateTestITCase extends AbstractV3TestITCase {
final ODataEntity actualEntity =
validateEntities(testStaticServiceRootURL, format, createdEntity, id, null, "Customer");
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Orders");
final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
@@ -383,7 +383,7 @@ public class NavigationLinkCreateTestITCase extends AbstractV3TestITCase {
final int actualObjectId,
final Collection<String> expands, final String entitySetName) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(serviceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(serviceRootURL).
appendEntitySetSegment(entitySetName).appendKeySegment(actualObjectId);
if (expands != null) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index 590abf6..7718317 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -40,13 +40,13 @@ import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
import org.apache.olingo.client.api.domain.geospatial.Point;
import org.apache.olingo.client.api.domain.geospatial.Polygon;
import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmSchema;
import org.junit.Ignore;
import org.junit.Test;
-public class OpenTypeTestITCase extends AbstractV3TestITCase {
+public class OpenTypeTestITCase extends AbstractTestITCase {
@Test
public void checkOpenTypeEntityTypesExist() {
@@ -62,7 +62,7 @@ public class OpenTypeTestITCase extends AbstractV3TestITCase {
}
private ODataEntity readRow(final ODataPubFormat format, final String uuid) {
- final URIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Row").appendKeySegment(UUID.fromString(uuid));
return read(format, builder.build());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
index 4b3f916..f7db133 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
@@ -30,7 +30,7 @@ import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.junit.Test;
-public class PrimitiveKeysTestITCase extends AbstractV3TestITCase {
+public class PrimitiveKeysTestITCase extends AbstractTestITCase {
private void readEntity(final String entityType, final Object key, final ODataPubFormat format) {
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
index f106a6a..331c73b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
@@ -36,13 +36,13 @@ import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Test;
-public class PropertyRetrieveTestITCase extends AbstractV3TestITCase {
+public class PropertyRetrieveTestITCase extends AbstractTestITCase {
private void retreivePropertyTest(final ODataFormat format, String entitySegment, String structuralSegment) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment(entitySegment).appendPropertySegment(structuralSegment);
final ODataPropertyRequest req = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
req.setFormat(format);
@@ -208,7 +208,7 @@ public class PropertyRetrieveTestITCase extends AbstractV3TestITCase {
@Test
public void navigationMediaLink() {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("Product").appendKeySegment(-7).appendLinksSegment("Photos");
ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
req.setAccept("application/json");
@@ -231,7 +231,7 @@ public class PropertyRetrieveTestITCase extends AbstractV3TestITCase {
@Test
public void navigationMediaLinkInvalidQuery() {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("Product").appendKeySegment(-7).appendLinksSegment("Photo");
ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
req.setAccept("application/json");
@@ -254,7 +254,7 @@ public class PropertyRetrieveTestITCase extends AbstractV3TestITCase {
@Test
public void navigationMediaLinkInvalidFormat() {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("Product").appendKeySegment(-7).appendLinksSegment("Photos");
ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
req.setAccept("application/atom+xml");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index fd6f21f..c39335f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -42,14 +42,14 @@ import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
/**
* This is the unit test class to check basic entity operations.
*/
-public class PropertyTestITCase extends AbstractV3TestITCase {
+public class PropertyTestITCase extends AbstractTestITCase {
protected String getServiceRoot() {
return testStaticServiceRootURL;
@@ -122,7 +122,7 @@ public class PropertyTestITCase extends AbstractV3TestITCase {
@Test
public void readCountValue() throws IOException {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").count();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -158,7 +158,7 @@ public class PropertyTestITCase extends AbstractV3TestITCase {
}
private void updatePropertyValue(final ODataValueFormat format, final UpdateType type) throws IOException {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-9).
appendPropertySegment("PrimaryContactInfo").
appendPropertySegment("HomePhone").
@@ -201,7 +201,7 @@ public class PropertyTestITCase extends AbstractV3TestITCase {
}
private void updateComplexProperty(final ODataFormat format, final UpdateType type) throws IOException {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-9).appendPropertySegment("PrimaryContactInfo");
ODataPropertyRequest retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
@@ -247,7 +247,7 @@ public class PropertyTestITCase extends AbstractV3TestITCase {
}
private void updateCollectionProperty(final ODataFormat format) throws IOException {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(-9).
appendPropertySegment("PrimaryContactInfo").appendPropertySegment("AlternativeNames");
@@ -294,7 +294,7 @@ public class PropertyTestITCase extends AbstractV3TestITCase {
}
private void updatePrimitiveProperty(final ODataFormat format) throws IOException {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(-9).
appendPropertySegment("PrimaryContactInfo").
appendPropertySegment("HomePhone").appendPropertySegment("PhoneNumber");
@@ -338,7 +338,7 @@ public class PropertyTestITCase extends AbstractV3TestITCase {
}
private void rawRequest(final ODataFormat format) {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).appendPropertySegment("BackupContactInfo");
final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
index 9addaef..1acb6be 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
@@ -27,14 +27,14 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataValueFormat;
-import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Test;
-public class PropertyValueTestITCase extends AbstractV3TestITCase {
+public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveIntPropertyValueTest() {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-10).appendPropertySegment("ProductId").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -46,7 +46,7 @@ public class PropertyValueTestITCase extends AbstractV3TestITCase {
@Test
public void retrieveBooleanPropertyValueTest() {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-10).appendPropertySegment("ProductId").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -58,7 +58,7 @@ public class PropertyValueTestITCase extends AbstractV3TestITCase {
@Test
public void retrieveStringPropertyValueTest() {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-6).appendPropertySegment("Description").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -70,7 +70,7 @@ public class PropertyValueTestITCase extends AbstractV3TestITCase {
@Test
public void retrieveDatePropertyValueTest() {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-7).appendPropertySegment(
"NestedComplexConcurrency/ModifiedDate").appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -82,7 +82,7 @@ public class PropertyValueTestITCase extends AbstractV3TestITCase {
@Test
public void retrieveDecimalPropertyValueTest() {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-6).appendPropertySegment("Dimensions/Height").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -94,7 +94,7 @@ public class PropertyValueTestITCase extends AbstractV3TestITCase {
@Test
public void retrieveBinaryPropertyValueTest() throws IOException {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("ProductPhoto(PhotoId=-3,ProductId=-3)").appendPropertySegment("Photo");
ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setAccept("application/json");
@@ -109,7 +109,7 @@ public class PropertyValueTestITCase extends AbstractV3TestITCase {
@Test(expected = ODataClientErrorException.class)
public void retrieveBinaryPropertyValueTestWithAtom() throws IOException {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("ProductPhoto(PhotoId=-3,ProductId=-3)").appendPropertySegment("Photo");
ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setAccept("application/atom+xml");
@@ -124,7 +124,7 @@ public class PropertyValueTestITCase extends AbstractV3TestITCase {
@Test(expected = IllegalArgumentException.class)
public void retrieveBinaryPropertyValueTestWithXML() throws IOException {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("ProductPhoto(PhotoId=-3,ProductId=-3)").appendPropertySegment("Photo");
ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setAccept("application/xml");
@@ -139,7 +139,7 @@ public class PropertyValueTestITCase extends AbstractV3TestITCase {
@Test
public void retrieveCollectionPropertyValueTest() {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-7).appendPropertySegment(
"ComplexConcurrency/QueriedDateTime").appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -153,7 +153,7 @@ public class PropertyValueTestITCase extends AbstractV3TestITCase {
@Test
public void retrieveNullPropertyValueTest() {
- URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-10).appendPropertySegment(
"ComplexConcurrency/Token").appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
index 6bd0826..3b47ef0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
@@ -33,15 +33,15 @@ import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
import org.apache.olingo.client.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.api.uri.V3URIBuilder.InlineCount;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.api.uri.v3.URIBuilder.InlineCount;
import org.apache.olingo.client.core.data.AtomEntryImpl;
import org.junit.Test;
/**
* This is the unit test class to check for query options.
*/
-public class QueryOptionsTestITCase extends AbstractV3TestITCase {
+public class QueryOptionsTestITCase extends AbstractTestITCase {
/**
* Test <tt>$expand</tt>.
@@ -59,7 +59,7 @@ public class QueryOptionsTestITCase extends AbstractV3TestITCase {
*/
@Test
public void filterOrderby() {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").filter("(VIN lt 16)");
// 1. check that filtered entity set looks as expected
@@ -98,7 +98,7 @@ public class QueryOptionsTestITCase extends AbstractV3TestITCase {
*/
@Test
public void format() {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-10).format("json");
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
@@ -132,7 +132,7 @@ public class QueryOptionsTestITCase extends AbstractV3TestITCase {
*/
@Test
public void skiptoken() {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").skipToken("-10");
final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
@@ -150,7 +150,7 @@ public class QueryOptionsTestITCase extends AbstractV3TestITCase {
*/
@Test
public void inlinecount() {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car").
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car").
inlineCount(InlineCount.allpages);
final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
@@ -165,7 +165,7 @@ public class QueryOptionsTestITCase extends AbstractV3TestITCase {
*/
@Test
public void select() {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-10).select("CustomerId,Orders").expand("Orders");
final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
@@ -177,7 +177,7 @@ public class QueryOptionsTestITCase extends AbstractV3TestITCase {
@Test
public void issue131() {
- final URIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-7).select("Name");
ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
index db28bc7..40a7ecf 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
@@ -27,7 +27,7 @@ import org.apache.olingo.client.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.format.ODataFormat;
import org.junit.Test;
-public class ServiceDocumentRetrieveTestITCase extends AbstractV3TestITCase {
+public class ServiceDocumentRetrieveTestITCase extends AbstractTestITCase {
private void retrieveServiceDocumentTest(final ODataFormat reqFormat, final String acceptFormat) {
final ODataServiceDocumentRequest req =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentTestITCase.java
index 8f94e42..820b3a0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentTestITCase.java
@@ -27,7 +27,7 @@ import org.apache.olingo.client.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.format.ODataFormat;
import org.junit.Test;
-public class ServiceDocumentTestITCase extends AbstractV3TestITCase {
+public class ServiceDocumentTestITCase extends AbstractTestITCase {
private void retrieveServiceDocument(final ODataFormat format) {
final ODataServiceDocumentRequest req =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
new file mode 100644
index 0000000..46a59bd
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.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.client.core.it.v4;
+
+import java.io.IOException;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.junit.BeforeClass;
+
+public abstract class AbstractTestITCase extends org.apache.olingo.client.core.it.AbstractTestITCase {
+
+ protected static ODataClient client;
+
+ protected static String testStaticServiceRootURL;
+
+ protected static String testLargeModelServiceRootURL;
+
+ protected static String testAuthServiceRootURL;
+
+ @BeforeClass
+ public static void setUpODataServiceRoot() throws IOException {
+ testStaticServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc";
+ testLargeModelServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc/large";
+ testAuthServiceRootURL = "http://localhost:9080/DefaultService.svc";
+ }
+
+ @BeforeClass
+ public static void setClientInstance() {
+ client = ODataClientFactory.getV4();
+ }
+
+ @Override
+ protected ODataClient getClient() {
+ return client;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractV4TestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractV4TestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractV4TestITCase.java
deleted file mode 100644
index 77297a8..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractV4TestITCase.java
+++ /dev/null
@@ -1,53 +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.client.core.it.v4;
-
-import java.io.IOException;
-import org.apache.olingo.client.api.ODataV4Client;
-import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.client.core.it.AbstractTestITCase;
-import org.junit.BeforeClass;
-
-public abstract class AbstractV4TestITCase extends AbstractTestITCase {
-
- protected static ODataV4Client client;
-
- protected static String testStaticServiceRootURL;
-
- protected static String testLargeModelServiceRootURL;
-
- protected static String testAuthServiceRootURL;
-
- @BeforeClass
- public static void setUpODataServiceRoot() throws IOException {
- testStaticServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc";
- testLargeModelServiceRootURL = "http://localhost:9080/StaticService/V30/Static.svc/large";
- testAuthServiceRootURL = "http://localhost:9080/DefaultService.svc";
- }
-
- @BeforeClass
- public static void setClientInstance() {
- client = ODataClientFactory.getV4();
- }
-
- @Override
- protected ODataV4Client getClient() {
- return client;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
index ca4d801..8917c49 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.it.v4;
-import org.apache.olingo.client.api.ODataV4Client;
+import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.client.core.it.AbstractMetadataTestITCase;
import org.apache.olingo.commons.api.edm.Edm;
@@ -28,7 +28,7 @@ import org.junit.Test;
public class MetadataTestITCase extends AbstractMetadataTestITCase {
@Override
- protected ODataV4Client getClient() {
+ protected ODataClient getClient() {
return ODataClientFactory.getV4();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
index b85386c..6963cee 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
@@ -28,7 +28,7 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
@@ -39,7 +39,7 @@ import org.junit.Test;
public class AtomTest extends AbstractTest {
@Override
- protected ODataV3Client getClient() {
+ protected ODataClient getClient() {
return v3Client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
index d2a3ad4..7de99d3 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.InputStream;
-import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
@@ -33,7 +33,7 @@ import org.junit.Test;
public class EntitySetTest extends AbstractTest {
@Override
- protected ODataV3Client getClient() {
+ protected ODataClient getClient() {
return v3Client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 87098ed..8559d4f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.InputStream;
-import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
@@ -38,7 +38,7 @@ import org.junit.Test;
public class EntityTest extends AbstractTest {
@Override
- protected ODataV3Client getClient() {
+ protected ODataClient getClient() {
return v3Client;
}
[45/52] [abbrv] git commit: [OLINGO-205,
OLINGO-200] provided atom v4 deserialization for entity type/set +
entity set request
Posted by sk...@apache.org.
[OLINGO-205, OLINGO-200] provided atom v4 deserialization for entity type/set + entity set request
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/9aefb959
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/9aefb959
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/9aefb959
Branch: refs/heads/olingo-206-validator
Commit: 9aefb95905edee86a6747c26afa40d6f57451008
Parents: 4780fc5
Author: fmartelli <fa...@gmail.com>
Authored: Mon Mar 24 09:50:23 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Mon Mar 24 09:50:23 2014 +0100
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 28 +-
.../olingo/fit/utils/AbstractJSONUtilities.java | 503 +++++++
.../olingo/fit/utils/AbstractUtilities.java | 3 +-
.../olingo/fit/utils/AbstractXMLUtilities.java | 1302 ++++++++++++++++
.../org/apache/olingo/fit/utils/Accept.java | 50 +-
.../org/apache/olingo/fit/utils/Commons.java | 6 +-
.../apache/olingo/fit/utils/JSONUtilities.java | 503 -------
.../apache/olingo/fit/utils/XMLUtilities.java | 1388 ------------------
.../olingo/fit/utils/v3/JSONUtilities.java | 28 +
.../olingo/fit/utils/v3/XMLUtilities.java | 191 +++
.../olingo/fit/utils/v4/JSONUtilities.java | 28 +
.../olingo/fit/utils/v4/XMLUtilities.java | 142 ++
fit/src/main/resources/v4/People/feed.full.json | 332 +++++
fit/src/main/resources/v4/People/feed.xml | 218 +++
fit/src/main/resources/v4/metadata.xml | 743 +++++-----
.../request/ODataBasicRequest.java | 3 +-
.../request/retrieve/ODataRetrieveRequest.java | 3 +-
.../olingo/client/api/domain/ODataLinkType.java | 8 +-
.../apache/olingo/client/api/format/Format.java | 26 +
.../olingo/client/api/format/ODataFormat.java | 8 +-
.../client/api/format/ODataMediaFormat.java | 8 +-
.../client/api/format/ODataPubFormat.java | 47 +-
.../client/api/format/ODataValueFormat.java | 8 +-
.../request/AbstractODataBasicRequest.java | 144 +-
.../communication/request/ODataRequestImpl.java | 12 +-
.../request/invoke/ODataInvokeRequestImpl.java | 4 +-
.../retrieve/AbstractODataRetrieveRequest.java | 3 +-
.../request/retrieve/ODataRawRequestImpl.java | 2 +-
.../AbstractODataStreamedEntityRequest.java | 4 +-
.../core/data/AbstractJsonDeserializer.java | 5 +-
.../client/core/data/AtomDeserializer.java | 2 -
.../core/data/AtomPropertyDeserializer.java | 16 +-
.../core/data/JSONGeoValueDeserializer.java | 11 +-
.../client/core/edm/EdmActionImportImpl.java | 1 -
.../client/core/edm/EdmOperationImpl.java | 8 +-
.../olingo/client/core/edm/EdmTypeInfo.java | 26 +-
.../core/op/impl/AbstractODataBinder.java | 8 +-
.../core/op/impl/AbstractODataDeserializer.java | 1 -
.../core/it/v3/EntityRetrieveTestITCase.java | 2 +-
.../client/core/it/v3/EntitySetTestITCase.java | 2 +-
.../core/it/v3/QueryOptionsTestITCase.java | 3 +-
.../client/core/it/v4/AbstractTestITCase.java | 4 +-
.../client/core/it/v4/EntitySetTestITCase.java | 152 ++
.../org/apache/olingo/commons/api/edm/Edm.java | 161 +-
.../olingo/commons/api/edm/EdmActionImport.java | 2 +-
.../api/edm/constants/ODataServiceVersion.java | 7 +-
.../core/edm/AbstractEdmComplexType.java | 39 +-
.../core/edm/AbstractEdmEntityContainer.java | 176 +--
.../commons/core/edm/AbstractEdmOperation.java | 131 +-
.../core/edm/AbstractEdmOperationImport.java | 65 +-
.../core/edm/AbstractEdmStructuredType.java | 159 +-
.../olingo/commons/core/edm/EdmNamedImpl.java | 21 +-
.../olingo/commons/core/edm/EdmTypeImpl.java | 31 +-
53 files changed, 3917 insertions(+), 2861 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
index 12032c5..025e4fe 100644
--- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
+++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
@@ -19,8 +19,8 @@
package org.apache.olingo.fit;
import org.apache.olingo.fit.utils.Accept;
-import org.apache.olingo.fit.utils.XMLUtilities;
-import org.apache.olingo.fit.utils.JSONUtilities;
+import org.apache.olingo.fit.utils.AbstractXMLUtilities;
+import org.apache.olingo.fit.utils.AbstractJSONUtilities;
import org.apache.olingo.fit.utils.ODataVersion;
import org.apache.olingo.fit.utils.FSManager;
@@ -70,13 +70,18 @@ public abstract class AbstractServices {
private static Set<ODataVersion> initialized = EnumSet.noneOf(ODataVersion.class);
protected abstract ODataVersion getVersion();
- protected final XMLUtilities xml;
+ protected final AbstractXMLUtilities xml;
- protected final JSONUtilities json;
+ protected final AbstractJSONUtilities json;
public AbstractServices() throws Exception {
- this.xml = new XMLUtilities(getVersion());
- this.json = new JSONUtilities(getVersion());
+ if (ODataVersion.v3 == getVersion()) {
+ this.xml = new org.apache.olingo.fit.utils.v3.XMLUtilities();
+ this.json = new org.apache.olingo.fit.utils.v3.JSONUtilities();
+ } else {
+ this.xml = new org.apache.olingo.fit.utils.v4.XMLUtilities();
+ this.json = new org.apache.olingo.fit.utils.v4.JSONUtilities();
+ }
if (!initialized.contains(getVersion())) {
xml.retrieveLinkInfoFromMetadata();
@@ -135,7 +140,7 @@ public abstract class AbstractServices {
return xml.
createResponse(FSManager.instance(getVersion()).readFile(filename, Accept.XML), null, Accept.XML);
} catch (Exception e) {
- return xml.createFaultResponse(Accept.XML.toString(), e);
+ return xml.createFaultResponse(Accept.XML.toString(getVersion()), e);
}
}
@@ -547,7 +552,7 @@ public abstract class AbstractServices {
return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
} catch (Exception e) {
- return xml.createFaultResponse(Accept.XML.toString(), e);
+ return xml.createFaultResponse(Accept.XML.toString(getVersion()), e);
}
}
@@ -749,7 +754,7 @@ public abstract class AbstractServices {
} catch (Exception e) {
LOG.error("Error retrieving entity", e);
- return xml.createFaultResponse(Accept.JSON.toString(), e);
+ return xml.createFaultResponse(Accept.JSON.toString(getVersion()), e);
}
}
@@ -775,7 +780,7 @@ public abstract class AbstractServices {
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
final String changes) {
if (xml.isMediaContent(entitySetName + "/" + path)) {
- return replaceMediaProperty(prefer, entitySetName, entityId, path, format, changes);
+ return replaceMediaProperty(prefer, entitySetName, entityId, path, changes);
} else {
return replaceProperty(accept, prefer, entitySetName, entityId, path, format, changes, false);
}
@@ -786,7 +791,6 @@ public abstract class AbstractServices {
final String entitySetName,
final String entityId,
final String path,
- final String format,
final String value) {
try {
final AbstractUtilities utils = getUtilities(null);
@@ -809,7 +813,7 @@ public abstract class AbstractServices {
} catch (Exception e) {
LOG.error("Error retrieving entity", e);
- return xml.createFaultResponse(Accept.JSON.toString(), e);
+ return xml.createFaultResponse(Accept.JSON.toString(getVersion()), e);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
new file mode 100644
index 0000000..c62d341
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
@@ -0,0 +1,503 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.utils;
+
+import static org.apache.olingo.fit.utils.Constants.*;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.databind.node.TextNode;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.AbstractMap.SimpleEntry;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.ws.rs.NotFoundException;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+
+public abstract class AbstractJSONUtilities extends AbstractUtilities {
+
+ public AbstractJSONUtilities(final ODataVersion version) throws Exception {
+ super(version);
+ }
+
+ @Override
+ protected Accept getDefaultFormat() {
+ return Accept.JSON_FULLMETA;
+ }
+
+ @Override
+ protected InputStream addLinks(
+ final String entitySetName, final String entitykey, final InputStream is, final Set<String> links)
+ throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
+ IOUtils.closeQuietly(is);
+
+ for (String link : links) {
+ srcNode.set(link + JSON_NAVIGATION_SUFFIX,
+ new TextNode(Commons.getLinksURI(version, entitySetName, entitykey, link)));
+ }
+
+ return IOUtils.toInputStream(srcNode.toString());
+ }
+
+ @Override
+ protected Set<String> retrieveAllLinkNames(InputStream is) throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
+ IOUtils.closeQuietly(is);
+
+ final Set<String> links = new HashSet<String>();
+
+ final Iterator<String> fieldIter = srcNode.fieldNames();
+
+ while (fieldIter.hasNext()) {
+ final String field = fieldIter.next();
+
+ if (field.endsWith(JSON_NAVIGATION_BIND_SUFFIX)
+ || field.endsWith(JSON_NAVIGATION_SUFFIX)
+ || field.endsWith(JSON_MEDIA_SUFFIX)
+ || field.endsWith(JSON_EDITLINK_NAME)) {
+ if (field.indexOf('@') > 0) {
+ links.add(field.substring(0, field.indexOf('@')));
+ } else {
+ links.add(field);
+ }
+ }
+ }
+
+ return links;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ protected NavigationLinks retrieveNavigationInfo(
+ final String entitySetName, final InputStream is)
+ throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
+ IOUtils.closeQuietly(is);
+
+ final NavigationLinks links = new NavigationLinks();
+
+ final Iterator<Map.Entry<String, JsonNode>> fieldIter = srcNode.fields();
+
+ while (fieldIter.hasNext()) {
+ final Map.Entry<String, JsonNode> field = fieldIter.next();
+ if (field.getKey().endsWith(JSON_NAVIGATION_BIND_SUFFIX)) {
+ final String title = field.getKey().substring(0, field.getKey().indexOf('@'));
+ final List<String> hrefs = new ArrayList<String>();
+ if (field.getValue().isArray()) {
+ for (JsonNode href : ((ArrayNode) field.getValue())) {
+ final String uri = href.asText();
+ hrefs.add(uri.substring(uri.lastIndexOf('/') + 1));
+ }
+ } else {
+ final String uri = field.getValue().asText();
+ hrefs.add(uri.substring(uri.lastIndexOf('/') + 1));
+ }
+
+ links.addLinks(title, hrefs);
+ } else if (Commons.linkInfo.get(version).exists(entitySetName, field.getKey())) {
+ links.addInlines(field.getKey(), IOUtils.toInputStream(field.getValue().toString()));
+ }
+ }
+
+ return links;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ protected InputStream normalizeLinks(
+ final String entitySetName, final String entityKey, final InputStream is, final NavigationLinks links)
+ throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
+
+ if (links != null) {
+ for (String linkTitle : links.getLinkNames()) {
+ // normalize link
+ srcNode.remove(linkTitle + JSON_NAVIGATION_BIND_SUFFIX);
+ srcNode.set(
+ linkTitle + JSON_NAVIGATION_SUFFIX,
+ new TextNode(String.format("%s(%s)/%s", entitySetName, entityKey, linkTitle)));
+ }
+
+ for (String linkTitle : links.getInlineNames()) {
+ // normalize link if exist; declare a new one if missing
+ srcNode.remove(linkTitle + JSON_NAVIGATION_BIND_SUFFIX);
+ srcNode.set(
+ linkTitle + JSON_NAVIGATION_SUFFIX,
+ new TextNode(String.format("%s(%s)/%s", entitySetName, entityKey, linkTitle)));
+
+ // remove inline
+ srcNode.remove(linkTitle);
+
+ // remove from links
+ links.removeLink(linkTitle);
+ }
+ }
+
+ srcNode.set(
+ JSON_EDITLINK_NAME,
+ new TextNode(Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")"));
+
+ return IOUtils.toInputStream(srcNode.toString());
+ }
+
+ @Override
+ public InputStream getPropertyValue(final InputStream src, final List<String> path)
+ throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final JsonNode srcNode = mapper.readTree(src);
+ JsonNode node = getProperty(srcNode, path);
+ return IOUtils.toInputStream(node.asText());
+ }
+
+ @Override
+ public InputStream getProperty(
+ final String entitySetName, final String entityId, final List<String> path, final String edmType)
+ throws Exception {
+
+ final InputStream src =
+ fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.JSON_FULLMETA);
+
+ final ObjectMapper mapper = new ObjectMapper();
+ final JsonNode srcNode = mapper.readTree(src);
+
+ final ObjectNode propertyNode = new ObjectNode(JsonNodeFactory.instance);
+
+ if (StringUtils.isNotBlank(edmType)) {
+ propertyNode.put(JSON_ODATAMETADATA_NAME, ODATA_METADATA_PREFIX + edmType);
+ }
+
+ JsonNode jsonNode = getProperty(srcNode, path);
+
+ if (jsonNode.isArray()) {
+ propertyNode.put("value", (ArrayNode) jsonNode);
+ } else if (jsonNode.isObject()) {
+ propertyNode.putAll((ObjectNode) jsonNode);
+ } else {
+ propertyNode.put("value", jsonNode.asText());
+ }
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ mapper.writeValue(bos, propertyNode);
+
+ final InputStream res = new ByteArrayInputStream(bos.toByteArray());
+ IOUtils.closeQuietly(bos);
+
+ return res;
+ }
+
+ private JsonNode getProperty(final JsonNode node, final List<String> path)
+ throws NotFoundException {
+
+ JsonNode propertyNode = node;
+ for (int i = 0; i < path.size(); i++) {
+ propertyNode = propertyNode.get(path.get(i));
+ if (propertyNode == null) {
+ throw new NotFoundException();
+ }
+ }
+
+ return propertyNode;
+ }
+
+ public InputStream addJsonInlinecount(
+ final InputStream src, final int count, final Accept accept)
+ throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final JsonNode srcNode = mapper.readTree(src);
+
+ ((ObjectNode) srcNode).put(ODATA_COUNT_NAME, count);
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ mapper.writeValue(bos, srcNode);
+
+ final InputStream res = new ByteArrayInputStream(bos.toByteArray());
+ IOUtils.closeQuietly(bos);
+
+ return res;
+ }
+
+ public InputStream wrapJsonEntities(final InputStream entities) throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final JsonNode node = mapper.readTree(entities);
+
+ final ObjectNode res;
+
+ final JsonNode value = node.get(JSON_VALUE_NAME);
+
+ if (value.isArray()) {
+ res = mapper.createObjectNode();
+ res.set("value", value);
+ final JsonNode next = node.get(JSON_NEXTLINK_NAME);
+ if (next != null) {
+ res.set(JSON_NEXTLINK_NAME, next);
+ }
+ } else {
+ res = (ObjectNode) value;
+ }
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ mapper.writeValue(bos, res);
+
+ final InputStream is = new ByteArrayInputStream(bos.toByteArray());
+ IOUtils.closeQuietly(bos);
+
+ return is;
+ }
+
+ @Override
+ public InputStream selectEntity(final InputStream src, final String[] propertyNames) throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final ObjectNode srcNode = (ObjectNode) mapper.readTree(src);
+
+ final Set<String> retain = new HashSet<String>();
+ retain.add(JSON_ID_NAME);
+ retain.add(JSON_TYPE_NAME);
+ retain.add(JSON_EDITLINK_NAME);
+ retain.add(JSON_NEXTLINK_NAME);
+ retain.add(JSON_ODATAMETADATA_NAME);
+ retain.add(JSON_VALUE_NAME);
+
+ for (String name : propertyNames) {
+ retain.add(name);
+ retain.add(name + JSON_NAVIGATION_SUFFIX);
+ retain.add(name + JSON_MEDIA_SUFFIX);
+ retain.add(name + JSON_TYPE_SUFFIX);
+ }
+
+ srcNode.retain(retain);
+
+ return IOUtils.toInputStream(srcNode.toString());
+ }
+
+ @Override
+ public InputStream readEntities(
+ final List<String> links, final String linkName, final String next, final boolean forceFeed)
+ throws Exception {
+
+ if (links.isEmpty()) {
+ throw new NotFoundException();
+ }
+
+ final ObjectMapper mapper = new ObjectMapper();
+ final ObjectNode node = mapper.createObjectNode();
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ if (forceFeed || links.size() > 1) {
+ bos.write("[".getBytes());
+ }
+
+ for (String link : links) {
+ try {
+ final Map.Entry<String, String> uri = Commons.parseEntityURI(link);
+ final Map.Entry<String, InputStream> entity =
+ readEntity(uri.getKey(), uri.getValue(), Accept.JSON_FULLMETA);
+
+ if (bos.size() > 1) {
+ bos.write(",".getBytes());
+ }
+
+ IOUtils.copy(entity.getValue(), bos);
+ } catch (Exception e) {
+ // log and ignore link
+ LOG.warn("Error parsing uri {}", link, e);
+ }
+ }
+
+ if (forceFeed || links.size() > 1) {
+ bos.write("]".getBytes());
+ }
+
+ node.set(JSON_VALUE_NAME, mapper.readTree(new ByteArrayInputStream(bos.toByteArray())));
+
+ if (StringUtils.isNotBlank(next)) {
+ node.set(JSON_NEXTLINK_NAME, new TextNode(next));
+ }
+
+ return IOUtils.toInputStream(node.toString());
+ }
+
+ @Override
+ protected InputStream replaceLink(
+ final InputStream toBeChanged, final String linkName, final InputStream replacement)
+ throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+
+ final ObjectNode toBeChangedNode = (ObjectNode) mapper.readTree(toBeChanged);
+ final ObjectNode replacementNode = (ObjectNode) mapper.readTree(replacement);
+
+ if (toBeChangedNode.get(linkName + JSON_NAVIGATION_SUFFIX) == null) {
+ throw new NotFoundException();
+ }
+
+ toBeChangedNode.set(linkName, replacementNode.get(JSON_VALUE_NAME));
+
+ final JsonNode next = replacementNode.get(linkName + JSON_NEXTLINK_NAME);
+ if (next != null) {
+ toBeChangedNode.set(linkName + JSON_NEXTLINK_SUFFIX, next);
+ }
+
+ return IOUtils.toInputStream(toBeChangedNode.toString());
+ }
+
+ @Override
+ protected Map<String, InputStream> getChanges(final InputStream src) throws Exception {
+ final Map<String, InputStream> res = new HashMap<String, InputStream>();
+
+ final ObjectMapper mapper = new ObjectMapper();
+ final JsonNode srcObject = mapper.readTree(src);
+
+ final Iterator<Map.Entry<String, JsonNode>> fields = srcObject.fields();
+ while (fields.hasNext()) {
+ final Map.Entry<String, JsonNode> field = fields.next();
+ res.put(field.getKey(), IOUtils.toInputStream(field.getValue().toString()));
+ }
+
+ return res;
+ }
+
+ @Override
+ protected InputStream setChanges(
+ final InputStream toBeChanged, final Map<String, InputStream> properties) throws Exception {
+
+ final ObjectMapper mapper = new ObjectMapper();
+ final ObjectNode toBeChangedObject = (ObjectNode) mapper.readTree(toBeChanged);
+
+ for (Map.Entry<String, InputStream> property : properties.entrySet()) {
+ final JsonNode propertyNode = mapper.readTree(property.getValue());
+ toBeChangedObject.set(property.getKey(), propertyNode);
+ }
+
+ return IOUtils.toInputStream(toBeChangedObject.toString());
+ }
+
+ @Override
+ public Map.Entry<String, List<String>> extractLinkURIs(
+ final String entitySetName, final String entityId, final String linkName)
+ throws Exception {
+ final LinkInfo links = readLinks(entitySetName, entityId, linkName, Accept.JSON_FULLMETA);
+ return extractLinkURIs(links.getLinks());
+ }
+
+ @Override
+ public Map.Entry<String, List<String>> extractLinkURIs(final InputStream is)
+ throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
+ IOUtils.closeQuietly(is);
+
+ final List<String> links = new ArrayList<String>();
+
+ JsonNode uris = srcNode.get("value");
+ if (uris == null) {
+ final JsonNode url = srcNode.get("url");
+ if (url != null) {
+ links.add(url.textValue());
+ }
+ } else {
+ final Iterator<JsonNode> iter = ((ArrayNode) uris).iterator();
+ while (iter.hasNext()) {
+ links.add(iter.next().get("url").textValue());
+ }
+ }
+
+ final JsonNode next = srcNode.get(JSON_NEXTLINK_NAME);
+
+ return new SimpleEntry<String, List<String>>(next == null ? null : next.asText(), links);
+ }
+
+ @Override
+ public InputStream addEditLink(
+ final InputStream content, final String title, final String href) throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final ObjectNode srcNode = (ObjectNode) mapper.readTree(content);
+ IOUtils.closeQuietly(content);
+
+ srcNode.set(JSON_EDITLINK_NAME, new TextNode(href));
+ return IOUtils.toInputStream(srcNode.toString());
+ }
+
+ @Override
+ public InputStream replaceProperty(
+ final InputStream src, final InputStream replacement, final List<String> path, final boolean justValue)
+ throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final ObjectNode srcNode = (ObjectNode) mapper.readTree(src);
+ IOUtils.closeQuietly(src);
+
+ final JsonNode replacementNode;
+ if (justValue) {
+ replacementNode = new TextNode(IOUtils.toString(replacement));
+ } else {
+ replacementNode = (ObjectNode) mapper.readTree(replacement);
+ }
+ IOUtils.closeQuietly(replacement);
+
+ JsonNode node = srcNode;
+ for (int i = 0; i < path.size() - 1; i++) {
+ node = node.get(path.get(i));
+ if (node == null) {
+ throw new NotFoundException();
+ }
+ }
+
+ ((ObjectNode) node).set(path.get(path.size() - 1), replacementNode);
+
+ return IOUtils.toInputStream(srcNode.toString());
+ }
+
+ @Override
+ public InputStream deleteProperty(final InputStream src, final List<String> path) throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ final ObjectNode srcNode = (ObjectNode) mapper.readTree(src);
+ IOUtils.closeQuietly(src);
+
+ JsonNode node = srcNode;
+ for (int i = 0; i < path.size() - 1; i++) {
+ node = node.get(path.get(i));
+ if (node == null) {
+ throw new NotFoundException();
+ }
+ }
+
+ ((ObjectNode) node).set(path.get(path.size() - 1), null);
+
+ return IOUtils.toInputStream(srcNode.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
index 74653a1..7b74b62 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
@@ -384,7 +384,7 @@ public abstract class AbstractUtilities {
}
if (accept != null) {
- builder.header("Content-Type", accept.toString());
+ builder.header("Content-Type", accept.toString(version));
} else {
builder.header("Content-Type", "*/*");
}
@@ -423,7 +423,6 @@ public abstract class AbstractUtilities {
public Response createFaultResponse(final String accept, final Exception e) {
LOG.debug("Create fault response about .... ", e);
- e.printStackTrace();
final Response.ResponseBuilder builder = Response.serverError();
if (version == ODataVersion.v3) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
new file mode 100644
index 0000000..d02e828
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
@@ -0,0 +1,1302 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.utils;
+
+import static org.apache.olingo.fit.utils.Constants.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.StringWriter;
+import java.util.AbstractMap;
+import java.util.AbstractMap.SimpleEntry;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.ws.rs.NotFoundException;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.vfs2.FileObject;
+import org.apache.commons.vfs2.FileSystemException;
+
+public abstract class AbstractXMLUtilities extends AbstractUtilities {
+
+ protected static XMLInputFactory ifactory = null;
+
+ protected static XMLOutputFactory ofactory = null;
+
+ public AbstractXMLUtilities(final ODataVersion version) throws Exception {
+ super(version);
+ }
+
+ public abstract void retrieveLinkInfoFromMetadata() throws Exception;
+
+ @Override
+ protected Accept getDefaultFormat() {
+ return Accept.ATOM;
+ }
+
+ protected XMLEventReader getEventReader(final InputStream is) throws XMLStreamException {
+ if (ifactory == null) {
+ ifactory = XMLInputFactory.newInstance();
+ }
+ ifactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, false);
+ return ifactory.createXMLEventReader(is);
+ }
+
+ protected static XMLEventWriter getEventWriter(final OutputStream os) throws XMLStreamException {
+ if (ofactory == null) {
+ ofactory = XMLOutputFactory.newInstance();
+ }
+
+ return ofactory.createXMLEventWriter(os);
+ }
+
+ private void writeEvent(final XMLEvent event, final XMLEventWriter writer) {
+ if (writer != null) {
+ try {
+ writer.add(event);
+ } catch (XMLStreamException e) {
+ LOG.error("Error writing event {}", event, e);
+ }
+ }
+ }
+
+ private void skipElement(
+ final StartElement start,
+ final XMLEventReader reader,
+ final XMLEventWriter writer,
+ final boolean excludeStart)
+ throws Exception {
+
+ if (!excludeStart) {
+ writeEvent(start, writer);
+ }
+
+ int depth = 1;
+ boolean found = false;
+
+ while (reader.hasNext() && !found) {
+ final XMLEvent event = reader.nextEvent();
+
+ writeEvent(event, writer);
+
+ if (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
+ depth++;
+ } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT) {
+ depth--;
+ found = depth == 0 && start.getName().equals(event.asEndElement().getName());
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ protected InputStream addLinks(
+ final String entitySetName, final String entitykey, final InputStream is, final Set<String> links)
+ throws Exception {
+
+ // -----------------------------------------
+ // 0. Build reader and writer
+ // -----------------------------------------
+ final XMLEventReader reader = getEventReader(is);
+ final XMLEventFactory eventFactory = XMLEventFactory.newInstance();
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final XMLEventWriter writer = getEventWriter(bos);
+ // -----------------------------------------
+ final Map.Entry<Integer, XmlElement> entry =
+ extractElement(reader, writer, Collections.singletonList("entry"), 0, 1, 1);
+
+ writer.add(entry.getValue().getStart());
+
+ // add for links
+ for (String link : links) {
+ final Set<Attribute> attributes = new HashSet<Attribute>();
+ attributes.add(eventFactory.createAttribute(new QName("title"), link));
+ attributes.add(eventFactory.createAttribute(new QName("href"),
+ Commons.getLinksURI(version, entitySetName, entitykey, link)));
+ attributes.add(eventFactory.createAttribute(new QName("rel"), Constants.ATOM_LINK_REL + link));
+ attributes.add(eventFactory.createAttribute(new QName("type"),
+ Commons.linkInfo.get(version).isFeed(entitySetName, link) ? Constants.ATOM_LINK_FEED
+ : Constants.ATOM_LINK_ENTRY));
+
+ writer.add(eventFactory.createStartElement(new QName(LINK), attributes.iterator(), null));
+ writer.add(eventFactory.createEndElement(new QName(LINK), null));
+ }
+
+ writer.add(entry.getValue().getContentReader());
+ writer.add(entry.getValue().getEnd());
+ writer.add(reader);
+ IOUtils.closeQuietly(is);
+
+ writer.flush();
+ writer.close();
+ reader.close();
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ protected Set<String> retrieveAllLinkNames(final InputStream is) throws Exception {
+ final Set<String> links = new HashSet<String>();
+
+ final XMLEventReader reader = getEventReader(is);
+
+ try {
+
+ int startDepth = 0;
+
+ while (true) {
+ final Map.Entry<Integer, XmlElement> linkInfo =
+ extractElement(reader, null, Collections.<String>singletonList(LINK), startDepth, 2, 2);
+
+ startDepth = linkInfo.getKey();
+
+ links.add(linkInfo.getValue().getStart().getAttributeByName(new QName("title")).getValue());
+ }
+ } catch (Exception ignore) {
+ // ignore
+ } finally {
+ reader.close();
+ IOUtils.closeQuietly(is);
+ }
+
+ return links;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ protected NavigationLinks retrieveNavigationInfo(
+ final String entitySetName, final InputStream is)
+ throws Exception {
+
+ final NavigationLinks links = new NavigationLinks();
+
+ final XMLEventReader reader = getEventReader(is);
+
+ try {
+ final List<Map.Entry<String, String>> filter = new ArrayList<Map.Entry<String, String>>();
+ filter.add(new AbstractMap.SimpleEntry<String, String>("type", "application/atom+xml;type=entry"));
+ filter.add(new AbstractMap.SimpleEntry<String, String>("type", "application/atom+xml;type=feed"));
+
+ int startDepth = 0;
+
+ while (true) {
+ // a. search for link with type attribute equals to "application/atom+xml;type=entry/feed"
+ final Map.Entry<Integer, XmlElement> linkInfo = extractElement(
+ reader, null, Collections.<String>singletonList(LINK), filter, true, startDepth, 2, 2);
+ final XmlElement link = linkInfo.getValue();
+ startDepth = linkInfo.getKey();
+
+ final String title = link.getStart().getAttributeByName(new QName("title")).getValue();
+
+ final Attribute hrefAttr = link.getStart().getAttributeByName(new QName("href"));
+ final String href = hrefAttr == null ? null : hrefAttr.getValue();
+
+ try {
+ final XmlElement inlineElement =
+ extractElement(link.getContentReader(), null, Collections.<String>singletonList(INLINE), 0, -1, -1).
+ getValue();
+ final XMLEventReader inlineReader = inlineElement.getContentReader();
+
+ try {
+ while (true) {
+ final XmlElement entry =
+ extractElement(inlineReader, null, Collections.<String>singletonList("entry"), 0, -1, -1).
+ getValue();
+ links.addInlines(title, entry.toStream());
+ }
+ } catch (Exception e) {
+ // Reached the end of document
+ }
+
+ inlineReader.close();
+ } catch (Exception ignore) {
+ // inline element not found (inlines are not mondatory).
+ if (StringUtils.isNotBlank(href) && entityUriPattern.matcher(href).matches()) {
+ links.addLinks(title, href.substring(href.lastIndexOf('/') + 1));
+ }
+ }
+ }
+ } catch (Exception ignore) {
+ // ignore
+ } finally {
+ reader.close();
+ }
+
+ return links;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ protected InputStream normalizeLinks(
+ final String entitySetName, final String entityKey, final InputStream is, final NavigationLinks links)
+ throws Exception {
+
+ // -----------------------------------------
+ // 0. Build reader and writer
+ // -----------------------------------------
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ IOUtils.copy(is, bos);
+ is.close();
+
+ final ByteArrayOutputStream tmpBos = new ByteArrayOutputStream();
+ final XMLEventWriter writer = getEventWriter(tmpBos);
+
+ final XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+ // -----------------------------------------
+
+ // -----------------------------------------
+ // 1. Normalize links
+ // -----------------------------------------
+ final Set<String> added = new HashSet<String>();
+
+ try {
+ final List<Map.Entry<String, String>> filter = new ArrayList<Map.Entry<String, String>>();
+ filter.add(new AbstractMap.SimpleEntry<String, String>("type", "application/atom+xml;type=entry"));
+ filter.add(new AbstractMap.SimpleEntry<String, String>("type", "application/atom+xml;type=feed"));
+
+ Map.Entry<Integer, XmlElement> linkInfo = null;
+
+ while (true) {
+ // a. search for link with type attribute equals to "application/atom+xml;type=entry/feed"
+ linkInfo = extractElement(
+ reader, writer, Collections.<String>singletonList(LINK), filter, true,
+ linkInfo == null ? 0 : linkInfo.getKey(), 2, 2);
+ final XmlElement link = linkInfo.getValue();
+
+ final String title = link.getStart().getAttributeByName(new QName("title")).getValue();
+
+ if (!added.contains(title)) {
+ added.add(title);
+
+ final String normalizedLink = String.format(
+ "<link href=\"%s(%s)/%s\" rel=\"%s\" title=\"%s\" type=\"%s\"/>",
+ entitySetName,
+ entityKey,
+ title,
+ link.getStart().getAttributeByName(new QName("rel")).getValue(),
+ title,
+ link.getStart().getAttributeByName(new QName("type")).getValue());
+
+ addAtomElement(IOUtils.toInputStream(normalizedLink), writer);
+ }
+ }
+ } catch (Exception ignore) {
+ // ignore
+ } finally {
+ writer.close();
+ reader.close();
+ }
+ // -----------------------------------------
+
+ // -----------------------------------------
+ // 2. Add edit link if missing
+ // -----------------------------------------
+ final InputStream content = addEditLink(
+ new ByteArrayInputStream(tmpBos.toByteArray()),
+ entitySetName,
+ Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")");
+ // -----------------------------------------
+
+ // -----------------------------------------
+ // 3. Add content element if missing
+ // -----------------------------------------
+ return addAtomContent(
+ content,
+ entitySetName,
+ Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")");
+ // -----------------------------------------
+
+ }
+
+ public XmlElement getXmlElement(
+ final StartElement start,
+ final XMLEventReader reader)
+ throws Exception {
+
+ final XmlElement res = new XmlElement();
+ res.setStart(start);
+
+ StringWriter content = new StringWriter();
+
+ int depth = 1;
+
+ while (reader.hasNext() && depth > 0) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
+ depth++;
+ } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT) {
+ depth--;
+ }
+
+ if (depth == 0) {
+ res.setEnd(event.asEndElement());
+ } else {
+ event.writeAsEncodedUnicode(content);
+ }
+ }
+
+ content.flush();
+ content.close();
+
+ res.setContent(new ByteArrayInputStream(content.toString().getBytes()));
+
+ return res;
+ }
+
+ private void addAtomElement(
+ final InputStream content,
+ final XMLEventWriter writer)
+ throws Exception {
+ final XMLEventReader reader = getEventReader(content);
+
+ final XMLEventFactory eventFactory = XMLEventFactory.newInstance();
+ XMLEvent newLine = eventFactory.createSpace("\n");
+
+ try {
+ writer.add(newLine);
+
+ while (reader.hasNext()) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.getEventType() != XMLStreamConstants.START_DOCUMENT
+ && event.getEventType() != XMLStreamConstants.END_DOCUMENT
+ && event.getEventType() != XMLStreamConstants.COMMENT) {
+ writer.add(event);
+ }
+ }
+ writer.add(newLine);
+ } finally {
+ reader.close();
+ IOUtils.closeQuietly(content);
+ }
+ }
+
+ @Override
+ public InputStream addEditLink(
+ final InputStream content, final String title, final String href)
+ throws Exception {
+
+ final ByteArrayOutputStream copy = new ByteArrayOutputStream();
+ IOUtils.copy(content, copy);
+
+ IOUtils.closeQuietly(content);
+
+ XMLEventReader reader = getEventReader(new ByteArrayInputStream(copy.toByteArray()));
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ XMLEventWriter writer = getEventWriter(bos);
+
+ final String editLinkElement = String.format("<link rel=\"edit\" title=\"%s\" href=\"%s\" />", title, href);
+
+ try {
+ // check edit link existence
+ extractElement(reader, writer, Collections.<String>singletonList(LINK),
+ Collections.<Map.Entry<String, String>>singletonList(
+ new AbstractMap.SimpleEntry<String, String>("rel", "edit")), false, 0, -1, -1);
+
+ addAtomElement(IOUtils.toInputStream(editLinkElement), writer);
+ writer.add(reader);
+
+ } catch (Exception e) {
+ reader.close();
+ reader = getEventReader(new ByteArrayInputStream(copy.toByteArray()));
+
+ bos = new ByteArrayOutputStream();
+ writer = getEventWriter(bos);
+
+ final XmlElement entryElement =
+ extractElement(reader, writer, Collections.<String>singletonList("entry"), 0, 1, 1).getValue();
+
+ writer.add(entryElement.getStart());
+
+ addAtomElement(IOUtils.toInputStream(editLinkElement), writer);
+
+ writer.add(entryElement.getContentReader());
+ writer.add(entryElement.getEnd());
+
+ writer.add(reader);
+
+ writer.flush();
+ writer.close();
+ } finally {
+ reader.close();
+ }
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ public InputStream addAtomContent(
+ final InputStream content, final String title, final String href)
+ throws Exception {
+
+ final ByteArrayOutputStream copy = new ByteArrayOutputStream();
+ IOUtils.copy(content, copy);
+
+ IOUtils.closeQuietly(content);
+
+ XMLEventReader reader = getEventReader(new ByteArrayInputStream(copy.toByteArray()));
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ XMLEventWriter writer = getEventWriter(bos);
+
+ try {
+ // check edit link existence
+ XmlElement contentElement =
+ extractElement(reader, writer, Collections.<String>singletonList("content"), 0, 2, 2).getValue();
+ writer.add(contentElement.getStart());
+ writer.add(contentElement.getContentReader());
+ writer.add(contentElement.getEnd());
+ writer.add(reader);
+ } catch (Exception e) {
+ reader.close();
+ reader = getEventReader(new ByteArrayInputStream(copy.toByteArray()));
+
+ bos = new ByteArrayOutputStream();
+ writer = getEventWriter(bos);
+
+ if (isMediaContent(title)) {
+ final XmlElement entryElement =
+ extractElement(reader, writer, Collections.<String>singletonList("entry"), 0, 1, 1).getValue();
+
+ writer.add(entryElement.getStart());
+ writer.add(entryElement.getContentReader());
+
+ addAtomElement(
+ IOUtils.toInputStream(String.format("<content type=\"*/*\" src=\"%s/$value\" />", href)),
+ writer);
+
+ writer.add(entryElement.getEnd());
+ } else {
+ try {
+ final XmlElement entryElement =
+ extractElement(reader, writer, Collections.<String>singletonList(PROPERTIES), 0, 2, 3).getValue();
+
+ addAtomElement(
+ IOUtils.toInputStream("<content type=\"application/xml\">"),
+ writer);
+
+ writer.add(entryElement.getStart());
+ writer.add(entryElement.getContentReader());
+ writer.add(entryElement.getEnd());
+
+ addAtomElement(
+ IOUtils.toInputStream("</content>"),
+ writer);
+ } catch (Exception nf) {
+ reader.close();
+ reader = getEventReader(new ByteArrayInputStream(copy.toByteArray()));
+
+ bos = new ByteArrayOutputStream();
+ writer = getEventWriter(bos);
+
+ final XmlElement entryElement =
+ extractElement(reader, writer, Collections.<String>singletonList("entry"), 0, 1, 1).getValue();
+ writer.add(entryElement.getStart());
+ writer.add(entryElement.getContentReader());
+
+ addAtomElement(
+ IOUtils.toInputStream("<content type=\"application/xml\"/>"),
+ writer);
+
+ writer.add(entryElement.getEnd());
+ }
+ }
+
+ writer.add(reader);
+
+ writer.flush();
+ writer.close();
+ } finally {
+ reader.close();
+ }
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ public int countAllElements(final String entitySetName) throws Exception {
+ final String basePath = entitySetName + File.separatorChar;
+ int count = countFeedElements(fsManager.readFile(basePath + FEED, Accept.XML), "entry");
+
+ final String skipTokenDirPath = fsManager.getAbsolutePath(basePath + SKIP_TOKEN, null);
+
+
+ try {
+ final FileObject skipToken = fsManager.resolve(skipTokenDirPath);
+ final FileObject[] files = fsManager.findByExtension(skipToken, Accept.XML.getExtension().substring(1));
+
+ for (FileObject file : files) {
+ count += countFeedElements(fsManager.readFile(
+ basePath + SKIP_TOKEN + File.separatorChar + file.getName().getBaseName(), null), "entry");
+ }
+ } catch (FileSystemException fse) {
+ LOG.debug("Resource path '{}' not found", skipTokenDirPath);
+ }
+
+
+ return count;
+ }
+
+ private int countFeedElements(final InputStream is, final String elementName) throws XMLStreamException {
+ final XMLEventReader reader = getEventReader(is);
+
+ int count = 0;
+
+ while (reader.hasNext()) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.getEventType() == XMLStreamConstants.START_ELEMENT
+ && elementName.equals(event.asStartElement().getName().getLocalPart())) {
+ count++;
+ }
+ }
+
+ reader.close();
+ return count;
+ }
+
+ public Map.Entry<Integer, XmlElement> extractElement(
+ final XMLEventReader reader, final XMLEventWriter writer, final List<String> path,
+ final int startPathPos, final int minPathPos, final int maxPathPos)
+ throws Exception {
+ return extractElement(reader, writer, path, null, false, startPathPos, minPathPos, maxPathPos);
+ }
+
+ public Map.Entry<Integer, XmlElement> extractElement(
+ final XMLEventReader reader, final XMLEventWriter writer, final List<String> path,
+ final Collection<Map.Entry<String, String>> filter,
+ final boolean filterInOr,
+ final int startPathPos, final int minPathPos, final int maxPathPos)
+ throws Exception {
+
+ StartElement start = null;
+ int searchFor = 0;
+ int depth = startPathPos;
+
+ // Current inspected element
+ String current = null;
+
+ // set defaults
+ final List<String> pathElementNames = path == null ? Collections.<String>emptyList() : path;
+ final Collection<Map.Entry<String, String>> filterAttrs =
+ filter == null ? Collections.<Map.Entry<String, String>>emptySet() : filter;
+
+ while (reader.hasNext() && start == null) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
+ depth++;
+
+ if (current != null || ((minPathPos < 0 || minPathPos <= depth) && (maxPathPos < 0 || depth <= maxPathPos))) {
+ if (pathElementNames.isEmpty()
+ || pathElementNames.get(searchFor).trim().equals(event.asStartElement().getName().getLocalPart())) {
+
+ if (searchFor < pathElementNames.size() - 1) {
+ // path exploring not completed
+ writeEvent(event, writer);
+ current = pathElementNames.get(searchFor).trim();
+ searchFor++;
+ } else {
+
+ // path exploring completed ... evaluate filter about path element name attribute
+ boolean match = filterAttrs.isEmpty() || !filterInOr;
+
+ for (Map.Entry<String, String> filterAttr : filterAttrs) {
+ final Attribute attr = event.asStartElement().getAttributeByName(new QName(filterAttr.getKey().trim()));
+
+ if (attr == null || !filterAttr.getValue().trim().equals(attr.getValue())) {
+ match = filterInOr ? match : false;
+ } else {
+ match = filterInOr ? true : match;
+ }
+ }
+
+ if (match) {
+ // found searched element
+ start = event.asStartElement();
+ } else {
+ skipElement(event.asStartElement(), reader, writer, false);
+ depth--;
+ }
+ }
+ } else if (current == null) {
+ writeEvent(event, writer);
+ } else {
+ // skip element
+ skipElement(event.asStartElement(), reader, writer, false);
+ depth--;
+ }
+ } else {
+ writeEvent(event, writer);
+ }
+
+ } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT) {
+ depth--;
+
+ writeEvent(event, writer);
+
+ if (event.asEndElement().getName().getLocalPart().equals(current)) {
+ // back step ....
+ searchFor--;
+ current = searchFor > 0 ? pathElementNames.get(searchFor - 1).trim() : null;
+ }
+ } else {
+ writeEvent(event, writer);
+ }
+ }
+
+ if (start == null) {
+ throw new NotFoundException();
+ }
+
+ return new SimpleEntry<Integer, XmlElement>(Integer.valueOf(depth - 1), getXmlElement(start, reader));
+ }
+
+ public InputStream addAtomInlinecount(
+ final InputStream feed, final int count, final Accept accept)
+ throws Exception {
+ final XMLEventReader reader = getEventReader(feed);
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final XMLEventWriter writer = getEventWriter(bos);
+
+ try {
+
+ final XmlElement feedElement =
+ extractElement(reader, writer, Collections.<String>singletonList("feed"), 0, 1, 1).getValue();
+
+ writer.add(feedElement.getStart());
+ addAtomElement(IOUtils.toInputStream(String.format("<m:count>%d</m:count>", count)), writer);
+ writer.add(feedElement.getContentReader());
+ writer.add(feedElement.getEnd());
+
+ while (reader.hasNext()) {
+ writer.add(reader.nextEvent());
+ }
+
+ } finally {
+ writer.flush();
+ writer.close();
+ reader.close();
+ IOUtils.closeQuietly(feed);
+ }
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ @Override
+ public InputStream getPropertyValue(final InputStream is, final List<String> path)
+ throws Exception {
+
+ final List<String> pathElements = new ArrayList<String>();
+
+ for (String element : path) {
+ pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ }
+
+ final XMLEventReader reader = getEventReader(is);
+ final Map.Entry<Integer, XmlElement> property = extractElement(reader, null, pathElements, 0, 3, 4);
+
+ reader.close();
+ IOUtils.closeQuietly(is);
+
+ return property.getValue().getContent();
+ }
+
+ @Override
+ public InputStream selectEntity(final InputStream entity, final String[] propertyNames) throws Exception {
+ final XMLEventReader reader = getEventReader(entity);
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final XMLEventWriter writer = getEventWriter(bos);
+
+ final List<String> found = new ArrayList<String>(Arrays.asList(propertyNames));
+
+ boolean inProperties = false;
+ boolean writeCurrent = true;
+ Boolean writeNext = null;
+ String currentName = null;
+
+ final List<String> fieldToBeSaved = new ArrayList<String>(Arrays.asList(propertyNames));
+
+ while (reader.hasNext()) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.getEventType() == XMLStreamConstants.START_ELEMENT
+ && LINK.equals(event.asStartElement().getName().getLocalPart())
+ && !fieldToBeSaved.contains(
+ event.asStartElement().getAttributeByName(new QName("title")).getValue())
+ && !"edit".equals(event.asStartElement().getAttributeByName(new QName("rel")).getValue())) {
+ writeCurrent = false;
+ } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
+ && LINK.equals(event.asEndElement().getName().getLocalPart())) {
+ writeNext = true;
+ } else if (event.getEventType() == XMLStreamConstants.START_ELEMENT
+ && (PROPERTIES).equals(event.asStartElement().getName().getLocalPart())) {
+ writeCurrent = true;
+ writeNext = false;
+ inProperties = true;
+ } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
+ && (PROPERTIES).equals(event.asEndElement().getName().getLocalPart())) {
+ writeCurrent = true;
+ } else if (inProperties) {
+ if (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
+ final String elementName = event.asStartElement().getName().getLocalPart();
+
+ for (String propertyName : propertyNames) {
+ if ((ATOM_PROPERTY_PREFIX + propertyName.trim()).equals(elementName)) {
+ writeCurrent = true;
+ found.remove(propertyName);
+ currentName = propertyName;
+ }
+ }
+
+ } else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
+ && StringUtils.isNotBlank(currentName)
+ && (ATOM_PROPERTY_PREFIX + currentName.trim()).equals(
+ event.asEndElement().getName().getLocalPart())) {
+ writeNext = false;
+ currentName = null;
+ }
+
+ }
+
+ if (writeCurrent) {
+ writer.add(event);
+ }
+
+ if (writeNext != null) {
+ writeCurrent = writeNext;
+ writeNext = null;
+ }
+ }
+
+ writer.flush();
+ writer.close();
+ reader.close();
+ IOUtils.closeQuietly(entity);
+
+ // Do not raise any exception in order to support FC properties as well
+ // if (!found.isEmpty()) {
+ // throw new Exception(String.format("Could not find a properties '%s'", found));
+ // }
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ @Override
+ public InputStream readEntities(
+ final List<String> links, final String linkName, final String next, final boolean forceFeed)
+ throws Exception {
+
+ if (links.isEmpty()) {
+ throw new NotFoundException();
+ }
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ if (forceFeed || links.size() > 1) {
+ // build a feed
+ bos.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>".getBytes());
+
+ bos.write(("<feed xml:base=\"" + DEFAULT_SERVICE_URL + "\" "
+ + "xmlns=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\" "
+ + "xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">")
+ .getBytes());
+
+ bos.write(("<id>" + DEFAULT_SERVICE_URL + "entityset(entityid)/" + linkName + "</id>").getBytes());
+
+ bos.write(("<title type=\"text\">" + linkName + "</title>").getBytes());
+ bos.write("<updated>2014-03-03T13:40:49Z</updated>".getBytes());
+ bos.write(("<link rel=\"self\" title=\"" + linkName + "\" href=\"" + linkName + "\" />").getBytes());
+ }
+
+ for (String link : links) {
+ try {
+ final Map.Entry<String, String> uri = Commons.parseEntityURI(link);
+
+ final XmlElement entry =
+ extractElement(
+ getEventReader(readEntity(uri.getKey(), uri.getValue(), Accept.ATOM).getValue()),
+ null,
+ Collections.<String>singletonList("entry"),
+ 0, 1, 1).getValue();
+
+ IOUtils.copy(entry.toStream(), bos);
+ } catch (Exception e) {
+ // log and ignore link
+ LOG.warn("Error parsing uri {}", link, e);
+ }
+ }
+
+ if (forceFeed || links.size() > 1) {
+
+ if (StringUtils.isNotBlank(next)) {
+ bos.write(String.format("<link rel=\"next\" href=\"%s\" />", next).getBytes());
+ }
+
+ bos.write("</feed>".getBytes());
+ }
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ @Override
+ public Map<String, InputStream> getChanges(final InputStream src) throws Exception {
+ final Map<String, InputStream> res = new HashMap<String, InputStream>();
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ IOUtils.copy(src, bos);
+ IOUtils.closeQuietly(src);
+
+ // retrieve properties ...
+ XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+
+ final Map.Entry<Integer, XmlElement> propertyElement =
+ extractElement(reader, null, Collections.<String>singletonList(PROPERTIES), 0, 2, 3);
+ reader.close();
+
+ reader = propertyElement.getValue().getContentReader();
+
+ try {
+ while (true) {
+ final XmlElement property = extractElement(reader, null, null, 0, -1, -1).getValue();
+ res.put(property.getStart().getName().getLocalPart(), property.toStream());
+ }
+ } catch (Exception ignore) {
+ // end
+ }
+
+ reader.close();
+
+ // retrieve links ...
+ reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+
+ try {
+ int pos = 0;
+ while (true) {
+ final Map.Entry<Integer, XmlElement> linkElement =
+ extractElement(reader, null, Collections.<String>singletonList(LINK), pos, 2, 2);
+
+ res.put("[LINK]" + linkElement.getValue().getStart().getAttributeByName(new QName("title")).getValue(),
+ linkElement.getValue().toStream());
+
+ pos = linkElement.getKey();
+ }
+ } catch (Exception ignore) {
+ // end
+ }
+
+ return res;
+ }
+
+ @Override
+ public InputStream setChanges(
+ final InputStream toBeChanged,
+ final Map<String, InputStream> properties)
+ throws Exception {
+ XMLEventReader reader = getEventReader(toBeChanged);
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ XMLEventWriter writer = getEventWriter(bos);
+
+ // ---------------------------------
+ // add property changes
+ // ---------------------------------
+ Map.Entry<Integer, XmlElement> propertyElement =
+ extractElement(reader, writer, Collections.<String>singletonList(PROPERTIES), 0, 2, 3);
+
+ writer.flush();
+
+ ByteArrayOutputStream pbos = new ByteArrayOutputStream();
+ OutputStreamWriter pwriter = new OutputStreamWriter(pbos);
+
+ final XMLEventReader propertyReader = propertyElement.getValue().getContentReader();
+
+ try {
+ while (true) {
+ final XmlElement property = extractElement(propertyReader, null, null, 0, -1, -1).getValue();
+ final String name = property.getStart().getName().getLocalPart();
+
+ if (properties.containsKey(name)) {
+ // replace
+ final InputStream replacement = properties.get(name);
+ properties.remove(property.getStart().getName().getLocalPart());
+ pwriter.append(IOUtils.toString(replacement));
+ IOUtils.closeQuietly(replacement);
+ } else {
+ pwriter.append(IOUtils.toString(property.toStream()));
+ }
+ }
+ } catch (Exception ignore) {
+ // end
+ }
+
+ for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
+ if (!remains.getKey().startsWith("[LINK]")) {
+ pwriter.append(IOUtils.toString(remains.getValue()));
+ IOUtils.closeQuietly(remains.getValue());
+ }
+ }
+
+ pwriter.flush();
+ pwriter.close();
+
+ writer.add(propertyElement.getValue().getStart());
+ writer.add(new XMLEventReaderWrapper(new ByteArrayInputStream(pbos.toByteArray())));
+ writer.add(propertyElement.getValue().getEnd());
+
+ IOUtils.closeQuietly(pbos);
+
+ writer.add(reader);
+ reader.close();
+ writer.flush();
+ writer.close();
+ // ---------------------------------
+
+ // ---------------------------------
+ // add navigationm changes
+ // ---------------------------------
+
+ // remove existent links
+ for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
+
+ if (remains.getKey().startsWith("[LINK]")) {
+ reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+
+ bos.reset();
+ writer = getEventWriter(bos);
+
+ try {
+ final String linkName = remains.getKey().substring(remains.getKey().indexOf("]") + 1);
+
+ extractElement(reader, writer, Collections.<String>singletonList(LINK),
+ Collections.<Map.Entry<String, String>>singleton(new SimpleEntry<String, String>("title", linkName)),
+ false, 0, 2, 2);
+
+ writer.add(reader);
+
+ } catch (Exception ignore) {
+ // ignore
+ }
+
+ writer.flush();
+ writer.close();
+ }
+ }
+
+ reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+
+ bos.reset();
+ writer = getEventWriter(bos);
+
+ propertyElement = extractElement(reader, writer, Collections.<String>singletonList(CONTENT), 0, 2, 2);
+ writer.flush();
+
+ pbos.reset();
+ pwriter = new OutputStreamWriter(pbos);
+
+ for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
+ if (remains.getKey().startsWith("[LINK]")) {
+ pwriter.append(IOUtils.toString(remains.getValue()));
+ IOUtils.closeQuietly(remains.getValue());
+ }
+ }
+
+ pwriter.flush();
+ pwriter.close();
+
+ writer.add(new XMLEventReaderWrapper(new ByteArrayInputStream(pbos.toByteArray())));
+ IOUtils.closeQuietly(pbos);
+
+ writer.add(propertyElement.getValue().getStart());
+ writer.add(propertyElement.getValue().getContentReader());
+ writer.add(propertyElement.getValue().getEnd());
+
+ writer.add(reader);
+ reader.close();
+ writer.flush();
+ writer.close();
+ // ---------------------------------
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ @Override
+ protected InputStream replaceLink(
+ final InputStream toBeChanged, final String linkName, final InputStream replacement)
+ throws Exception {
+ final XMLEventReader reader = getEventReader(toBeChanged);
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final XMLEventWriter writer = getEventWriter(bos);
+
+ final XMLEventFactory eventFactory = XMLEventFactory.newInstance();
+ XMLEvent newLine = eventFactory.createSpace("\n");
+
+ try {
+ final XmlElement linkElement =
+ extractElement(reader, writer, Collections.<String>singletonList(LINK),
+ Collections.<Map.Entry<String, String>>singletonList(new SimpleEntry<String, String>("title", linkName)),
+ false, 0, -1, -1).getValue();
+ writer.add(linkElement.getStart());
+
+ // ------------------------------------------
+ // write inline ...
+ // ------------------------------------------
+ writer.add(newLine);
+ writer.add(eventFactory.createStartElement("m", null, "inline"));
+
+ addAtomElement(replacement, writer);
+
+ writer.add(eventFactory.createEndElement("m", null, "inline"));
+ writer.add(newLine);
+ // ------------------------------------------
+
+ writer.add(linkElement.getEnd());
+
+ writer.add(reader);
+ writer.flush();
+ writer.close();
+ } finally {
+ reader.close();
+ IOUtils.closeQuietly(toBeChanged);
+ }
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ public String getEdmTypeFromAtom(final String entitySetName, final String entityId, final List<String> path)
+ throws Exception {
+ InputStream src = fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.XML);
+
+ final List<String> atomPathElements = new ArrayList<String>();
+
+ for (String element : path) {
+ atomPathElements.add(ATOM_PROPERTY_PREFIX + element);
+ }
+
+ final Map.Entry<Integer, XmlElement> prop = extractElement(getEventReader(src), null, atomPathElements, 0, 3, 4);
+ IOUtils.closeQuietly(src);
+
+ final Attribute type = prop.getValue().getStart().getAttributeByName(new QName(TYPE));
+
+ final String edmType;
+
+ if (type == null) {
+ edmType = Constants.ATOM_DEF_TYPE;
+ } else {
+ edmType = type.getValue();
+ }
+
+ return edmType;
+ }
+
+ @Override
+ public Map.Entry<String, List<String>> extractLinkURIs(
+ final String entitySetName, final String entityId, final String linkName)
+ throws Exception {
+ final LinkInfo links = readLinks(entitySetName, entityId, linkName, Accept.XML);
+ return extractLinkURIs(links.getLinks());
+ }
+
+ @Override
+ public Map.Entry<String, List<String>> extractLinkURIs(final InputStream is)
+ throws Exception {
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ IOUtils.copy(is, bos);
+ IOUtils.closeQuietly(is);
+
+ XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+ final List<String> links = new ArrayList<String>();
+ try {
+ while (true) {
+ links.add(IOUtils.toString(extractElement(reader, null, Collections.<String>singletonList("uri"), 0, -1, -1).
+ getValue().getContent()));
+ }
+ } catch (Exception ignore) {
+ // End document reached ...
+ }
+ reader.close();
+
+ String next;
+
+ reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
+ try {
+ next = IOUtils.toString(extractElement(reader, null, Collections.<String>singletonList("next"), 0, -1, -1).
+ getValue().getContent());
+ } catch (Exception ignore) {
+ // next link is not mandatory
+ next = null;
+ }
+ reader.close();
+
+ return new AbstractMap.SimpleEntry<String, List<String>>(next, links);
+ }
+
+ @Override
+ public InputStream getProperty(
+ final String entitySetName, final String entityId, final List<String> path, final String edmType)
+ throws Exception {
+ final List<String> pathElements = new ArrayList<String>();
+
+ for (String element : path) {
+ pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ }
+
+ final InputStream src =
+ fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.XML);
+
+ final XMLEventReader reader = getEventReader(src);
+ final XmlElement property = extractElement(reader, null, pathElements, 0, 3, 4).getValue();
+
+ reader.close();
+ IOUtils.closeQuietly(src);
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final XMLEventWriter writer = getEventWriter(bos);
+
+ final XMLEventFactory eventFactory = XMLEventFactory.newInstance();
+ writer.add(eventFactory.createStartDocument("UTF-8", "1.0"));
+ writer.add(property.getStart());
+
+ if (property.getStart().getAttributeByName(new QName(ATOM_DATASERVICE_NS)) == null) {
+ writer.add(eventFactory.createNamespace(ATOM_PROPERTY_PREFIX.substring(0, 1), DATASERVICES_NS));
+ }
+ if (property.getStart().getAttributeByName(new QName(ATOM_METADATA_NS)) == null) {
+ writer.add(eventFactory.createNamespace(ATOM_METADATA_PREFIX.substring(0, 1), METADATA_NS));
+ }
+
+ writer.add(property.getContentReader());
+ writer.add(property.getEnd());
+
+ writer.flush();
+ writer.close();
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ @Override
+ public InputStream replaceProperty(
+ final InputStream src, final InputStream replacement, final List<String> path, final boolean justValue)
+ throws Exception {
+
+ final List<String> pathElements = new ArrayList<String>();
+
+ for (String element : path) {
+ pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ }
+
+ final XMLEventReader reader = getEventReader(src);
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final XMLEventWriter writer = getEventWriter(bos);
+
+ final Map.Entry<Integer, XmlElement> element = extractElement(reader, writer, pathElements, 0, 3, 4);
+
+ if (justValue) {
+ writer.add(element.getValue().getStart());
+ }
+
+ final XMLEventReader changesReader = new XMLEventReaderWrapper(replacement);
+
+ writer.add(changesReader);
+ changesReader.close();
+ IOUtils.closeQuietly(replacement);
+
+ if (justValue) {
+ writer.add(element.getValue().getEnd());
+ }
+
+ writer.add(reader);
+
+ reader.close();
+ IOUtils.closeQuietly(src);
+
+ writer.flush();
+ writer.close();
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ @Override
+ public InputStream deleteProperty(final InputStream src, final List<String> path) throws Exception {
+
+ final List<String> pathElements = new ArrayList<String>();
+
+ for (String element : path) {
+ pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ }
+
+ final XMLEventReader reader = getEventReader(src);
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final XMLEventWriter writer = getEventWriter(bos);
+
+ final Map.Entry<Integer, XmlElement> element = extractElement(reader, writer, pathElements, 0, 3, 4);
+
+ final XMLEventReader changesReader = new XMLEventReaderWrapper(
+ IOUtils.toInputStream(String.format("<%s m:null=\"true\" />", path.get(path.size() - 1))));
+
+ writer.add(changesReader);
+ changesReader.close();
+
+ writer.add(reader);
+
+ reader.close();
+ IOUtils.closeQuietly(src);
+
+ writer.flush();
+ writer.close();
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/utils/Accept.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Accept.java b/fit/src/main/java/org/apache/olingo/fit/utils/Accept.java
index 9fdf1da..2371843 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/Accept.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/Accept.java
@@ -28,24 +28,35 @@ public enum Accept {
TEXT(ContentType.TEXT_PLAIN.getMimeType(), ".txt"),
XML(ContentType.APPLICATION_XML.getMimeType(), ".xml"),
ATOM(ContentType.APPLICATION_ATOM_XML.getMimeType(), ".xml"),
- JSON(ContentType.APPLICATION_JSON.getMimeType() + ";odata=minimalmetadata", ".full.json"),
- JSON_NOMETA(ContentType.APPLICATION_JSON.getMimeType() + ";odata=nometadata", ".full.json"),
- JSON_FULLMETA(ContentType.APPLICATION_JSON.getMimeType() + ";odata=fullmetadata", ".full.json");
+ JSON(ContentType.APPLICATION_JSON.getMimeType() + ";odata=minimalmetadata",
+ ContentType.APPLICATION_JSON.getMimeType() + ";odata.metadata=minimal", ".full.json"),
+ JSON_NOMETA(ContentType.APPLICATION_JSON.getMimeType() + ";odata=nometadata",
+ ContentType.APPLICATION_JSON.getMimeType() + ";odata.metadata=none", ".full.json"),
+ JSON_FULLMETA(ContentType.APPLICATION_JSON.getMimeType() + ";odata=fullmetadata",
+ ContentType.APPLICATION_JSON.getMimeType() + ";odata.metadata=full", ".full.json");
- private final String contentType;
+ private final String contentTypeV3;
+
+ private final String contentTypeV4;
private final String fileExtension;
private static Pattern allTypesPattern = Pattern.compile("(.*,)?\\*/\\*([,;].*)?");
- Accept(final String contentType, final String fileExtension) {
- this.contentType = contentType;
+ Accept(final String contentTypeV3, final String fileExtension) {
+ this.contentTypeV3 = contentTypeV3;
+ this.contentTypeV4 = contentTypeV3;
+ this.fileExtension = fileExtension;
+ }
+
+ Accept(final String contentTypeV3, final String contentTypeV4, final String fileExtension) {
+ this.contentTypeV3 = contentTypeV3;
+ this.contentTypeV4 = contentTypeV4;
this.fileExtension = fileExtension;
}
- @Override
- public String toString() {
- return contentType;
+ public String toString(final ODataVersion version) {
+ return ODataVersion.v3 == version ? contentTypeV3 : contentTypeV4;
}
public String getExtension() {
@@ -53,23 +64,30 @@ public enum Accept {
}
public static Accept parse(final String contentType, final ODataVersion version) {
- return parse(contentType, version, ODataVersion.v3 == version ? ATOM : JSON_NOMETA);
+ final Accept def;
+ if (ODataVersion.v3 == version) {
+ def = ATOM;
+ } else {
+ def = JSON_NOMETA;
+ }
+
+ return parse(contentType, version, def);
}
public static Accept parse(final String contentType, final ODataVersion version, final Accept def) {
if (StringUtils.isBlank(contentType) || allTypesPattern.matcher(contentType).matches()) {
return def;
- } else if (JSON_NOMETA.toString().equals(contentType)) {
+ } else if (JSON_NOMETA.toString(version).equals(contentType)) {
return JSON_NOMETA;
- } else if (JSON.toString().equals(contentType) || "application/json".equals(contentType)) {
+ } else if (JSON.toString(version).equals(contentType) || "application/json".equals(contentType)) {
return JSON;
- } else if (JSON_FULLMETA.toString().equals(contentType)) {
+ } else if (JSON_FULLMETA.toString(version).equals(contentType)) {
return JSON_FULLMETA;
- } else if (XML.toString().equals(contentType)) {
+ } else if (XML.toString(version).equals(contentType)) {
return XML;
- } else if (ATOM.toString().equals(contentType)) {
+ } else if (ATOM.toString(version).equals(contentType)) {
return ATOM;
- } else if (TEXT.toString().equals(contentType)) {
+ } else if (TEXT.toString(version).equals(contentType)) {
return TEXT;
} else {
throw new UnsupportedMediaTypeException("Unsupported media type");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
index 233e03d..dcc4807 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
@@ -74,6 +74,10 @@ public abstract class Commons {
mediaContent.put("Car/Photo", null);
}
+ public static Map<ODataVersion, MetadataLinkInfo> getLinkInfo() {
+ return linkInfo;
+ }
+
public static String getEntityURI(final String entitySetName, final String entityKey) {
return entitySetName + "(" + entityKey + ")";
}
@@ -230,7 +234,7 @@ public abstract class Commons {
break;
default:
- throw new UnsupportedOperationException(target.toString());
+ throw new UnsupportedOperationException(target.name());
}
for (String field : toBeRemoved) {
[40/52] [abbrv] git commit: [OLINGO-200] Moving ODataDeserializer and
ODataSerializer (interfaces and impl) to commons
Posted by sk...@apache.org.
[OLINGO-200] Moving ODataDeserializer and ODataSerializer (interfaces and impl) to commons
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/a55ed62a
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/a55ed62a
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/a55ed62a
Branch: refs/heads/olingo-206-validator
Commit: a55ed62accf3686daf6359ec2923455b535c9199
Parents: fac84b3
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 24 09:45:25 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 24 09:45:25 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/CommonODataClient.java | 6 +-
.../client/api/op/ClientODataDeserializer.java | 39 +++++
.../client/api/op/CommonODataDeserializer.java | 84 ----------
.../olingo/client/api/op/ODataSerializer.java | 100 ------------
.../client/api/op/v3/ODataDeserializer.java | 4 +-
.../client/api/op/v4/ODataDeserializer.java | 4 +-
.../olingo/client/core/AbstractODataClient.java | 2 +-
.../client/core/op/AbstractJacksonTool.java | 83 ----------
.../client/core/op/AbstractODataBinder.java | 1 +
.../core/op/AbstractODataDeserializer.java | 107 ------------
.../client/core/op/AbstractODataSerializer.java | 141 ----------------
.../core/op/InjectableSerializerProvider.java | 43 -----
.../client/core/op/ODataObjectFactoryImpl.java | 162 -------------------
.../olingo/client/core/op/ODataWriterImpl.java | 1 +
.../olingo/client/core/op/ResourceFactory.java | 125 --------------
.../core/op/impl/v3/ODataDeserializerImpl.java | 2 +-
.../core/op/impl/v3/ODataSerializerImpl.java | 2 +-
.../core/op/impl/v4/ODataDeserializerImpl.java | 2 +-
.../core/op/impl/v4/ODataSerializerImpl.java | 2 +-
.../olingo/client/core/v3/ODataClientImpl.java | 2 +-
.../olingo/client/core/v4/ODataClientImpl.java | 2 +-
.../core/it/v3/EntityRetrieveTestITCase.java | 2 +-
.../client/core/it/v3/EntitySetTestITCase.java | 2 +-
.../olingo/client/core/v3/EntitySetTest.java | 2 +-
.../olingo/client/core/v3/EntityTest.java | 2 +-
.../commons/api/op/CommonODataDeserializer.java | 71 ++++++++
.../olingo/commons/api/op/ODataSerializer.java | 100 ++++++++++++
.../commons/core/op/AbstractJacksonTool.java | 83 ++++++++++
.../core/op/AbstractODataDeserializer.java | 107 ++++++++++++
.../core/op/AbstractODataSerializer.java | 141 ++++++++++++++++
.../core/op/InjectableSerializerProvider.java | 43 +++++
.../commons/core/op/ODataObjectFactoryImpl.java | 162 +++++++++++++++++++
.../olingo/commons/core/op/ResourceFactory.java | 125 ++++++++++++++
33 files changed, 891 insertions(+), 863 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
index 4b708d9..e863d0d 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
@@ -24,13 +24,13 @@ import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFa
import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
+import org.apache.olingo.client.api.op.ClientODataDeserializer;
import org.apache.olingo.commons.api.domain.ODataObjectFactory;
import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.op.CommonODataBinder;
-import org.apache.olingo.client.api.op.CommonODataDeserializer;
import org.apache.olingo.client.api.op.CommonODataReader;
-import org.apache.olingo.client.api.op.ODataSerializer;
+import org.apache.olingo.commons.api.op.ODataSerializer;
import org.apache.olingo.client.api.op.ODataWriter;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.uri.CommonFilterFactory;
@@ -54,7 +54,7 @@ public interface CommonODataClient {
ODataSerializer getSerializer();
- CommonODataDeserializer getDeserializer();
+ ClientODataDeserializer getDeserializer();
CommonODataReader getReader();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java
new file mode 100644
index 0000000..ad482fb
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.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.client.api.op;
+
+import java.io.InputStream;
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.op.CommonODataDeserializer;
+
+public interface ClientODataDeserializer extends CommonODataDeserializer {
+
+ XMLMetadata toMetadata(InputStream input);
+
+ /**
+ * Gets the ServiceDocument object represented by the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @param format OData service document format.
+ * @return <tt>ServiceDocument</tt> object.
+ */
+ ServiceDocument toServiceDocument(InputStream input, ODataFormat format);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
deleted file mode 100644
index 5b01fa3..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataDeserializer.java
+++ /dev/null
@@ -1,84 +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.client.api.op;
-
-import java.io.InputStream;
-import java.io.Serializable;
-import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.commons.api.data.Feed;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-
-/**
- * Utility class for serialization.
- */
-public interface CommonODataDeserializer extends Serializable {
-
- XMLMetadata toMetadata(InputStream input);
-
- /**
- * Gets the ServiceDocument object represented by the given InputStream.
- *
- * @param input stream to be de-serialized.
- * @param format OData service document format.
- * @return <tt>ServiceDocument</tt> object.
- */
- ServiceDocument toServiceDocument(InputStream input, ODataFormat format);
-
- /**
- * Gets a feed object from the given InputStream.
- *
- * @param input stream to be de-serialized.
- * @param format Atom or JSON
- * @return Feed instance.
- */
- Feed toFeed(InputStream input, ODataPubFormat format);
-
- /**
- * Gets an entry object from the given InputStream.
- *
- * @param input stream to be de-serialized.
- * @param format Atom or JSON
- * @return Entry instance.
- */
- Entry toEntry(InputStream input, ODataPubFormat format);
-
- /**
- * Gets a property object from the given InputStream.
- *
- * @param input stream to be de-serialized.
- * @param format XML or JSON
- * @return Property instance.
- */
- Property toProperty(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 toError(InputStream input, boolean isXML);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java
deleted file mode 100644
index 811a07b..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataSerializer.java
+++ /dev/null
@@ -1,100 +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.client.api.op;
-
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.io.Writer;
-import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.data.Feed;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.format.ODataFormat;
-
-/**
- * Utility class for serialization.
- */
-public interface ODataSerializer extends Serializable {
-
- /**
- * Writes Feed object onto the given stream.
- *
- * @param obj object to be streamed.
- * @param out output stream.
- */
- void feed(Feed obj, OutputStream out);
-
- /**
- * Writes Feed object by the given writer.
- *
- * @param obj object to be streamed.
- * @param writer writer.
- */
- void feed(Feed obj, Writer writer);
-
- /**
- * Writes theEntry object onto the given stream.
- *
- * @param obj object to be streamed.
- * @param out output stream.
- */
- void entry(Entry obj, OutputStream out);
-
- /**
- * Writes the Entry object by the given writer.
- *
- * @param obj object to be streamed.
- * @param writer writer.
- */
- void entry(Entry obj, Writer writer);
-
- /**
- * Writes the property object onto the given stream.
- *
- * @param property object to be streamed.
- * @param out output stream.
- */
- void property(Property property, OutputStream out);
-
- /**
- * Writes the property object by the given writer.
- *
- * @param property object to be streamed.
- * @param writer writer.
- */
- void property(Property property, Writer writer);
-
- /**
- * Writes link onto the given stream.
- *
- * @param link OData link to be streamed.
- * @param format streaming format.
- * @param out output stream.
- */
- void link(Link link, ODataFormat format, OutputStream out);
-
- /**
- * Writes link by the given writer.
- *
- * @param link OData link to be streamed.
- * @param format streaming format.
- * @param writer writer.
- */
- void link(Link link, ODataFormat format, Writer writer);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
index 6c7a2bb..b12b104 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
@@ -19,11 +19,11 @@
package org.apache.olingo.client.api.op.v3;
import java.io.InputStream;
+import org.apache.olingo.client.api.op.ClientODataDeserializer;
import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.client.api.op.CommonODataDeserializer;
-public interface ODataDeserializer extends CommonODataDeserializer {
+public interface ODataDeserializer extends ClientODataDeserializer {
/**
* Gets a list of links from the given InputStream.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataDeserializer.java
index 425e530..8b0e0b7 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataDeserializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataDeserializer.java
@@ -21,9 +21,9 @@ package org.apache.olingo.client.api.op.v4;
import java.io.InputStream;
import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
-import org.apache.olingo.client.api.op.CommonODataDeserializer;
+import org.apache.olingo.client.api.op.ClientODataDeserializer;
-public interface ODataDeserializer extends CommonODataDeserializer {
+public interface ODataDeserializer extends ClientODataDeserializer {
@Override
XMLMetadata toMetadata(InputStream input);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index b5603fc..4197094 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.domain.ODataObjectFactory;
import org.apache.olingo.client.api.op.ODataWriter;
import org.apache.olingo.client.core.domain.ODataGeospatialValueImpl;
import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
-import org.apache.olingo.client.core.op.ODataObjectFactoryImpl;
+import org.apache.olingo.commons.core.op.ODataObjectFactoryImpl;
import org.apache.olingo.client.core.op.ODataWriterImpl;
public abstract class AbstractODataClient implements CommonODataClient {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java
deleted file mode 100644
index 2d62a7d..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractJacksonTool.java
+++ /dev/null
@@ -1,83 +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.client.core.op;
-
-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.commons.api.edm.constants.ODataServiceVersion;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-abstract class AbstractJacksonTool {
-
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractJacksonTool.class);
-
- protected final ODataServiceVersion version;
-
- protected AbstractJacksonTool(final ODataServiceVersion client) {
- this.version = client;
- }
-
- protected ObjectMapper getObjectMapper() {
- final ObjectMapper mapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
-
- mapper.setInjectableValues(new InjectableValues.Std().addValue(ODataServiceVersion.class, version));
-
- mapper.setSerializerProvider(new InjectableSerializerProvider(mapper.getSerializerProvider(),
- mapper.getSerializationConfig().withAttribute(ODataServiceVersion.class, version),
- 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(ODataServiceVersion.class, version));
-
- 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/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index d2e9ede..0524c13 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.op;
+import org.apache.olingo.commons.core.op.ResourceFactory;
import java.io.StringWriter;
import java.net.URI;
import java.util.Iterator;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
deleted file mode 100644
index ed49ca8..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataDeserializer.java
+++ /dev/null
@@ -1,107 +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.client.core.op;
-
-import java.io.InputStream;
-import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.commons.api.data.Feed;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.op.CommonODataDeserializer;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.data.AtomDeserializer;
-import org.apache.olingo.commons.core.data.AtomEntryImpl;
-import org.apache.olingo.commons.core.data.AtomFeedImpl;
-import org.apache.olingo.commons.core.data.AtomPropertyImpl;
-import org.apache.olingo.commons.core.data.JSONEntryImpl;
-import org.apache.olingo.commons.core.data.JSONErrorBundle;
-import org.apache.olingo.commons.core.data.JSONFeedImpl;
-import org.apache.olingo.commons.core.data.JSONPropertyImpl;
-import org.apache.olingo.commons.core.data.XMLErrorImpl;
-
-public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements CommonODataDeserializer {
-
- private static final long serialVersionUID = -4244158979195609909L;
-
- private final AtomDeserializer atomDeserializer;
-
- public AbstractODataDeserializer(final ODataServiceVersion version) {
- super(version);
-
- this.atomDeserializer = new AtomDeserializer(version);
- }
-
- @Override
- public Feed toFeed(final InputStream input, final ODataPubFormat format) {
- return format == ODataPubFormat.ATOM
- ? atom(input, AtomFeedImpl.class)
- : json(input, JSONFeedImpl.class);
- }
-
- @Override
- public Entry toEntry(final InputStream input, final ODataPubFormat format) {
- return format == ODataPubFormat.ATOM
- ? atom(input, AtomEntryImpl.class)
- : json(input, JSONEntryImpl.class);
- }
-
- @Override
- public Property toProperty(final InputStream input, final ODataFormat format) {
- return format == ODataFormat.XML
- ? atom(input, AtomPropertyImpl.class)
- : json(input, JSONPropertyImpl.class);
- }
-
- @Override
- public ODataError toError(final InputStream input, final boolean isXML) {
- return isXML
- ? xml(input, XMLErrorImpl.class)
- : json(input, JSONErrorBundle.class).getError();
- }
-
- /*
- * ------------------ Protected methods ------------------
- */
- protected <T> T xml(final InputStream input, final Class<T> reference) {
- try {
- return getXmlMapper().readValue(input, reference);
- } catch (Exception e) {
- throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
- }
- }
-
- protected <T> T atom(final InputStream input, final Class<T> reference) {
- try {
- return atomDeserializer.read(input, reference);
- } catch (Exception e) {
- throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
- }
- }
-
- protected <T> T json(final InputStream input, final Class<T> reference) {
- try {
- return getObjectMapper().readValue(input, reference);
- } catch (Exception e) {
- throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
deleted file mode 100644
index c314139..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataSerializer.java
+++ /dev/null
@@ -1,141 +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.client.core.op;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.data.Feed;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.client.api.op.ODataSerializer;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.data.AtomEntryImpl;
-import org.apache.olingo.commons.core.data.AtomFeedImpl;
-import org.apache.olingo.commons.core.data.AtomPropertyImpl;
-import org.apache.olingo.commons.core.data.AtomSerializer;
-import org.apache.olingo.commons.core.data.JSONEntryImpl;
-import org.apache.olingo.commons.core.data.JSONFeedImpl;
-import org.apache.olingo.commons.core.data.JSONPropertyImpl;
-
-public abstract class AbstractODataSerializer extends AbstractJacksonTool implements ODataSerializer {
-
- private static final long serialVersionUID = -357777648541325363L;
-
- private final AtomSerializer atomSerializer;
-
- public AbstractODataSerializer(final ODataServiceVersion version) {
- super(version);
-
- this.atomSerializer = new AtomSerializer(version);
- }
-
- @Override
- public void feed(final Feed obj, final OutputStream out) {
- feed(obj, new OutputStreamWriter(out));
- }
-
- @Override
- public void feed(final Feed obj, final Writer writer) {
- if (obj instanceof AtomFeedImpl) {
- atom((AtomFeedImpl) obj, writer);
- } else {
- json((JSONFeedImpl) obj, writer);
- }
- }
-
- @Override
- public void entry(final Entry obj, final OutputStream out) {
- entry(obj, new OutputStreamWriter(out));
- }
-
- @Override
- public void entry(final Entry obj, final Writer writer) {
- if (obj instanceof AtomEntryImpl) {
- atom((AtomEntryImpl) obj, writer);
- } else {
- json((JSONEntryImpl) obj, writer);
- }
- }
-
- @Override
- public void property(final Property obj, final OutputStream out) {
- property(obj, new OutputStreamWriter(out));
- }
-
- @Override
- public void property(final Property obj, final Writer writer) {
- if (obj instanceof AtomPropertyImpl) {
- atom((AtomPropertyImpl) obj, writer);
- } else {
- json((JSONPropertyImpl) obj, writer);
- }
- }
-
- @Override
- public void link(final Link link, final ODataFormat format, final OutputStream out) {
- link(link, format, new OutputStreamWriter(out));
- }
-
- @Override
- public void link(final Link link, final ODataFormat format, final Writer writer) {
- if (format == ODataFormat.XML) {
- atom(link, writer);
- } else {
- jsonLink(link, writer);
- }
- }
-
- /*
- * ------------------ Protected methods ------------------
- */
- protected <T> void atom(final T obj, final Writer writer) {
- try {
- atomSerializer.write(writer, obj);
- } catch (Exception e) {
- throw new IllegalArgumentException("While serializing Atom object", e);
- }
- }
-
- protected <T> 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 jsonLink(final Link link, final Writer writer) {
- final ObjectMapper mapper = getObjectMapper();
- final ObjectNode uri = mapper.createObjectNode();
- uri.put(Constants.JSON_URL, link.getHref());
-
- try {
- mapper.writeValue(writer, uri);
- } catch (Exception e) {
- throw new IllegalArgumentException("While serializing JSON link", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/InjectableSerializerProvider.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/InjectableSerializerProvider.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/InjectableSerializerProvider.java
deleted file mode 100644
index b9b5374..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/InjectableSerializerProvider.java
+++ /dev/null
@@ -1,43 +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.client.core.op;
-
-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;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
deleted file mode 100644
index e5e7aa3..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataObjectFactoryImpl.java
+++ /dev/null
@@ -1,162 +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.client.core.op;
-
-import java.net.URI;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataObjectFactory;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-public class ODataObjectFactoryImpl implements ODataObjectFactory {
-
- private static final long serialVersionUID = -3769695665946919447L;
-
- protected final ODataServiceVersion version;
-
- public ODataObjectFactoryImpl(final ODataServiceVersion version) {
- this.version = version;
- }
-
- @Override
- public ODataEntitySet newEntitySet() {
- return new ODataEntitySet();
- }
-
- @Override
- public ODataEntitySet newEntitySet(final URI next) {
- return new ODataEntitySet(next);
- }
-
- @Override
- public ODataEntity newEntity(final String name) {
- return new ODataEntity(name);
- }
-
- @Override
- public ODataEntity newEntity(final String name, final URI link) {
- final ODataEntity result = new ODataEntity(name);
- result.setLink(link);
- return result;
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(version, link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(version, baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
- return new ODataInlineEntity(version, link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
- final ODataEntity entity) {
-
- return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
- return new ODataProperty(name, value);
- }
-
- @Override
- public ODataProperty newPrimitiveProperty(final String name, final ODataGeospatialValue value) {
- return new ODataProperty(name, value);
- }
-
- @Override
- public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
- return new ODataProperty(name, value);
- }
-
- @Override
- public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
- return new ODataProperty(name, value);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
index 80f4f11..2b914b4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.op;
+import org.apache.olingo.commons.core.op.ResourceFactory;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
deleted file mode 100644
index 525114e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ResourceFactory.java
+++ /dev/null
@@ -1,125 +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.client.core.op;
-
-import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.data.Feed;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.core.data.AtomEntryImpl;
-import org.apache.olingo.commons.core.data.AtomFeedImpl;
-import org.apache.olingo.commons.core.data.AtomPropertyImpl;
-import org.apache.olingo.commons.core.data.JSONEntryImpl;
-import org.apache.olingo.commons.core.data.JSONFeedImpl;
-import org.apache.olingo.commons.core.data.JSONPropertyImpl;
-
-public class ResourceFactory {
-
- /**
- * Gets a new instance of <tt>Feed</tt>.
- *
- * @param resourceClass reference class.
- * @return <tt>Feed</tt> object.
- */
- public static Feed newFeed(final Class<? extends Feed> resourceClass) {
- Feed result = null;
-
- if (AtomFeedImpl.class.equals(resourceClass)) {
- result = new AtomFeedImpl();
- }
- if (JSONFeedImpl.class.equals(resourceClass)) {
- result = new JSONFeedImpl();
- }
-
- return result;
- }
-
- /**
- * Gets a new instance of <tt>Entry</tt>.
- *
- * @param resourceClass reference class.
- * @return <tt>Entry</tt> object.
- */
- public static Entry newEntry(final Class<? extends Entry> resourceClass) {
- Entry result = null;
- if (AtomEntryImpl.class.equals(resourceClass)) {
- result = new AtomEntryImpl();
- }
- if (JSONEntryImpl.class.equals(resourceClass)) {
- result = new JSONEntryImpl();
- }
-
- return result;
- }
-
- public static Property newProperty(final Class<? extends Entry> resourceClass) {
- Property result = null;
- if (AtomEntryImpl.class.equals(resourceClass)) {
- result = new AtomPropertyImpl();
- }
- if (JSONEntryImpl.class.equals(resourceClass)) {
- result = new JSONPropertyImpl();
- }
-
- return result;
- }
-
- /**
- * Gets feed reference class from the given format.
- *
- * @param isXML whether it is JSON or XML / Atom
- * @return resource reference class.
- */
- public static Class<? extends Feed> feedClassForFormat(final boolean isXML) {
- return isXML ? AtomFeedImpl.class : JSONFeedImpl.class;
- }
-
- /**
- * Gets entry reference class from the given format.
- *
- * @param isXML whether it is JSON or XML / Atom
- * @return resource reference class.
- */
- public static Class<? extends Entry> entryClassForFormat(final boolean isXML) {
- return isXML ? AtomEntryImpl.class : JSONEntryImpl.class;
- }
-
- /**
- * Gets <tt>Entry</tt> object from feed resource.
- *
- * @param resourceClass feed reference class.
- * @return <tt>Entry</tt> object.
- */
- public static Class<? extends Entry> entryClassForFeed(final Class<? extends Feed> resourceClass) {
- Class<? extends Entry> result = null;
-
- if (AtomFeedImpl.class.equals(resourceClass)) {
- result = AtomEntryImpl.class;
- }
- if (JSONFeedImpl.class.equals(resourceClass)) {
- result = JSONEntryImpl.class;
- }
-
- return result;
- }
-
- public static ODataPubFormat formatForEntryClass(final Class<? extends Entry> reference) {
- return reference.equals(AtomEntryImpl.class) ? ODataPubFormat.ATOM : ODataPubFormat.JSON;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
index 9abd8e3..d6b05d9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
@@ -30,7 +30,7 @@ import org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl;
import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
import org.apache.olingo.client.core.edm.xml.v3.EdmxImpl;
import org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl;
-import org.apache.olingo.client.core.op.AbstractODataDeserializer;
+import org.apache.olingo.commons.core.op.AbstractODataDeserializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ODataDeserializerImpl extends AbstractODataDeserializer implements ODataDeserializer {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
index d1fa5f0..40b5b06 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.op.impl.v3;
-import org.apache.olingo.client.core.op.AbstractODataSerializer;
+import org.apache.olingo.commons.core.op.AbstractODataSerializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ODataSerializerImpl extends AbstractODataSerializer {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
index 4147901..f936853 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl;
import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
import org.apache.olingo.client.core.edm.xml.v4.EdmxImpl;
import org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl;
-import org.apache.olingo.client.core.op.AbstractODataDeserializer;
+import org.apache.olingo.commons.core.op.AbstractODataDeserializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ODataDeserializerImpl extends AbstractODataDeserializer implements ODataDeserializer {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
index 309ed91..f75fb3e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.op.impl.v4;
-import org.apache.olingo.client.core.op.AbstractODataSerializer;
+import org.apache.olingo.commons.core.op.AbstractODataSerializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ODataSerializerImpl extends AbstractODataSerializer {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
index 34d7069..d10c874 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
@@ -27,7 +27,7 @@ import org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFacto
import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory;
-import org.apache.olingo.client.api.op.ODataSerializer;
+import org.apache.olingo.commons.api.op.ODataSerializer;
import org.apache.olingo.client.api.op.v3.ODataDeserializer;
import org.apache.olingo.client.api.op.v3.ODataBinder;
import org.apache.olingo.client.api.op.v3.ODataReader;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
index ebab41a..bb12f1a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
@@ -27,7 +27,7 @@ import org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFacto
import org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.streamed.v4.StreamedRequestFactory;
-import org.apache.olingo.client.api.op.ODataSerializer;
+import org.apache.olingo.commons.api.op.ODataSerializer;
import org.apache.olingo.client.api.op.v4.ODataBinder;
import org.apache.olingo.client.api.op.v4.ODataDeserializer;
import org.apache.olingo.client.api.op.v4.ODataReader;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
index 609bd9a..eb8d314 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
@@ -38,7 +38,7 @@ import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataProperty;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.core.op.ResourceFactory;
+import org.apache.olingo.commons.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
index aaa9ed7..b9ac098 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
@@ -33,7 +33,7 @@ import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.client.core.op.ResourceFactory;
+import org.apache.olingo.commons.core.op.ResourceFactory;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
index 792ddb7..c6fd0d8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
@@ -27,7 +27,7 @@ import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.op.ResourceFactory;
+import org.apache.olingo.commons.core.op.ResourceFactory;
import org.junit.Test;
public class EntitySetTest extends AbstractTest {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index d8f02a6..b615988 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataProperty;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.op.ResourceFactory;
+import org.apache.olingo.commons.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
new file mode 100644
index 0000000..dfefb78
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.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.commons.api.op;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.domain.ODataError;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+
+/**
+ * Interface for serialization.
+ */
+public interface CommonODataDeserializer extends Serializable {
+
+ /**
+ * Gets a feed object from the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @param format Atom or JSON
+ * @return Feed instance.
+ */
+ Feed toFeed(InputStream input, ODataPubFormat format);
+
+ /**
+ * Gets an entry object from the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @param format Atom or JSON
+ * @return Entry instance.
+ */
+ Entry toEntry(InputStream input, ODataPubFormat format);
+
+ /**
+ * Gets a property object from the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @param format XML or JSON
+ * @return Property instance.
+ */
+ Property toProperty(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 toError(InputStream input, boolean isXML);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/ODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/ODataSerializer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/ODataSerializer.java
new file mode 100644
index 0000000..2a7beff
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/ODataSerializer.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.commons.api.op;
+
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.io.Writer;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.format.ODataFormat;
+
+/**
+ * Utility class for serialization.
+ */
+public interface ODataSerializer extends Serializable {
+
+ /**
+ * Writes Feed object onto the given stream.
+ *
+ * @param obj object to be streamed.
+ * @param out output stream.
+ */
+ void feed(Feed obj, OutputStream out);
+
+ /**
+ * Writes Feed object by the given writer.
+ *
+ * @param obj object to be streamed.
+ * @param writer writer.
+ */
+ void feed(Feed obj, Writer writer);
+
+ /**
+ * Writes theEntry object onto the given stream.
+ *
+ * @param obj object to be streamed.
+ * @param out output stream.
+ */
+ void entry(Entry obj, OutputStream out);
+
+ /**
+ * Writes the Entry object by the given writer.
+ *
+ * @param obj object to be streamed.
+ * @param writer writer.
+ */
+ void entry(Entry obj, Writer writer);
+
+ /**
+ * Writes the property object onto the given stream.
+ *
+ * @param property object to be streamed.
+ * @param out output stream.
+ */
+ void property(Property property, OutputStream out);
+
+ /**
+ * Writes the property object by the given writer.
+ *
+ * @param property object to be streamed.
+ * @param writer writer.
+ */
+ void property(Property property, Writer writer);
+
+ /**
+ * Writes link onto the given stream.
+ *
+ * @param link OData link to be streamed.
+ * @param format streaming format.
+ * @param out output stream.
+ */
+ void link(Link link, ODataFormat format, OutputStream out);
+
+ /**
+ * Writes link by the given writer.
+ *
+ * @param link OData link to be streamed.
+ * @param format streaming format.
+ * @param writer writer.
+ */
+ void link(Link link, ODataFormat format, Writer writer);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractJacksonTool.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractJacksonTool.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractJacksonTool.java
new file mode 100644
index 0000000..c5eda7a
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/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.commons.core.op;
+
+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.commons.api.edm.constants.ODataServiceVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+abstract class AbstractJacksonTool {
+
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractJacksonTool.class);
+
+ protected final ODataServiceVersion version;
+
+ protected AbstractJacksonTool(final ODataServiceVersion client) {
+ this.version = client;
+ }
+
+ protected ObjectMapper getObjectMapper() {
+ final ObjectMapper mapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
+
+ mapper.setInjectableValues(new InjectableValues.Std().addValue(ODataServiceVersion.class, version));
+
+ mapper.setSerializerProvider(new InjectableSerializerProvider(mapper.getSerializerProvider(),
+ mapper.getSerializationConfig().withAttribute(ODataServiceVersion.class, version),
+ 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(ODataServiceVersion.class, version));
+
+ 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/olingo-odata4/blob/a55ed62a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
new file mode 100644
index 0000000..94c43da
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.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.commons.core.op;
+
+import java.io.InputStream;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.domain.ODataError;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.op.CommonODataDeserializer;
+import org.apache.olingo.commons.core.data.AtomDeserializer;
+import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.AtomFeedImpl;
+import org.apache.olingo.commons.core.data.AtomPropertyImpl;
+import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.core.data.JSONErrorBundle;
+import org.apache.olingo.commons.core.data.JSONFeedImpl;
+import org.apache.olingo.commons.core.data.JSONPropertyImpl;
+import org.apache.olingo.commons.core.data.XMLErrorImpl;
+
+public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements CommonODataDeserializer {
+
+ private static final long serialVersionUID = -4244158979195609909L;
+
+ private final AtomDeserializer atomDeserializer;
+
+ public AbstractODataDeserializer(final ODataServiceVersion version) {
+ super(version);
+
+ this.atomDeserializer = new AtomDeserializer(version);
+ }
+
+ @Override
+ public Feed toFeed(final InputStream input, final ODataPubFormat format) {
+ return format == ODataPubFormat.ATOM
+ ? atom(input, AtomFeedImpl.class)
+ : json(input, JSONFeedImpl.class);
+ }
+
+ @Override
+ public Entry toEntry(final InputStream input, final ODataPubFormat format) {
+ return format == ODataPubFormat.ATOM
+ ? atom(input, AtomEntryImpl.class)
+ : json(input, JSONEntryImpl.class);
+ }
+
+ @Override
+ public Property toProperty(final InputStream input, final ODataFormat format) {
+ return format == ODataFormat.XML
+ ? atom(input, AtomPropertyImpl.class)
+ : json(input, JSONPropertyImpl.class);
+ }
+
+ @Override
+ public ODataError toError(final InputStream input, final boolean isXML) {
+ return isXML
+ ? xml(input, XMLErrorImpl.class)
+ : json(input, JSONErrorBundle.class).getError();
+ }
+
+ /*
+ * ------------------ Protected methods ------------------
+ */
+ protected <T> T xml(final InputStream input, final Class<T> reference) {
+ try {
+ return getXmlMapper().readValue(input, reference);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
+ }
+ }
+
+ protected <T> T atom(final InputStream input, final Class<T> reference) {
+ try {
+ return atomDeserializer.read(input, reference);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
+ }
+ }
+
+ protected <T> T json(final InputStream input, final Class<T> reference) {
+ try {
+ return getObjectMapper().readValue(input, reference);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataSerializer.java
new file mode 100644
index 0000000..6ce1fbf
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataSerializer.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.commons.core.op;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.op.ODataSerializer;
+import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.AtomFeedImpl;
+import org.apache.olingo.commons.core.data.AtomPropertyImpl;
+import org.apache.olingo.commons.core.data.AtomSerializer;
+import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.core.data.JSONFeedImpl;
+import org.apache.olingo.commons.core.data.JSONPropertyImpl;
+
+public abstract class AbstractODataSerializer extends AbstractJacksonTool implements ODataSerializer {
+
+ private static final long serialVersionUID = -357777648541325363L;
+
+ private final AtomSerializer atomSerializer;
+
+ public AbstractODataSerializer(final ODataServiceVersion version) {
+ super(version);
+
+ this.atomSerializer = new AtomSerializer(version);
+ }
+
+ @Override
+ public void feed(final Feed obj, final OutputStream out) {
+ feed(obj, new OutputStreamWriter(out));
+ }
+
+ @Override
+ public void feed(final Feed obj, final Writer writer) {
+ if (obj instanceof AtomFeedImpl) {
+ atom((AtomFeedImpl) obj, writer);
+ } else {
+ json((JSONFeedImpl) obj, writer);
+ }
+ }
+
+ @Override
+ public void entry(final Entry obj, final OutputStream out) {
+ entry(obj, new OutputStreamWriter(out));
+ }
+
+ @Override
+ public void entry(final Entry obj, final Writer writer) {
+ if (obj instanceof AtomEntryImpl) {
+ atom((AtomEntryImpl) obj, writer);
+ } else {
+ json((JSONEntryImpl) obj, writer);
+ }
+ }
+
+ @Override
+ public void property(final Property obj, final OutputStream out) {
+ property(obj, new OutputStreamWriter(out));
+ }
+
+ @Override
+ public void property(final Property obj, final Writer writer) {
+ if (obj instanceof AtomPropertyImpl) {
+ atom((AtomPropertyImpl) obj, writer);
+ } else {
+ json((JSONPropertyImpl) obj, writer);
+ }
+ }
+
+ @Override
+ public void link(final Link link, final ODataFormat format, final OutputStream out) {
+ link(link, format, new OutputStreamWriter(out));
+ }
+
+ @Override
+ public void link(final Link link, final ODataFormat format, final Writer writer) {
+ if (format == ODataFormat.XML) {
+ atom(link, writer);
+ } else {
+ jsonLink(link, writer);
+ }
+ }
+
+ /*
+ * ------------------ Protected methods ------------------
+ */
+ protected <T> void atom(final T obj, final Writer writer) {
+ try {
+ atomSerializer.write(writer, obj);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While serializing Atom object", e);
+ }
+ }
+
+ protected <T> 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 jsonLink(final Link link, final Writer writer) {
+ final ObjectMapper mapper = getObjectMapper();
+ final ObjectNode uri = mapper.createObjectNode();
+ uri.put(Constants.JSON_URL, link.getHref());
+
+ try {
+ mapper.writeValue(writer, uri);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("While serializing JSON link", e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/InjectableSerializerProvider.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/InjectableSerializerProvider.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/InjectableSerializerProvider.java
new file mode 100644
index 0000000..967f1e0
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/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.commons.core.op;
+
+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;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a55ed62a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
new file mode 100644
index 0000000..5e9f9c1
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.op;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public class ODataObjectFactoryImpl implements ODataObjectFactory {
+
+ private static final long serialVersionUID = -3769695665946919447L;
+
+ protected final ODataServiceVersion version;
+
+ public ODataObjectFactoryImpl(final ODataServiceVersion version) {
+ this.version = version;
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet() {
+ return new ODataEntitySet();
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet(final URI next) {
+ return new ODataEntitySet(next);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name) {
+ return new ODataEntity(name);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name, final URI link) {
+ final ODataEntity result = new ODataEntity(name);
+ result.setLink(link);
+ return result;
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
+ final ODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(version, link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
+ final ODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(version, baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
+ return new ODataInlineEntity(version, link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
+ final ODataEntity entity) {
+
+ return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
+ return new ODataProperty(name, value);
+ }
+
+ @Override
+ public ODataProperty newPrimitiveProperty(final String name, final ODataGeospatialValue value) {
+ return new ODataProperty(name, value);
+ }
+
+ @Override
+ public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ return new ODataProperty(name, value);
+ }
+
+ @Override
+ public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ return new ODataProperty(name, value);
+ }
+
+}