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:59 UTC
[47/52] [abbrv] git commit: [OLINGO-205, OLINGO-200, OLINGO-65] merge
[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));
+ }
+ }
-
+ }