You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by fm...@apache.org on 2014/04/10 16:33:30 UTC
[51/51] [partial] git commit: [OLINGO-175] using commons
(de-)serializers to add some capabilities to fit
[OLINGO-175] using commons (de-)serializers to add some capabilities to fit
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/450ccfd4
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/450ccfd4
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/450ccfd4
Branch: refs/heads/master
Commit: 450ccfd4e3a714729c2641732e8f3bb071c8cc1f
Parents: ba791fa
Author: fmartelli <fa...@gmail.com>
Authored: Thu Apr 10 16:32:12 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Thu Apr 10 16:32:12 2014 +0200
----------------------------------------------------------------------
fit/pom.xml | 12 +
.../org/apache/olingo/fit/AbstractServices.java | 386 ++++-
.../apache/olingo/fit/V3ActionOverloading.java | 19 +-
.../org/apache/olingo/fit/V3KeyAsSegment.java | 3 +-
.../java/org/apache/olingo/fit/V3Services.java | 13 +-
.../java/org/apache/olingo/fit/V4NorthWind.java | 6 +-
.../org/apache/olingo/fit/V4NorthWindExt.java | 6 +-
.../java/org/apache/olingo/fit/V4Services.java | 12 +-
.../fit/metadata/AbstractMetadataElement.java | 29 +
.../apache/olingo/fit/metadata/Association.java | 70 +
.../olingo/fit/metadata/AssociationSet.java | 74 +
.../apache/olingo/fit/metadata/Container.java | 76 +
.../apache/olingo/fit/metadata/EntitySet.java | 72 +
.../apache/olingo/fit/metadata/EntityType.java | 77 +
.../apache/olingo/fit/metadata/Metadata.java | 354 +++++
.../olingo/fit/metadata/NavigationProperty.java | 86 ++
.../apache/olingo/fit/metadata/Property.java | 52 +
.../org/apache/olingo/fit/metadata/Schema.java | 80 +
.../fit/serializer/JsonEntryContainer.java | 35 +
.../fit/serializer/JsonFeedContainer.java | 35 +
.../olingo/fit/utils/AbstractJSONUtilities.java | 12 +-
.../olingo/fit/utils/AbstractUtilities.java | 79 +-
.../olingo/fit/utils/AbstractXMLUtilities.java | 50 +-
.../org/apache/olingo/fit/utils/Accept.java | 11 +-
.../org/apache/olingo/fit/utils/Commons.java | 86 +-
.../org/apache/olingo/fit/utils/Constants.java | 8 +-
.../org/apache/olingo/fit/utils/DataBinder.java | 276 ++++
.../org/apache/olingo/fit/utils/FSManager.java | 50 +-
.../apache/olingo/fit/utils/ODataVersion.java | 35 -
.../olingo/fit/utils/v3/JSONUtilities.java | 4 +-
.../olingo/fit/utils/v3/XMLUtilities.java | 168 +-
.../olingo/fit/utils/v4/JSONUtilities.java | 4 +-
.../olingo/fit/utils/v4/XMLUtilities.java | 123 +-
fit/src/main/resources/V30/Car/12/$value.bin | 0
.../main/resources/V30/Car/12/entity.full.json | 13 +
fit/src/main/resources/V30/Car/12/entity.xml | 39 +
fit/src/main/resources/V30/Car/14/$value.bin | 0
.../main/resources/V30/Car/14/entity.full.json | 13 +
fit/src/main/resources/V30/Car/14/entity.xml | 39 +
fit/src/main/resources/V30/Car/15/$value.bin | 0
.../main/resources/V30/Car/15/entity.full.json | 13 +
fit/src/main/resources/V30/Car/15/entity.xml | 39 +
.../main/resources/V30/Car/16/entity.full.json | 14 +
fit/src/main/resources/V30/Car/16/entity.xml | 45 +
fit/src/main/resources/V30/Car/feed.full.json | 297 ++++
fit/src/main/resources/V30/Car/feed.xml | 459 ++++++
.../Car/filter/((1 add VIN) eq 16).full.json | 1 +
.../V30/Car/filter/((1 add VIN) eq 16).xml | 45 +
.../Car/filter/((VIN add 1) eq 16).full.json | 1 +
.../V30/Car/filter/((VIN add 1) eq 16).xml | 45 +
.../((VIN lt 16) and (VIN gt 12)).full.json | 1 +
.../filter/((VIN lt 16) and (VIN gt 12)).xml | 81 +
.../Car/filter/(16 eq (1 add VIN)).full.json | 1 +
.../V30/Car/filter/(16 eq (1 add VIN)).xml | 45 +
.../V30/Car/filter/(VIN lt 16).full.json | 1 +
.../resources/V30/Car/filter/(VIN lt 16).xml | 117 ++
...ngth(Description) gt (VIN add 10)).full.json | 1 +
.../(length(Description) gt (VIN add 10)).xml | 117 ++
.../V30/Car/filter/VIN add 5 lt 11.full.json | 1 +
.../V30/Car/filter/VIN add 5 lt 11.xml | 32 +
.../V30/Car/filter/VIN div 2 le 8.full.json | 1 +
.../resources/V30/Car/filter/VIN div 2 le 8.xml | 22 +
.../filter/VIN le 18 and VIN gt 12.full.json | 1 +
.../V30/Car/filter/VIN le 18 and VIN gt 12.xml | 22 +
.../V30/Car/filter/VIN mul 2 le 30.full.json | 1 +
.../V30/Car/filter/VIN mul 2 le 30.xml | 22 +
...not (((VIN ge 16) or (VIN le 12))).full.json | 1 +
.../not (((VIN ge 16) or (VIN le 12))).xml | 81 +
.../startswith(Description,'cen').full.json | 1 +
.../filter/startswith(Description,'cen').xml | 45 +
.../VIN desc/filter/(VIN lt 16).full.json | 9 +
.../Car/orderby/VIN desc/filter/(VIN lt 16).xml | 117 ++
.../V30/ComputerDetail/-10/entity.full.json | 23 +
.../resources/V30/ComputerDetail/-10/entity.xml | 44 +
.../(month(PurchaseDate) eq 12).full.json | 1 +
.../filter/(month(PurchaseDate) eq 12).xml | 64 +
.../filter/day(PurchaseDate) eq 15.full.json | 1 +
.../filter/day(PurchaseDate) eq 15.xml | 22 +
.../filter/hour(PurchaseDate) eq 1.full.json | 1 +
.../filter/hour(PurchaseDate) eq 1.xml | 22 +
.../filter/minute(PurchaseDate) eq 33.full.json | 1 +
.../filter/minute(PurchaseDate) eq 33.xml | 22 +
.../filter/month(PurchaseDate) eq 12.full.json | 1 +
.../filter/month(PurchaseDate) eq 12.xml | 22 +
.../filter/second(PurchaseDate) eq 35.full.json | 1 +
.../filter/second(PurchaseDate) eq 35.xml | 22 +
.../filter/year(PurchaseDate) eq 2020.full.json | 1 +
.../filter/year(PurchaseDate) eq 2020.xml | 22 +
.../resources/V30/Customer/-10/entity.full.json | 673 ++++++++
.../main/resources/V30/Customer/-10/entity.xml | 516 +++++++
.../V30/Customer/-10/links/Info.full.json | 4 +
.../resources/V30/Customer/-10/links/Info.xml | 22 +
.../Customer/-10/links/Logins('3').full.json | 4 +
.../V30/Customer/-10/links/Logins.full.json | 12 +
.../resources/V30/Customer/-10/links/Logins.xml | 25 +
.../Customer/-10/links/Orders(-10).full.json | 4 +
.../V30/Customer/-10/links/Orders.full.json | 13 +
.../resources/V30/Customer/-10/links/Orders.xml | 26 +
.../resources/V30/Customer/-7/entity.full.json | 487 ++++++
.../main/resources/V30/Customer/-7/entity.xml | 381 +++++
.../resources/V30/Customer/-9/entity.full.json | 750 +++++++++
.../main/resources/V30/Customer/-9/entity.xml | 565 +++++++
.../main/resources/V30/Customer/feed.full.json | 893 +++++++++++
fit/src/main/resources/V30/Customer/feed.xml | 704 +++++++++
....PhoneNumber,'ODataJClient') eq 1).full.json | 1 +
...ePhone.PhoneNumber,'ODataJClient') eq 1).xml | 30 +
...ne.PhoneNumber,'lccvussrv') ne -1).full.json | 1 +
...omePhone.PhoneNumber,'lccvussrv') ne -1).xml | 600 ++++++++
.../Customer/filter/CustomerId eq -10.full.json | 678 ++++++++
.../V30/Customer/filter/CustomerId eq -10.xml | 522 +++++++
.../Customer/filter/CustomerId gt -10.full.json | 1 +
.../V30/Customer/filter/CustomerId gt -10.xml | 740 +++++++++
.../Customer/filter/CustomerId lt -10.full.json | 1 +
.../V30/Customer/filter/CustomerId lt -10.xml | 30 +
.../isof(Name,'Edm.String') eq true.full.json | 1 +
.../filter/isof(Name,'Edm.String') eq true.xml | 1065 +++++++++++++
.../not endswith(Name,'Chandan').full.json | 1 +
.../filter/not endswith(Name,'Chandan').xml | 1065 +++++++++++++
.../V30/Customer/skiptoken/-1.full.json | 6 +
.../resources/V30/Customer/skiptoken/-1.xml | 30 +
.../V30/Customer/skiptoken/-10.full.json | 978 ++++++++++++
.../resources/V30/Customer/skiptoken/-10.xml | 953 ++++++++++++
.../V30/Customer/skiptoken/-3.full.json | 776 ++++++++++
.../resources/V30/Customer/skiptoken/-3.xml | 613 ++++++++
.../V30/Customer/skiptoken/-5.full.json | 1444 ++++++++++++++++++
.../resources/V30/Customer/skiptoken/-5.xml | 1104 +++++++++++++
.../V30/Customer/skiptoken/-7.full.json | 1296 ++++++++++++++++
.../resources/V30/Customer/skiptoken/-7.xml | 990 ++++++++++++
.../V30/Customer/skiptoken/-9.full.json | 715 +++++++++
.../resources/V30/Customer/skiptoken/-9.xml | 559 +++++++
.../V30/CustomerInfo/11/entity.full.json | 11 +
.../resources/V30/CustomerInfo/11/entity.xml | 37 +
.../V30/CustomerInfo/12/entity.full.json | 11 +
.../resources/V30/CustomerInfo/12/entity.xml | 37 +
.../V30/EdmBooleanSet/true/entity.full.json | 1 +
.../resources/V30/EdmBooleanSet/true/entity.xml | 36 +
.../V30/EdmByteSet/255/entity.full.json | 1 +
.../resources/V30/EdmByteSet/255/entity.xml | 36 +
.../entity.full.json | 1 +
.../79228162514264337593543950335M/entity.xml | 36 +
.../1.7976931348623157E308D/entity.full.json | 1 +
.../1.7976931348623157E308D/entity.xml | 36 +
.../entity.full.json | 1 +
.../entity.xml | 36 +
.../V30/EdmInt16Set/32767/entity.full.json | 1 +
.../resources/V30/EdmInt16Set/32767/entity.xml | 36 +
.../EdmInt32Set/-2147483648/entity.full.json | 1 +
.../V30/EdmInt32Set/-2147483648/entity.xml | 36 +
.../9223372036854775807L/entity.full.json | 1 +
.../EdmInt64Set/9223372036854775807L/entity.xml | 36 +
.../EdmSingleSet/3.4028235E38f/entity.full.json | 1 +
.../V30/EdmSingleSet/3.4028235E38f/entity.xml | 36 +
.../V30/EdmStringSet/'$'/entity.full.json | 1 +
.../resources/V30/EdmStringSet/'$'/entity.xml | 36 +
.../entity.full.json | 1 +
.../entity.xml | 36 +
...ionReturnsCollectionOfComplexTypes.full.json | 1 +
...rojectionReturnsCollectionOfComplexTypes.xml | 618 ++++++++
.../resources/V30/GetArgumentPlusOne.full.json | 4 +
.../main/resources/V30/GetArgumentPlusOne.xml | 23 +
.../resources/V30/GetPrimitiveString.full.json | 1 +
.../main/resources/V30/GetPrimitiveString.xml | 23 +
.../resources/V30/GetSpecificCustomer.full.json | 137 ++
.../main/resources/V30/GetSpecificCustomer.xml | 200 +++
.../V30/InStreamErrorGetCustomer.full.json | 1 +
.../resources/V30/InStreamErrorGetCustomer.xml | 578 +++++++
.../resources/V30/Login/'3'/entity.full.json | 13 +
fit/src/main/resources/V30/Login/'3'/entity.xml | 42 +
.../V30/Message/1 -10/entity.full.json | 17 +
.../main/resources/V30/Message/1 -10/entity.xml | 46 +
.../resources/V30/Order/-10/entity.full.json | 11 +
fit/src/main/resources/V30/Order/-10/entity.xml | 40 +
.../resources/V30/Order/-7/entity.full.json | 17 +
fit/src/main/resources/V30/Order/-7/entity.xml | 43 +
.../resources/V30/Order/-8/entity.full.json | 17 +
fit/src/main/resources/V30/Order/-8/entity.xml | 43 +
.../resources/V30/Order/-9/entity.full.json | 17 +
fit/src/main/resources/V30/Order/-9/entity.xml | 43 +
.../V30/OrderLine/-10 -10/entity.full.json | 14 +
.../resources/V30/OrderLine/-10 -10/entity.xml | 42 +
.../resources/V30/OrderLine/-10 -10/etag.txt | 1 +
.../feed.full.json | 1 +
.../feed.xml | 200 +++
.../feed.full.json | 80 +
.../feed.xml | 131 ++
.../filter/PersonId sub 2 lt -10.full.json | 1 +
.../V30/Person/filter/PersonId sub 2 lt -10.xml | 79 +
...iaDefaultService.SpecialEmployee').full.json | 1 +
....AstoriaDefaultService.SpecialEmployee').xml | 131 ++
.../resources/V30/Product/-10/entity.full.json | 51 +
.../main/resources/V30/Product/-10/entity.xml | 61 +
fit/src/main/resources/V30/Product/-10/etag.txt | 1 +
.../resources/V30/Product/-6/entity.full.json | 51 +
.../main/resources/V30/Product/-6/entity.xml | 61 +
fit/src/main/resources/V30/Product/-6/etag.txt | 1 +
.../resources/V30/Product/-7/entity.full.json | 51 +
.../main/resources/V30/Product/-7/entity.xml | 61 +
fit/src/main/resources/V30/Product/-7/etag.txt | 1 +
.../V30/Product/-7/links/Photos.full.json | 12 +
.../resources/V30/Product/-9/entity.full.json | 60 +
.../main/resources/V30/Product/-9/entity.xml | 68 +
fit/src/main/resources/V30/Product/-9/etag.txt | 1 +
.../main/resources/V30/Product/feed.full.json | 452 ++++++
fit/src/main/resources/V30/Product/feed.xml | 415 +++++
.../ceiling(Dimensions.Width) eq 7338.full.json | 1 +
.../ceiling(Dimensions.Width) eq 7338.xml | 68 +
...', newname') eq 'kdcuklu, newname'.full.json | 1 +
...tion, ', newname') eq 'kdcuklu, newname'.xml | 74 +
.../floor(Dimensions.Width) eq 7337.full.json | 1 +
.../filter/floor(Dimensions.Width) eq 7337.xml | 68 +
.../indexof(Description, 'k') eq 0.full.json | 1 +
.../filter/indexof(Description, 'k') eq 0.xml | 117 ++
.../filter/length(Description) eq 7.full.json | 1 +
.../Product/filter/length(Description) eq 7.xml | 74 +
.../round(Dimensions.Width) eq 7338.full.json | 1 +
.../filter/round(Dimensions.Width) eq 7338.xml | 68 +
...artswith(Description, 'k') eq true.full.json | 1 +
.../startswith(Description, 'k') eq true.xml | 117 ++
...of('kdcuklu', Description) eq true.full.json | 1 +
...stringof('kdcuklu', Description) eq true.xml | 74 +
.../toupper(Description) eq 'KDCUKLU'.full.json | 1 +
.../toupper(Description) eq 'KDCUKLU'.xml | 74 +
.../V30/ProductPhoto/-2 -2/entity.full.json | 10 +
.../resources/V30/ProductPhoto/-2 -2/entity.xml | 39 +
.../V30/ProductPhoto/-3 -3/entity.full.json | 10 +
.../resources/V30/ProductPhoto/-3 -3/entity.xml | 38 +
.../resources/V30/actionOverloadingMetadata.xml | 708 +++++++++
.../actionOverloadingRetrieveProduct.full.json | 1 +
.../V30/actionOverloadingRetrieveProduct.xml | 24 +
fit/src/main/resources/V30/badRequest.json | 17 +
fit/src/main/resources/V30/badRequest.xml | 30 +
fit/src/main/resources/V30/largeMetadata.xml | 42 +
fit/src/main/resources/V30/metadata.xml | 719 +++++++++
fit/src/main/resources/V30/notFound.json | 11 +
fit/src/main/resources/V30/notFound.xml | 25 +
fit/src/main/resources/V30/openTypeMetadata.xml | 67 +
fit/src/main/resources/V30/services.full.json | 102 ++
fit/src/main/resources/V30/services.xml | 98 ++
.../resources/V30/unsupportedMediaType.json | 17 +
.../main/resources/V30/unsupportedMediaType.xml | 34 +
.../main/resources/V40/Company/entity.full.json | 38 +
fit/src/main/resources/V40/Company/entity.xml | 49 +
.../resources/V40/Customers/1/entity.full.json | 67 +
.../main/resources/V40/Customers/1/entity.xml | 67 +
.../V40/Customers/1/links/Company.full.json | 4 +
.../resources/V40/Customers/1/links/Company.xml | 22 +
.../V40/Customers/1/links/Orders.full.json | 10 +
.../resources/V40/Customers/1/links/Orders.xml | 25 +
.../resources/V40/Orders/8/entity.full.json | 23 +
fit/src/main/resources/V40/Orders/8/entity.xml | 50 +
fit/src/main/resources/V40/Orders/8/etag.txt | 1 +
.../resources/V40/Orders/8/links/.full.json | 4 +
.../Orders/8/links/CustomerForOrder.full.json | 4 +
.../V40/Orders/8/links/CustomerForOrder.xml | 22 +
.../main/resources/V40/Orders/feed.full.json | 48 +
fit/src/main/resources/V40/Orders/feed.xml | 72 +
.../resources/V40/People/5/entity.full.json | 51 +
fit/src/main/resources/V40/People/5/entity.xml | 55 +
.../main/resources/V40/People/feed.full.json | 333 ++++
fit/src/main/resources/V40/People/feed.xml | 219 +++
.../V40/ProductDetails/6 1/entity.full.json | 19 +
.../resources/V40/ProductDetails/6 1/entity.xml | 41 +
fit/src/main/resources/V40/badRequest.json | 17 +
fit/src/main/resources/V40/badRequest.xml | 30 +
fit/src/main/resources/V40/metadata.xml | 438 ++++++
.../main/resources/V40/northwind-metadata.xml | 91 ++
.../resources/V40/northwindExt-metadata.xml | 408 +++++
fit/src/main/resources/V40/notFound.json | 11 +
fit/src/main/resources/V40/notFound.xml | 25 +
...JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json | 4 +
.../T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.xml | 22 +
fit/src/main/resources/V40/services.full.json | 126 ++
fit/src/main/resources/V40/services.xml | 102 ++
.../resources/V40/unsupportedMediaType.json | 17 +
.../main/resources/V40/unsupportedMediaType.xml | 34 +
fit/src/main/resources/v3/Car/12/$value.bin | 0
.../main/resources/v3/Car/12/entity.full.json | 13 -
fit/src/main/resources/v3/Car/12/entity.xml | 39 -
fit/src/main/resources/v3/Car/14/$value.bin | 0
.../main/resources/v3/Car/14/entity.full.json | 13 -
fit/src/main/resources/v3/Car/14/entity.xml | 39 -
fit/src/main/resources/v3/Car/15/$value.bin | 0
.../main/resources/v3/Car/15/entity.full.json | 13 -
fit/src/main/resources/v3/Car/15/entity.xml | 39 -
.../main/resources/v3/Car/16/entity.full.json | 14 -
fit/src/main/resources/v3/Car/16/entity.xml | 45 -
fit/src/main/resources/v3/Car/feed.full.json | 297 ----
fit/src/main/resources/v3/Car/feed.xml | 459 ------
.../v3/Car/filter/((1 add VIN) eq 16).full.json | 1 -
.../v3/Car/filter/((1 add VIN) eq 16).xml | 45 -
.../v3/Car/filter/((VIN add 1) eq 16).full.json | 1 -
.../v3/Car/filter/((VIN add 1) eq 16).xml | 45 -
.../((VIN lt 16) and (VIN gt 12)).full.json | 1 -
.../filter/((VIN lt 16) and (VIN gt 12)).xml | 81 -
.../v3/Car/filter/(16 eq (1 add VIN)).full.json | 1 -
.../v3/Car/filter/(16 eq (1 add VIN)).xml | 45 -
.../v3/Car/filter/(VIN lt 16).full.json | 1 -
.../resources/v3/Car/filter/(VIN lt 16).xml | 117 --
...ngth(Description) gt (VIN add 10)).full.json | 1 -
.../(length(Description) gt (VIN add 10)).xml | 117 --
.../v3/Car/filter/VIN add 5 lt 11.full.json | 1 -
.../resources/v3/Car/filter/VIN add 5 lt 11.xml | 32 -
.../v3/Car/filter/VIN div 2 le 8.full.json | 1 -
.../resources/v3/Car/filter/VIN div 2 le 8.xml | 22 -
.../filter/VIN le 18 and VIN gt 12.full.json | 1 -
.../v3/Car/filter/VIN le 18 and VIN gt 12.xml | 22 -
.../v3/Car/filter/VIN mul 2 le 30.full.json | 1 -
.../resources/v3/Car/filter/VIN mul 2 le 30.xml | 22 -
...not (((VIN ge 16) or (VIN le 12))).full.json | 1 -
.../not (((VIN ge 16) or (VIN le 12))).xml | 81 -
.../startswith(Description,'cen').full.json | 1 -
.../filter/startswith(Description,'cen').xml | 45 -
.../VIN desc/filter/(VIN lt 16).full.json | 9 -
.../Car/orderby/VIN desc/filter/(VIN lt 16).xml | 117 --
.../v3/ComputerDetail/-10/entity.full.json | 23 -
.../resources/v3/ComputerDetail/-10/entity.xml | 44 -
.../(month(PurchaseDate) eq 12).full.json | 1 -
.../filter/(month(PurchaseDate) eq 12).xml | 64 -
.../filter/day(PurchaseDate) eq 15.full.json | 1 -
.../filter/day(PurchaseDate) eq 15.xml | 22 -
.../filter/hour(PurchaseDate) eq 1.full.json | 1 -
.../filter/hour(PurchaseDate) eq 1.xml | 22 -
.../filter/minute(PurchaseDate) eq 33.full.json | 1 -
.../filter/minute(PurchaseDate) eq 33.xml | 22 -
.../filter/month(PurchaseDate) eq 12.full.json | 1 -
.../filter/month(PurchaseDate) eq 12.xml | 22 -
.../filter/second(PurchaseDate) eq 35.full.json | 1 -
.../filter/second(PurchaseDate) eq 35.xml | 22 -
.../filter/year(PurchaseDate) eq 2020.full.json | 1 -
.../filter/year(PurchaseDate) eq 2020.xml | 22 -
.../resources/v3/Customer/-10/entity.full.json | 673 --------
.../main/resources/v3/Customer/-10/entity.xml | 516 -------
.../v3/Customer/-10/links/Info.full.json | 4 -
.../resources/v3/Customer/-10/links/Info.xml | 22 -
.../v3/Customer/-10/links/Logins('3').full.json | 4 -
.../v3/Customer/-10/links/Logins.full.json | 12 -
.../resources/v3/Customer/-10/links/Logins.xml | 25 -
.../v3/Customer/-10/links/Orders(-10).full.json | 4 -
.../v3/Customer/-10/links/Orders.full.json | 13 -
.../resources/v3/Customer/-10/links/Orders.xml | 26 -
.../resources/v3/Customer/-7/entity.full.json | 487 ------
.../main/resources/v3/Customer/-7/entity.xml | 381 -----
.../resources/v3/Customer/-9/entity.full.json | 750 ---------
.../main/resources/v3/Customer/-9/entity.xml | 565 -------
.../main/resources/v3/Customer/feed.full.json | 893 -----------
fit/src/main/resources/v3/Customer/feed.xml | 704 ---------
....PhoneNumber,'ODataJClient') eq 1).full.json | 1 -
...ePhone.PhoneNumber,'ODataJClient') eq 1).xml | 30 -
...ne.PhoneNumber,'lccvussrv') ne -1).full.json | 1 -
...omePhone.PhoneNumber,'lccvussrv') ne -1).xml | 600 --------
.../Customer/filter/CustomerId eq -10.full.json | 678 --------
.../v3/Customer/filter/CustomerId eq -10.xml | 522 -------
.../Customer/filter/CustomerId gt -10.full.json | 1 -
.../v3/Customer/filter/CustomerId gt -10.xml | 740 ---------
.../Customer/filter/CustomerId lt -10.full.json | 1 -
.../v3/Customer/filter/CustomerId lt -10.xml | 30 -
.../isof(Name,'Edm.String') eq true.full.json | 1 -
.../filter/isof(Name,'Edm.String') eq true.xml | 1065 -------------
.../not endswith(Name,'Chandan').full.json | 1 -
.../filter/not endswith(Name,'Chandan').xml | 1065 -------------
.../v3/Customer/skiptoken/-1.full.json | 6 -
.../main/resources/v3/Customer/skiptoken/-1.xml | 30 -
.../v3/Customer/skiptoken/-10.full.json | 978 ------------
.../resources/v3/Customer/skiptoken/-10.xml | 953 ------------
.../v3/Customer/skiptoken/-3.full.json | 776 ----------
.../main/resources/v3/Customer/skiptoken/-3.xml | 613 --------
.../v3/Customer/skiptoken/-5.full.json | 1444 ------------------
.../main/resources/v3/Customer/skiptoken/-5.xml | 1104 -------------
.../v3/Customer/skiptoken/-7.full.json | 1296 ----------------
.../main/resources/v3/Customer/skiptoken/-7.xml | 990 ------------
.../v3/Customer/skiptoken/-9.full.json | 715 ---------
.../main/resources/v3/Customer/skiptoken/-9.xml | 559 -------
.../v3/CustomerInfo/11/entity.full.json | 11 -
.../resources/v3/CustomerInfo/11/entity.xml | 37 -
.../v3/CustomerInfo/12/entity.full.json | 11 -
.../resources/v3/CustomerInfo/12/entity.xml | 37 -
.../v3/EdmBooleanSet/true/entity.full.json | 1 -
.../resources/v3/EdmBooleanSet/true/entity.xml | 36 -
.../v3/EdmByteSet/255/entity.full.json | 1 -
.../main/resources/v3/EdmByteSet/255/entity.xml | 36 -
.../entity.full.json | 1 -
.../79228162514264337593543950335M/entity.xml | 36 -
.../1.7976931348623157E308D/entity.full.json | 1 -
.../1.7976931348623157E308D/entity.xml | 36 -
.../entity.full.json | 1 -
.../entity.xml | 36 -
.../v3/EdmInt16Set/32767/entity.full.json | 1 -
.../resources/v3/EdmInt16Set/32767/entity.xml | 36 -
.../v3/EdmInt32Set/-2147483648/entity.full.json | 1 -
.../v3/EdmInt32Set/-2147483648/entity.xml | 36 -
.../9223372036854775807L/entity.full.json | 1 -
.../EdmInt64Set/9223372036854775807L/entity.xml | 36 -
.../EdmSingleSet/3.4028235E38f/entity.full.json | 1 -
.../v3/EdmSingleSet/3.4028235E38f/entity.xml | 36 -
.../v3/EdmStringSet/'$'/entity.full.json | 1 -
.../resources/v3/EdmStringSet/'$'/entity.xml | 36 -
.../entity.full.json | 1 -
.../entity.xml | 36 -
...ionReturnsCollectionOfComplexTypes.full.json | 1 -
...rojectionReturnsCollectionOfComplexTypes.xml | 618 --------
.../resources/v3/GetArgumentPlusOne.full.json | 4 -
.../main/resources/v3/GetArgumentPlusOne.xml | 23 -
.../resources/v3/GetPrimitiveString.full.json | 1 -
.../main/resources/v3/GetPrimitiveString.xml | 23 -
.../resources/v3/GetSpecificCustomer.full.json | 137 --
.../main/resources/v3/GetSpecificCustomer.xml | 200 ---
.../v3/InStreamErrorGetCustomer.full.json | 1 -
.../resources/v3/InStreamErrorGetCustomer.xml | 578 -------
.../resources/v3/Login/'3'/entity.full.json | 13 -
fit/src/main/resources/v3/Login/'3'/entity.xml | 42 -
.../resources/v3/Message/1 -10/entity.full.json | 17 -
.../main/resources/v3/Message/1 -10/entity.xml | 46 -
.../resources/v3/Order/-10/entity.full.json | 11 -
fit/src/main/resources/v3/Order/-10/entity.xml | 40 -
.../main/resources/v3/Order/-7/entity.full.json | 17 -
fit/src/main/resources/v3/Order/-7/entity.xml | 43 -
.../main/resources/v3/Order/-8/entity.full.json | 17 -
fit/src/main/resources/v3/Order/-8/entity.xml | 43 -
.../main/resources/v3/Order/-9/entity.full.json | 17 -
fit/src/main/resources/v3/Order/-9/entity.xml | 43 -
.../v3/OrderLine/-10 -10/entity.full.json | 14 -
.../resources/v3/OrderLine/-10 -10/entity.xml | 42 -
.../resources/v3/OrderLine/-10 -10/etag.txt | 1 -
.../feed.full.json | 1 -
.../feed.xml | 200 ---
.../feed.full.json | 80 -
.../feed.xml | 131 --
.../filter/PersonId sub 2 lt -10.full.json | 1 -
.../v3/Person/filter/PersonId sub 2 lt -10.xml | 79 -
...iaDefaultService.SpecialEmployee').full.json | 1 -
....AstoriaDefaultService.SpecialEmployee').xml | 131 --
.../resources/v3/Product/-10/entity.full.json | 51 -
.../main/resources/v3/Product/-10/entity.xml | 61 -
fit/src/main/resources/v3/Product/-10/etag.txt | 1 -
.../resources/v3/Product/-6/entity.full.json | 51 -
fit/src/main/resources/v3/Product/-6/entity.xml | 61 -
fit/src/main/resources/v3/Product/-6/etag.txt | 1 -
.../resources/v3/Product/-7/entity.full.json | 51 -
fit/src/main/resources/v3/Product/-7/entity.xml | 61 -
fit/src/main/resources/v3/Product/-7/etag.txt | 1 -
.../v3/Product/-7/links/Photos.full.json | 12 -
.../resources/v3/Product/-9/entity.full.json | 60 -
fit/src/main/resources/v3/Product/-9/entity.xml | 68 -
fit/src/main/resources/v3/Product/-9/etag.txt | 1 -
.../main/resources/v3/Product/feed.full.json | 452 ------
fit/src/main/resources/v3/Product/feed.xml | 410 -----
.../ceiling(Dimensions.Width) eq 7338.full.json | 1 -
.../ceiling(Dimensions.Width) eq 7338.xml | 68 -
...', newname') eq 'kdcuklu, newname'.full.json | 1 -
...tion, ', newname') eq 'kdcuklu, newname'.xml | 74 -
.../floor(Dimensions.Width) eq 7337.full.json | 1 -
.../filter/floor(Dimensions.Width) eq 7337.xml | 68 -
.../indexof(Description, 'k') eq 0.full.json | 1 -
.../filter/indexof(Description, 'k') eq 0.xml | 117 --
.../filter/length(Description) eq 7.full.json | 1 -
.../Product/filter/length(Description) eq 7.xml | 74 -
.../round(Dimensions.Width) eq 7338.full.json | 1 -
.../filter/round(Dimensions.Width) eq 7338.xml | 68 -
...artswith(Description, 'k') eq true.full.json | 1 -
.../startswith(Description, 'k') eq true.xml | 117 --
...of('kdcuklu', Description) eq true.full.json | 1 -
...stringof('kdcuklu', Description) eq true.xml | 74 -
.../toupper(Description) eq 'KDCUKLU'.full.json | 1 -
.../toupper(Description) eq 'KDCUKLU'.xml | 74 -
.../v3/ProductPhoto/-2 -2/entity.full.json | 10 -
.../resources/v3/ProductPhoto/-2 -2/entity.xml | 39 -
.../v3/ProductPhoto/-3 -3/entity.full.json | 10 -
.../resources/v3/ProductPhoto/-3 -3/entity.xml | 38 -
.../resources/v3/actionOverloadingMetadata.xml | 708 ---------
.../actionOverloadingRetrieveProduct.full.json | 1 -
.../v3/actionOverloadingRetrieveProduct.xml | 24 -
fit/src/main/resources/v3/badRequest.json | 17 -
fit/src/main/resources/v3/badRequest.xml | 30 -
fit/src/main/resources/v3/largeMetadata.xml | 42 -
fit/src/main/resources/v3/metadata.xml | 719 ---------
fit/src/main/resources/v3/notFound.json | 11 -
fit/src/main/resources/v3/notFound.xml | 25 -
fit/src/main/resources/v3/openTypeMetadata.xml | 67 -
fit/src/main/resources/v3/services.full.json | 102 --
fit/src/main/resources/v3/services.xml | 98 --
.../main/resources/v3/unsupportedMediaType.json | 17 -
.../main/resources/v3/unsupportedMediaType.xml | 34 -
.../main/resources/v4/Company/entity.full.json | 38 -
fit/src/main/resources/v4/Company/entity.xml | 49 -
.../resources/v4/Customers/1/entity.full.json | 67 -
.../main/resources/v4/Customers/1/entity.xml | 67 -
.../v4/Customers/1/links/Company.full.json | 4 -
.../resources/v4/Customers/1/links/Company.xml | 22 -
.../v4/Customers/1/links/Orders.full.json | 10 -
.../resources/v4/Customers/1/links/Orders.xml | 25 -
.../main/resources/v4/Orders/8/entity.full.json | 23 -
fit/src/main/resources/v4/Orders/8/entity.xml | 50 -
fit/src/main/resources/v4/Orders/8/etag.txt | 1 -
.../main/resources/v4/Orders/8/links/.full.json | 4 -
.../Orders/8/links/CustomerForOrder.full.json | 4 -
.../v4/Orders/8/links/CustomerForOrder.xml | 22 -
fit/src/main/resources/v4/Orders/feed.full.json | 48 -
fit/src/main/resources/v4/Orders/feed.xml | 72 -
.../main/resources/v4/People/5/entity.full.json | 51 -
fit/src/main/resources/v4/People/5/entity.xml | 55 -
fit/src/main/resources/v4/People/feed.full.json | 333 ----
fit/src/main/resources/v4/People/feed.xml | 219 ---
.../v4/ProductDetails/6 1/entity.full.json | 19 -
.../resources/v4/ProductDetails/6 1/entity.xml | 41 -
fit/src/main/resources/v4/badRequest.json | 17 -
fit/src/main/resources/v4/badRequest.xml | 30 -
fit/src/main/resources/v4/metadata.xml | 438 ------
.../main/resources/v4/northwind-metadata.xml | 91 --
.../main/resources/v4/northwindExt-metadata.xml | 408 -----
fit/src/main/resources/v4/notFound.json | 11 -
fit/src/main/resources/v4/notFound.xml | 25 -
...JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json | 4 -
.../T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.xml | 22 -
fit/src/main/resources/v4/services.full.json | 126 --
fit/src/main/resources/v4/services.xml | 102 --
.../main/resources/v4/unsupportedMediaType.json | 17 -
.../main/resources/v4/unsupportedMediaType.xml | 34 -
.../client/core/op/AbstractODataBinder.java | 20 +-
.../core/it/v3/EntityCreateTestITCase.java | 2 -
.../client/core/it/v3/EntitySetTestITCase.java | 25 +
.../core/it/v3/PrimitiveKeysTestITCase.java | 2 +-
.../core/it/v4/EntityRetrieveTestITCase.java | 3 -
.../client/core/it/v4/EntitySetTestITCase.java | 25 +
.../core/data/AbstractJsonDeserializer.java | 52 +-
.../core/data/AbstractJsonSerializer.java | 48 +-
.../commons/core/data/AbstractODataObject.java | 2 +-
.../commons/core/data/AtomSerializer.java | 104 +-
.../core/data/JSONEntryDeserializer.java | 5 +-
.../commons/core/data/JSONEntrySerializer.java | 34 +
.../olingo/commons/core/data/JSONFeedImpl.java | 2 +-
.../commons/core/data/JSONFeedSerializer.java | 28 +-
.../core/data/JSONPropertySerializer.java | 10 +
.../core/data/ODataJacksonDeserializer.java | 7 +-
.../core/data/ODataJacksonSerializer.java | 16 +-
.../commons/core/op/AbstractJacksonTool.java | 13 +-
.../core/op/InjectableSerializerProvider.java | 3 +-
536 files changed, 33365 insertions(+), 31598 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/pom.xml
----------------------------------------------------------------------
diff --git a/fit/pom.xml b/fit/pom.xml
index d4e1e90..e6030f5 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -40,6 +40,18 @@
</properties>
<dependencies>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-commons-core</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.fasterxml</groupId>
+ <artifactId>aalto-xml</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
<!-- Stax -->
<dependency>
<groupId>stax</groupId>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
index e247cf2..f128981 100644
--- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
+++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
@@ -18,15 +18,35 @@
*/
package org.apache.olingo.fit;
+import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.data.AtomDeserializer;
+import org.apache.olingo.commons.core.data.AtomFeedImpl;
+import org.apache.olingo.commons.core.data.LinkImpl;
+import org.apache.olingo.fit.metadata.Metadata;
+import org.apache.olingo.fit.serializer.JsonFeedContainer;
+import org.apache.olingo.fit.serializer.JsonEntryContainer;
+import org.apache.olingo.fit.utils.ConstantKey;
+import org.apache.olingo.fit.utils.Constants;
+import org.apache.olingo.fit.utils.DataBinder;
+
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
+import java.io.OutputStreamWriter;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.Collections;
-import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -51,18 +71,28 @@ import javax.ws.rs.core.UriInfo;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.AtomPropertyImpl;
+import org.apache.olingo.commons.core.data.AtomSerializer;
+import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.core.data.JSONFeedImpl;
+import org.apache.olingo.commons.core.data.NullValueImpl;
+import org.apache.olingo.commons.core.data.PrimitiveValueImpl;
+import org.apache.olingo.fit.metadata.EntitySet;
+import org.apache.olingo.fit.metadata.EntityType;
+import org.apache.olingo.fit.metadata.NavigationProperty;
+import org.apache.olingo.fit.utils.Accept;
+import org.apache.olingo.fit.utils.FSManager;
+
+import org.apache.olingo.fit.utils.Commons;
import org.apache.olingo.fit.methods.MERGE;
import org.apache.olingo.fit.methods.PATCH;
import org.apache.olingo.fit.utils.AbstractJSONUtilities;
import org.apache.olingo.fit.utils.AbstractUtilities;
import org.apache.olingo.fit.utils.AbstractXMLUtilities;
-import org.apache.olingo.fit.utils.Accept;
-import org.apache.olingo.fit.utils.Commons;
-import org.apache.olingo.fit.utils.ConstantKey;
-import org.apache.olingo.fit.utils.Constants;
-import org.apache.olingo.fit.utils.FSManager;
import org.apache.olingo.fit.utils.LinkInfo;
-import org.apache.olingo.fit.utils.ODataVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,9 +103,7 @@ public abstract class AbstractServices {
*/
protected static final Logger LOG = LoggerFactory.getLogger(AbstractServices.class);
- private static final Set<ODataVersion> INITIALIZED = EnumSet.noneOf(ODataVersion.class);
-
- protected final ODataVersion version;
+ protected final ODataServiceVersion version;
protected final AbstractXMLUtilities xml;
@@ -84,9 +112,11 @@ public abstract class AbstractServices {
@Context
protected UriInfo uriInfo;
- public AbstractServices(final ODataVersion version) throws Exception {
+ protected Metadata metadata;
+
+ public AbstractServices(final ODataServiceVersion version) throws Exception {
this.version = version;
- if (ODataVersion.v3 == version) {
+ if (version.compareTo(ODataServiceVersion.V30) <= 0) {
this.xml = new org.apache.olingo.fit.utils.v3.XMLUtilities();
this.json = new org.apache.olingo.fit.utils.v3.JSONUtilities();
} else {
@@ -94,10 +124,7 @@ public abstract class AbstractServices {
this.json = new org.apache.olingo.fit.utils.v4.JSONUtilities();
}
- if (!INITIALIZED.contains(version)) {
- xml.retrieveLinkInfoFromMetadata();
- INITIALIZED.add(version);
- }
+ metadata = Commons.getMetadata(version);
}
/**
@@ -169,7 +196,7 @@ public abstract class AbstractServices {
return utils.getValue().createResponse(
FSManager.instance(version).readFile(Constants.get(version, ConstantKey.REF)
- + File.separatorChar + filename, utils.getKey()),
+ + File.separatorChar + filename, utils.getKey()),
null,
utils.getKey());
} catch (Exception e) {
@@ -216,9 +243,32 @@ public abstract class AbstractServices {
InputStream res =
util.patchEntity(entitySetName, entityId, IOUtils.toInputStream(changes), acceptType, ifMatch);
+
+ final AtomDeserializer atomDeserializer = Commons.getAtomDeserializer(version);
+
+ final ObjectMapper mapper = Commons.getJsonMapper(version);
+
+ final Container<AtomEntryImpl> cres;
+ if (acceptType == Accept.ATOM) {
+ cres = atomDeserializer.read(res, AtomEntryImpl.class);
+ } else {
+ final Container<JSONEntryImpl> jcont = mapper.readValue(res, new TypeReference<JSONEntryImpl>() {
+ });
+ cres = new Container<AtomEntryImpl>(jcont.getContextURL(), jcont.getMetadataETag(),
+ (new DataBinder(version)).getAtomEntry(jcont.getObject()));
+ }
+
+ normalizeAtomEntry(cres.getObject(), entitySetName, entityId);
+
+ final String path = Commons.getEntityBasePath(entitySetName, entityId);
+ FSManager.instance(version).putInMemory(
+ cres, path + File.separatorChar + Constants.get(version, ConstantKey.ENTITY));
+
final Response response;
if ("return-content".equalsIgnoreCase(prefer)) {
- response = xml.createResponse(res, null, acceptType, Response.Status.OK);
+ response = xml.createResponse(
+ util.readEntity(entitySetName, entityId, acceptType).getValue(),
+ null, acceptType, Response.Status.OK);
} else {
res.close();
response = xml.createResponse(null, null, acceptType, Response.Status.NO_CONTENT);
@@ -258,9 +308,28 @@ public abstract class AbstractServices {
res = json.addOrReplaceEntity(entityId, entitySetName, IOUtils.toInputStream(entity));
}
+ final AtomDeserializer atomDeserializer = Commons.getAtomDeserializer(version);
+ final ObjectMapper mapper = Commons.getJsonMapper(version);
+
+ final Container<AtomEntryImpl> cres;
+ if (acceptType == Accept.ATOM) {
+ cres = atomDeserializer.read(res, AtomEntryImpl.class);
+ } else {
+ final Container<JSONEntryImpl> jcont = mapper.readValue(res, new TypeReference<JSONEntryImpl>() {
+ });
+ cres = new Container<AtomEntryImpl>(jcont.getContextURL(), jcont.getMetadataETag(),
+ (new DataBinder(version)).getAtomEntry(jcont.getObject()));
+ }
+
+ final String path = Commons.getEntityBasePath(entitySetName, entityId);
+ FSManager.instance(version).putInMemory(
+ cres, path + File.separatorChar + Constants.get(version, ConstantKey.ENTITY));
+
final Response response;
if ("return-content".equalsIgnoreCase(prefer)) {
- response = xml.createResponse(res, null, acceptType, Response.Status.OK);
+ response = xml.createResponse(
+ getUtilities(acceptType).readEntity(entitySetName, entityId, acceptType).getValue(),
+ null, acceptType, Response.Status.OK);
} else {
res.close();
response = xml.createResponse(null, null, acceptType, Response.Status.NO_CONTENT);
@@ -282,6 +351,7 @@ public abstract class AbstractServices {
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
public Response postNewEntity(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
@PathParam("entitySetName") String entitySetName,
final String entity) {
@@ -297,20 +367,89 @@ public abstract class AbstractServices {
utils = getUtilities(acceptType);
- final InputStream res;
+ final AtomDeserializer atomDeserializer = Commons.getAtomDeserializer(version);
+ final AtomSerializer atomSerializer = Commons.getAtomSerializer(version);
+ final ObjectMapper mapper = Commons.getJsonMapper(version);
+
+ final Container<AtomEntryImpl> container;
+
+ final EntitySet entitySet = metadata.getEntitySet(entitySetName);
+ final AtomEntryImpl entry;
+
+ final String entityKey;
if (utils.isMediaContent(entitySetName)) {
- res = utils.addMediaEntity(entitySetName, IOUtils.toInputStream(entity));
+ entityKey = xml.getDefaultEntryKey(entitySetName, null);
+
+ utils.addMediaEntityValue(entitySetName, entityKey, IOUtils.toInputStream(entity));
+
+ entry = new AtomEntryImpl();
+ entry.setMediaContentType(ContentType.WILDCARD);
+ entry.setType(entitySet.getType());
+
+ final String id = Commons.getMediaContent().get(entitySetName);
+ if (StringUtils.isNotBlank(id)) {
+ final AtomPropertyImpl prop = new AtomPropertyImpl();
+ prop.setName(id);
+ prop.setType(EdmPrimitiveTypeKind.Int32.toString());
+ prop.setValue(new PrimitiveValueImpl(entityKey));
+ entry.getProperties().add(prop);
+ }
+
+ final Link editLink = new LinkImpl();
+ editLink.setHref(Commons.getEntityURI(entitySetName, entityKey));
+ editLink.setRel("edit");
+ editLink.setTitle(entitySetName);
+ entry.setEditLink(editLink);
+
+ entry.setMediaContentSource(editLink.getHref() + "/$value");
+
+ container = new Container<AtomEntryImpl>(null, null, entry);
} else {
- res = utils.addOrReplaceEntity(entitySetName, IOUtils.toInputStream(entity));
+ final Accept contentTypeValue = Accept.parse(contentType, version);
+ entityKey = getUtilities(contentTypeValue).getDefaultEntryKey(entitySetName, IOUtils.toInputStream(entity));
+
+ if (Accept.ATOM == contentTypeValue) {
+ container = atomDeserializer.read(IOUtils.toInputStream(entity), AtomEntryImpl.class);
+ entry = container.getObject();
+ } else {
+ final Container<JSONEntryImpl> jcontainer =
+ mapper.readValue(IOUtils.toInputStream(entity), new TypeReference<JSONEntryImpl>() {
+ });
+
+ entry = (new DataBinder(version)).
+ getAtomEntry(jcontainer.getObject());
+
+ container = new Container<AtomEntryImpl>(
+ jcontainer.getContextURL(),
+ jcontainer.getMetadataETag(),
+ entry);
+ }
}
+ normalizeAtomEntry(entry, entitySetName, entityKey);
+
+ final ByteArrayOutputStream content = new ByteArrayOutputStream();
+ OutputStreamWriter writer = new OutputStreamWriter(content, Constants.encoding);
+ atomSerializer.write(writer, container);
+ writer.flush();
+ writer.close();
+
+ final InputStream serialization =
+ xml.addOrReplaceEntity(entitySetName, new ByteArrayInputStream(content.toByteArray()));
+
+ final Container<AtomEntryImpl> cres = atomDeserializer.read(serialization, AtomEntryImpl.class);
+
+ final String path = Commons.getEntityBasePath(entitySetName, entityKey);
+ FSManager.instance(version).putInMemory(
+ cres, path + File.separatorChar + Constants.get(version, ConstantKey.ENTITY));
+
final Response response;
if ("return-no-content".equalsIgnoreCase(prefer)) {
- IOUtils.closeQuietly(res);
response = utils.createResponse(null, null, acceptType, Response.Status.NO_CONTENT);
} else {
- response = utils.createResponse(res, null, acceptType, Response.Status.CREATED);
+ response = utils.createResponse(utils.readEntity(entitySetName, entityKey, acceptType).getValue(),
+ null, acceptType, Response.Status.CREATED);
}
if (StringUtils.isNotBlank(prefer)) {
@@ -349,13 +488,13 @@ public abstract class AbstractServices {
replaceAll("\"Salary\":[0-9]*,", "\"Salary\":0,").
replaceAll("\"Title\":\".*\"", "\"Title\":\"[Sacked]\"").
replaceAll("\\<d:Salary m:type=\"Edm.Int32\"\\>.*\\</d:Salary\\>",
- "<d:Salary m:type=\"Edm.Int32\">0</d:Salary>").
+ "<d:Salary m:type=\"Edm.Int32\">0</d:Salary>").
replaceAll("\\<d:Title\\>.*\\</d:Title\\>", "<d:Title>[Sacked]</d:Title>");
final FSManager fsManager = FSManager.instance(version);
fsManager.putInMemory(IOUtils.toInputStream(newContent, "UTF-8"),
fsManager.getAbsolutePath(Commons.getEntityBasePath("Person", entityId) + Constants.get(version,
- ConstantKey.ENTITY), utils.getKey()));
+ ConstantKey.ENTITY), utils.getKey()));
return utils.getValue().createResponse(null, null, utils.getKey(), Response.Status.NO_CONTENT);
} catch (Exception e) {
@@ -387,7 +526,8 @@ public abstract class AbstractServices {
final StringBuilder path = new StringBuilder(name).
append(File.separatorChar).append(type).
append(File.separatorChar);
- path.append(Commons.getLinkInfo().get(version).isSingleton(name)
+
+ path.append(metadata.getEntitySet(name).isSingleton()
? Constants.get(version, ConstantKey.ENTITY)
: Constants.get(version, ConstantKey.FEED));
@@ -406,9 +546,9 @@ public abstract class AbstractServices {
final Long newSalary = Long.valueOf(salaryMatcher.group(1)) + n;
newContent = newContent.
replaceAll("\"Salary\":" + salaryMatcher.group(1) + ",",
- "\"Salary\":" + newSalary + ",").
+ "\"Salary\":" + newSalary + ",").
replaceAll("\\<d:Salary m:type=\"Edm.Int32\"\\>" + salaryMatcher.group(1) + "</d:Salary\\>",
- "<d:Salary m:type=\"Edm.Int32\">" + newSalary + "</d:Salary>");
+ "<d:Salary m:type=\"Edm.Int32\">" + newSalary + "</d:Salary>");
}
FSManager.instance(version).putInMemory(IOUtils.toInputStream(newContent, "UTF-8"),
@@ -445,7 +585,8 @@ public abstract class AbstractServices {
final StringBuilder path = new StringBuilder(name).
append(File.separatorChar).append(type).
append(File.separatorChar);
- path.append(Commons.getLinkInfo().get(version).isSingleton(name)
+
+ path.append(metadata.getEntitySet(name).isSingleton()
? Constants.get(version, ConstantKey.ENTITY)
: Constants.get(version, ConstantKey.FEED));
@@ -462,7 +603,7 @@ public abstract class AbstractServices {
* @param accept Accept header.
* @param name entity set or function name.
* @param format format query option.
- * @param inlinecount inlinecount query option.
+ * @param count inlinecount query option.
* @param filter filter query option.
* @param orderby orderby query option.
* @param skiptoken skiptoken query option.
@@ -474,7 +615,7 @@ public abstract class AbstractServices {
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@PathParam("name") String name,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
- @QueryParam("$inlinecount") @DefaultValue(StringUtils.EMPTY) String inlinecount,
+ @QueryParam("$inlinecount") @DefaultValue(StringUtils.EMPTY) String count,
@QueryParam("$filter") @DefaultValue(StringUtils.EMPTY) String filter,
@QueryParam("$orderby") @DefaultValue(StringUtils.EMPTY) String orderby,
@QueryParam("$skiptoken") @DefaultValue(StringUtils.EMPTY) String skiptoken) {
@@ -514,35 +655,55 @@ public abstract class AbstractServices {
builder.append(Constants.get(version, ConstantKey.SKIP_TOKEN)).append(File.separatorChar).
append(skiptoken);
} else {
- builder.append(Commons.getLinkInfo().get(version).isSingleton(name)
+ builder.append(metadata.getEntitySet(name).isSingleton()
? Constants.get(version, ConstantKey.ENTITY)
: Constants.get(version, ConstantKey.FEED));
}
- InputStream feed = FSManager.instance(version).readFile(builder.toString(), acceptType);
- if ("allpages".equals(inlinecount)) {
- int count = xml.countAllElements(name);
- feed.close();
- if (acceptType == Accept.ATOM) {
- feed = xml.addAtomInlinecount(
- FSManager.instance(version).readFile(builder.toString(), acceptType),
- count,
- acceptType);
- } else {
- feed = json.addJsonInlinecount(
- FSManager.instance(version).readFile(builder.toString(), acceptType),
- count,
- acceptType);
- }
+ final InputStream feed = FSManager.instance(version).readFile(builder.toString(), Accept.ATOM);
+
+ final AtomDeserializer atomDeserializer = Commons.getAtomDeserializer(version);
+ final AtomSerializer atomSerializer = Commons.getAtomSerializer(version);
+ final Container<Feed> container = atomDeserializer.read(feed, AtomFeedImpl.class);
+
+ setInlineCount(container.getObject(), count);
+
+ final ByteArrayOutputStream content = new ByteArrayOutputStream();
+ final OutputStreamWriter writer = new OutputStreamWriter(content, Constants.encoding);
+
+ if (acceptType == Accept.ATOM) {
+ atomSerializer.write(writer, container);
+ writer.flush();
+ writer.close();
+ } else {
+ final ObjectMapper mapper = Commons.getJsonMapper(version);
+
+ mapper.writeValue(
+ writer, new JsonFeedContainer<JSONFeedImpl>(container.getContextURL(), container.getMetadataETag(),
+ (new DataBinder(version)).getJsonFeed((AtomFeedImpl) container.getObject())));
}
- return xml.createResponse(feed, Commons.getETag(basePath, version), acceptType);
+ return xml.createResponse(new ByteArrayInputStream(content.toByteArray()),
+ Commons.getETag(basePath, version), acceptType);
}
} catch (Exception e) {
return xml.createFaultResponse(accept, e);
}
}
+ protected abstract void setInlineCount(final Feed feed, final String count);
+
+ /**
+ * Retrieve entity with key as segment.
+ *
+ * @param accept Accept header.
+ * @param entitySetName Entity set name.
+ * @param entityId entity id.
+ * @param format format query option.
+ * @param expand expand query option.
+ * @param select select query option.
+ * @return entity.
+ */
@GET
@Path("/Person({entityId})")
public Response getEntity(
@@ -615,31 +776,101 @@ public abstract class AbstractServices {
}
final Map.Entry<String, InputStream> entityInfo =
- utils.getValue().readEntity(entitySetName, entityId, utils.getKey());
+ utils.getValue().readEntity(entitySetName, entityId, Accept.ATOM);
InputStream entity = entityInfo.getValue();
+ final AtomDeserializer atomDeserializer = Commons.getAtomDeserializer(version);
+ final AtomSerializer atomSerializer = Commons.getAtomSerializer(version);
+
+ final Container<Entry> container = atomDeserializer.<Entry, AtomEntryImpl>read(entity, AtomEntryImpl.class);
+ final Entry entry = container.getObject();
+
if (keyAsSegment) {
- entity = utils.getValue().addEditLink(
- entity, entitySetName,
- Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "/" + entityId);
+ final Link editLink = new LinkImpl();
+ editLink.setRel("edit");
+ editLink.setTitle(entitySetName);
+ editLink.setHref(Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "/" + entityId);
+
+ entry.setEditLink(editLink);
}
if (StringUtils.isNotBlank(select)) {
- entity = utils.getValue().selectEntity(entity, select.split(","));
+ final List<String> properties = Arrays.asList(select.split(","));
+ final Set<Property> toBeRemoved = new HashSet<Property>();
+
+ for (Property property : entry.getProperties()) {
+ if (!properties.contains(property.getName())) {
+ toBeRemoved.add(property);
+ }
+ }
+
+ entry.getProperties().removeAll(toBeRemoved);
+
+ final Set<Link> linkToBeRemoved = new HashSet<Link>();
+
+ for (Link link : entry.getNavigationLinks()) {
+ if (!properties.contains(link.getTitle().replaceAll("@.*$", "")) && !properties.contains(link.getTitle())) {
+ linkToBeRemoved.add(link);
+ }
+ }
+
+ entry.getNavigationLinks().removeAll(linkToBeRemoved);
}
if (StringUtils.isNotBlank(expand)) {
- for (String exp : expand.split(",")) {
- entity = utils.getValue().expandEntity(
- entitySetName,
- entityId,
- entity,
- exp);
+ final List<String> links = Arrays.asList(expand.split(","));
+
+ final Map<Link, Link> replace = new HashMap<Link, Link>();
+
+ for (Link link : entry.getNavigationLinks()) {
+ if (links.contains(link.getTitle())) {
+ // expand link
+ final Link rep = new LinkImpl();
+ rep.setHref(link.getHref());
+ rep.setRel(link.getRel());
+ rep.setTitle(link.getTitle());
+ rep.setType(link.getType());
+ if (link.getType().equals(Constants.get(ConstantKey.ATOM_LINK_ENTRY))) {
+ // inline entry
+ final Entry inline = atomDeserializer.<Entry, AtomEntryImpl>read(
+ xml.expandEntity(entitySetName, entityId, link.getTitle()),
+ AtomEntryImpl.class).getObject();
+ rep.setInlineEntry(inline);
+ } else if (link.getType().equals(Constants.get(ConstantKey.ATOM_LINK_FEED))) {
+ // inline feed
+ final Feed inline = atomDeserializer.<Feed, AtomFeedImpl>read(
+ xml.expandEntity(entitySetName, entityId, link.getTitle()),
+ AtomFeedImpl.class).getObject();
+ rep.setInlineFeed(inline);
+ }
+ replace.put(link, rep);
+ }
+ }
+
+ for (Map.Entry<Link, Link> link : replace.entrySet()) {
+ entry.getNavigationLinks().remove(link.getKey());
+ entry.getNavigationLinks().add(link.getValue());
}
}
- return utils.getValue().createResponse(entity, Commons.getETag(entityInfo.getKey(), version), utils.getKey());
+ final ByteArrayOutputStream content = new ByteArrayOutputStream();
+ final OutputStreamWriter writer = new OutputStreamWriter(content, Constants.encoding);
+
+ if (utils.getKey() == Accept.ATOM) {
+ atomSerializer.write(writer, container);
+ writer.flush();
+ writer.close();
+ } else {
+ final ObjectMapper mapper = Commons.getJsonMapper(version);
+ mapper.writeValue(
+ writer, new JsonEntryContainer<JSONEntryImpl>(container.getContextURL(), container.getMetadataETag(),
+ (new DataBinder(version)).getJsonEntry((AtomEntryImpl) container.getObject())));
+ }
+
+ return xml.createResponse(new ByteArrayInputStream(content.toByteArray()),
+ Commons.getETag(entityInfo.getKey(), version), utils.getKey());
+
} catch (Exception e) {
LOG.error("Error retrieving entity", e);
return xml.createFaultResponse(accept, e);
@@ -1384,4 +1615,37 @@ public abstract class AbstractServices {
return utils;
}
+
+ private void normalizeAtomEntry(final AtomEntryImpl entry, final String entitySetName, final String entityKey) {
+ final EntitySet entitySet = metadata.getEntitySet(entitySetName);
+ final EntityType entityType = metadata.getEntityType(entitySet.getType());
+ for (Map.Entry<String, org.apache.olingo.fit.metadata.Property> property
+ : entityType.getPropertyMap().entrySet()) {
+ if (entry.getProperty(property.getKey()) == null && property.getValue().isNullable()) {
+ final AtomPropertyImpl prop = new AtomPropertyImpl();
+ prop.setName(property.getKey());
+ prop.setValue(new NullValueImpl());
+ entry.getProperties().add(prop);
+ }
+ }
+
+ for (Map.Entry<String, NavigationProperty> property : entityType.getNavigationPropertyMap().entrySet()) {
+ boolean found = false;
+ for (Link link : entry.getNavigationLinks()) {
+ if (link.getTitle().equals(property.getKey())) {
+ found = true;
+ }
+ }
+
+ if (!found) {
+ final LinkImpl link = new LinkImpl();
+ link.setTitle(property.getKey());
+ link.setType(property.getValue().isFeed()
+ ? Constants.get(ConstantKey.ATOM_LINK_FEED) : Constants.get(ConstantKey.ATOM_LINK_ENTRY));
+ link.setRel(Constants.get(ConstantKey.ATOM_LINK_REL) + property.getKey());
+ link.setHref(entitySetName + "(" + entityKey + ")/" + property.getKey());
+ entry.getNavigationLinks().add(link);
+ }
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/V3ActionOverloading.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3ActionOverloading.java b/fit/src/main/java/org/apache/olingo/fit/V3ActionOverloading.java
index e7b4dd0..d26daa5 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3ActionOverloading.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3ActionOverloading.java
@@ -35,6 +35,8 @@ import javax.ws.rs.core.Response;
import static javax.ws.rs.core.Response.status;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import static org.apache.olingo.fit.AbstractServices.LOG;
import org.apache.olingo.fit.utils.AbstractUtilities;
import org.apache.olingo.fit.utils.Accept;
@@ -42,7 +44,6 @@ import org.apache.olingo.fit.utils.Commons;
import org.apache.olingo.fit.utils.ConstantKey;
import org.apache.olingo.fit.utils.Constants;
import org.apache.olingo.fit.utils.FSManager;
-import org.apache.olingo.fit.utils.ODataVersion;
import org.springframework.stereotype.Service;
@Service
@@ -50,7 +51,7 @@ import org.springframework.stereotype.Service;
public class V3ActionOverloading extends AbstractServices {
public V3ActionOverloading() throws Exception {
- super(ODataVersion.v3);
+ super(ODataServiceVersion.V30);
}
private Response replaceServiceName(final Response response) {
@@ -84,7 +85,7 @@ public class V3ActionOverloading extends AbstractServices {
@Produces(MediaType.APPLICATION_XML)
public Response getLargeMetadata() {
return super.getMetadata("actionOverloading"
- + StringUtils.capitalize(Constants.get(ODataVersion.v3, ConstantKey.METADATA)));
+ + StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)));
}
@POST
@@ -98,14 +99,14 @@ public class V3ActionOverloading extends AbstractServices {
if (StringUtils.isNotBlank(format)) {
acceptType = Accept.valueOf(format.toUpperCase());
} else {
- acceptType = Accept.parse(accept, ODataVersion.v3);
+ acceptType = Accept.parse(accept, ODataServiceVersion.V30);
}
if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
throw new UnsupportedMediaTypeException("Unsupported media type");
}
try {
- final InputStream result = FSManager.instance(ODataVersion.v3).
+ final InputStream result = FSManager.instance(ODataServiceVersion.V30).
readFile("actionOverloadingRetrieveProduct", acceptType);
return replaceServiceName(xml.createResponse(result, null, acceptType));
} catch (Exception e) {
@@ -137,7 +138,7 @@ public class V3ActionOverloading extends AbstractServices {
}
return replaceServiceName(utils.getValue().createResponse(
- entity, Commons.getETag(entityInfo.getKey(), ODataVersion.v3), utils.getKey()));
+ entity, Commons.getETag(entityInfo.getKey(), ODataServiceVersion.V30), utils.getKey()));
} catch (Exception e) {
LOG.error("Error retrieving entity", e);
return replaceServiceName(xml.createFaultResponse(accept, e));
@@ -180,7 +181,7 @@ public class V3ActionOverloading extends AbstractServices {
}
return replaceServiceName(utils.getValue().createResponse(
- entity, Commons.getETag(entityInfo.getKey(), ODataVersion.v3), utils.getKey()));
+ entity, Commons.getETag(entityInfo.getKey(), ODataServiceVersion.V30), utils.getKey()));
} catch (Exception e) {
LOG.error("Error retrieving entity", e);
return replaceServiceName(xml.createFaultResponse(accept, e));
@@ -197,4 +198,8 @@ public class V3ActionOverloading extends AbstractServices {
return unboundRetrieveProduct(accept, format, contentType);
}
+ @Override
+ protected void setInlineCount(Feed feed, String count) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/V3KeyAsSegment.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3KeyAsSegment.java b/fit/src/main/java/org/apache/olingo/fit/V3KeyAsSegment.java
index 6ec8651..479496d 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3KeyAsSegment.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3KeyAsSegment.java
@@ -150,10 +150,11 @@ public class V3KeyAsSegment {
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
public Response postNewEntity(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
@PathParam("entitySetName") String entitySetName,
final String entity) {
- return replaceServiceName(services.postNewEntity(accept, prefer, entitySetName, entity));
+ return replaceServiceName(services.postNewEntity(accept, contentType, prefer, entitySetName, entity));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/V3Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3Services.java b/fit/src/main/java/org/apache/olingo/fit/V3Services.java
index 14e1db2..3e15bd5 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3Services.java
@@ -22,7 +22,6 @@ import java.io.InputStream;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
-import org.apache.olingo.fit.utils.ODataVersion;
import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -31,6 +30,8 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.interceptor.InInterceptors;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.fit.utils.Accept;
import org.apache.olingo.fit.utils.ConstantKey;
import org.apache.olingo.fit.utils.Constants;
@@ -43,7 +44,7 @@ import org.springframework.stereotype.Service;
public class V3Services extends AbstractServices {
public V3Services() throws Exception {
- super(ODataVersion.v3);
+ super(ODataServiceVersion.V30);
}
@GET
@@ -63,7 +64,7 @@ public class V3Services extends AbstractServices {
final InputStream error = FSManager.instance(version).readFile("InStreamErrorGetCustomer", acceptType);
return Response.ok(error).
- header(Constants.get(version, ConstantKey.ODATA_SERVICE_VERSION), version.getVersion() + ";").
+ header(Constants.get(version, ConstantKey.ODATA_SERVICE_VERSION), version + ";").
header("Content-Type", acceptType.toString(version)).
build();
} catch (Exception e) {
@@ -99,4 +100,10 @@ public class V3Services extends AbstractServices {
return getMetadata("openType" + StringUtils.capitalize(Constants.get(version, ConstantKey.METADATA)));
}
+ @Override
+ protected void setInlineCount(final Feed feed, final String count) {
+ if ("allpages".equals(count)) {
+ feed.setCount(feed.getEntries().size());
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
index 254b5ae..7a4a9c9 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.fit;
-import org.apache.olingo.fit.utils.ODataVersion;
import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
@@ -30,15 +29,14 @@ import org.springframework.stereotype.Service;
@Service
@Path("/V40/NorthWind.svc")
@InInterceptors(classes = XHTTPMethodInterceptor.class)
-public class V4NorthWind extends AbstractServices {
+public class V4NorthWind extends V4Services {
public V4NorthWind() throws Exception {
- super(ODataVersion.v4);
+ super();
}
@Override
public Response getMetadata() {
return getMetadata("northwind-" + Constants.get(version, ConstantKey.METADATA));
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
index ba986f0..e8838a6 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.fit;
-import org.apache.olingo.fit.utils.ODataVersion;
import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
@@ -31,15 +30,14 @@ import org.springframework.stereotype.Service;
@Service
@Path("/V40/NorthWindExt.svc")
@InInterceptors(classes = {XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class})
-public class V4NorthWindExt extends AbstractServices {
+public class V4NorthWindExt extends V4Services {
public V4NorthWindExt() throws Exception {
- super(ODataVersion.v4);
+ super();
}
@Override
public Response getMetadata() {
return getMetadata("northwindExt-" + Constants.get(version, ConstantKey.METADATA));
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/V4Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Services.java b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
index 838a4f6..a879f77 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
@@ -18,10 +18,11 @@
*/
package org.apache.olingo.fit;
-import org.apache.olingo.fit.utils.ODataVersion;
import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import org.apache.cxf.interceptor.InInterceptors;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.fit.utils.ResolvingReferencesInterceptor;
import org.springframework.stereotype.Service;
@@ -31,6 +32,13 @@ import org.springframework.stereotype.Service;
public class V4Services extends AbstractServices {
public V4Services() throws Exception {
- super(ODataVersion.v4);
+ super(ODataServiceVersion.V40);
+ }
+
+ @Override
+ protected void setInlineCount(final Feed feed, final String count) {
+ if ("true".equals(count)) {
+ feed.setCount(feed.getEntries().size());
+ }
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/metadata/AbstractMetadataElement.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/AbstractMetadataElement.java b/fit/src/main/java/org/apache/olingo/fit/metadata/AbstractMetadataElement.java
new file mode 100644
index 0000000..9a83a76
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/metadata/AbstractMetadataElement.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.metadata;
+
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+
+public class AbstractMetadataElement {
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java
new file mode 100644
index 0000000..f750d2c
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.metadata;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class Association extends AbstractMetadataElement {
+
+ private final String name;
+
+ private Map<String, Role> roles;
+
+ public Association(final String name) {
+ this.name = name;
+ roles = new LinkedHashMap<String, Role>();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Association addRole(final String name, final String type, final String multiplicity) {
+ roles.put(name, new Role(name, type, multiplicity));
+ return this;
+ }
+
+ public Role getRole(final String name) {
+ return roles.get(name);
+ }
+
+ public static class Role {
+
+ final String name;
+
+ final String type;
+
+ final String multiplicity;
+
+ public Role(final String name, final String type, final String multiplicity) {
+ this.name = name;
+ this.type = type;
+ this.multiplicity = multiplicity;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getMultiplicity() {
+ return multiplicity;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java b/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java
new file mode 100644
index 0000000..3d381d7
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.metadata;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class AssociationSet extends AbstractMetadataElement {
+
+ private final String name;
+
+ private final String association;
+
+ private Map<String, Role> roles;
+
+ public AssociationSet(final String name, final String association) {
+ this.name = name;
+ this.association = association;
+ roles = new LinkedHashMap<String, Role>();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getAssociation() {
+ return association;
+ }
+
+ public AssociationSet addRole(final String name, final String entitySet) {
+ roles.put(name, new Role(name, entitySet));
+ return this;
+ }
+
+ public Role getRole(final String name) {
+ return roles.get(name);
+ }
+
+ public static class Role {
+
+ final String name;
+
+ final String entitySet;
+
+ public Role(final String name, final String entitySet) {
+ this.name = name;
+ this.entitySet = entitySet;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getEntitySet() {
+ return entitySet;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java
new file mode 100644
index 0000000..37d3f92
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.metadata;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+public class Container extends AbstractMetadataElement {
+
+ private final String name;
+
+ private final Map<String, EntitySet> entitySets;
+
+ private final Map<String, AssociationSet> associationSets;
+
+ public Container(final String name) {
+ this.name = name;
+ entitySets = new HashMap<String, EntitySet>();
+ associationSets = new HashMap<String, AssociationSet>();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public AssociationSet getAssociationSet(final String association) {
+ return associationSets.get(association);
+ }
+
+ public Collection<EntitySet> getEntitySets() {
+ return entitySets.values();
+ }
+
+ public Collection<EntitySet> getEntitySets(final String namespace, final String entityTypeName) {
+ final Collection<EntitySet> res = new HashSet<EntitySet>();
+ for (EntitySet entitySet : entitySets.values()) {
+ if ((namespace + "." + entityTypeName).equals(entitySet.getType())) {
+ res.add(entitySet);
+ }
+ }
+
+ return res;
+ }
+
+ public EntitySet getEntitySet(final String name) {
+ return entitySets.get(name);
+ }
+
+ public Container addEntitySet(final String name, final EntitySet entitySet) {
+ entitySets.put(name, entitySet);
+ return this;
+ }
+
+ public Container addAssociationSet(final String name, final AssociationSet associationSet) {
+ associationSets.put(name, associationSet);
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/metadata/EntitySet.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/EntitySet.java b/fit/src/main/java/org/apache/olingo/fit/metadata/EntitySet.java
new file mode 100644
index 0000000..b127861
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/metadata/EntitySet.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.metadata;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class EntitySet extends AbstractMetadataElement {
+
+ private final String name;
+
+ private String type;
+
+ private final boolean singleton;
+
+ // --------------------------
+ // V4 only
+ // --------------------------
+ private final Map<String, String> binding;
+ // --------------------------
+
+ public EntitySet(final String name, final boolean singleton) {
+ this.name = name;
+ this.singleton = singleton;
+ this.binding = new LinkedHashMap<String, String>();
+ }
+
+ public EntitySet(final String name) {
+ this(name, false);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public boolean isSingleton() {
+ return singleton;
+ }
+
+ public EntitySet addBinding(final String path, final String target) {
+ this.binding.put(path, target);
+ return this;
+ }
+
+ public String getTarget(final String path) {
+ return this.binding.get(path);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/450ccfd4/fit/src/main/java/org/apache/olingo/fit/metadata/EntityType.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/EntityType.java b/fit/src/main/java/org/apache/olingo/fit/metadata/EntityType.java
new file mode 100644
index 0000000..376e3fd
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/metadata/EntityType.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.metadata;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+public class EntityType extends AbstractMetadataElement {
+
+ private final String name;
+
+ private final Map<String, Property> properties;
+
+ private final Map<String, NavigationProperty> navigationProperties;
+
+ public EntityType(final String name) {
+ this.name = name;
+ properties = new HashMap<String, Property>();
+ navigationProperties = new HashMap<String, NavigationProperty>();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Collection<NavigationProperty> getNavigationProperties() {
+ return new HashSet<NavigationProperty>(navigationProperties.values());
+ }
+
+ public Map<String, NavigationProperty> getNavigationPropertyMap() {
+ return new HashMap<String, NavigationProperty>(navigationProperties);
+ }
+
+ public Map<String, Property> getPropertyMap() {
+ return new HashMap<String, Property>(properties);
+ }
+
+ public Collection<Property> getProperties() {
+ return new HashSet<Property>(properties.values());
+ }
+
+ public Property getProperty(final String name) {
+ return properties.get(name);
+ }
+
+ public EntityType addProperty(final String name, final Property property) {
+ properties.put(name, property);
+ return this;
+ }
+
+ public NavigationProperty getNavigationProperty(final String name) {
+ return navigationProperties.get(name);
+ }
+
+ public EntityType addNavigationProperty(final String name, final NavigationProperty property) {
+ navigationProperties.put(name, property);
+ return this;
+ }
+}