You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ar...@apache.org on 2018/07/26 11:40:51 UTC
olingo-odata4 git commit: Revert "[OLINGO-1279]OData V4.0: Client
returns CsdlPath for CsdlAnnotationPath attribute"
Repository: olingo-odata4
Updated Branches:
refs/heads/master 8f4e554df -> a9aaa9355
Revert "[OLINGO-1279]OData V4.0: Client returns CsdlPath for CsdlAnnotationPath attribute"
This reverts commit 8f4e554dfacb5b152f7b0c24939f8336db810c61.
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/a9aaa935
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/a9aaa935
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/a9aaa935
Branch: refs/heads/master
Commit: a9aaa9355dc83b87037fd091a92f63d499877621
Parents: 8f4e554
Author: Archana Rai <ar...@sap.com>
Authored: Thu Jul 26 17:10:06 2018 +0530
Committer: Archana Rai <ar...@sap.com>
Committed: Thu Jul 26 17:10:06 2018 +0530
----------------------------------------------------------------------
.../fit/tecsvc/client/AsyncSupportITCase.java | 46 ++-------------
.../invoke/AbstractODataInvokeRequest.java | 2 +-
.../request/invoke/ODataInvokeRequestImpl.java | 60 --------------------
.../annotation/ClientCsdlDynamicExpression.java | 3 +-
.../apache/olingo/client/core/MetadataTest.java | 28 ---------
.../client/core/edmxWithCsdlAnnotationPath.xml | 37 ------------
.../org/apache/olingo/server/api/OData.java | 19 -------
.../netty/server/core/ODataNettyImpl.java | 12 ----
.../apache/olingo/server/core/ODataImpl.java | 36 ------------
.../json/ODataJsonDeserializer.java | 23 ++------
.../server/tecsvc/data/RequestValidator.java | 6 +-
11 files changed, 14 insertions(+), 258 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a9aaa935/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
index 15c8c3e..2263e9b 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
@@ -18,17 +18,10 @@
*/
package org.apache.olingo.fit.tecsvc.client;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.net.URI;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -37,34 +30,32 @@ import java.util.concurrent.TimeoutException;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.AsyncBatchRequestWrapper;
-import org.apache.olingo.client.api.communication.request.AsyncRequestWrapper;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.ODataRequest;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
-import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.AsyncResponseWrapper;
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
import org.apache.olingo.client.api.communication.response.ODataResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.client.api.uri.URIBuilder;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.format.PreferenceName;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
public final class AsyncSupportITCase extends AbstractParamTecSvcITCase {
@@ -284,34 +275,7 @@ public final class AsyncSupportITCase extends AbstractParamTecSvcITCase {
assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), e.getStatusLine().getStatusCode());
}
}
-
- @Test
- public void entityAction() throws Exception {
- Calendar dateTime = Calendar.getInstance();
- dateTime.clear();
- dateTime.set(1012, 2, 0, 0, 0, 0);
- final Map<String, ClientValue> parameters = Collections.singletonMap(
- "ParameterDate",
- (ClientValue) getFactory().newPrimitiveValueBuilder()
- .setType(EdmPrimitiveTypeKind.Date).setValue(dateTime).build());
- ODataClient client = getClient();
- URI uri = client.newURIBuilder(TecSvcConst.BASE_URI)
- .appendActionCallSegment("AIRTESAllPrimParam").build();
-
- ODataInvokeRequest<ClientEntity> req = client.getInvokeRequestFactory()
- .getActionInvokeRequest(uri, ClientEntity.class, parameters);
- AsyncRequestWrapper<ODataRetrieveResponse<ClientEntity>>
- asyncReqWrp = client.getAsyncRequestFactory().getAsyncRequestWrapper(req);
- AsyncResponseWrapper<ODataRetrieveResponse<ClientEntity>>
- asyncRespWrp = asyncReqWrp.execute();
- waitTillDone(asyncRespWrp, 5);
- @SuppressWarnings("unchecked")
- ODataInvokeResponse<ClientEntity> response = (ODataInvokeResponse<ClientEntity>)asyncRespWrp.getODataResponse();
-
- assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode());
- assertEquals(TecSvcConst.BASE_URI + "/ESAllPrim(1)", response.getHeader(HttpHeader.LOCATION).iterator().next());
- }
-
+
private ODataEntityRequest<ClientEntity> appendGetRequest(final ODataClient client,
final String segment, final Object key, final boolean isRelative) {
final URI targetURI = client.newURIBuilder(SERVICE_URI)
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a9aaa935/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
index 5cf9385..8bd3363 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
@@ -55,7 +55,7 @@ public abstract class AbstractODataInvokeRequest<T extends ClientInvokeResult>
extends AbstractODataBasicRequest<ODataInvokeResponse<T>>
implements ODataInvokeRequest<T>, ODataBatchableRequest {
- protected final Class<T> reference;
+ private final Class<T> reference;
/**
* Function parameters.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a9aaa935/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 d00f977..6d6cc01 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
@@ -18,22 +18,10 @@
*/
package org.apache.olingo.client.core.communication.request.invoke;
-import java.io.IOException;
-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.communication.request.invoke.ClientNoContent;
-import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.domain.ClientInvokeResult;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.api.serialization.ODataDeserializerException;
-import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;
@@ -57,52 +45,4 @@ public class ODataInvokeRequestImpl<T extends ClientInvokeResult> extends Abstra
protected ContentType getPOSTParameterFormat() {
return contentType == null ? getDefaultFormat() : contentType;
}
-
- /**
- * Response class about an ODataInvokeRequest.
- */
- protected class ODataInvokeResponseImpl extends AbstractODataResponse implements ODataInvokeResponse<T> {
-
- private T invokeResult = null;
-
- private ODataInvokeResponseImpl(final ODataClient odataClient, final HttpClient httpClient,
- final HttpResponse res) {
-
- super(odataClient, httpClient, res);
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public T getBody() {
- if (invokeResult == null) {
- try {
- if (ClientNoContent.class.isAssignableFrom(reference)) {
- invokeResult = reference.cast(new ClientNoContent());
- } else {
- // avoid getContent() twice:IllegalStateException: Content has been consumed
- final InputStream responseStream = this.payload == null ? res.getEntity().getContent() : this.payload;
- if (ClientEntitySet.class.isAssignableFrom(reference)) {
- invokeResult = reference.cast(odataClient.getReader().readEntitySet(responseStream,
- ContentType.parse(getContentType())));
- } else if (ClientEntity.class.isAssignableFrom(reference)) {
- invokeResult = reference.cast(odataClient.getReader().readEntity(responseStream,
- ContentType.parse(getContentType())));
- } else if (ClientProperty.class.isAssignableFrom(reference)) {
- invokeResult = reference.cast(odataClient.getReader().readProperty(responseStream,
- ContentType.parse(getContentType())));
- }
- }
- } catch (IOException e) {
- throw new HttpClientException(e);
- } catch (final ODataDeserializerException e) {
- throw new IllegalArgumentException(e);
- } finally {
- this.close();
- }
- }
- return invokeResult;
- }
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a9aaa935/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlDynamicExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlDynamicExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlDynamicExpression.java
index 1afbca5..8e41a64 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlDynamicExpression.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlDynamicExpression.java
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.io.Serializable;
import org.apache.olingo.client.core.edm.xml.AbstractClientCsdlEdmDeserializer;
-import org.apache.olingo.commons.api.edm.provider.annotation.CsdlAnnotationPath;
import org.apache.olingo.commons.api.edm.provider.annotation.CsdlDynamicExpression;
import org.apache.olingo.commons.api.edm.provider.annotation.CsdlExpression;
import org.apache.olingo.commons.api.edm.provider.annotation.CsdlIf;
@@ -121,7 +120,7 @@ public abstract class ClientCsdlDynamicExpression extends CsdlDynamicExpression
} else if (PROPERTY_PATH.equals(jp.getCurrentName())) {
expression = new CsdlPropertyPath().setValue(jp.nextTextValue());
} else if (ANNOTATION_PATH.equals(jp.getCurrentName())) {
- expression = new CsdlAnnotationPath().setValue(jp.nextTextValue());
+ expression = new CsdlPath().setValue(jp.nextTextValue());
} else if (APPLY.equals(jp.getCurrentName())) {
jp.nextToken();
expression = jp.readValueAs(ClientCsdlApply.class);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a9aaa935/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java
index 00cd2ad..23ef55f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java
@@ -60,7 +60,6 @@ import org.apache.olingo.commons.api.edm.provider.CsdlFunctionImport;
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
import org.apache.olingo.commons.api.edm.provider.CsdlTerm;
-import org.apache.olingo.commons.api.edm.provider.annotation.CsdlAnnotationPath;
import org.apache.olingo.commons.api.edm.provider.annotation.CsdlApply;
import org.apache.olingo.commons.api.edm.provider.annotation.CsdlCollection;
import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
@@ -458,33 +457,6 @@ public class MetadataTest extends AbstractTest {
assertEquals("EnumMember", expression.getExpressionName());
}
}
-
- @Test
- public void readPropertyAnnotationsTest() {
- List<InputStream> streams = new ArrayList<InputStream>();
- streams.add(getClass().getResourceAsStream("VOC_Core.xml"));
- final Edm edm = client.getReader().readMetadata(getClass().getResourceAsStream("edmxWithCsdlAnnotationPath.xml"),
- streams);
- assertNotNull(edm);
-
- final EdmEntityType person = edm.getEntityType(
- new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Person"));
- assertNotNull(person);
- EdmProperty userName = (EdmProperty) person.getProperty("UserName");
- List<EdmAnnotation> userNameAnnotations = userName.getAnnotations();
- for (EdmAnnotation annotation : userNameAnnotations) {
- EdmTerm term = annotation.getTerm();
- assertNotNull(term);
- assertEquals("Permissions", term.getName());
- assertEquals("Org.OData.Core.V1.Permissions",
- term.getFullQualifiedName().getFullQualifiedNameAsString());
- EdmExpression expression = annotation.getExpression();
- assertNotNull(expression);
- assertTrue(expression.isDynamic());
- assertEquals("AnnotationPath", expression.asDynamic().getExpressionName());
- }
- }
-
@Test
public void testOLINGO1100() {
final Edm edm = client.getReader().readMetadata(getClass().getResourceAsStream("olingo1100.xml"));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a9aaa935/lib/client-core/src/test/resources/org/apache/olingo/client/core/edmxWithCsdlAnnotationPath.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/edmxWithCsdlAnnotationPath.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/edmxWithCsdlAnnotationPath.xml
deleted file mode 100644
index 331bb13..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/edmxWithCsdlAnnotationPath.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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. -->
-<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
- <edmx:DataServices m:DataServiceVersion="4.0"
- m:MaxDataServiceVersion="4.0" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata">
- <Schema Namespace="Microsoft.Exchange.Services.OData.Model"
- xmlns="http://docs.oasis-open.org/odata/ns/edm">
- <EntityType Name="Person" OpenType="true">
- <Key>
- <PropertyRef Name="UserName" />
- </Key>
- <Property Name="UserName" Type="Edm.String" Nullable="false">
- <Annotation Term="Org.OData.Core.V1.Permissions">
- <AnnotationPath>Org.OData.Core.V1.Permission/Read</AnnotationPath>
- </Annotation>
- </Property>
- <Property Name="FirstName" Type="Edm.String" Nullable="false" />
- <Property Name="LastName" Type="Edm.String" Nullable="false" />
- <Property Name="Emails" Type="Collection(Edm.String)" />
- </EntityType>
- <EntityContainer Name="EntityContainer"
- m:IsDefaultEntityContainer="true">
- <EntitySet Name="People"
- EntityType="Microsoft.Exchange.Services.OData.Model.Person" />
- </EntityContainer>
- </Schema>
- </edmx:DataServices>
-</edmx:Edmx>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a9aaa935/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
index ad06b7c..16cca29 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
@@ -155,31 +155,12 @@ public abstract class OData {
* Deserializers are used in Processor implementations.
*
* @param contentType any content type supported by Olingo (XML, JSON ...)
- */
- public abstract ODataDeserializer createDeserializer(ContentType contentType,
- final List<String> versions) throws DeserializerException;
-
- /**
- * Creates a new deserializer object for reading content in the specified format.
- * Deserializers are used in Processor implementations.
- *
- * @param contentType any content type supported by Olingo (XML, JSON ...)
* @param metadata ServiceMetada of the service
*/
public abstract ODataDeserializer createDeserializer(ContentType contentType,
ServiceMetadata metadata) throws DeserializerException;
/**
- * Creates a new deserializer object for reading content in the specified format.
- * Deserializers are used in Processor implementations.
- *
- * @param contentType any content type supported by Olingo (XML, JSON ...)
- * @param metadata ServiceMetada of the service
- */
- public abstract ODataDeserializer createDeserializer(ContentType contentType,
- ServiceMetadata metadata, final List<String> versions) throws DeserializerException;
-
- /**
* Creates a primitive-type instance.
* @param kind the kind of the primitive type
* @return an {@link EdmPrimitiveType} instance for the type kind
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a9aaa935/lib/server-core/src/main/java/org/apache/olingo/netty/server/core/ODataNettyImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/netty/server/core/ODataNettyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/netty/server/core/ODataNettyImpl.java
index 0a6ce52..113eb03 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/netty/server/core/ODataNettyImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/netty/server/core/ODataNettyImpl.java
@@ -160,17 +160,5 @@ public class ODataNettyImpl extends ODataNetty {
throws SerializerException {
return odata.createEdmDeltaSerializer(contentType, versions);
}
-
- @Override
- public ODataDeserializer createDeserializer(ContentType contentType, List<String> versions)
- throws DeserializerException {
- return odata.createDeserializer(contentType, versions);
- }
-
- @Override
- public ODataDeserializer createDeserializer(ContentType contentType, ServiceMetadata metadata, List<String> versions)
- throws DeserializerException {
- return odata.createDeserializer(contentType, metadata, versions);
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a9aaa935/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
index 997fc8f..c3507fb 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
@@ -238,40 +238,4 @@ public class ODataImpl extends OData {
// TODO: Support more debug formats
return new DebugResponseHelperImpl(debugFormat);
}
-
- @Override
- public ODataDeserializer createDeserializer(ContentType contentType, List<String> versions)
- throws DeserializerException {
- IConstants constants = new Constantsv00();
- if(versions!=null && versions.size()>0 && getMaxVersion(versions)>4){
- constants = new Constantsv01() ;
- }
- if (contentType.isCompatible(ContentType.JSON)) {
- return new ODataJsonDeserializer(contentType, constants);
- } else if (contentType.isCompatible(ContentType.APPLICATION_XML)
- || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)) {
- return new ODataXmlDeserializer();
- } else {
- throw new DeserializerException("Unsupported format: " + contentType.toContentTypeString(),
- DeserializerException.MessageKeys.UNSUPPORTED_FORMAT, contentType.toContentTypeString());
- }
- }
-
- @Override
- public ODataDeserializer createDeserializer(ContentType contentType, ServiceMetadata metadata, List<String> versions)
- throws DeserializerException {
- IConstants constants = new Constantsv00();
- if(versions!=null && versions.size()>0 && getMaxVersion(versions)>4){
- constants = new Constantsv01() ;
- }
- if (contentType.isCompatible(ContentType.JSON)) {
- return new ODataJsonDeserializer(contentType, metadata, constants);
- } else if (contentType.isCompatible(ContentType.APPLICATION_XML)
- || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)) {
- return new ODataXmlDeserializer(metadata);
- } else {
- throw new DeserializerException("Unsupported format: " + contentType.toContentTypeString(),
- DeserializerException.MessageKeys.UNSUPPORTED_FORMAT, contentType.toContentTypeString());
- }
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a9aaa935/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
index cb96c20..71aee42 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
@@ -33,8 +33,6 @@ import java.util.Map;
import java.util.Map.Entry;
import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.IConstants;
-import org.apache.olingo.commons.api.constants.Constantsv00;
import org.apache.olingo.commons.api.data.ComplexValue;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
@@ -107,27 +105,14 @@ public class ODataJsonDeserializer implements ODataDeserializer {
private final boolean isIEEE754Compatible;
private ServiceMetadata serviceMetadata;
- private IConstants constants;
public ODataJsonDeserializer(final ContentType contentType) {
- this(contentType, null, new Constantsv00());
+ this(contentType, null);
}
public ODataJsonDeserializer(final ContentType contentType, final ServiceMetadata serviceMetadata) {
isIEEE754Compatible = ContentTypeHelper.isODataIEEE754Compatible(contentType);
this.serviceMetadata = serviceMetadata;
- this.constants = new Constantsv00();
- }
-
- public ODataJsonDeserializer(ContentType contentType, ServiceMetadata serviceMetadata, IConstants constants) {
- isIEEE754Compatible = ContentTypeHelper.isODataIEEE754Compatible(contentType);
- this.serviceMetadata = serviceMetadata;
- this.constants = constants;
- }
-
- public ODataJsonDeserializer(ContentType contentType, IConstants constants) {
- isIEEE754Compatible = ContentTypeHelper.isODataIEEE754Compatible(contentType);
- this.constants = constants;
}
@Override
@@ -352,7 +337,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
while (fieldsIterator.hasNext()) {
Entry<String, JsonNode> field = fieldsIterator.next();
- if (field.getKey().contains(constants.getBind())) {
+ if (field.getKey().contains(Constants.JSON_BIND_LINK_SUFFIX)) {
Link bindingLink = consumeBindingLink(field.getKey(), field.getValue(), edmEntityType);
entity.getNavigationBindings().add(bindingLink);
toRemove.add(field.getKey());
@@ -952,7 +937,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
try {
List<URI> parsedValues = new ArrayList<URI>();
final ObjectNode tree = parseJsonTree(stream);
- final String key = constants.getId();
+ final String key = Constants.JSON_ID;
JsonNode jsonNode = tree.get(Constants.VALUE);
if (jsonNode != null) {
if (jsonNode.isArray()) {
@@ -999,7 +984,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
private EdmType getDerivedType(final EdmStructuredType edmType, final JsonNode jsonNode)
throws DeserializerException {
- JsonNode odataTypeNode = jsonNode.get(constants.getType());
+ JsonNode odataTypeNode = jsonNode.get(Constants.JSON_TYPE);
if (odataTypeNode != null) {
String odataType = odataTypeNode.asText();
if (!odataType.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a9aaa935/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java
index 07a793a..baf2f40 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java
@@ -140,13 +140,13 @@ public class RequestValidator {
if (edmProperty.isCollection()) {
final EntityCollection inlineEntitySet = navigationLink.getInlineEntitySet();
if (inlineEntitySet != null) {
- /*if (!isInsert && inlineEntitySet.getEntities().size() > 0) {
+ if (!isInsert && inlineEntitySet.getEntities().size() > 0) {
throw new DataProvider.DataProviderException("Deep update is not allowed", HttpStatusCode.BAD_REQUEST);
- } else {*/
+ } else {
for (final Entity entity : navigationLink.getInlineEntitySet().getEntities()) {
validate(edmBindingTarget, entity);
}
- // }
+ }
}
} else {
final Entity inlineEntity = navigationLink.getInlineEntity();